Java 类javax.swing.event.HyperlinkEvent 实例源码

项目:incubator-netbeans    文件:BrowserUtils.java   
public static HyperlinkListener createHyperlinkListener() {
    return new HyperlinkListener() {

        public void hyperlinkUpdate(HyperlinkEvent hlevt) {
            if (HyperlinkEvent.EventType.ACTIVATED == hlevt.getEventType()) {
                final URL url = hlevt.getURL();
                if (url != null) {
                    try {
                        openBrowser(url.toURI());
                    } catch (URISyntaxException e) {
                        LogManager.log(e);
                    }
                }
            }
        }
    };
}
项目:incubator-netbeans    文件:NotificationsManager.java   
public void setupPane(JTextPane pane, final File[] files, String fileNames, final File projectDir, final String url, final String revision) {
     String msg = revision == null
             ? NbBundle.getMessage(NotificationsManager.class, "MSG_NotificationBubble_DeleteDescription", fileNames, CMD_DIFF) //NOI18N
             : NbBundle.getMessage(NotificationsManager.class, "MSG_NotificationBubble_Description", fileNames, url, CMD_DIFF); //NOI18N
    pane.setText(msg);

    pane.addHyperlinkListener(new HyperlinkListener() {
        @Override
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
                if(CMD_DIFF.equals(e.getDescription())) {
                    Context ctx = new Context(files);
                    DiffAction.diff(ctx, Setup.DIFFTYPE_REMOTE, NbBundle.getMessage(NotificationsManager.class, "LBL_Remote_Changes", projectDir.getName()), false); //NOI18N
                } else if (revision != null) {
                    try {
                        SearchHistoryAction.openSearch(new SVNUrl(url), projectDir, Long.parseLong(revision));
                    } catch (MalformedURLException ex) {
                        LOG.log(Level.WARNING, null, ex);
                    }
                }
            }
        }
    });
}
项目:incubator-netbeans    文件:HyperlinkEventProcessor.java   
public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) {
    url = hyperlinkEvent.getURL();
    HyperlinkEvent.EventType type = hyperlinkEvent.getEventType();
    if (type == HyperlinkEvent.EventType.ENTERED) {
      isInsideHyperlink = true;
      pane.setToolTipText(getURLExternalForm()); // #176141
    }
    else if (type == HyperlinkEvent.EventType.ACTIVATED) {
      isInsideHyperlink = false;
      pane.setToolTipText(null);
    }
    else if (type == HyperlinkEvent.EventType.EXITED) {
      isInsideHyperlink = false;
      pane.setToolTipText(null);
    }
    else {
      Installer.log.log(Level.SEVERE, "Unknown hyperlinkEvent: " +
                                       hyperlinkEvent);
    }
}
项目:incubator-netbeans    文件:DocumentationScrollPane.java   
public void hyperlinkUpdate(HyperlinkEvent e) {
    if (e != null && HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
        final String desc = e.getDescription();
        if (desc != null) {
            RP.post(new Runnable() {
                public @Override void run() {
                    final ElementJavadoc cd;
                    synchronized (DocumentationScrollPane.this) {
                        cd = currentDocumentation;
                    }
                    if (cd != null) {
                        final ElementJavadoc doc = cd.resolveLink(desc);
                        if (doc != null) {
                            EventQueue.invokeLater(new Runnable() {
                                public @Override void run() {
                                    setData(doc, false);
                                }
                            });
                        }
                    }
                }
            });
        }
    }
}
项目:incubator-netbeans    文件:DocumentationScrollPane.java   
public void hyperlinkUpdate(HyperlinkEvent e) {
    if (e != null && HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
        final String desc = e.getDescription();
        if (desc != null) {
            RP.post(new Runnable() {
                public @Override void run() {
                    CompletionDocumentation cd = currentDocumentation;
                    if (cd != null) {
                        final CompletionDocumentation doc = cd.resolveLink(desc);
                        if (doc != null) {
                            EventQueue.invokeLater(new Runnable() {
                                public @Override void run() {
                                    setData(doc);
                                }
                            });
                        }
                    }
                }
            });
        }                    
    }
}
项目:incubator-netbeans    文件:ShowNotifications.java   
private static JTextPane createInfoPanel(String notification) {
    JTextPane balloon = new JTextPane();
    balloon.setContentType("text/html");
    String text = getDetails(notification).replaceAll("(\r\n|\n|\r)", "<br>");
    balloon.setText(text);
    balloon.setOpaque(false);
    balloon.setEditable(false);
    balloon.setBorder(new EmptyBorder(0, 0, 0, 0));


    if (UIManager.getLookAndFeel().getID().equals("Nimbus")) {
        //#134837
        //http://forums.java.net/jive/thread.jspa?messageID=283882
        balloon.setBackground(new Color(0, 0, 0, 0));
    }

    balloon.addHyperlinkListener(new HyperlinkListener() {

        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
                URLDisplayer.getDefault().showURL(e.getURL());
            }
        }
    });
    return balloon;
}
项目:rapidminer    文件:FixedWidthEditorPane.java   
/**
 * Creates a pane with the given rootlessHTML as text with the given width.
 *
 * @param width
 *            the desired width
 * @param rootlessHTML
 *            the text, can contain hyperlinks that will be clickable
 */
