com.intellij.ide.BrowserUtil Java Examples

The following examples show how to use com.intellij.ide.BrowserUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UploadNotification.java    From markdown-image-kit with MIT License 7 votes vote down vote up
/**
 * 上传时检查到配置错误时通知
 *
 * @param project    the project
 * @param actionName the action name
 */
public static void notifyConfigurableError(Project project, String actionName) {
    String content = "<p><a href=''>Configure " + actionName + " OSS</a></p><br />";
    content = "<p>You may need to set or reset your account. Please be sure to <b>test</b> it after the setup is complete.</p>" + content + "<br />";
    content = content + "<p>Or you may need <a href='" + HELP_URL + "'>Help</a></p>";
    Notifications.Bus.notify(new Notification(MIK_NOTIFICATION_GROUP,
                                              "Configurable Error",
                                              content,
                                              NotificationType.ERROR,
                                              new NotificationListener.Adapter() {
                                                  @Override
                                                  protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
                                                      String url = e.getDescription();
                                                      log.trace("{}", e.getDescription());
                                                      if (StringUtils.isBlank(url)) {
                                                          ProjectSettingsPage configurable = new ProjectSettingsPage();
                                                          // 打开设置面板
                                                          ShowSettingsUtil.getInstance().editConfigurable(project, configurable);
                                                      } else {
                                                          BrowserUtil.browse(url);
                                                      }
                                                      hideBalloon(notification.getBalloon());
                                                  }
                                              }), project);
}
 
Example #2
Source File: PluginManagerMain.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
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 {
      URL url = e.getURL();
      if (url != null) {
        BrowserUtil.browse(url);
      }
    }
  }
}
 
Example #3
Source File: WindowsDefenderFixAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void actionPerformed(@Nonnull AnActionEvent e, @Nonnull Notification notification) {
  int rc = Messages.showDialog(e.getProject(), DiagnosticBundle
                                       .message("virus.scanning.fix.explanation", ApplicationNamesInfo.getInstance().getFullProductName(), WindowsDefenderChecker.getInstance().getConfigurationInstructionsUrl()),
                               DiagnosticBundle.message("virus.scanning.fix.title"),
                               new String[]{DiagnosticBundle.message("virus.scanning.fix.automatically"), DiagnosticBundle.message("virus.scanning.fix.manually"),
                                       CommonBundle.getCancelButtonText()}, 0, null);

  switch (rc) {
    case Messages.OK:
      notification.expire();
      ApplicationManager.getApplication().executeOnPooledThread(() -> {
        if (WindowsDefenderChecker.getInstance().runExcludePathsCommand(e.getProject(), myPaths)) {
          UIUtil.invokeLaterIfNeeded(() -> {
            Notifications.Bus.notifyAndHide(new Notification("System Health", "", DiagnosticBundle.message("virus.scanning.fix.success.notification"), NotificationType.INFORMATION), e.getProject());
          });
        }
      });

      break;
    case Messages.CANCEL:
      BrowserUtil.browse(WindowsDefenderChecker.getInstance().getConfigurationInstructionsUrl());
      break;
  }
}
 
Example #4
Source File: AbstractBaseTagMouseListener.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onClick(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.launchBrowser(tag.toString());
      return true;
    }
  }
  return false;
}
 
