Java Code Examples for com.intellij.ide.BrowserUtil#launchBrowser()

The following examples show how to use com.intellij.ide.BrowserUtil#launchBrowser() . 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: 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 2
Source File: GitLabOpenInBrowserAction.java    From IDEA-GitLab-Integration with MIT License 5 votes vote down vote up
@Override
public void actionPerformed(@Nullable AnActionEvent unused) {
    if (!path.startsWith(rootPath)) {
        GitLabOpenInBrowserAction.showError(project, GitLabOpenInBrowserAction.CANNOT_OPEN_IN_BROWSER,
                "File is not under repository root", "Root: " + rootPath + ", file: " + path);
        return;
    }

    String branch = GitLabOpenInBrowserAction.getBranchNameOnRemote(project, repository);
    if (branch == null) {
        return;
    }

    String remoteUrl = remote.getFirstUrl();

    if (remoteUrl == null) {
        GitLabOpenInBrowserAction.showError(project, GitLabOpenInBrowserAction.CANNOT_OPEN_IN_BROWSER,
                "Can't obtain url for remote", remote.getName());
        return;
    }

    String relativePath = path.substring(rootPath.length());
    String urlToOpen = GitLabOpenInBrowserAction.makeUrlToOpen(editor, relativePath, branch, remoteUrl);
    if (urlToOpen == null) {
        GitLabOpenInBrowserAction.showError(project, GitLabOpenInBrowserAction.CANNOT_OPEN_IN_BROWSER,
                "Can't create properly url", remote.getFirstUrl());
        return;
    }

    BrowserUtil.launchBrowser(urlToOpen);
}
 
Example 3
Source File: BrowserHyperlinkInfo.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static void openUrl(String url) {
  BrowserUtil.launchBrowser(url);
}
 
Example 4
Source File: OnlineDocAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void actionPerformed(AnActionEvent e) {
  BrowserUtil.launchBrowser(ApplicationInfoImpl.getShadowInstance().getDocumentationUrl());
}
 
Example 5
Source File: WhatsNewAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void actionPerformed(AnActionEvent e) {
  BrowserUtil.launchBrowser(ApplicationInfo.getInstance().getWhatsNewUrl());
}
 
Example 6
Source File: TechnicalSupportAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void actionPerformed(AnActionEvent e) {
  BrowserUtil.launchBrowser(ApplicationInfoImpl.getShadowInstance().getSupportUrl());
}