Search in sources :

Example 1 with JBLabel

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

the class GoMultiplePackagesQuickFix method invoke.

@Override
public void invoke(@NotNull Project project, @NotNull PsiFile file, @Nullable("is null when called from inspection") Editor editor, @NotNull PsiElement startElement, @NotNull PsiElement endElement) {
    if (editor == null || myTestingPackageName != null) {
        renamePackagesInDirectory(project, file.getContainingDirectory(), myTestingPackageName != null ? myTestingPackageName : myPackageName);
        return;
    }
    JBList list = new JBList(myPackages);
    list.installCellRenderer(o -> {
        JBLabel label = new JBLabel(o.toString());
        label.setBorder(IdeBorderFactory.createEmptyBorder(2, 4, 2, 4));
        return label;
    });
    JBPopupFactory.getInstance().createListPopupBuilder(list).setTitle("Choose package name").setItemChoosenCallback(() -> {
        String name = (String) list.getSelectedValue();
        if (name != null) {
            renamePackagesInDirectory(project, file.getContainingDirectory(), name);
        }
    }).createPopup().showInBestPositionFor(editor);
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) JBList(com.intellij.ui.components.JBList)

Example 2 with JBLabel

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

the class GoSdkConfigurable method createUIComponents.

private void createUIComponents() {
    myVersionLabel = new JBLabel();
    myDefaultLabelColor = myVersionLabel.getForeground();
    myVersionPanel = new JPanel(new JBCardLayout());
    JPanel gettingVersionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
    AsyncProcessIcon gettingVersionIcon = new AsyncProcessIcon("Getting Go version");
    gettingVersionPanel.add(gettingVersionIcon);
    gettingVersionPanel.add(new JLabel("Getting..."));
    myVersionPanel.add(gettingVersionPanel, VERSION_GETTING);
    myVersionPanel.add(myVersionLabel, VERSION_RESULT);
    setVersion(null);
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) AsyncProcessIcon(com.intellij.util.ui.AsyncProcessIcon) JBCardLayout(com.intellij.ui.JBCardLayout)

Example 3 with JBLabel

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

the class HgBookmarkDialog method createCenterPanel.

@Override
@NotNull
protected JComponent createCenterPanel() {
    JPanel contentPanel = new JPanel(new GridBagLayout());
    GridBag g = new GridBag().setDefaultInsets(new Insets(0, 0, DEFAULT_VGAP, DEFAULT_HGAP)).setDefaultAnchor(GridBagConstraints.LINE_START).setDefaultFill(GridBagConstraints.HORIZONTAL);
    JLabel icon = new JLabel(UIUtil.getQuestionIcon(), SwingConstants.LEFT);
    myBookmarkName = new JBTextField(13);
    myBookmarkName.getDocument().addDocumentListener(new DocumentAdapter() {

        @Override
        public void textChanged(DocumentEvent e) {
            validateFields();
        }
    });
    JBLabel bookmarkLabel = new JBLabel("Bookmark name:");
    bookmarkLabel.setLabelFor(myBookmarkName);
    myActiveCheckbox = new JBCheckBox("Inactive", false);
    contentPanel.add(icon, g.nextLine().next().coverColumn(3).pady(DEFAULT_HGAP));
    contentPanel.add(bookmarkLabel, g.next().fillCellNone().insets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)));
    contentPanel.add(myBookmarkName, g.next().coverLine().setDefaultWeightX(1));
    contentPanel.add(myActiveCheckbox, g.nextLine().next().next().coverLine(2));
    return contentPanel;
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) DocumentAdapter(com.intellij.ui.DocumentAdapter) JBTextField(com.intellij.ui.components.JBTextField) GridBag(com.intellij.util.ui.GridBag) DocumentEvent(javax.swing.event.DocumentEvent) JBCheckBox(com.intellij.ui.components.JBCheckBox) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with JBLabel

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

the class DesignerEditorPanel method addErrorMessage.

