当前位置: 首页>>代码示例>>Java>>正文


Java BrowserUtil.launchBrowser方法代码示例

本文整理汇总了Java中com.intellij.ide.BrowserUtil.launchBrowser方法的典型用法代码示例。如果您正苦于以下问题:Java BrowserUtil.launchBrowser方法的具体用法?Java BrowserUtil.launchBrowser怎么用?Java BrowserUtil.launchBrowser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ide.BrowserUtil的用法示例。


在下文中一共展示了BrowserUtil.launchBrowser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import com.intellij.ide.BrowserUtil; //导入方法依赖的package包/类
public void actionPerformed(AnActionEvent e) {
  DataContext dataContext = e.getDataContext();
  CopyProvider provider = PlatformDataKeys.COPY_PROVIDER.getData(dataContext);
  if (provider == null) {
    return;
  }
  provider.performCopy(dataContext);
  Transferable contents = CopyPasteManager.getInstance().getContents();
  String string;
  try {
    string = contents == null? null : (String)contents.getTransferData(DataFlavor.stringFlavor);
  }
  catch (Exception ex) {
    return;
  }
  if (StringUtil.isNotEmpty(string)) {
    BrowserUtil.launchBrowser("http://www.google.com/search?q="+ URLEncoder.encode(string));
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:SearchWebAction.java

示例2: onClick

import com.intellij.ide.BrowserUtil; //导入方法依赖的package包/类
@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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:AbstractBaseTagMouseListener.java

示例3: actionPerformed

import com.intellij.ide.BrowserUtil; //导入方法依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
  try {
    if (new File(PLUGIN_URL).isFile()) {
      BrowserUtil.launchBrowser(PLUGIN_URL);
    }
    else {
      BrowserUtil.launchBrowser(PLUGIN_WEBSITE);
    }
  }
  catch(IllegalStateException ex) {
    // ignore
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:DevelopPluginsAction.java

示例4: showExternalJavadoc

import com.intellij.ide.BrowserUtil; //导入方法依赖的package包/类
public static void showExternalJavadoc(List<String> urls) {
  final HashSet<String> set = new HashSet<String>(urls);
  if (set.size() > 1) {
    JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<String>("Choose external documentation root", ArrayUtil.toStringArray(set)) {
      @Override
      public PopupStep onChosen(final String selectedValue, final boolean finalChoice) {
        BrowserUtil.launchBrowser(selectedValue);
        return FINAL_CHOICE;
      }
    }).showInBestPositionFor(DataManager.getInstance().getDataContext());
  }
  else if (set.size() == 1) {
    BrowserUtil.launchBrowser(urls.get(0));
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:ExternalJavaDocAction.java

示例5: linkActivated

import com.intellij.ide.BrowserUtil; //导入方法依赖的package包/类
@SuppressWarnings({"HardCodedStringLiteral"})
protected void linkActivated(URL u){
  String url=u.toExternalForm();
  if(url.startsWith("http") || url.startsWith("ftp")){
    BrowserUtil.launchBrowser(url);
  } else{
    super.linkActivated(u);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:IdeaHelpContentViewUI.java

示例6: launchBrowser

import com.intellij.ide.BrowserUtil; //导入方法依赖的package包/类
public static void launchBrowser(@Nullable BrowsersConfiguration.BrowserFamily family, @NotNull String url) {
  if (family == null) {
    BrowserUtil.launchBrowser(url);
  }
  else {
    for (UrlOpener urlOpener : EP_NAME.getExtensions()) {
      if (urlOpener.openUrl(family, url)) {
        return;
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:UrlOpener.java

示例7: createCenterPanel

import com.intellij.ide.BrowserUtil; //导入方法依赖的package包/类
@Override
protected JComponent createCenterPanel() {
  JLabel description = new JBLabel(
    "<html>You are about to commit CRLF line separators to the Git repository.<br/>" +
    "It is recommended to set core.autocrlf Git attribute to <code>" + RECOMMENDED_VALUE +
    "</code> to avoid line separator issues.</html>");

  JLabel additionalDescription = new JBLabel(
    "<html>Fix and Commit: <code>git config --global core.autocrlf " + RECOMMENDED_VALUE + "</code> will be called,<br/>" +
    "Commit as Is: the config value won't be set.</html>", UIUtil.ComponentStyle.SMALL);

  JLabel readMore = new LinkLabel("Read more", null, new LinkListener() {
    @Override
    public void linkSelected(LinkLabel aSource, Object aLinkData) {
      BrowserUtil.launchBrowser("https://help.github.com/articles/dealing-with-line-endings");
    }
  });

  JLabel icon = new JLabel(UIUtil.getWarningIcon(), SwingConstants.LEFT);
  myDontWarn = new JBCheckBox("Don't warn again");
  myDontWarn.setMnemonic('w');

  JPanel rootPanel = new JPanel(new GridBagLayout());
  GridBag g = new GridBag()
    .setDefaultInsets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP))
    .setDefaultAnchor(GridBagConstraints.LINE_START)
    .setDefaultFill(GridBagConstraints.HORIZONTAL);

  rootPanel.add(icon, g.nextLine().next().coverColumn(4));
  rootPanel.add(description, g.next());
  rootPanel.add(readMore, g.nextLine().next().next());
  rootPanel.add(additionalDescription, g.nextLine().next().next().pady(DEFAULT_HGAP));
  rootPanel.add(myDontWarn,  g.nextLine().next().next().insets(0, 0, 0, 0));

  return rootPanel;

}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:38,代码来源:GitCrlfDialog.java

示例8: launchBrowser

import com.intellij.ide.BrowserUtil; //导入方法依赖的package包/类
public static void launchBrowser() {
  final ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx();
  String urlTemplate = appInfo.isEAP() ? appInfo.getEAPFeedbackUrl() : appInfo.getReleaseFeedbackUrl();
  urlTemplate = urlTemplate
    .replace("$BUILD", appInfo.getBuild().asString())
    .replace("$TIMEZONE", System.getProperty("user.timezone"))
    .replace("$VERSION", appInfo.getFullVersion())
    .replace("$EVAL", isEvaluationLicense() ? "true" : "false");
  BrowserUtil.launchBrowser(urlTemplate);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:SendFeedbackAction.java

示例9: actionPerformed

import com.intellij.ide.BrowserUtil; //导入方法依赖的package包/类
public void actionPerformed(AnActionEvent e) {
  final String url = KEYMAP_URL;
  File file = new File(url);
  if (file.isFile()) {
    BrowserUtil.browse(file);
  }
  else {
    final ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx();
    String webUrl = SystemInfo.isMac ? appInfo.getMacKeymapUrl() : appInfo.getWinKeymapUrl();
    if (webUrl != null) {
      BrowserUtil.launchBrowser(webUrl);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:RefCardAction.java

示例10: showCoverageForFile

import com.intellij.ide.BrowserUtil; //导入方法依赖的package包/类
private void showCoverageForFile(PsiJavaFile javaFile, AnActionEvent e, Project project) {
    VirtualFile virtualFile = javaFile.getVirtualFile();
    if (virtualFile == null) {
        Notifications.Bus.notify(getMissingFileNotification(virtualFile), project);
        return;
    }
    Module module = ModuleUtil.findModuleForFile(virtualFile, project);

    if(module == null){
        return;
    }

    File coverageRootPath = CoverageUtils.getCoverageReportRoot(module, project);
    if (coverageRootPath.exists()) {
        String packageName = javaFile.getPackageName();
        File url = new File(coverageRootPath, packageName);
        boolean wasFound = false;
        url = new File(url, virtualFile.getName() + ".html");
        if (url.exists()) {
            BrowserUtil.launchBrowser(url.toURI().getPath());
            wasFound = true;
        }
        if (!wasFound) {
            Notifications.Bus.notify(getMissingFileNotification(virtualFile), project);
        }
    } else {
        Notifications.Bus.notify(getMissingReportNotification(e), project);
    }
}
 
开发者ID:resios,项目名称:jacoco-coverage,代码行数:30,代码来源:AnnotateFileWithCoverageAction.java

示例11: launch

import com.intellij.ide.BrowserUtil; //导入方法依赖的package包/类
@Override
public void launch(Project project, Entity entity) {
    String tenantId = getTenantId(project);
    if (tenantId != null) {
        String entityUrl = getUrl(project, entity, tenantId);
        BrowserUtil.launchBrowser(entityUrl);
    }
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:9,代码来源:BrowserAction.java

示例12: setHyperlinkTarget

import com.intellij.ide.BrowserUtil; //导入方法依赖的package包/类
public void setHyperlinkTarget(@Nullable final String url) {
  if (myHyperlinkListener != null) {
    removeHyperlinkListener(myHyperlinkListener);
  }
  if (url != null) {
    myHyperlinkListener = new HyperlinkListener() {
      @Override
      public void hyperlinkUpdate(HyperlinkEvent e) {
        BrowserUtil.launchBrowser(url);
      }
    };
    addHyperlinkListener(myHyperlinkListener);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:HyperlinkLabel.java

示例13: actionPerformed

import com.intellij.ide.BrowserUtil; //导入方法依赖的package包/类
@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);
}
 
开发者ID:bsideup,项目名称:IDEA-GitLab-Integration,代码行数:32,代码来源:GitLabOpenInBrowserAction.java

示例14: openUrl

import com.intellij.ide.BrowserUtil; //导入方法依赖的package包/类
public static void openUrl(String url) {
  BrowserUtil.launchBrowser(url);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:BrowserHyperlinkInfo.java

示例15: run

import com.intellij.ide.BrowserUtil; //导入方法依赖的package包/类
@Override
public void run() {
  BrowserUtil.launchBrowser(myUrl);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:5,代码来源:SimpleColoredComponent.java


注:本文中的com.intellij.ide.BrowserUtil.launchBrowser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。