示例#1
0
 private void showHelpForCurrentMessage() {
   String helpURL = getHelpUrlForCurrentMessage();
   if (helpURL == null) {
     return;
   }
   BrowserUtil.browse(helpURL);
 }
    public void openInExternalBrowser(@NotNull String link) {
      if (!BrowserUtil.isAbsoluteURL(link)) {
        try {
          link = new URI("http", link, null).toURL().toString();
        } catch (Exception ignore) {
        }
      }

      BrowserUtil.browse(link);
    }
  @Override
  public boolean onClick(@NotNull MouseEvent e, int clickCount) {
    if (e.getButton() == 1 && !e.isPopupTrigger()) {
      Object tag = getTagAt(e);
      if (tag instanceof Runnable) {
        ((Runnable) tag).run();
        return true;
      }

      if (tag != null && !Object.class.getName().equals(tag.getClass().getName())) {
        BrowserUtil.browse(tag.toString());
        return true;
      }
    }
    return false;
  }
  public void addBackAndOpenButtons() {
    ApplicationManager.getApplication()
        .invokeLater(
            () -> {
              final JPanel panel = new JPanel();
              panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));

              final JButton backButton =
                  makeGoButton("Click to go back", AllIcons.Actions.Back, -1);
              final JButton forwardButton =
                  makeGoButton("Click to go forward", AllIcons.Actions.Forward, 1);
              final JButton openInBrowser = new JButton(AllIcons.Actions.Browser_externalJavaDoc);
              openInBrowser.addActionListener(e -> BrowserUtil.browse(myEngine.getLocation()));
              openInBrowser.setToolTipText("Click to open link in browser");
              addButtonsAvailabilityListeners(backButton, forwardButton);

              panel.setMaximumSize(new Dimension(40, getPanel().getHeight()));
              panel.add(backButton);
              panel.add(forwardButton);
              panel.add(openInBrowser);

              add(panel, BorderLayout.PAGE_START);
            });
  }
 @Override
 public void actionPerformed(AnActionEvent event) {
   BrowserUtil.browse(getUrl());
 }
 public void actionPerformed(AnActionEvent e) {
   String url = getIssueUrl(e);
   if (url != null) {
     BrowserUtil.browse(url);
   }
 }
 @Override
 public void run() {
   BrowserUtil.browse(myUrl);
 }
 @Override
 protected void doOKAction() {
   BrowserUtil.browse(myChannel.getHomePageUrl());
   super.doOKAction();
 }