Example #5
Source File: VcsCommitInfoBalloon.java    From consulo with Apache License 2.0 6 votes vote down vote up
public VcsCommitInfoBalloon(@Nonnull JTree tree) {
  myTree = tree;
  myEditorPane = new JEditorPane(UIUtil.HTML_MIME, "");
  myEditorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
  myEditorPane.setEditable(false);
  myEditorPane.setBackground(HintUtil.INFORMATION_COLOR);
  myEditorPane.setFont(UIUtil.getToolTipFont());
  myEditorPane.setBorder(HintUtil.createHintBorder());
  Border margin = IdeBorderFactory.createEmptyBorder(3, 3, 3, 3);
  myEditorPane.setBorder(new CompoundBorder(myEditorPane.getBorder(), margin));
  myEditorPane.addHyperlinkListener(new HyperlinkAdapter() {
    @Override
    protected void hyperlinkActivated(HyperlinkEvent e) {
      BrowserUtil.browse(e.getURL());
    }
  });
  myWrapper = new Wrapper(myEditorPane);
  myPopupBuilder = JBPopupFactory.getInstance().createComponentPopupBuilder(myWrapper, null);
  myPopupBuilder.setCancelOnClickOutside(true).setResizable(true).setMovable(true).setRequestFocus(false)
          .setMinSize(new Dimension(80, 30));
}
 
Example #6
Source File: AnnotateActionTest.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
@Test
public void testExecute_Success() {
    ArgumentCaptor<URI> argCapture = ArgumentCaptor.forClass(URI.class);
    when(mockTeamProjectReference.getName()).thenReturn("TeamName");
    when(mockItemInfo.getServerItem()).thenReturn("$/path/to/file.txt");
    when(mockServerContext.getTeamProjectReference()).thenReturn(mockTeamProjectReference);
    when(mockActionContext.getServerContext()).thenReturn(mockServerContext);
    when(mockActionContext.getItem()).thenReturn(mockItemInfo);
    annotateAction.execute(mockActionContext);

    verifyStatic(times(0));
    Messages.showErrorDialog(any(Project.class), anyString(), anyString());
    verifyStatic(times(1));
    BrowserUtil.browse(argCapture.capture());
    assertEquals(serverURI.toString() +
                    "TeamName/_versionControl/?path=%24%2Fpath%2Fto%2Ffile.txt&_a=contents&annotate=true&hideComments=true",
            argCapture.getValue().toString());
}
 
Example #7
Source File: TipUIUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static JEditorPane createTipBrowser() {
  JEditorPane browser = new JEditorPane() {
    @Override
    public void setDocument(Document document) {
      super.setDocument(document);
      document.putProperty("imageCache", new URLDictionatyLoader());
    }
  };
  browser.setEditable(false);
  browser.setBackground(UIUtil.getTextFieldBackground());
  browser.addHyperlinkListener(e -> {
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
      BrowserUtil.browse(e.getURL());
    }
  });
  URL resource = ResourceUtil.getResource(TipUIUtil.class, "/tips/css/", UIUtil.isUnderDarcula() ? "tips_darcula.css" : "tips.css");
  HTMLEditorKit kit = UIUtil.getHTMLEditorKit(false);
  kit.getStyleSheet().addStyleSheet(UIUtil.loadStyleSheet(resource));
  browser.setEditorKit(kit);
  return browser;
}
 
Example #8
Source File: FlutterRunNotifications.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void checkForDisplayFirstReload() {
  final PropertiesComponent properties = PropertiesComponent.getInstance(myProject);

  final boolean alreadyRun = properties.getBoolean(RELOAD_ALREADY_RUN);
  if (!alreadyRun) {
    properties.setValue(RELOAD_ALREADY_RUN, true);

    final Notification notification = new Notification(
      FlutterMessages.FLUTTER_NOTIFICATION_GROUP_ID,
      FlutterBundle.message("flutter.reload.firstRun.title"),
      FlutterBundle.message("flutter.reload.firstRun.content"),
      NotificationType.INFORMATION);
    notification.setIcon(FlutterIcons.HotReload);
    notification.addAction(new AnAction("Learn more") {
      @Override
      public void actionPerformed(@NotNull AnActionEvent event) {
        BrowserUtil.browse(FlutterBundle.message("flutter.reload.firstRun.url"));
        notification.expire();
      }
    });
    Notifications.Bus.notify(notification);
  }
}
 
