Search in sources :

Example 1 with LinkLabel

use of com.intellij.ui.components.labels.LinkLabel in project intellij-community by JetBrains.

the class InfoAndProgressPanel method buildInProcessCount.

private void buildInProcessCount() {
    removeAll();
    setLayout(new BorderLayout());
    final JPanel progressCountPanel = new JPanel(new BorderLayout(0, 0));
    progressCountPanel.setOpaque(false);
    String processWord = myOriginals.size() == 1 ? " process" : " processes";
    final LinkLabel label = new LinkLabel(myOriginals.size() + processWord + " running...", null, new LinkListener() {

        @Override
        public void linkSelected(final LinkLabel aSource, final Object aLinkData) {
            triggerPopupShowing();
        }
    });
    if (SystemInfo.isMac)
        label.setFont(JBUI.Fonts.label(11));
    label.setOpaque(false);
    final Wrapper labelComp = new Wrapper(label);
    labelComp.setOpaque(false);
    progressCountPanel.add(labelComp, BorderLayout.CENTER);
    //myProgressIcon.setBorder(new IdeStatusBarImpl.MacStatusBarWidgetBorder());
    progressCountPanel.add(myProgressIcon, BorderLayout.WEST);
    add(myRefreshAndInfoPanel, BorderLayout.CENTER);
    progressCountPanel.setBorder(JBUI.Borders.emptyRight(4));
    add(progressCountPanel, BorderLayout.EAST);
    revalidate();
    repaint();
}
Also used : Wrapper(com.intellij.ui.components.panels.Wrapper) TabbedPaneWrapper(com.intellij.ui.TabbedPaneWrapper) LinkListener(com.intellij.ui.components.labels.LinkListener) LinkLabel(com.intellij.ui.components.labels.LinkLabel)

Example 2 with LinkLabel

use of com.intellij.ui.components.labels.LinkLabel in project intellij-community by JetBrains.

the class PackageChooserDialog method setupPathComponent.

private void setupPathComponent(final JPanel northPanel) {
    northPanel.add(new TextFieldAction() {

        @Override
        public void linkSelected(LinkLabel aSource, Object aLinkData) {
            toggleShowPathComponent(northPanel, this);
        }
    }, BorderLayout.EAST);
    myPathEditor = new EditorTextField(JavaReferenceEditorUtil.createDocument("", myProject, false), myProject, StdFileTypes.JAVA);
    myPathEditor.addDocumentListener(new DocumentAdapter() {

        @Override
        public void documentChanged(DocumentEvent e) {
            myAlarm.cancelAllRequests();
            myAlarm.addRequest(() -> updateTreeFromPath(), 300);
        }
    });
    myPathEditor.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 0));
    northPanel.add(myPathEditor, BorderLayout.SOUTH);
}
Also used : TextFieldAction(com.intellij.openapi.fileChooser.ex.TextFieldAction) EditorTextField(com.intellij.ui.EditorTextField) LinkLabel(com.intellij.ui.components.labels.LinkLabel) DocumentAdapter(com.intellij.openapi.editor.event.DocumentAdapter) DocumentEvent(com.intellij.openapi.editor.event.DocumentEvent)

Example 3 with LinkLabel

use of com.intellij.ui.components.labels.LinkLabel in project intellij-community by JetBrains.

the class NotificationsManagerImpl method createMergeAction.

private static void createMergeAction(@NotNull final BalloonLayoutData layoutData, @NotNull JPanel panel) {
    StringBuilder title = new StringBuilder().append(layoutData.mergeData.count).append(" more");
    String shortTitle = NotificationParentGroup.getShortTitle(layoutData.groupId);
    if (shortTitle != null) {
        title.append(" from ").append(shortTitle);
    }
    LinkLabel<BalloonLayoutData> action = new LinkLabel<BalloonLayoutData>(title.toString(), null, new LinkListener<BalloonLayoutData>() {

        @Override
        public void linkSelected(LinkLabel aSource, BalloonLayoutData layoutData) {
            EventLog.showNotification(layoutData.project, layoutData.groupId, layoutData.getMergeIds());
        }
    }, layoutData) {

        @Override
        protected boolean isInClickableArea(Point pt) {
            return true;
        }

        @Override
        protected Color getTextColor() {
            return new JBColor(0x666666, 0x8C8C8C);
        }
    };
    action.setFont(FontUtil.minusOne(action.getFont()));
    action.setHorizontalAlignment(SwingConstants.CENTER);
    action.setPaintUnderline(false);
    AbstractLayoutManager layout = new AbstractLayoutManager() {

        @Override
        public Dimension preferredLayoutSize(Container parent) {
            return new Dimension(parent.getWidth(), JBUI.scale(20) + 2);
        }

        @Override
        public void layoutContainer(Container parent) {
            parent.getComponent(0).setBounds(2, 1, parent.getWidth() - 4, JBUI.scale(20));
        }
    };
    JPanel mergePanel = new NonOpaquePanel(layout) {

        @Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.setColor(new JBColor(0xE3E3E3, 0x3A3C3D));
            ((Graphics2D) g).fill(new Rectangle2D.Double(1.5, 1, getWidth() - 2.5, getHeight() - 2));
            g.setColor(new JBColor(0xDBDBDB, 0x353738));
            if (SystemInfo.isMac) {
                ((Graphics2D) g).draw(new Rectangle2D.Double(2, 0, getWidth() - 3.5, 0.5));
            } else if (SystemInfo.isWindows) {
                ((Graphics2D) g).draw(new Rectangle2D.Double(1.5, 0, getWidth() - 3, 0.5));
            } else {
                ((Graphics2D) g).draw(new Rectangle2D.Double(1.5, 0, getWidth() - 2.5, 0.5));
            }
        }
    };
    mergePanel.add(action);
    panel.add(BorderLayout.SOUTH, mergePanel);
}
Also used : AbstractLayoutManager(com.intellij.util.ui.AbstractLayoutManager) Rectangle2D(java.awt.geom.Rectangle2D) NonOpaquePanel(com.intellij.ui.components.panels.NonOpaquePanel) LinkLabel(com.intellij.ui.components.labels.LinkLabel)