public FixedWidthEditorPane(int width, String rootlessHTML) {
    super("text/html", "");
    this.width = width;
    this.rootlessHTML = rootlessHTML;
    updateLabel();

    setEditable(false);
    setFocusable(false);
    installDefaultStylesheet();
    addHyperlinkListener(new HyperlinkListener() {

        @Override
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                RMUrlHandler.handleUrl(e.getDescription());
            }
        }
    });

}
项目:jmt    文件:HtmlPanel.java   
/**
 * Initialize this component
 */
private void init() {
    antiAliasing = false;
    // By default disable editing
    setEditable(false);
    setContentType("text/html");

    // Adds hyperlink listener
    this.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                // An hyperlink is activated
                if (getPage() != null && e.getURL().getPath() != null && e.getURL().getPath().equals(getPage().getPath())) {
                    setURL(e.getURL());
                } else {
                    // Open external links in default browser
                    BrowserLauncher.openURL(e.getURL().toString());
                }
            }
        }
    });
}
项目:TrafficPetri    文件:MessageWithLink.java   
public MessageWithLink(String htmlBody) {
    super("text/html", "<html><body style=\"" + getStyle() + "\">" + htmlBody + "</body></html>");
    addHyperlinkListener(e -> {
        if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
            // Process the click event on the link (for example with java.awt.Desktop.getDesktop().browse())
            URI uri = URI.create(String.valueOf(e.getURL()));
            try {
                Desktop.getDesktop().browse(uri);
            } catch (IOException e1) {
                e1.printStackTrace();
            }
        }
    });
    setEditable(false);
    setBorder(null);
}
项目:QN-ACTR-Release    文件:HtmlPanel.java   
/**
 * Initialize this component
 */