Example #9
Source File: ChangeListStorageImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static void notifyUser(String message) {
  final String logFile = ContainerPathManager.get().getLogPath();
  /*String createIssuePart = "<br>" +
                           "<br>" +
                           "Please attach log files from <a href=\"file\">" + logFile + "</a><br>" +
                           "to the <a href=\"url\">YouTrack issue</a>";*/
  Notifications.Bus.notify(new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID,
                                            "Local History is broken",
                                            message /*+ createIssuePart*/,
                                            NotificationType.ERROR,
                                            new NotificationListener() {
                                              @Override
                                              public void hyperlinkUpdate(@Nonnull Notification notification,
                                                                          @Nonnull HyperlinkEvent event) {
                                                if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                                                  if ("url".equals(event.getDescription())) {
                                                    BrowserUtil.launchBrowser("http://youtrack.jetbrains.net/issue/IDEA-71270");
                                                  }
                                                  else {
                                                    File file = new File(logFile);
                                                    ShowFilePathAction.openFile(file);
                                                  }
                                                }
                                              }
                                            }), null);
}
 
Example #10
Source File: BrowserLauncherAppless.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void addArgs(@Nonnull GeneralCommandLine command, @Nullable BrowserSpecificSettings settings, @Nonnull String[] additional) {
  List<String> specific = settings == null ? Collections.<String>emptyList() : settings.getAdditionalParameters();
  if (specific.size() + additional.length > 0) {
    if (isOpenCommandUsed(command)) {
      if (BrowserUtil.isOpenCommandSupportArgs()) {
        command.addParameter("--args");
      }
      else {
        LOG.warn("'open' command doesn't allow to pass command line arguments so they will be ignored: " + StringUtil.join(specific, ", ") + " " + Arrays.toString(additional));
        return;
      }
    }

    command.addParameters(specific);
    command.addParameters(additional);
  }
}
 
Example #11
Source File: FeedbackAction.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
public void sendFeedback(final boolean smile) {
    final FeedbackDialog dialog = new FeedbackDialog(project, smile);

    dialog.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            if (FeedbackForm.CMD_GOTO_PRIVACY.equalsIgnoreCase(e.getActionCommand())) {
                BrowserUtil.browse(URL_PRIVACY_POLICY);
            }
        }
    });

    if (dialog.showAndGet()) {
        VcsNotifier.getInstance(project).notifySuccess(
                TfPluginBundle.message(TfPluginBundle.KEY_FEEDBACK_DIALOG_TITLE),
                TfPluginBundle.message(TfPluginBundle.KEY_FEEDBACK_NOTIFICATION));
    }
}
 
Example #12
Source File: UnityPluginFileValidator.java    From consulo-unity3d with Apache License 2.0 6 votes vote down vote up
private static void showNotify(final Project project, final String pluginFileName, final File unityPluginFile, @Nonnull String title, @Nonnull List<VirtualFile> oldPluginFiles)
{
	Notification notification = new Notification(ourGroup.getDisplayId(), "Unity3D Plugin", title, !oldPluginFiles.isEmpty() ? NotificationType.ERROR : NotificationType.INFORMATION);
	notification.setListener((thisNotification, hyperlinkEvent) ->
	{
		thisNotification.hideBalloon();

		switch(hyperlinkEvent.getDescription())
		{
			case "info":
				BrowserUtil.browse("https://github.com/consulo/consulo/issues/250");
				break;
			case "update":
				updatePlugin(project, pluginFileName, unityPluginFile, oldPluginFiles);
				break;
		}
	});
	notification.notify(project);
}
 
