Search in sources :

Example 6 with LabeledComponent

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

the class DependsOnGroupsInspection method createOptionsPanel.

@Override
@Nullable
public JComponent createOptionsPanel() {
    final LabeledComponent<JTextField> definedGroups = new LabeledComponent<>();
    definedGroups.setText("&Defined Groups");
    final JTextField textField = new JTextField(StringUtil.join(ArrayUtil.toStringArray(groups), ","));
    textField.getDocument().addDocumentListener(new DocumentAdapter() {

        @Override
        protected void textChanged(final DocumentEvent e) {
            groups.clear();
            String text = textField.getText();
            if (!StringUtil.isEmptyOrSpaces(text)) {
                ContainerUtil.addAll(groups, text.split("[, ]"));
            }
        }
    });
    definedGroups.setComponent(textField);
    final JPanel optionsPanel = new JPanel(new BorderLayout());
    optionsPanel.add(definedGroups, BorderLayout.NORTH);
    return optionsPanel;
}
Also used : DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent) LabeledComponent(com.intellij.openapi.ui.LabeledComponent) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

LabeledComponent (com.intellij.openapi.ui.LabeledComponent)6 DocumentAdapter (com.intellij.ui.DocumentAdapter)2 DocumentEvent (javax.swing.event.DocumentEvent)2 Nullable (org.jetbrains.annotations.Nullable)2 ApplicationConfigurable (com.intellij.execution.application.ApplicationConfigurable)1 JUnitConfigurable (com.intellij.execution.junit2.configuration.JUnitConfigurable)1 IdeView (com.intellij.ide.IdeView)1 PackageChooserDialog (com.intellij.ide.util.PackageChooserDialog)1 ChangeCounter (com.intellij.openapi.diff.impl.incrementalMerge.ChangeCounter)1 MergeRequestImpl (com.intellij.openapi.diff.impl.mergeTool.MergeRequestImpl)1 DiffDividerPaint (com.intellij.openapi.diff.impl.splitter.DiffDividerPaint)1 Document (com.intellij.openapi.editor.Document)1 Configurable (com.intellij.openapi.options.Configurable)1 Project (com.intellij.openapi.project.Project)1 DialogWrapper (com.intellij.openapi.ui.DialogWrapper)1 ValidationInfo (com.intellij.openapi.ui.ValidationInfo)1 EditorTextField (com.intellij.ui.EditorTextField)1 EditorTextFieldWithBrowseButton (com.intellij.ui.EditorTextFieldWithBrowseButton)1 ToolbarDecorator (com.intellij.ui.ToolbarDecorator)1 Convertor (com.intellij.util.containers.Convertor)1