Example 4 with LinkLabel

use of com.intellij.ui.components.labels.LinkLabel in project intellij-community by JetBrains.

the class ConfigurableEditor method createDefaultContent.

private JComponent createDefaultContent(Configurable configurable) {
    JComponent content = new JPanel(new BorderLayout());
    content.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    String key = configurable == null ? null : ConfigurableVisitor.ByID.getID(configurable) + ".settings.description";
    String description = key == null ? null : getString(configurable, key);
    if (description == null) {
        description = "Select configuration element in the tree to edit its settings";
        content.add(BorderLayout.CENTER, new JLabel(description, SwingConstants.CENTER));
        content.setPreferredSize(JBUI.size(800, 600));
    } else {
        content.add(BorderLayout.NORTH, new JLabel(description));
        if (configurable instanceof Configurable.Composite) {
            Configurable.Composite composite = (Configurable.Composite) configurable;
            JPanel panel = new JPanel();
            panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
            content.add(BorderLayout.CENTER, panel);
            panel.add(Box.createVerticalStrut(10));
            for (Configurable current : composite.getConfigurables()) {
                LinkLabel label = LinkLabel.create(current.getDisplayName(), () -> openLink(current));
                label.setBorder(BorderFactory.createEmptyBorder(1, 17, 3, 1));
                panel.add(label);
            }
        }
    }
    return content;
}
Also used : LinkLabel(com.intellij.ui.components.labels.LinkLabel) Configurable(com.intellij.openapi.options.Configurable) BaseConfigurable(com.intellij.openapi.options.BaseConfigurable)

Example 5 with LinkLabel

use of com.intellij.ui.components.labels.LinkLabel in project intellij-community by JetBrains.

the class InspectionViewNavigationPanel method resetChildrenNavigation.

private void resetChildrenNavigation() {
    final int currentChildrenCount = myNode.getChildCount();
    if (myShownChildrenCount != currentChildrenCount) {
        myLinks.removeAll();
        myLinks.add(Box.createVerticalStrut(JBUI.scale(10)));
        for (int i = 0; i < currentChildrenCount; i++) {
            final TreeNode child = myNode.getChildAt(i);
            final LinkLabel link = new LinkLabel(child.toString(), null) {

                @Override
                public void doClick() {
                    TreeUtil.selectInTree((DefaultMutableTreeNode) child, true, myTree);
                }
            };
            link.setBorder(IdeBorderFactory.createEmptyBorder(1, 17, 3, 1));
            myLinks.add(link);
        }
        myShownChildrenCount = currentChildrenCount;
    }
}
Also used : TreeNode(javax.swing.tree.TreeNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) LinkLabel(com.intellij.ui.components.labels.LinkLabel)

Aggregations

LinkLabel (com.intellij.ui.components.labels.LinkLabel)14 LinkListener (com.intellij.ui.components.labels.LinkListener)6 EmptyBorder (javax.swing.border.EmptyBorder)4 NonOpaquePanel (com.intellij.ui.components.panels.NonOpaquePanel)3 NotNull (org.jetbrains.annotations.NotNull)2 CommonBundle.getCancelButtonText (com.intellij.CommonBundle.getCancelButtonText)1 IdeBundle (com.intellij.ide.IdeBundle)1 IdeaPluginDescriptor (com.intellij.ide.plugins.IdeaPluginDescriptor)1 com.intellij.ide.todo (com.intellij.ide.todo)1 ActionManager (com.intellij.openapi.actionSystem.ActionManager)1 ActionPlaces (com.intellij.openapi.actionSystem.ActionPlaces)1 ActionPopupMenu (com.intellij.openapi.actionSystem.ActionPopupMenu)1 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)1 ApplicationActivationListener (com.intellij.openapi.application.ApplicationActivationListener)1 ApplicationManager (com.intellij.openapi.application.ApplicationManager)1 ApplicationNamesInfo (com.intellij.openapi.application.ApplicationNamesInfo)1 ModalityState (com.intellij.openapi.application.ModalityState)1 ServiceManager (com.intellij.openapi.components.ServiceManager)1 DocumentAdapter (com.intellij.openapi.editor.event.DocumentAdapter)1 DocumentEvent (com.intellij.openapi.editor.event.DocumentEvent)1