Example #13
Source File: OpenCommitInBrowserAction.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
@Override
public void actionPerformed(@NotNull final AnActionEvent anActionEvent) {
    final Project project = anActionEvent.getRequiredData(CommonDataKeys.PROJECT);
    final VcsFullCommitDetails commit = anActionEvent.getRequiredData(VcsLogDataKeys.VCS_LOG).getSelectedDetails().get(0);

    final GitRepository gitRepository = GitUtil.getRepositoryManager(project).getRepositoryForRootQuick(commit.getRoot());
    if (gitRepository == null)
        return;

    final GitRemote remote = TfGitHelper.getTfGitRemote(gitRepository);

    // guard for null so findbugs doesn't complain
    if (remote == null) {
        return;
    }

    final String remoteUrl = remote.getFirstUrl();
    if (remoteUrl == null) {
        return;
    }

    final URI urlToBrowseTo = UrlHelper.getCommitURI(remoteUrl, commit.getId().toString());
    logger.info("Browsing to url " + urlToBrowseTo.getPath());
    BrowserUtil.browse(urlToBrowseTo);
}
 
Example #14
Source File: SearchAction.java    From tutorials with MIT License 6 votes vote down vote up
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
    Optional<PsiFile> psiFile = Optional.ofNullable(e.getData(LangDataKeys.PSI_FILE));
    String languageTag = psiFile
            .map(PsiFile::getLanguage)
            .map(Language::getDisplayName)
            .map(String::toLowerCase)
            .map(lang -> "[" + lang + "]")
            .orElse("");

    Editor editor = e.getRequiredData(CommonDataKeys.EDITOR);
    CaretModel caretModel = editor.getCaretModel();
    String selectedText = caretModel.getCurrentCaret().getSelectedText();

    BrowserUtil.browse("https://stackoverflow.com/search?q=" + languageTag + selectedText);
}
 
Example #15
Source File: AnnotateAction.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
@Override
protected void execute(final @NotNull SingleItemActionContext actionContext) {
    final ServerContext context = actionContext.getServerContext();

    // check for null values (it's ok if the server item is null because the URL redirects to the general page in that case
    if (context != null && context.getTeamProjectReference() != null && actionContext.getItem() != null) {
        final URI urlToBrowseTo = UrlHelper.getTfvcAnnotateURI(context.getUri().toString(),
                context.getTeamProjectReference().getName(), actionContext.getItem().getServerItem());
        logger.info("Browsing to url " + urlToBrowseTo.getPath());
        BrowserUtil.browse(urlToBrowseTo);
    } else {
        final String issue = context == null ? "context is null" : context.getTeamProjectReference() == null ? "team project is null" : "getItem is null";
        logger.warn("Couldn't create annotate url: " + issue);
        Messages.showErrorDialog(actionContext.getProject(), TfPluginBundle.message(TfPluginBundle.KEY_ACTIONS_ANNOTATE_ERROR_MSG),
                TfPluginBundle.message(TfPluginBundle.KEY_ACTIONS_ANNOTATE_ERROR_TITLE));
    }
}
 
Example #16
Source File: FlutterRunNotifications.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void checkForDisplayFirstReload() {
  final PropertiesComponent properties = PropertiesComponent.getInstance(myProject);

  final boolean alreadyRun = properties.getBoolean(RELOAD_ALREADY_RUN);
  if (!alreadyRun) {
    properties.setValue(RELOAD_ALREADY_RUN, true);

    final Notification notification = new Notification(
      FlutterMessages.FLUTTER_NOTIFICATION_GROUP_ID,
      FlutterBundle.message("flutter.reload.firstRun.title"),
      FlutterBundle.message("flutter.reload.firstRun.content"),
      NotificationType.INFORMATION);
    notification.setIcon(FlutterIcons.HotReload);
    notification.addAction(new AnAction("Learn more") {
      @Override
      public void actionPerformed(@NotNull AnActionEvent event) {
        BrowserUtil.browse(FlutterBundle.message("flutter.reload.firstRun.url"));
        notification.expire();
      }
    });
    Notifications.Bus.notify(notification);
  }
}
 
Example #17
Source File: IdeaUtils.java    From netbeans-mmd-plugin with Apache License 2.0 5 votes vote down vote up
public static boolean browseURI(final URI uri, final boolean useInternalBrowser) {
  try {
    BrowserUtil.browse(uri);
  } catch (Exception ex) {
    ex.printStackTrace();
    return false;
  }
  return true;
}
 
