Java 类com.intellij.ui.BrowserHyperlinkListener 实例源码

项目:hybris-integration-intellij-idea-plugin    文件:InformationStep.java   
private void createUIComponents() {
    final Font font = UIManager.getFont("Label.font");
    final String bodyRule = "body { font-family: " + font.getFamily() + "; " + "font-size: " + font.getSize() + "pt; }";
    informationEditorPane = new JEditorPane();
    informationEditorPane.setEditorKit(new HTMLEditorKit());
    ((HTMLDocument) informationEditorPane.getDocument()).getStyleSheet().addRule(bodyRule);
    cvsEditorPane = new JEditorPane();
    cvsEditorPane.setEditorKit(new HTMLEditorKit());
    ((HTMLDocument) cvsEditorPane.getDocument()).getStyleSheet().addRule(bodyRule);
    jrebelEditorPane = new JEditorPane();
    jrebelEditorPane.setEditorKit(new HTMLEditorKit());
    ((HTMLDocument) jrebelEditorPane.getDocument()).getStyleSheet().addRule(bodyRule);
    jiraEditorPane = new JEditorPane();
    jiraEditorPane.setEditorKit(new HTMLEditorKit());
    ((HTMLDocument) jiraEditorPane.getDocument()).getStyleSheet().addRule(bodyRule);
    jiraEditorPane.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);
}
项目:educational-plugin    文件:StudySwingToolWindow.java   
@Override
public JComponent createTaskInfoPanel(Project project) {
  myTaskTextPane = new JTextPane();
  final JBScrollPane scrollPane = new JBScrollPane(myTaskTextPane);
  myTaskTextPane.setContentType(new HTMLEditorKit().getContentType());
  final EditorColorsScheme editorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
  int fontSize = editorColorsScheme.getEditorFontSize();
  final String fontName = editorColorsScheme.getEditorFontName();
  final Font font = new Font(fontName, Font.PLAIN, fontSize);
  String bodyRule = "body { font-family: " + font.getFamily() + "; " +
                    "font-size: " + font.getSize() + "pt; }" +
                    "pre {font-family: Courier; display: inline; ine-height: 50px; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; background-color:"
                    + ColorUtil.toHex(ColorUtil.dimmer(UIUtil.getPanelBackground())) + ";}" +
                    "code {font-family: Courier; display: flex; float: left; background-color:"
                    + ColorUtil.toHex(ColorUtil.dimmer(UIUtil.getPanelBackground())) + ";}";
  ((HTMLDocument)myTaskTextPane.getDocument()).getStyleSheet().addRule(bodyRule);
  myTaskTextPane.setEditable(false);
  if (!UIUtil.isUnderDarcula()) {
    myTaskTextPane.setBackground(EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground());
  }
  myTaskTextPane.setBorder(new EmptyBorder(20, 20, 0, 10));
  myTaskTextPane.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);
  return scrollPane;
}
项目:hybris-integration-intellij-idea-plugin    文件:DiscountImportstep.java   
private void createUIComponents() {
    final Font font = UIManager.getFont("Label.font");
    final String bodyRule = "body { font-family: " + font.getFamily() + "; " + "font-size: " + font.getSize() + "pt; }";
    discountEditorPane = new JEditorPane();
    discountEditorPane.setEditorKit(new HTMLEditorKit());
    ((HTMLDocument) discountEditorPane.getDocument()).getStyleSheet().addRule(bodyRule);
    discountEditorPane.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);
}
项目:intellij-ce-playground    文件:Messages.java   
@NotNull
public static JTextPane configureMessagePaneUi(JTextPane messageComponent,
                                               String message,
                                               final boolean addBrowserHyperlinkListener) {
  messageComponent.setFont(UIUtil.getLabelFont());
  if (BasicHTML.isHTMLString(message)) {
    final HTMLEditorKit editorKit = new HTMLEditorKit();
    editorKit.getStyleSheet().addRule(UIUtil.displayPropertiesToCSS(UIUtil.getLabelFont(), UIUtil.getLabelForeground()));
    messageComponent.setEditorKit(editorKit);
    messageComponent.setContentType(UIUtil.HTML_MIME);
    if (addBrowserHyperlinkListener) {
      messageComponent.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);
    }
  }
  messageComponent.setText(message);
  messageComponent.setEditable(false);
  if (messageComponent.getCaret() != null) {
    messageComponent.setCaretPosition(0);
  }

  if (UIUtil.isUnderNimbusLookAndFeel()) {
    messageComponent.setOpaque(false);
    messageComponent.setBackground(UIUtil.TRANSPARENT_COLOR);
  }
  else {
    messageComponent.setBackground(UIUtil.getOptionPaneBackground());
  }

  messageComponent.setForeground(UIUtil.getLabelForeground());
  return messageComponent;
}
项目:intellij-ce-playground    文件:DetailsPanel.java   
DataPanel(@NotNull Project project, boolean multiRoot, @NotNull Disposable disposable) {
  super(UIUtil.HTML_MIME, "");
  myProject = project;
  myMultiRoot = multiRoot;
  setEditable(false);
  setOpaque(false);
  putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);

  EditorColorsManager.getInstance().addEditorColorsListener(new EditorColorsAdapter() {
    @Override
    public void globalSchemeChange(EditorColorsScheme scheme) {
      update();
    }
  }, disposable);

  DefaultCaret caret = (DefaultCaret)getCaret();
  caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);

  addHyperlinkListener(new HyperlinkListener() {
    public void hyperlinkUpdate(HyperlinkEvent e) {
      if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED && SHOW_OR_HIDE_BRANCHES.equals(e.getDescription())) {
        myExpanded = !myExpanded;
        update();
      }
      else {
        BrowserHyperlinkListener.INSTANCE.hyperlinkUpdate(e);
      }
    }
  });
}
项目:intellij-ce-playground    文件:NewChannelDialog.java   
private NewChannelPanel() {
  String message = IdeBundle.message("updates.channel.name.message", myChannel.getName(), myLatestBuild.getMessage());
  configureMessageArea(myMessageArea, message, null, BrowserHyperlinkListener.INSTANCE);

  if (myLicenseInfo != null) {
    configureMessageArea(myLicenseArea, myLicenseInfo, null, BrowserHyperlinkListener.INSTANCE);
  }
  else {
    myLicenseArea.setVisible(false);
  }
}
项目:intellij-ce-playground    文件:ChangeListViewerDialog.java   
private void initCommitMessageArea(final Project project, final CommittedChangeList changeList) {
  myCommitMessageArea = new JEditorPane(UIUtil.HTML_MIME, "");
  myCommitMessageArea.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
  myCommitMessageArea.setEditable(false);
  @NonNls final String text = IssueLinkHtmlRenderer.formatTextIntoHtml(project, changeList.getComment().trim());
  myCommitMessageArea.setBackground(UIUtil.getComboBoxDisabledBackground());
  myCommitMessageArea.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);
  commitMessageScroll = ScrollPaneFactory.createScrollPane(myCommitMessageArea);
  myCommitMessageArea.setText(text);
  myCommitMessageArea.setCaretPosition(0);
}
项目:intellij-ce-playground    文件:StudyToolWindow.java   
public StudyToolWindow(final Project project) {
  super(true, true);
  JPanel toolbarPanel = createToolbarPanel();
  setToolbar(toolbarPanel);

  final JTextPane taskTextPane = createTaskTextPane();

  VirtualFile[] files = FileEditorManager.getInstance(project).getSelectedFiles();
  TaskFile taskFile = null;
  for (VirtualFile file : files) {
    taskFile = StudyUtils.getTaskFile(project, file);
    if (taskFile != null) {
      break;
    }
  }
  if (taskFile == null) {
    taskTextPane.setText(EMPTY_TASK_TEXT);
    setContent(taskTextPane);
    return;
  }
  final Task task = taskFile.getTask();

  if (task != null) {
    final String taskText = getTaskText(task, task.getTaskDir(project));
    if (taskText == null) {
      return;
    }
    JBScrollPane scrollPane = new JBScrollPane(taskTextPane);
    taskTextPane.setText(taskText);
    taskTextPane.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);

    setContent(scrollPane);

    final FileEditorManagerListener listener = new StudyFileEditorManagerListener(project, taskTextPane);
    project.getMessageBus().connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, listener);
  }
}
项目:intellij-ce-playground    文件:IpnbUtils.java   
public static JEditorPane createLatexPane(@NotNull final String source) {
  final JEditorPane editorPane = new JEditorPane();
  editorPane.setBackground(IpnbEditorUtil.getBackground());
  editorPane.setContentType(new HTMLEditorKit().getContentType());
  editorPane.setEditorKit(new HTMLEditorKit());
  final HTMLDocument document = (HTMLDocument)editorPane.getDocument();
  final StyleSheet sheet = document.getStyleSheet();
  sheet.addRule(ourBodyRule);
  sheet.addRule(ourCodeRule);
  sheet.addRule(ourAlertRule);
  sheet.addRule(ourAlertSuccessRule);
  sheet.addRule(ourAlertErrorRule);

  editorPane.setEditable(false);

  final String html = convertToHtml(source, document);
  editorPane.setText("<html><body>" + html + "</body></html>");

  editorPane.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      final Container parent = editorPane.getParent();
      final MouseEvent parentEvent = SwingUtilities.convertMouseEvent(editorPane, e, parent);
      parent.dispatchEvent(parentEvent);
    }
  });
  editorPane.addHyperlinkListener(new BrowserHyperlinkListener());
  //TODO: jump to the section (see User Interface#Utilities)

  return editorPane;
}
项目:AndroidLocalizationer    文件:MultiSelectDialog.java   
@NotNull
public static JTextPane configureMessagePaneUi(JTextPane messageComponent,
                                               String message,
                                               final boolean addBrowserHyperlinkListener) {
    messageComponent.setFont(UIUtil.getLabelFont());
    if (BasicHTML.isHTMLString(message)) {
        final HTMLEditorKit editorKit = new HTMLEditorKit();
        editorKit.getStyleSheet().addRule(UIUtil.displayPropertiesToCSS(UIUtil.getLabelFont(), UIUtil.getLabelForeground()));
        messageComponent.setEditorKit(editorKit);
        messageComponent.setContentType(UIUtil.HTML_MIME);
        if (addBrowserHyperlinkListener) {
            messageComponent.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);
        }
    }
    messageComponent.setText(message);
    messageComponent.setEditable(false);
    if (messageComponent.getCaret() != null) {
        messageComponent.setCaretPosition(0);
    }

    if (UIUtil.isUnderNimbusLookAndFeel()) {
        messageComponent.setOpaque(false);
        messageComponent.setBackground(UIUtil.TRANSPARENT_COLOR);
    }
    else {
        messageComponent.setBackground(UIUtil.getOptionPaneBackground());
    }

    messageComponent.setForeground(UIUtil.getLabelForeground());
    return messageComponent;
}
项目:tools-idea    文件:NewChannelDialog.java   
@Override
protected JComponent createCenterPanel() {
  JEditorPane pane = new JEditorPane(UIUtil.HTML_MIME, myInformationText);
  pane.addHyperlinkListener(new BrowserHyperlinkListener());
  pane.setEditable(false);
  pane.setBackground(UIUtil.getLabelBackground());
  JBScrollPane scrollPane = new JBScrollPane(pane);
  scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
  return scrollPane;
}
项目:tools-idea    文件:UpdateInfoDialog.java   
public UpdateInfoPanel() {
  ApplicationInfo appInfo = ApplicationInfo.getInstance();
  myBuildNumber.setText(appInfo.getBuild().asStringWithoutProductCode() + ")");
  final String version = appInfo.getFullVersion();

  myVersionNumber.setText(version);
  myNewBuildNumber.setText(myLatestBuild.getNumber().asStringWithoutProductCode() + ")");
  myNewVersionNumber.setText(myLatestBuild.getVersion());
  myUpdateMessageLabel.setBackground(UIUtil.getLabelBackground());
  myScrollPane.setBackground(UIUtil.getLabelBackground());
  myScrollPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
  if (myLatestBuild.getMessage() != null) {
    StringBuilder builder = new StringBuilder();
    builder.append("<html><head>").append(UIUtil.getCssFontDeclaration(UIUtil.getLabelFont())).append("</head><body>")
      .append(StringUtil.formatLinks(myLatestBuild.getMessage()))
      .append("</body></html>");
    myUpdateMessageLabel.setText(builder.toString());
    myUpdateMessageLabel.addHyperlinkListener(new BrowserHyperlinkListener());
  }
  else {
    myUpdateMessageLabel.setVisible(false);
  }

  PatchInfo patch = myLatestBuild.findPatchForCurrentBuild();
  if (patch == null) {
    myPatchAvailableLabel.setVisible(false);
    myPatchSizeLabel.setVisible(false);
  }
  else {
    myPatchSizeLabel.setText(patch.getSize() + "MB");
  }

  if (SystemInfo.isMac) {
    myManualCheckLabel.setText("<html><br>To check for new updates manually, use the <b>" +
                               ApplicationNamesInfo.getInstance().getProductName() + " | Check for Updates</b> command.</html>");
  }

  LabelTextReplacingUtil.replaceText(myPanel);
}
项目:tools-idea    文件:ChangeListViewerDialog.java   
private void initCommitMessageArea(final Project project, final CommittedChangeList changeList) {
  myCommitMessageArea = new JEditorPane(UIUtil.HTML_MIME, "");
  myCommitMessageArea.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
  myCommitMessageArea.setEditable(false);
  @NonNls final String text = IssueLinkHtmlRenderer.formatTextIntoHtml(project, changeList.getComment().trim());
  myCommitMessageArea.setBackground(UIUtil.getComboBoxDisabledBackground());
  myCommitMessageArea.addHyperlinkListener(new BrowserHyperlinkListener());
  commitMessageScroll = ScrollPaneFactory.createScrollPane(myCommitMessageArea);
  myCommitMessageArea.setText(text);
  myCommitMessageArea.setCaretPosition(0);
}
项目:consulo    文件:ChangeListViewerDialog.java   
private void initCommitMessageArea(final Project project, final CommittedChangeList changeList) {
  myCommitMessageArea = new JEditorPane(UIUtil.HTML_MIME, "");
  myCommitMessageArea.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
  myCommitMessageArea.setEditable(false);
  @NonNls final String text = IssueLinkHtmlRenderer.formatTextIntoHtml(project, changeList.getComment().trim());
  myCommitMessageArea.setBackground(UIUtil.getComboBoxDisabledBackground());
  myCommitMessageArea.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);
  commitMessageScroll = ScrollPaneFactory.createScrollPane(myCommitMessageArea);
  myCommitMessageArea.setText(text);
  myCommitMessageArea.setCaretPosition(0);
}
项目:intellij-ce-playground    文件:UpdateInfoDialog.java   
public UpdateInfoPanel() {
  ApplicationInfo appInfo = ApplicationInfo.getInstance();
  ApplicationNamesInfo appNames = ApplicationNamesInfo.getInstance();

  String message = myLatestBuild.getMessage();
  final String fullProductName = appNames.getFullProductName();
  if (message == null) {
    message = IdeBundle.message("updates.new.version.available", fullProductName);
  }
  final String homePageUrl = myUpdatedChannel.getHomePageUrl();
  if (!StringUtil.isEmptyOrSpaces(homePageUrl)) {
    final int idx = message.indexOf(fullProductName);
    if (idx >= 0) {
      message = message.substring(0, idx) + 
                "<a href=\'" + homePageUrl + "\'>" + fullProductName + "</a>" + message.substring(idx + fullProductName.length());
    }
  }
  configureMessageArea(myUpdateMessage, message, null, BrowserHyperlinkListener.INSTANCE);

  myCurrentVersion.setText(
    formatVersion(
      appInfo.getFullVersion() + (appInfo instanceof ApplicationInfoEx && ((ApplicationInfoEx)appInfo).isEAP() ? " EAP": ""),
      appInfo.getBuild().asStringWithoutProductCode()
    )
  );
  myNewVersion.setText(formatVersion(myLatestBuild.getVersion(), myLatestBuild.getNumber().asStringWithoutProductCode()));

  if (myPatch != null && !StringUtil.isEmptyOrSpaces(myPatch.getSize())) {
    myPatchInfo.setText(myPatch.getSize() + " MB");
  }
  else {
    myPatchLabel.setVisible(false);
    myPatchInfo.setVisible(false);
  }

  if (myWriteProtected) {
    message = IdeBundle.message("updates.write.protected", appNames.getProductName(), PathManager.getHomePath());
    configureMessageArea(myMessageArea, message, JBColor.RED, null);
  }
  else {
    configureMessageArea(myMessageArea);
  }

  if (myLicenseInfo != null) {
    configureMessageArea(myLicenseArea, myLicenseInfo, myPaidUpgrade ? JBColor.RED : null, null);
  }
}
项目:intellij-ce-playground    文件:ChangeListDetailsAction.java   
public static void showDetailsPopup(final Project project, final CommittedChangeList changeList) {
  StringBuilder detailsBuilder = new StringBuilder("<html><head>");
  detailsBuilder.append(UIUtil.getCssFontDeclaration(UIUtil.getLabelFont())).append("</head><body>");
  final AbstractVcs vcs = changeList.getVcs();
  CachingCommittedChangesProvider provider = null;
  if (vcs != null) {
    provider = vcs.getCachingCommittedChangesProvider();
    if (provider != null && provider.getChangelistTitle() != null) {
      detailsBuilder.append(provider.getChangelistTitle()).append(" #").append(changeList.getNumber()).append("<br>");
    }
  }
  @NonNls String committer = "<b>" + changeList.getCommitterName() + "</b>";
  detailsBuilder.append(VcsBundle.message("changelist.details.committed.format", committer,
                                          DateFormatUtil.formatPrettyDateTime(changeList.getCommitDate())));
  detailsBuilder.append("<br>");

  if (provider != null) {
    final CommittedChangeList originalChangeList = ReceivedChangeList.unwrap(changeList);
    for(ChangeListColumn column: provider.getColumns()) {
      if (ChangeListColumn.isCustom(column)) {
        String value = column.getValue(originalChangeList).toString();
        if (value.length() == 0) {
          value = "<none>";
        }
        detailsBuilder.append(column.getTitle()).append(": ").append(XmlStringUtil.escapeString(value)).append("<br>");
      }
    }
  }

  detailsBuilder.append(IssueLinkHtmlRenderer.formatTextWithLinks(project, changeList.getComment()));
  detailsBuilder.append("</body></html>");

  JEditorPane editorPane = new JEditorPane(UIUtil.HTML_MIME, detailsBuilder.toString());
  editorPane.setEditable(false);
  editorPane.setBackground(HintUtil.INFORMATION_COLOR);
  editorPane.select(0, 0);
  editorPane.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);
  JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(editorPane);
  final JBPopup hint =
    JBPopupFactory.getInstance().createComponentPopupBuilder(scrollPane, editorPane)
      .setDimensionServiceKey(project, "changelist.details.popup", false)
      .setResizable(true)
      .setMovable(true)
      .setRequestFocus(true)
      .setTitle(VcsBundle.message("changelist.details.title"))
      .createPopup();
  hint.showInBestPositionFor(DataManager.getInstance().getDataContext());
}
项目:intellij    文件:WithBrowserHyperlinkExecutionException.java   
@Override
public final void hyperlinkUpdate(HyperlinkEvent e) {
  if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
    BrowserHyperlinkListener.INSTANCE.hyperlinkUpdate(e);
  }
}
项目:tools-idea    文件:ChangeListDetailsAction.java   
public static void showDetailsPopup(final Project project, final CommittedChangeList changeList) {
  StringBuilder detailsBuilder = new StringBuilder("<html><head>");
  detailsBuilder.append(UIUtil.getCssFontDeclaration(UIUtil.getLabelFont())).append("</head><body>");
  final AbstractVcs vcs = changeList.getVcs();
  CachingCommittedChangesProvider provider = null;
  if (vcs != null) {
    provider = vcs.getCachingCommittedChangesProvider();
    if (provider != null && provider.getChangelistTitle() != null) {
      detailsBuilder.append(provider.getChangelistTitle()).append(" #").append(changeList.getNumber()).append("<br>");
    }
  }
  @NonNls String committer = "<b>" + changeList.getCommitterName() + "</b>";
  detailsBuilder.append(VcsBundle.message("changelist.details.committed.format", committer,
                                          DateFormatUtil.formatPrettyDateTime(changeList.getCommitDate())));
  detailsBuilder.append("<br>");

  if (provider != null) {
    final CommittedChangeList originalChangeList;
    if (changeList instanceof ReceivedChangeList) {
      originalChangeList = ((ReceivedChangeList) changeList).getBaseList();
    }
    else {
      originalChangeList = changeList;
    }
    for(ChangeListColumn column: provider.getColumns()) {
      if (ChangeListColumn.isCustom(column)) {
        String value = column.getValue(originalChangeList).toString();
        if (value.length() == 0) {
          value = "<none>";
        }
        detailsBuilder.append(column.getTitle()).append(": ").append(XmlStringUtil.escapeString(value)).append("<br>");
      }
    }
  }

  detailsBuilder.append(IssueLinkHtmlRenderer.formatTextWithLinks(project, changeList.getComment()));
  detailsBuilder.append("</body></html>");

  JEditorPane editorPane = new JEditorPane(UIUtil.HTML_MIME, detailsBuilder.toString());
  editorPane.setEditable(false);
  editorPane.setBackground(HintUtil.INFORMATION_COLOR);
  editorPane.select(0, 0);
  editorPane.addHyperlinkListener(new BrowserHyperlinkListener());
  JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(editorPane);
  final JBPopup hint =
    JBPopupFactory.getInstance().createComponentPopupBuilder(scrollPane, editorPane)
      .setDimensionServiceKey(project, "changelist.details.popup", false)
      .setResizable(true)
      .setMovable(true)
      .setRequestFocus(true)
      .setTitle(VcsBundle.message("changelist.details.title"))
      .createPopup();
  hint.showInBestPositionFor(DataManager.getInstance().getDataContext());
}
项目:tools-idea    文件:GitLogDetailsPanel.java   
public GitLogDetailsPanel(final Project myProject,
                          final DetailsCache detailsCache,
                          final Convertor<VirtualFile, CachedRefs> refsProvider,
                          Processor<AbstractHash> markProcessor) {
  myRefsProvider = refsProvider;
  myMarkProcessor = markProcessor;
  myPanel = new JPanel(new CardLayout());
  myPanel.add(UIVcsUtil.errorPanel("Nothing selected", false), NOTHING_SELECTED);
  myPanel.add(UIVcsUtil.errorPanel("Loading...", false), LOADING);
  myPanel.add(UIVcsUtil.errorPanel("Several commits selected", false), MULTIPLE_SELECTED);

  myHtmlHighlighter = new HtmlHighlighter();
  myPresentationData = new MyPresentationData(myProject, detailsCache, myHtmlHighlighter);

  final JPanel wrapper = new JPanel(new GridBagLayout());
  final GridBagConstraints gb = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
                           new Insets(1, 1, 1, 1), 0, 0);

  myJEditorPane = new JEditorPane(UIUtil.HTML_MIME, "");
  myJEditorPane.setPreferredSize(new Dimension(150, 100));
  myJEditorPane.setEditable(false);
  myJEditorPane.setBackground(UIUtil.getComboBoxDisabledBackground());
  myJEditorPane.addHyperlinkListener(new BrowserHyperlinkListener() {
    @Override
    protected void hyperlinkActivated(HyperlinkEvent e) {
      if (CONFIGURE_BRANCHES.equals(e.getDescription())) {
        if (myRoot == null) return;
        final CachedRefs symbolicRefs = refsProvider.convert(myRoot);
        if (symbolicRefs == null) return;
        final TreeSet<String> localBranches = symbolicRefs.getLocalBranches();
        if (localBranches == null || localBranches.isEmpty()) {
          VcsBalloonProblemNotifier.showOverChangesView(myProject, "Branches is not loaded yet", MessageType.WARNING);
          return;
        }
        final ContainedInBranchesConfigDialog dialog =
          new ContainedInBranchesConfigDialog(myProject, localBranches, symbolicRefs.getRemoteBranches(),
                                              symbolicRefs.getCurrentName(), symbolicRefs.getTrackedRemoteName());
        dialog.show();
        if (dialog.isChanged()) {
          //detailsCache.clearBranches();
          myPresentationData.branchesPresentation();
          changeDetailsText();
        }
        return;
      }
      super.hyperlinkActivated(e);
    }
  });

  myMarksPanel = new JPanel();
  final BoxLayout boxLayout = new BoxLayout(myMarksPanel, BoxLayout.X_AXIS);
  myMarksPanel.setLayout(boxLayout);
  gb.weightx = 1;
  wrapper.add(myMarksPanel, gb);
  ++ gb.gridy;
  gb.weighty = 1;
  gb.fill = GridBagConstraints.BOTH;
  final JBScrollPane tableScroll = new JBScrollPane(myJEditorPane);
  tableScroll.setBorder(null);
  myJEditorPane.setBorder(null);
  wrapper.add(tableScroll, gb);
  myJEditorPane.setBackground(UIUtil.getTableBackground());
  myMarksPanel.setBackground(UIUtil.getTableBackground());
  wrapper.setBackground(UIUtil.getTableBackground());

  myPanel.add(wrapper, DATA);
  ((CardLayout) myPanel.getLayout()).show(myPanel, NOTHING_SELECTED);
}
项目:consulo    文件:ChangeListDetailsAction.java   
public static void showDetailsPopup(final Project project, final CommittedChangeList changeList) {
  StringBuilder detailsBuilder = new StringBuilder("<html><head>");
  detailsBuilder.append(UIUtil.getCssFontDeclaration(UIUtil.getLabelFont())).append("</head><body>");
  final AbstractVcs vcs = changeList.getVcs();
  CachingCommittedChangesProvider provider = null;
  if (vcs != null) {
    provider = vcs.getCachingCommittedChangesProvider();
    if (provider != null && provider.getChangelistTitle() != null) {
      detailsBuilder.append(provider.getChangelistTitle()).append(" #").append(changeList.getNumber()).append("<br>");
    }
  }
  @NonNls String committer = "<b>" + changeList.getCommitterName() + "</b>";
  detailsBuilder.append(VcsBundle.message("changelist.details.committed.format", committer,
                                          DateFormatUtil.formatPrettyDateTime(changeList.getCommitDate())));
  detailsBuilder.append("<br>");

  if (provider != null) {
    final CommittedChangeList originalChangeList;
    if (changeList instanceof ReceivedChangeList) {
      originalChangeList = ((ReceivedChangeList) changeList).getBaseList();
    }
    else {
      originalChangeList = changeList;
    }
    for(ChangeListColumn column: provider.getColumns()) {
      if (ChangeListColumn.isCustom(column)) {
        String value = column.getValue(originalChangeList).toString();
        if (value.length() == 0) {
          value = "<none>";
        }
        detailsBuilder.append(column.getTitle()).append(": ").append(XmlStringUtil.escapeString(value)).append("<br>");
      }
    }
  }

  detailsBuilder.append(IssueLinkHtmlRenderer.formatTextWithLinks(project, changeList.getComment()));
  detailsBuilder.append("</body></html>");

  JEditorPane editorPane = new JEditorPane(UIUtil.HTML_MIME, detailsBuilder.toString());
  editorPane.setEditable(false);
  editorPane.setBackground(HintUtil.INFORMATION_COLOR);
  editorPane.select(0, 0);
  editorPane.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);
  JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(editorPane);
  final JBPopup hint =
    JBPopupFactory.getInstance().createComponentPopupBuilder(scrollPane, editorPane)
      .setDimensionServiceKey(project, "changelist.details.popup", false)
      .setResizable(true)
      .setMovable(true)
      .setRequestFocus(true)
      .setTitle(VcsBundle.message("changelist.details.title"))
      .createPopup();
  hint.showInBestPositionFor(DataManager.getInstance().getDataContext());
}
项目:consulo    文件:HtmlPanel.java   
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
  BrowserHyperlinkListener.INSTANCE.hyperlinkUpdate(e);
}