Search in sources :

Example 1 with BrowserHyperlinkListener

use of com.intellij.ui.BrowserHyperlinkListener in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoUIUtil method createDescriptionPane.

@NotNull
public static JTextPane createDescriptionPane() {
    JTextPane result = new JTextPane();
    result.addHyperlinkListener(new BrowserHyperlinkListener());
    result.setContentType("text/html");
    Font descriptionFont = UIUtil.getLabelFont(UIUtil.FontSize.SMALL);
    HTMLEditorKit editorKit = UIUtil.getHTMLEditorKit();
    editorKit.getStyleSheet().addRule("body, p {" + "color:#" + ColorUtil.toHex(UIUtil.getLabelFontColor(UIUtil.FontColor.BRIGHTER)) + ";" + "font-family:" + descriptionFont.getFamily() + ";" + "font-size:" + descriptionFont.getSize() + "pt;}");
    result.setHighlighter(null);
    result.setEditorKit(editorKit);
    return result;
}
Also used : BrowserHyperlinkListener(com.intellij.ui.BrowserHyperlinkListener) HTMLEditorKit(javax.swing.text.html.HTMLEditorKit) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with BrowserHyperlinkListener

use of com.intellij.ui.BrowserHyperlinkListener in project azure-tools-for-java by Microsoft.

the class ActivityLogToolWindowFactory method registerDeploymentListener.

public void registerDeploymentListener() {
    AzurePlugin.addDeploymentEventListener(new DeploymentEventListener() {

        @Override
        public void onDeploymentStep(final DeploymentEventArgs args) {
            // unique identifier for deployment
            String key = args.getId() + args.getStartTime().getTime();
            if (rows.containsKey(key)) {
                final DeploymentTableItem item = rows.get(key);
                ApplicationManager.getApplication().invokeLater(new Runnable() {

                    @Override
                    public void run() {
                        item.progress = args.getDeployCompleteness();
                        if (args.getDeployMessage().equalsIgnoreCase(message("runStatus"))) {
                            String html = String.format("%s%s%s%s", "  ", "<html><a href=\"" + args.getDeploymentURL() + "\">", message("runStatusVisible"), "</a></html>");
                            item.description = message("runStatusVisible");
                            item.link = args.getDeploymentURL();
                            if (!ToolWindowManager.getInstance(project).getToolWindow(ActivityLogToolWindowFactory.ACTIVITY_LOG_WINDOW).isVisible()) {
                                ToolWindowManager.getInstance(project).notifyByBalloon(ACTIVITY_LOG_WINDOW, MessageType.INFO, html, null, new BrowserHyperlinkListener());
                            }
                        } else {
                            item.description = args.getDeployMessage();
                        }
                        table.getListTableModel().fireTableDataChanged();
                    }
                });
            } else {
                final DeploymentTableItem item = new DeploymentTableItem(args.getId(), args.getDeployMessage(), dateFormat.format(args.getStartTime()), args.getDeployCompleteness());
                rows.put(key, item);
                ApplicationManager.getApplication().invokeLater(new Runnable() {

                    @Override
                    public void run() {
                        table.getListTableModel().addRow(item);
                    }
                });
            }
        }
    });
}
Also used : DeploymentEventArgs(com.microsoft.azuretools.azurecommons.deploy.DeploymentEventArgs) BrowserHyperlinkListener(com.intellij.ui.BrowserHyperlinkListener) DeploymentEventListener(com.microsoft.azuretools.azurecommons.deploy.DeploymentEventListener)

Example 3 with BrowserHyperlinkListener

use of com.intellij.ui.BrowserHyperlinkListener in project intellij-community by JetBrains.

the class FileTemplateConfigurable method createComponent.

@Override
public JComponent createComponent() {
    myMainPanel = new JPanel(new GridBagLayout());
    myNameField = new JTextField();
    myExtensionField = new JTextField();
    mySplitter = new Splitter(true, myProportion);
    myAdjustBox = new JCheckBox(IdeBundle.message("checkbox.reformat.according.to.style"));
    myLiveTemplateBox = new JCheckBox(IdeBundle.message("checkbox.enable.live.templates"));
    myTemplateEditor = createEditor();
    myDescriptionComponent = new JEditorPane(UIUtil.HTML_MIME, EMPTY_HTML);
    myDescriptionComponent.setEditable(false);
    myDescriptionComponent.addHyperlinkListener(new BrowserHyperlinkListener());
    myTopPanel = new JPanel(new GridBagLayout());
    JPanel descriptionPanel = new JPanel(new GridBagLayout());
    descriptionPanel.add(SeparatorFactory.createSeparator(IdeBundle.message("label.description"), null), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, JBUI.insetsBottom(2), 0, 0));
    descriptionPanel.add(ScrollPaneFactory.createScrollPane(myDescriptionComponent), new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, JBUI.insetsTop(2), 0, 0));
    myMainPanel.add(myTopPanel, new GridBagConstraints(0, 0, 4, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, JBUI.emptyInsets(), 0, 0));
    myMainPanel.add(mySplitter, new GridBagConstraints(0, 2, 4, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, JBUI.emptyInsets(), 0, 0));
    mySplitter.setSecondComponent(descriptionPanel);
    setShowInternalMessage(null);
    myNameField.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(@NotNull FocusEvent e) {
            onNameChanged();
        }
    });
    myExtensionField.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(@NotNull FocusEvent e) {
            onNameChanged();
        }
    });
    myMainPanel.setPreferredSize(JBUI.size(400, 300));
    return myMainPanel;
}
Also used : FocusAdapter(java.awt.event.FocusAdapter) Splitter(com.intellij.openapi.ui.Splitter) BrowserHyperlinkListener(com.intellij.ui.BrowserHyperlinkListener) FocusEvent(java.awt.event.FocusEvent)

Aggregations

BrowserHyperlinkListener (com.intellij.ui.BrowserHyperlinkListener)3 Splitter (com.intellij.openapi.ui.Splitter)1 DeploymentEventArgs (com.microsoft.azuretools.azurecommons.deploy.DeploymentEventArgs)1 DeploymentEventListener (com.microsoft.azuretools.azurecommons.deploy.DeploymentEventListener)1 FocusAdapter (java.awt.event.FocusAdapter)1 FocusEvent (java.awt.event.FocusEvent)1 HTMLEditorKit (javax.swing.text.html.HTMLEditorKit)1 NotNull (org.jetbrains.annotations.NotNull)1