Example #18
Source File: QuarkusCodeEndpointChooserStep.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
QuarkusCodeEndpointChooserStep(WizardContext wizardContext) {
    this.customUrlWithBrowseButton = new ComponentWithBrowseButton(this.endpointURL, new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                QuarkusCodeEndpointChooserStep.this.validate();
                BrowserUtil.browse(QuarkusCodeEndpointChooserStep.this.endpointURL.getText());
            } catch (ConfigurationException var3) {
                Messages.showErrorDialog(var3.getMessage(), "Cannot Open URL");
            }

        }
    });
    this.wizardContext = wizardContext;
    String lastServiceUrl = PropertiesComponent.getInstance().getValue(LAST_ENDPOINT_URL, QUARKUS_CODE_URL);
    if (!lastServiceUrl.equals(QUARKUS_CODE_URL)) {
        this.endpointURL.setSelectedItem(lastServiceUrl);
        this.defaultRadioButton.setSelected(false);
        this.customRadioButton.setSelected(true);
    } else {
        this.defaultRadioButton.setSelected(true);
    }

    List<String> history = this.endpointURL.getHistory();
    history.remove(QUARKUS_CODE_URL);
    this.endpointURL.setHistory(history);
    this.updateCustomUrl();
}
 
Example #19
Source File: ProjectTree.java    From KodeBeagle with Apache License 2.0 5 votes vote down vote up
public final MouseListener getMouseListener(final TreeNode root) {
    return new MouseAdapter() {
        @Override
        public void mouseClicked(final MouseEvent mouseEvent) {
            DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)
                    windowObjects.getjTree().getLastSelectedPathComponent();
            String url = "";
            if (mouseEvent.isMetaDown() && selectedNode != null
                    && selectedNode.getParent() != null) {
                final String gitUrl = getGitUrl(selectedNode, url, root);
                JPopupMenu menu = new JPopupMenu();

                if (selectedNode.isLeaf()) {
                    final CodeInfo codeInfo = (CodeInfo) selectedNode.getUserObject();

                    menu.add(new JMenuItem(addOpenInNewTabMenuItem(codeInfo))).
                            setText(OPEN_IN_NEW_TAB);
                }

                menu.add(new JMenuItem(new AbstractAction() {
                    @Override
                    public void actionPerformed(final ActionEvent actionEvent) {
                        if (!gitUrl.isEmpty()) {
                            BrowserUtil.browse(GITHUB_LINK + gitUrl);
                        }
                    }
                })).setText(RIGHT_CLICK_MENU_ITEM_TEXT);

                menu.show(mouseEvent.getComponent(), mouseEvent.getX(), mouseEvent.getY());
            }
            doubleClickListener(mouseEvent);
        }
    };
}
 
Example #20
Source File: LegalNotice.java    From KodeBeagle with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected final JComponent createCenterPanel() {

    JPanel iconPanel = new JBPanel(new BorderLayout());
    iconPanel.add(new JBLabel(AllIcons.General.WarningDialog), BorderLayout.NORTH);

    JEditorPane messageEditorPane = new JEditorPane();
    messageEditorPane.setEditorKit(UIUtil.getHTMLEditorKit());
    messageEditorPane.setEditable(false);
    messageEditorPane.setPreferredSize(MESSAGE_EDITOR_PANE_PREFERRED_SIZE);
    messageEditorPane.setBorder(BorderFactory.createLineBorder(Gray._200));
    String text = DIV_STYLE_MARGIN_5PX + getLegalNoticeMessage() + "\n"
            + KODEBEAGLE_PRIVACY_POLICY + DIV;
    messageEditorPane.setText(text);
    JPanel legalNoticePanel = new JPanel(LEGAL_NOTICE_LAYOUT);
    legalNoticePanel.add(iconPanel, BorderLayout.WEST);
    legalNoticePanel.add(messageEditorPane, BorderLayout.CENTER);

    messageEditorPane.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(final HyperlinkEvent he) {
            if (he.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                BrowserUtil.browse(he.getURL());
            }
        }
    });
    return legalNoticePanel;
}
 