protected void addErrorMessage(final FixableMessageInfo message, Icon icon) {
    if (message.myLinkText.length() > 0 || message.myAfterLinkText.length() > 0) {
        HyperlinkLabel warnLabel = new HyperlinkLabel();
        warnLabel.setOpaque(false);
        warnLabel.setHyperlinkText(message.myBeforeLinkText, message.myLinkText, message.myAfterLinkText);
        warnLabel.setIcon(icon);
        if (message.myQuickFix != null) {
            warnLabel.addHyperlinkListener(new HyperlinkListener() {

                public void hyperlinkUpdate(final HyperlinkEvent e) {
                    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                        message.myQuickFix.run();
                    }
                }
            });
        }
        myErrorMessages.add(warnLabel);
    } else {
        JBLabel warnLabel = new JBLabel();
        warnLabel.setOpaque(false);
        warnLabel.setText("<html><body>" + message.myBeforeLinkText.replace("\n", "<br>") + "</body></html>");
        warnLabel.setIcon(icon);
        myErrorMessages.add(warnLabel);
    }
    if (message.myAdditionalFixes != null && message.myAdditionalFixes.size() > 0) {
        JPanel fixesPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
        fixesPanel.setBorder(IdeBorderFactory.createEmptyBorder(3, 0, 10, 0));
        fixesPanel.setOpaque(false);
        fixesPanel.add(Box.createHorizontalStrut(icon.getIconWidth()));
        for (Pair<String, Runnable> pair : message.myAdditionalFixes) {
            HyperlinkLabel fixLabel = new HyperlinkLabel();
            fixLabel.setOpaque(false);
            fixLabel.setHyperlinkText(pair.getFirst());
            final Runnable fix = pair.getSecond();
            fixLabel.addHyperlinkListener(new HyperlinkListener() {

                @Override
                public void hyperlinkUpdate(HyperlinkEvent e) {
                    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                        fix.run();
                    }
                }
            });
            fixesPanel.add(fixLabel);
        }
        myErrorMessages.add(fixesPanel);
    }
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout) HyperlinkListener(javax.swing.event.HyperlinkListener) JBLabel(com.intellij.ui.components.JBLabel) ThrowableRunnable(com.intellij.util.ThrowableRunnable) HyperlinkLabel(com.intellij.ui.HyperlinkLabel)

Example 5 with JBLabel

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

the class PyDebuggerConfigurable method createUIComponents.

private void createUIComponents() {
    warningIcon = new JBLabel(AllIcons.General.BalloonWarning);
    IdeTooltipManager.getInstance().setCustomTooltip(warningIcon, new TooltipWithClickableLinks.ForBrowser(warningIcon, DEBUGGER_WARNING_MESSAGE));
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) TooltipWithClickableLinks(com.intellij.ui.TooltipWithClickableLinks)

Aggregations

JBLabel (com.intellij.ui.components.JBLabel)98 Nullable (org.jetbrains.annotations.Nullable)23 NotNull (org.jetbrains.annotations.NotNull)11 JBCheckBox (com.intellij.ui.components.JBCheckBox)10 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)9 VirtualFile (com.intellij.openapi.vfs.VirtualFile)8 ComboBox (com.intellij.openapi.ui.ComboBox)7 VerticalFlowLayout (com.intellij.openapi.ui.VerticalFlowLayout)7 GridBag (com.intellij.util.ui.GridBag)7 List (java.util.List)7 JBList (com.intellij.ui.components.JBList)6 JBTable (com.intellij.ui.table.JBTable)6 JBTextField (com.intellij.ui.components.JBTextField)5 DocumentEvent (javax.swing.event.DocumentEvent)5 DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)4 Project (com.intellij.openapi.project.Project)4 TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)4 StringUtil (com.intellij.openapi.util.text.StringUtil)4 java.awt (java.awt)4 ArrayList (java.util.ArrayList)4