本文整理汇总了Java中com.intellij.ui.BrowserHyperlinkListener类的典型用法代码示例。如果您正苦于以下问题:Java BrowserHyperlinkListener类的具体用法?Java BrowserHyperlinkListener怎么用?Java BrowserHyperlinkListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BrowserHyperlinkListener类属于com.intellij.ui包,在下文中一共展示了BrowserHyperlinkListener类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createUIComponents
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
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);
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:18,代码来源:InformationStep.java
示例2: createTaskInfoPanel
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
@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;
}
开发者ID:medvector,项目名称:educational-plugin,代码行数:25,代码来源:StudySwingToolWindow.java
示例3: createUIComponents
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
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);
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:9,代码来源:DiscountImportstep.java
示例4: configureMessagePaneUi
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
@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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:Messages.java
示例5: DataPanel
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
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);
}
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:DetailsPanel.java
示例6: NewChannelPanel
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
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);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:NewChannelDialog.java
示例7: initCommitMessageArea
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ChangeListViewerDialog.java
示例8: StudyToolWindow
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
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);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:StudyToolWindow.java
示例9: createLatexPane
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:IpnbUtils.java
示例10: configureMessagePaneUi
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
@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;
}
开发者ID:westlinkin,项目名称:AndroidLocalizationer,代码行数:32,代码来源:MultiSelectDialog.java
示例11: createCenterPanel
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
@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;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:NewChannelDialog.java
示例12: UpdateInfoPanel
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
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);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:40,代码来源:UpdateInfoDialog.java
示例13: initCommitMessageArea
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
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);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:ChangeListViewerDialog.java
示例14: UpdateInfoPanel
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
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);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:48,代码来源:UpdateInfoDialog.java
示例15: showDetailsPopup
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
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());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:49,代码来源:ChangeListDetailsAction.java
示例16: hyperlinkUpdate
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
@Override
public final void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
BrowserHyperlinkListener.INSTANCE.hyperlinkUpdate(e);
}
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:7,代码来源:WithBrowserHyperlinkExecutionException.java
示例17: showDetailsPopup
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
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());
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:55,代码来源:ChangeListDetailsAction.java
示例18: GitLogDetailsPanel
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
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);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:69,代码来源:GitLogDetailsPanel.java
示例19: showDetailsPopup
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
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());
}
开发者ID:consulo,项目名称:consulo,代码行数:55,代码来源:ChangeListDetailsAction.java
示例20: hyperlinkUpdate
import com.intellij.ui.BrowserHyperlinkListener; //导入依赖的package包/类
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
BrowserHyperlinkListener.INSTANCE.hyperlinkUpdate(e);
}
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:HtmlPanel.java
注:本文中的com.intellij.ui.BrowserHyperlinkListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论