private void init() {
    antiAliasing = false;
    // By default disable editing
    setEditable(false);
    setContentType("text/html");

    // Adds hyperlink listener
    this.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                // An hyperlink is activated
                if (getPage() != null && e.getURL().getPath() != null && e.getURL().getPath().equals(getPage().getPath())) {
                    setURL(e.getURL());
                } else {
                    // Open external links in default browser
                    BareBonesBrowserLaunch.openURL(e.getURL().toString());
                }
            }
        }
    });
}
项目:gate-core    文件:JTextPaneTableCellRenderer.java   
public JTextPaneTableCellRenderer() {
  textPane.setContentType("text/html");
  textPane.setEditable(false);
  textPane.setOpaque(true);
  textPane.setBorder(null);

  textPane.setForeground(UIManager.getColor("Table.selectionForeground"));
  textPane.setBackground(UIManager.getColor("Table.selectionBackground"));

  Font font = UIManager.getFont("Label.font");
  String bodyRule =
      "body { font-family: " + font.getFamily() + "; " + "font-size: "
          + font.getSize() + "pt; "
          + (font.isBold() ? "font-weight: bold;" : "") + "}";
  ((HTMLDocument)textPane.getDocument()).getStyleSheet().addRule(bodyRule);

  textPane.addHyperlinkListener(new HyperlinkListener() {

    @Override
    public void hyperlinkUpdate(HyperlinkEvent e) {
      if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED))
          MainFrame.getInstance().showHelpFrame(e.getURL().toString(), "CREOLE Plugin Manager");
    }
  });
}
项目:imagetozxspec    文件:AboutListener.java   
@Override
public void actionPerformed(ActionEvent e) {        
    long maxHeap = Runtime.getRuntime().maxMemory();
    int cpus = Runtime.getRuntime().availableProcessors();
    JTextPane aboutField = new JTextPane();
    aboutField.setContentType("text/html");
    aboutField.setText("Image to ZX Spec is a simple to use program which applies a Sinclair ZX Spectrum<br>" +
            "effect to images, creates Spectrum playable slideshows from images or \"video\"<br>" +
            "from compatible video files.<br><br>"+
            "This software is copyright Silent Software (Benjamin Brown), uses Caprica Software<br>"+
            "Limited's VLCJ and Art Clarke's Humble Video as well as other open source libraries.<br>"+
            "See the included licences.txt for full details.<br><br>" +
            "Processors: "+cpus+"<br>"+
            "Total Java Memory: "+maxHeap/1024/1024+"MB<br><br>"+
            "Visit Silent Software at <a href='"+HOME_PAGE+"'>"+HOME_PAGE+"</a><br><br>"+
            "If you like this program and find it useful don't forget to <a href='"+COFFEE_LINK+"'>buy the developer a coffee!</a>");
    aboutField.putClientProperty(JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
    aboutField.setEditable(false);
    aboutField.setOpaque(false);
    aboutField.addHyperlinkListener(e1 -> {
           if (HyperlinkEvent.EventType.ACTIVATED == e1.getEventType()) {
               openLink(e1.getURL());
           }
       });
    JOptionPane.showMessageDialog(null, aboutField, "About Image to ZX Spec", JOptionPane.INFORMATION_MESSAGE, ImageToZxSpec.IMAGE_ICON);
}
项目:imagetozxspec    文件:CoffeeDialog.java   
void showPopupIfNecessary() {
    log.debug("Application starts: {}", optionsObject.getStarts());
    if (optionsObject.getStarts() == STARTS_BEFORE_COFFEE) {
        JTextPane aboutField = new JTextPane();
        aboutField.setContentType("text/html");
        aboutField.setText("<h2>You seem to be enjoying Image to ZX Spec!</h2>" +
                "Did you know Image to ZX Spec has been in development for the last 7 years?<br>"+
                "That's a lot of coffee, so please consider a contribution of any amount to the<br>"+
                "developer's coffee buying budget!<br>"+
                "<h3><a href='"+COFFEE_LINK+"'>Buy the developer a coffee</a></h3>"+
                "This popup will never be shown again, but if you want to buy a coffee later you can<br>"+
                "always find the link in the About dialog.<br><br>"+
                "<b>Thank you for your support.</b>");
        aboutField.putClientProperty(JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
        aboutField.setEditable(false);
        aboutField.setOpaque(false);
        aboutField.addHyperlinkListener(e -> {
               if (HyperlinkEvent.EventType.ACTIVATED == e.getEventType())  {
                   openLink(e.getURL());
               }
           });
        JOptionPane.showMessageDialog(null, aboutField, "Information", JOptionPane.INFORMATION_MESSAGE, ImageToZxSpec.IMAGE_ICON);
    }
    optionsObject.setStarts((optionsObject.getStarts()+1));
    PreferencesService.save();      
}
项目:ramus    文件:Navigator.java   
@Override
public JComponent createComponent() {
    pane.addHyperlinkListener(new HyperlinkListener() {
        @Override
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == EventType.ACTIVATED) {
                location = e.getURL().toExternalForm();
                openLocation();
            }
        }
    });

    pane.setEditable(false);

    scrollPane = new JScrollPane();
    scrollPane.setViewportView(this.pane);
    return scrollPane;
}
项目:freecol    文件:ColopediaPanel.java   
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
    HyperlinkEvent.EventType type = e.getEventType();
    if (type == HyperlinkEvent.EventType.ACTIVATED) {
        String[] path = e.getURL().getPath().split("/");
        if (null != path[1]) {
            switch (path[1]) {
            case FreeColObject.ID_ATTRIBUTE_TAG:
                select(path[2]);
                break;
            case "action":
                getFreeColClient().getActionManager()
                    .getFreeColAction(path[2]).actionPerformed(null);
                break;
            default:
                break;
            }
        }
    }
}
项目:nativehtml    文件:SwingTextComponent.java   
public SwingTextComponent(final Document document)  {
  //super("text/html");
    this.document = document;

    configureEditor(this);
    addHyperlinkListener(new HyperlinkListener() {

         @Override
         public void hyperlinkUpdate(HyperlinkEvent event) {
           if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
             RequestHandler requestHandler = document.getRequestHandler();
             if (requestHandler != null) {
               try {
                 requestHandler.openLink(event.getURL().toURI());
               } catch (URISyntaxException e) {
                 e.printStackTrace();
               }
             }
           }
         }
       });
}
项目:educational-plugin    文件:StepicStudyOptions.java   
@NotNull
private HyperlinkAdapter createAuthorizeListener() {
  return new HyperlinkAdapter() {

    @Override
    protected void hyperlinkActivated(HyperlinkEvent e) {
      ApplicationManager.getApplication().getMessageBus().connect().subscribe(StudySettings.SETTINGS_CHANGED, () -> {
        StepicUser user = StudySettings.getInstance().getUser();
        if (user != null && !user.equals(myStepicUser)) {
          StudySettings.getInstance().setUser(myStepicUser);
          myStepicUser = user;
          updateLoginLabels(myStepicUser);
        }
      });

      EduStepicConnector.doAuthorize(() -> showDialog());
    }
  };
}
项目:MFM    文件:MFMHTMLTextPane.java   
@Override
public void hyperlinkUpdate(final HyperlinkEvent event) {
    if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        try {
            Desktop.getDesktop().browse(event.getURL().toURI());
        } catch (final IOException | URISyntaxException e) {
            throw new RuntimeException("Can't open URL", e);
        }
    }
}
项目:FreeCol    文件:ColopediaPanel.java   
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
    HyperlinkEvent.EventType type = e.getEventType();
    if (type == HyperlinkEvent.EventType.ACTIVATED) {
        String[] path = e.getURL().getPath().split("/");
        if (null != path[1]) {
            switch (path[1]) {
            case FreeColObject.ID_ATTRIBUTE_TAG:
                select(path[2]);
                break;
            case "action":
                getFreeColClient().getActionManager()
                    .getFreeColAction(path[2]).actionPerformed(null);
                break;
            default:
                break;
            }
        }
    }
}
项目:intellij-ce-playground    文件:PowerSaveModeNotifier.java   
static void notifyOnPowerSaveMode(Project project) {
  if (PropertiesComponent.getInstance().getBoolean(IGNORE_POWER_SAVE_MODE)) {
    return;
  }

  String message = "Code insight and other background tasks are disabled." +
                   "<br/><a href=\"ignore\">Do not show again</a>" +
                   "<br/><a href=\"turnOff\">Disable Power Save Mode</a>";
  POWER_SAVE_MODE.createNotification("Power save mode is on", message, NotificationType.WARNING, new NotificationListener() {
    @Override
    public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
      final String description = event.getDescription();
      if ("ignore".equals(description)) {
        PropertiesComponent.getInstance().setValue(IGNORE_POWER_SAVE_MODE, true);
        notification.expire();
      }
      else if ("turnOff".equals(description)) {
        PowerSaveMode.setEnabled(false);
        notification.expire();
      }
    }
  }).notify(project);
}
项目:DataRecorder    文件:HtmlViewer.java   
@Override
public void hyperlinkUpdate(final HyperlinkEvent e) {
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        final JEditorPane pane = (JEditorPane) e.getSource();
        if (e instanceof HTMLFrameHyperlinkEvent) {
            final HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e;
            final HTMLDocument doc = (HTMLDocument) pane.getDocument();
            doc.processHTMLFrameHyperlinkEvent(evt);
        } else {
            try {
                pane.setPage(e.getURL());
            } catch (final Throwable t) {
                MessageBox.showError(HtmlViewer.this.getParent(), t.getMessage());
            }
        }
    }
}
项目:terrier-desktop    文件:HelpDialog.java   
/**
 * This method initializes jTextPane    
 *  
 * @return javax.swing.JTextPane    
 */    