Example #21
Source File: SearchAction.java    From tutorials with MIT License 5 votes vote down vote up
/**
 * Convert selected text to a URL friendly string.
 * @param e
 */
@Override
public void actionPerformed(AnActionEvent e)
{
   final Editor editor = e.getRequiredData(CommonDataKeys.EDITOR);
   CaretModel caretModel = editor.getCaretModel();

   // For searches from the editor, we should also get file type information
   // to help add scope to the search using the Stack overflow search syntax.
   //
   // https://stackoverflow.com/help/searching

   String languageTag = "";
   PsiFile file = e.getData(CommonDataKeys.PSI_FILE);
   if(file != null)
   {
      Language lang = e.getData(CommonDataKeys.PSI_FILE).getLanguage();
      languageTag = "+[" + lang.getDisplayName().toLowerCase() + "]";
   }

   // The update method below is only called periodically so need
   // to be careful to check for selected text
   if(caretModel.getCurrentCaret().hasSelection())
   {
      String query = caretModel.getCurrentCaret().getSelectedText().replace(' ', '+') + languageTag;
      BrowserUtil.browse("https://stackoverflow.com/search?q=" + query);
   }
}
 
Example #22
Source File: PantsProjectSettingsControl.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
@Override
protected void fillExtraControls(@NotNull PaintAwarePanel content, int indentLevel) {
  PantsProjectSettings initialSettings = getInitialSettings();
  myLibsWithSourcesCheckBox.setSelected(initialSettings.libsWithSources);
  myEnableIncrementalImportCheckBox.setSelected(initialSettings.incrementalImportEnabled);
  myImportDepthSpinner.setValue(initialSettings.incrementalImportDepth);
  myUseIdeaProjectJdkCheckBox.setSelected(initialSettings.useIdeaProjectJdk);
  myImportSourceDepsAsJarsCheckBox.setSelected(initialSettings.importSourceDepsAsJars);
  myUseIntellijCompilerCheckBox.setSelected(initialSettings.useIntellijCompiler);
  LinkLabel<?> intellijCompilerHelpMessage = LinkLabel.create(
    PantsBundle.message("pants.settings.text.use.intellij.compiler.help.messasge"),
    () -> BrowserUtil.browse(PantsBundle.message("pants.settings.text.use.intellij.compiler.help.messasge.link"))
  );

  myTargetSpecsBox.setItems(initialSettings.getAllAvailableTargetSpecs(), x -> x);
  initialSettings.getSelectedTargetSpecs().forEach(spec -> myTargetSpecsBox.setItemSelected(spec, true));

  insertNameFieldBeforeProjectPath(content);

  List<JComponent> boxes = ContainerUtil.newArrayList(
    myLibsWithSourcesCheckBox,
    myEnableIncrementalImportCheckBox,
    myImportDepthPanel,
    myUseIdeaProjectJdkCheckBox,
    myImportSourceDepsAsJarsCheckBox,
    myUseIntellijCompilerCheckBox,
    intellijCompilerHelpMessage,
    new JBLabel(PantsBundle.message("pants.settings.text.targets")),
    new JBScrollPane(myTargetSpecsBox)
  );

  GridBag lineConstraints = ExternalSystemUiUtil.getFillLineConstraints(indentLevel);

  for (JComponent component : boxes) {
    content.add(component, lineConstraints);
  }
}
 
