本文整理汇总了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));
}
}
示例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;
}
示例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
}
}
示例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));
}
}
示例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);
}
}
示例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;
}
}
}
}
示例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;
}
示例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);
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例14: openUrl
import com.intellij.ide.BrowserUtil; //导入方法依赖的package包/类
public static void openUrl(String url) {
BrowserUtil.launchBrowser(url);
}
示例15: run
import com.intellij.ide.BrowserUtil; //导入方法依赖的package包/类
@Override
public void run() {
BrowserUtil.launchBrowser(myUrl);
}