Search in sources :

Example 16 with ComboBox

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

the class StringConcatenationArgumentToLogCallInspection method createOptionsPanel.

@Nullable
@Override
public JComponent createOptionsPanel() {
    final ComboBox comboBox = new ComboBox(new Object[] { InspectionGadgetsBundle.message("all.levels.option"), InspectionGadgetsBundle.message("warn.level.and.lower.option"), InspectionGadgetsBundle.message("info.level.and.lower.option"), InspectionGadgetsBundle.message("debug.level.and.lower.option"), InspectionGadgetsBundle.message("trace.level.option") });
    comboBox.setSelectedIndex(warnLevel);
    comboBox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            warnLevel = comboBox.getSelectedIndex();
        }
    });
    final JPanel panel = new JPanel(new BorderLayout());
    panel.add(FormBuilder.createFormBuilder().addLabeledComponent(InspectionGadgetsBundle.message("warn.on.label"), comboBox).getPanel(), BorderLayout.NORTH);
    return panel;
}
Also used : ActionListener(java.awt.event.ActionListener) ComboBox(com.intellij.openapi.ui.ComboBox) ActionEvent(java.awt.event.ActionEvent) Nullable(org.jetbrains.annotations.Nullable)

Example 17 with ComboBox

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

the class TagPanel method createUIComponents.

private void createUIComponents() {
    myLocalName = new LanguageTextField(RegExpLanguage.INSTANCE, myProject, myOrigInjection.getTagName());
    myNamespace = new ComboBox(200);
}
Also used : ComboBox(com.intellij.openapi.ui.ComboBox) LanguageTextField(com.intellij.ui.LanguageTextField)

Example 18 with ComboBox

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

the class XmlAttributePanel method createUIComponents.

private void createUIComponents() {
    myLanguagePanel = new LanguagePanel(myProject, myOrigInjection);
    myTagPanel = new TagPanel(myProject, myOrigInjection);
    myAdvancedPanel = new AdvancedXmlPanel(myProject, myOrigInjection);
    myLocalName = new LanguageTextField(RegExpLanguage.INSTANCE, myProject, myOrigInjection.getAttributeName());
    myNamespace = new ComboBox(200);
}
Also used : ComboBox(com.intellij.openapi.ui.ComboBox) LanguageTextField(com.intellij.ui.LanguageTextField)

Example 19 with ComboBox

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

the class AntHectorConfigurable method createComponent.

public JComponent createComponent() {
    final JPanel panel = new JPanel(new GridBagLayout());
    panel.setBorder(IdeBorderFactory.createTitledBorder("File Context", false));
    myCombo = new ComboBox();
    myCombo.putClientProperty(CONTEXTS_COMBO_KEY, Boolean.TRUE);
    panel.add(new JLabel("Included into:"), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, JBUI.insets(5, 0), 0, 0));
    panel.add(myCombo, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, JBUI.insets(5, 5, 5, 0), 0, 0));
    final PsiManager psiManager = PsiManager.getInstance(myProject);
    final FileBasedIndex fbi = FileBasedIndex.getInstance();
    final Collection<VirtualFile> antFiles = fbi.getContainingFiles(AntImportsIndex.INDEX_NAME, AntImportsIndex.ANT_FILES_WITH_IMPORTS_KEY, myFileFilter);
    for (VirtualFile file : antFiles) {
        final PsiFile psiFile = psiManager.findFile(file);
        if (!(psiFile instanceof XmlFile)) {
            continue;
        }
        final XmlFile xmlFile = (XmlFile) psiFile;
        if (!xmlFile.equals(myFile) && AntDomFileDescription.isAntFile(xmlFile)) {
            final String path = PathUtil.getLocalPath(file);
            final XmlFile previous = myPathToFileMap.put(path, xmlFile);
            assert previous == null;
        }
    }
    final List<String> paths = new ArrayList<>(myPathToFileMap.keySet());
    Collections.sort(paths, (o1, o2) -> o1.compareTo(o2));
    myCombo.addItem(NONE);
    for (String path : paths) {
        myCombo.addItem(path);
    }
    final AntConfigurationBase antConfig = AntConfigurationBase.getInstance(myProject);
    final XmlFile currentContext = antConfig.getContextFile(myFile);
    if (currentContext != null) {
        final VirtualFile vFile = currentContext.getVirtualFile();
        assert vFile != null;
        final String path = PathUtil.getLocalPath(vFile);
        if (!FileUtil.pathsEqual(path, myLocalPath)) {
            myOriginalContext = path;
        }
    }
    myCombo.setSelectedItem(myOriginalContext);
    return panel;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) XmlFile(com.intellij.psi.xml.XmlFile) ComboBox(com.intellij.openapi.ui.ComboBox) PsiManager(com.intellij.psi.PsiManager) AntConfigurationBase(com.intellij.lang.ant.config.AntConfigurationBase) PsiFile(com.intellij.psi.PsiFile) FileBasedIndex(com.intellij.util.indexing.FileBasedIndex)

Example 20 with ComboBox

use of com.intellij.openapi.ui.ComboBox in project android by JetBrains.

the class ConfigureDeviceOptionsStep method createUIComponents.

private void createUIComponents() {
    myNavigationControlsCombo = new ComboBox(new EnumComboBoxModel<>(Navigation.class)) {

        @Override
        public ListCellRenderer getRenderer() {
            return new ColoredListCellRenderer() {

                @Override
                protected void customizeCellRenderer(@NotNull JList list, Object value, int index, boolean selected, boolean hasFocus) {
                    append(((Navigation) value).getShortDisplayValue());
                }
            };
        }
    };
    myHardwareSkinHelpLabel = new HyperlinkLabel("How do I create a custom hardware skin?");
    myHardwareSkinHelpLabel.setHyperlinkTarget(AvdWizardUtils.CREATE_SKIN_HELP_LINK);
    myCustomSkinPath = new SkinChooser(null, false);
    myDeviceDefinitionPreview = new DeviceDefinitionPreview(getModel().getDeviceData());
}
Also used : Navigation(com.android.resources.Navigation) ComboBox(com.intellij.openapi.ui.ComboBox)

Aggregations

ComboBox (com.intellij.openapi.ui.ComboBox)46 Nullable (org.jetbrains.annotations.Nullable)12 ActionListener (java.awt.event.ActionListener)11 ActionEvent (java.awt.event.ActionEvent)10 JBLabel (com.intellij.ui.components.JBLabel)7 NotNull (org.jetbrains.annotations.NotNull)7 JBTextField (com.intellij.ui.components.JBTextField)6 TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)5 AndroidTargetHash.getAddonHashString (com.android.sdklib.AndroidTargetHash.getAddonHashString)4 BuildFileKey (com.android.tools.idea.gradle.parser.BuildFileKey)4 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)4 Project (com.intellij.openapi.project.Project)4 javax.swing (javax.swing)4 Module (com.intellij.openapi.module.Module)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 JBCheckBox (com.intellij.ui.components.JBCheckBox)3 java.awt (java.awt)3 ItemEvent (java.awt.event.ItemEvent)3 ItemListener (java.awt.event.ItemListener)3 CompletionResultSet (com.intellij.codeInsight.completion.CompletionResultSet)2