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


Java BrowserUtil类代码示例

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


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

示例1: convertReference

import com.intellij.ide.BrowserUtil; //导入依赖的package包/类
@Override
protected String convertReference(String root, String href) {
  if (BrowserUtil.isAbsoluteURL(href)) {
    return href;
  }
  String reference = JavaDocInfoGenerator.createReferenceForRelativeLink(href, myElement);
  if (reference == null) {
    if (href.startsWith("#")) {
      return root + href;
    }
    else {
      String nakedRoot = ourHTMLFilesuffix.matcher(root).replaceAll("/");
      return doAnnihilate(nakedRoot + href);
    }
  }
  else {
    return reference;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:JavaDocExternalFilter.java

示例2: addArgs

import com.intellij.ide.BrowserUtil; //导入依赖的package包/类
private static void addArgs(@NotNull GeneralCommandLine command, @Nullable BrowserSpecificSettings settings, @NotNull 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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:BrowserLauncherAppless.java

示例3: addBackAndOpenButtons

import com.intellij.ide.BrowserUtil; //导入依赖的package包/类
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);
  });
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:21,代码来源:StudyBrowserWindow.java

示例4: getReaderByUrl

import com.intellij.ide.BrowserUtil; //导入依赖的package包/类
@Nullable
public static Reader getReaderByUrl(final String surl, final HttpConfigurable httpConfigurable, final ProgressIndicator pi) throws IOException {
    if (surl.startsWith(JAR_PROTOCOL)) {
        VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(BrowserUtil.getDocURL(surl));

        if (file == null) {
            return null;
        }

        return new StringReader(VfsUtil.loadText(file));
    }

    URL url = BrowserUtil.getURL(surl);
    if (url == null) {
        return null;
    }
    httpConfigurable.prepareURL(url.toString());
    final URLConnection urlConnection = url.openConnection();
    final String contentEncoding = urlConnection.getContentEncoding();
    final InputStream inputStream =
            pi != null ? UrlConnectionUtil.getConnectionInputStreamWithException(urlConnection, pi) : urlConnection.getInputStream();
    //noinspection IOResourceOpenedButNotSafelyClosed
    return contentEncoding != null ? new InputStreamReader(inputStream, contentEncoding) : new InputStreamReader(inputStream);
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:25,代码来源:UrlUtil.java

示例5: startProcess

import com.intellij.ide.BrowserUtil; //导入依赖的package包/类
@NotNull
protected OSProcessHandler startProcess() throws ExecutionException {
  final OSProcessHandler handler = JavaCommandLineStateUtil.startProcess(createCommandLine());
  ProcessTerminatedListener.attach(handler, myProject, JavadocBundle.message("javadoc.generate.exited"));
  handler.addProcessListener(new ProcessAdapter() {
    public void processTerminated(ProcessEvent event) {
      if (myConfiguration.OPEN_IN_BROWSER) {
        File url = new File(myConfiguration.OUTPUT_DIRECTORY, INDEX_HTML);
        if (url.exists() && event.getExitCode() == 0) {
          BrowserUtil.browse(url);
        }
      }
    }
  });
  return handler;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JavadocGeneratorRunProfile.java

示例6: notifyUser

import com.intellij.ide.BrowserUtil; //导入依赖的package包/类
public static void notifyUser(String message) {
  final String logFile = PathManager.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(@NotNull Notification notification,
                                                                          @NotNull HyperlinkEvent event) {
                                                if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                                                  if ("url".equals(event.getDescription())) {
                                                    BrowserUtil.browse("http://youtrack.jetbrains.net/issue/IDEA-71270");
                                                  }
                                                  else {
                                                    File file = new File(logFile);
                                                    ShowFilePathAction.openFile(file);
                                                  }
                                                }
                                              }
                                            }), null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ChangeListStorageImpl.java

示例7: createTipBrowser

import com.intellij.ide.BrowserUtil; //导入依赖的package包/类
@NotNull
public static JEditorPane createTipBrowser() {
  JEditorPane browser = new JEditorPane();
  browser.setEditable(false);
  browser.setBackground(UIUtil.getTextFieldBackground());
  browser.addHyperlinkListener(
    new HyperlinkListener() {
      public void hyperlinkUpdate(HyperlinkEvent 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");
  final StyleSheet styleSheet = UIUtil.loadStyleSheet(resource);
  HTMLEditorKit kit = new HTMLEditorKit() {
    @Override
    public StyleSheet getStyleSheet() {
      return styleSheet != null ? styleSheet : super.getStyleSheet();
    }
  };
  browser.setEditorKit(kit);
  return browser;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:TipUIUtil.java

示例8: hyperlinkUpdate

import com.intellij.ide.BrowserUtil; //导入依赖的package包/类
@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);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PluginManagerMain.java

示例9: VcsCommitInfoBalloon

import com.intellij.ide.BrowserUtil; //导入依赖的package包/类
public VcsCommitInfoBalloon(@NotNull 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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:VcsCommitInfoBalloon.java

示例10: onClick

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

示例11: getAfterTask

import com.intellij.ide.BrowserUtil; //导入依赖的package包/类
@Override
protected Runnable getAfterTask() {
  return new Runnable() {
    @Override
    public void run() {
      VirtualFile virtualFile = findOutput();
      if (virtualFile != null) {
        if (myConfiguration.openInBrowser()) {
          BrowserUtil.browse(virtualFile);
        }
        else {
          FileEditorManager.getInstance(myConfiguration.getProject()).openFile(virtualFile, true);
        }
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DocutilsCommandLineState.java

示例12: DisableAutoImportNotificationPanel

import com.intellij.ide.BrowserUtil; //导入依赖的package包/类
DisableAutoImportNotificationPanel(@NotNull final GradleProjectSettings settings) {
  setText("Gradle 'auto-import' will considerably slow down the IDE, due to a known bug.");

  createActionLabel("Open bug report", new Runnable() {
    @Override
    public void run() {
      BrowserUtil.browse("https://code.google.com/p/android/issues/detail?id=59965");
    }
  });

  createActionLabel("Disable 'auto-import'", new Runnable() {
    @Override
    public void run() {
      settings.setUseAutoImport(false);
      myNotifications.updateAllNotifications();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:AutoImportNotificationProvider.java

示例13: openInBrowser

import com.intellij.ide.BrowserUtil; //导入依赖的package包/类
protected static void openInBrowser(Project project, GitRepository repository, String revisionHash) {
  String url = GithubUtil.findGithubRemoteUrl(repository);
  if (url == null) {
    GithubUtil.LOG.info(String.format("Repository is not under GitHub. Root: %s, Remotes: %s", repository.getRoot(),
                                         GitUtil.getPrintableRemotes(repository.getRemotes())));
    return;
  }
  GithubFullPath userAndRepository = GithubUrlUtil.getUserAndRepositoryFromRemoteUrl(url);
  if (userAndRepository == null) {
    GithubNotifications
      .showError(project, GithubOpenInBrowserAction.CANNOT_OPEN_IN_BROWSER, "Cannot extract info about repository: " + url);
    return;
  }

  String githubUrl = GithubUrlUtil.getGithubHost() + '/' + userAndRepository.getUser() + '/'
                     + userAndRepository.getRepository() + "/commit/" + revisionHash;
  BrowserUtil.browse(githubUrl);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GithubShowCommitInBrowserAction.java

示例14: execute

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

示例15: doActionPerformed

import com.intellij.ide.BrowserUtil; //导入依赖的package包/类
@Override
public void doActionPerformed(@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).getRepositoryForRoot(commit.getRoot());
    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);
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:23,代码来源:OpenCommitInBrowserAction.java


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