private JTextPane getJTextPane() {
    if (jTextPane == null) {
        jTextPane = new JTextPane();
        jTextPane.setContentType("text/html");
        jTextPane.setText(helpText);
        jTextPane.addHyperlinkListener(new HyperlinkListener() {
            public void hyperlinkUpdate(HyperlinkEvent e) {
                if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                    try{
                        FileOpener opener = new MultiOSFileOpener();
                        opener.open(e.getURL().toString());
                    }catch (Exception ex) {
                        logger.error("", ex);
                    }
                }
            }
        });
        jTextPane.setEditable(false);           
    }
    return jTextPane;
}
项目:Universal-Pointer-Searcher    文件:HTMLDialogUtilities.java   
public static void addHyperLinkListener(JEditorPane editorPane)
{
    editorPane.addHyperlinkListener(hyperlinkListener ->
    {
        if (HyperlinkEvent.EventType.ACTIVATED.equals(hyperlinkListener.getEventType()))
        {
            Desktop desktop = Desktop.getDesktop();

            try
            {
                desktop.browse(hyperlinkListener.getURL().toURI());
            } catch (Exception exception)
            {
                exception.printStackTrace();
            }
        }
    });
}
项目:intellij-ce-playground    文件:DefaultSdksConfigurable.java   
private void createNdkDownloadLink() {
  myNdkDownloadHyperlinkLabel = new HyperlinkLabel();
  myNdkDownloadHyperlinkLabel.setHyperlinkText("", "Download", " Android NDK.");
  myNdkDownloadHyperlinkLabel.addHyperlinkListener(new HyperlinkAdapter() {
    @Override
    protected void hyperlinkActivated(HyperlinkEvent e) {
      List<IPkgDesc> requested = ImmutableList.of(PkgDesc.Builder.newNdk(FullRevision.NOT_SPECIFIED).create());
      SdkQuickfixWizard wizard = new SdkQuickfixWizard(null, null, requested);
      wizard.init();
      if (wizard.showAndGet()) {
        File ndk = IdeSdks.getAndroidNdkPath();
        if (ndk != null) {
          myNdkLocationTextField.setText(ndk.getPath());
        }
        validateState();
      }
    }
  });
}
项目:intellij-ce-playground    文件:GitBranchUiHandlerImpl.java   
@Override
public void showUnmergedFilesNotification(@NotNull final String operationName, @NotNull final Collection<GitRepository> repositories) {
  String title = unmergedFilesErrorTitle(operationName);
  String description = unmergedFilesErrorNotificationDescription(operationName);
  VcsNotifier.getInstance(myProject).notifyError(title, description,
    new NotificationListener() {
      @Override
      public void hyperlinkUpdate(@NotNull Notification notification,
                                  @NotNull HyperlinkEvent event) {
        if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED && event.getDescription().equals("resolve")) {
          GitConflictResolver.Params params = new GitConflictResolver.Params().
            setMergeDescription(String.format("The following files have unresolved conflicts. You need to resolve them before %s.",
                                              operationName)).
            setErrorNotificationTitle("Unresolved files remain.");
          new GitConflictResolver(myProject, myGit, myFacade, GitUtil.getRootsFromRepositories(repositories), params).merge();
        }
      }
    }
  );
}
项目:CodeChickenCore    文件:DepLoader.java   
@Override
public void showErrorDialog(String name, String url) {
    JEditorPane ep = new JEditorPane("text/html", "<html>" + owner + " was unable to download required library " + name + "<br>Check your internet connection and try restarting or download it manually from" + "<br><a href=\"" + url + "\">" + url + "</a> and put it in your mods folder" + "</html>");

    ep.setEditable(false);
    ep.setOpaque(false);
    ep.addHyperlinkListener(new HyperlinkListener() {
        @Override
        public void hyperlinkUpdate(HyperlinkEvent event) {
            try {
                if (event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
                    Desktop.getDesktop().browse(event.getURL().toURI());
                }
            } catch (Exception e) {
            }
        }
    });

    JOptionPane.showMessageDialog(null, ep, "A download error has occured", JOptionPane.ERROR_MESSAGE);
}
项目:intellij-ce-playground    文件:EnvironmentVariablesTextFieldWithBrowseButton.java   
protected MyEnvironmentVariablesDialog() {
  super(EnvironmentVariablesTextFieldWithBrowseButton.this, true);
  myEnvVariablesTable = new EnvVariablesTable();
  myEnvVariablesTable.setValues(convertToVariables(myData.getEnvs(), false));

  myUseDefaultCb.setSelected(isPassParentEnvs());
  myWholePanel.add(myEnvVariablesTable.getComponent(), BorderLayout.CENTER);
  JPanel useDefaultPanel = new JPanel(new BorderLayout());
  useDefaultPanel.add(myUseDefaultCb, BorderLayout.CENTER);
  HyperlinkLabel showLink = new HyperlinkLabel(ExecutionBundle.message("env.vars.show.system"));
  useDefaultPanel.add(showLink, BorderLayout.EAST);
  showLink.addHyperlinkListener(new HyperlinkListener() {
    @Override
    public void hyperlinkUpdate(HyperlinkEvent e) {
      if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        showParentEnvironmentDialog(MyEnvironmentVariablesDialog.this.getWindow());
      }
    }
  });

  myWholePanel.add(useDefaultPanel, BorderLayout.SOUTH);
  setTitle(ExecutionBundle.message("environment.variables.dialog.title"));
  init();
}
项目:PhET    文件:SoftwareAgreementManager.java   
public MessagePane( final JDialog owner, final SessionMessage sessionMessage ) {
    super( "" );

    // insert our own hyperlink descriptions into the message, so translators can't mess them up
    Object[] args = { LINK_SHOW_STATISTICS_DETAILS, LINK_SHOW_SOFTWARE_AGREEMENT };
    String htmlFragment = MessageFormat.format( MESSAGE_PATTERN, args );
    setText( HTMLUtils.createStyledHTMLFromFragment( htmlFragment ) );

    addHyperlinkListener( new HyperlinkListener() {
        public void hyperlinkUpdate( HyperlinkEvent e ) {
            if ( e.getEventType() == HyperlinkEvent.EventType.ACTIVATED ) {
                if ( e.getDescription().equals( LINK_SHOW_STATISTICS_DETAILS ) ) {
                    showStatisticsDetails( owner, sessionMessage );
                }
                else if ( e.getDescription().equals( LINK_SHOW_SOFTWARE_AGREEMENT ) ) {
                    showSoftwareAgreement( owner );
                }
                else {
                    System.err.println( "SoftwareAgreementManager.MessagePane.hyperlinkUpdate: unsupported hyperlink, description=" + e.getDescription() );
                }
            }
        }
    } );
    setBackground( new JPanel().getBackground() );//see #1275
}
项目:intellij-ce-playground    文件:GitUnstashDialog.java   
@Override
protected void notifyUnresolvedRemain() {
  VcsNotifier.getInstance(myProject).notifyImportantWarning("Conflicts were not resolved during unstash",
                                                            "Unstash is not complete, you have unresolved merges in your working tree<br/>" +
                                                            "<a href='resolve'>Resolve</a> conflicts.", new NotificationListener() {
      @Override
      public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
        if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
          if (event.getDescription().equals("resolve")) {
            new UnstashConflictResolver(myProject, myRoot, myStashInfo).mergeNoProceed();
          }
        }
      }
    }
  );
}
项目:intellij-ce-playground    文件:Browser.java   
public Browser(@NotNull InspectionResultsView view) {
  super(new BorderLayout());
  myView = view;

  myCurrentEntity = null;
  myCurrentDescriptor = null;

  myHTMLViewer = new JEditorPane(UIUtil.HTML_MIME, InspectionsBundle.message("inspection.offline.view.empty.browser.text"));
  myHTMLViewer.setEditable(false);
  myHyperLinkListener = new HyperlinkListener() {
    @Override
    public void hyperlinkUpdate(HyperlinkEvent e) {
      Browser.this.hyperlinkUpdate(e);
    }
  };
  myHTMLViewer.addHyperlinkListener(myHyperLinkListener);

  final JScrollPane pane = ScrollPaneFactory.createScrollPane(myHTMLViewer);
  pane.setBorder(null);
  add(pane, BorderLayout.CENTER);
  setupStyle();
}
项目:intellij-ce-playground    文件:NotificationsUtil.java   
@Nullable
public static HyperlinkListener wrapListener(@NotNull final Notification notification) {
  final NotificationListener listener = notification.getListener();
  if (listener == null) return null;

  return new HyperlinkListener() {
    public void hyperlinkUpdate(HyperlinkEvent e) {
      if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        final NotificationListener listener1 = notification.getListener();
        if (listener1 != null) {
          listener1.hyperlinkUpdate(notification, e);
        }
      }
    }
  };
}
项目:intellij-ce-playground    文件:LabelWithEditLink.java   
public LabelWithEditLink() {
  setLayout(new BorderLayout());
  myCardPanel.add(EDIT, myEditField);
  myCardPanel.add(DISPLAY, myContentLabel);
  myCardPanel.revalidate();
  myCardPanel.repaint();
  myCardLayout.show(myCardPanel, DISPLAY);

  add(myCardPanel, BorderLayout.CENTER);
  add(myEditLabel, BorderLayout.EAST);

  myContentLabel.setHorizontalTextPosition(SwingConstants.RIGHT);
  myEditLabel.addHyperlinkListener(new HyperlinkListener() {
    @Override
    public void hyperlinkUpdate(HyperlinkEvent e) {
      if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
        toggleEdit();
      }
    }
  });
  myContentLabel.setForeground(JBColor.gray);
  setFont(UIUtil.getLabelFont());
  myEditLabel.setHtmlText(EDIT_TEXT);
}
项目:safe-java    文件:UiUtil.java   
public static JEditorPane createLinkEnabledEditorPane(final Component parent,
                                                      String text) {
    JEditorPane pane = createEditorPane(text);
    HyperlinkListener linkListener = new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                URL url = e.getURL();
                if (!openBrowser(e.getURL())) {
                    JOptionPane.showMessageDialog(parent,
                                                  "An error occurred while opening the URL: " + url.toString(),
                                                  "Error", JOptionPane.ERROR_MESSAGE);
                }
            }
        }
    };
    pane.addHyperlinkListener(linkListener);
    return pane;
}
项目:eva2    文件:HtmlDemo.java   
/**
 *
 */