Example #23
Source File: DesktopHelpManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void invokeHelp(@javax.annotation.Nullable String id) {
  if (MacHelpUtil.isApplicable()) {
    if (MacHelpUtil.invokeHelp(id)) return;
  }
  if (myHelpSet == null) {
    myHelpSet = createHelpSet();
  }

  if (myHelpSet == null) {
    BrowserUtil.browse(ApplicationInfo.getInstance().getWebHelpUrl() + id);
    return;
  }

  if (myBroker == null) {
    myBroker = new IdeaHelpBroker(myHelpSet);
  }

  Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
  myBroker.setActivationWindow(activeWindow);

  if (id != null) {
    try {
      myBroker.setCurrentID(id);
    }
    catch (BadIDException e) {
      Messages.showErrorDialog(IdeBundle.message("help.topic.not.found.error", id), CommonBundle.getErrorTitle());
      return;
    }
  }
  myBroker.setDisplayed(true);
}
 
Example #24
Source File: BlamePopup.java    From GitToolBox with Apache License 2.0 5 votes vote down vote up
private void handleLinkClick(String action) {
  if (PopupAction.REVEAL_IN_LOG.isAction(action)) {
    VcsLogContentUtil.openMainLogAndExecute(project, this::revealRevisionInLog);
  } else if (PopupAction.AFFECTED_FILES.isAction(action)) {
    showAffectedFiles();
  } else if (PopupAction.COPY_REVISION.isAction(action)) {
    CopyPasteManager.getInstance().setContents(new StringSelection(revisionInfo.getRevisionNumber().asString()));
  } else {
    BrowserUtil.open(action);
  }
  close();
}
 
Example #25
Source File: IdeaHelpContentViewUI.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void linkActivated(URL u) {
  String url = u.toExternalForm();
  if (url.startsWith("http") || url.startsWith("ftp")) {
    BrowserUtil.browse(url);
  }
  else {
    super.linkActivated(u);
  }
}
 
Example #26
Source File: NotificationListener.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void hyperlinkActivated(@Nonnull Notification notification, @Nonnull HyperlinkEvent event) {
  URL url = event.getURL();
  if (url == null) {
    BrowserUtil.browse(event.getDescription());
  }
  else {
    BrowserUtil.browse(url);
  }
  if (myExpireNotification) {
    notification.expire();
  }
}
 
Example #27
Source File: ExportTestResultsAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void openEditorOrBrowser(final VirtualFile result, final Project project, final boolean editor) {
  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      if (editor) {
        FileEditorManager.getInstance(project).openFile(result, true);
      }
      else {
        BrowserUtil.browse(result);
      }
    }
  });
}
 
Example #28
Source File: BrowserLauncherAppless.java    From consulo with Apache License 2.0 5 votes vote down vote up
private boolean doLaunch(@Nullable String url,
                         @Nullable String browserPath,
                         @Nullable WebBrowser browser,
                         @Nullable Project project,
                         @Nonnull String[] additionalParameters,
                         @Nullable Runnable launchTask) {
  if (!checkPath(browserPath, browser, project, launchTask)) {
    return false;
  }
  return doLaunch(url, BrowserUtil.getOpenBrowserCommand(browserPath, false), browser, project, additionalParameters, launchTask);
}
 
Example #29
Source File: Donate.java    From MavenHelper with Apache License 2.0 5 votes vote down vote up
public static void init(JComponent donatePanel, JButton donate) {
	donate.setBorder(null);
	donate.setMargin(new Insets(0, 0, 0, 0));
	donate.setContentAreaFilled(false);
	donate.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			BrowserUtil.browse("https://www.paypal.me/VojtechKrasa");
		}
	});
	donate.putClientProperty("JButton.backgroundColor", donatePanel.getBackground());
}
 
Example #30
Source File: SendFeedbackAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void launchBrowser() {
  final ApplicationInfo appInfo = ApplicationInfo.getInstance();
  String urlTemplate = appInfo.getReleaseFeedbackUrl();
  urlTemplate = urlTemplate
    .replace("$BUILD", appInfo.getBuild().asString())
    .replace("$TIMEZONE", System.getProperty("user.timezone"))
    .replace("$EVAL", "false");
  BrowserUtil.browse(urlTemplate);
}