public HyperlinkListener createHyperLinkListener() {
    return e -> {
        if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
            if (e instanceof HTMLFrameHyperlinkEvent) {
                ((HTMLDocument) htmlEditorPane.getDocument()).processHTMLFrameHyperlinkEvent(
                        (HTMLFrameHyperlinkEvent) e);
            } else {
                try {
                    htmlEditorPane.setPage(e.getURL());
                } catch (IOException ioe) {
                    System.out.println("IOE: " + ioe);
                }
            }
        }
    };
}
项目:intellij-ce-playground    文件:ProjectManagerImpl.java   
public UnableToSaveProjectNotification(@NotNull final Project project, @NotNull VirtualFile[] readOnlyFiles) {
  super("Project Settings", "Could not save project", "Unable to save project files. Please ensure project files are writable and you have permissions to modify them." +
                                                       " <a href=\"\">Try to save project again</a>.", NotificationType.ERROR, new NotificationListener() {
    @Override
    public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
      final UnableToSaveProjectNotification unableToSaveProjectNotification = (UnableToSaveProjectNotification)notification;
      final Project _project = unableToSaveProjectNotification.myProject;
      notification.expire();

      if (_project != null && !_project.isDisposed()) {
        _project.save();
      }
    }
  });

  myProject = project;
  myFiles = readOnlyFiles;
}
项目:JSmooth    文件:HTMLPane.java   
public void hyperlinkUpdate(HyperlinkEvent e) {
  if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {

    JEditorPane pane = (JEditorPane)e.getSource();
    if (e instanceof HTMLFrameHyperlinkEvent) {
      HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)e;
      HTMLDocument doc = (HTMLDocument)pane.getDocument();
      doc.processHTMLFrameHyperlinkEvent(evt);
    } else {
      try {
        URL nurl = e.getURL();
        if (nurl == null) nurl = new URL(m_baseurl, e.getDescription());
        if (jsmooth.Native.isAvailable()) {
          jsmooth.Native.shellExecute(jsmooth.Native.SHELLEXECUTE_OPEN, nurl.toString(), null, null, jsmooth.Native.SW_NORMAL);
        } else
          m_launcher.openURLinBrowser(nurl.toExternalForm());
      } catch (Throwable t) {
        t.printStackTrace();
      }
    }
  }
}
项目:intellij-ce-playground    文件:DvcsBranchPopup.java   
private void notifyAboutSyncedBranches() {
  String description =
    "You have several " + myVcs.getDisplayName() + " roots in the project and they all are checked out at the same branch. " +
    "We've enabled synchronous branch control for the project. <br/>" +
    "If you wish to control branches in different roots separately, " +
    "you may <a href='settings'>disable</a> the setting.";
  NotificationListener listener = new NotificationListener() {
    @Override
    public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
      if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        ShowSettingsUtil.getInstance().showSettingsDialog(myProject, myVcs.getConfigurable().getDisplayName());
        if (myVcsSettings.getSyncSetting() == DvcsSyncSettings.Value.DONT_SYNC) {
          notification.expire();
        }
      }
    }
  };
  VcsNotifier.getInstance(myProject).notifyImportantInfo("Synchronous branch control enabled", description, listener);
}
项目:intellij-ce-playground    文件:CloudGitRemoteDetector.java   
public RepositoryNotifier(CloudGitDeploymentDetector deploymentDetector, GitRepository repository) {
  myDeploymentDetector = deploymentDetector;
  myRepositoryRoot = repository.getRoot();
  myCloudName = deploymentDetector.getCloudType().getPresentableName();
  String path = FileUtil.toSystemDependentName(myRepositoryRoot.getPath());
  myNotification = myNotifier.showMessage(CloudBundle.getText("git.cloud.app.detected", myCloudName, path),
                                          MessageType.INFO,
                                          new NotificationListener() {

                                            @Override
                                            public void hyperlinkUpdate(@NotNull Notification notification,
                                                                        @NotNull HyperlinkEvent event) {
                                              setupRunConfiguration();
                                            }
                                          });
}
项目:littleluck    文件:EditorPaneDemo.java   
private HyperlinkListener createHyperLinkListener() {
    return new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                if (e instanceof HTMLFrameHyperlinkEvent) {
                    ((HTMLDocument) html.getDocument()).processHTMLFrameHyperlinkEvent(
                            (HTMLFrameHyperlinkEvent) e);
                } else {
                    try {
                        html.setPage(e.getURL());
                    } catch (IOException ioe) {
                        System.out.println("IOE: " + ioe);
                    }
                }
            }
        }
    };
}
项目:littleluck    文件:HTMLPanel.java   
public void hyperlinkUpdate(HyperlinkEvent event) {
    JEditorPane descriptionPane = (JEditorPane) event.getSource();
    HyperlinkEvent.EventType type = event.getEventType();
    if (type == HyperlinkEvent.EventType.ACTIVATED) {
        try {
            DemoUtilities.browse(event.getURL().toURI());
        } catch (Exception e) {
            e.printStackTrace();
            System.err.println(e);
        }

    } else if (type == HyperlinkEvent.EventType.ENTERED) {
        defaultCursor = descriptionPane.getCursor();
        descriptionPane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    } else if (type == HyperlinkEvent.EventType.EXITED) {
        descriptionPane.setCursor(defaultCursor);
    }
}