Java Code Examples for com.intellij.openapi.ui.ComboBox

The following examples show how to use com.intellij.openapi.ui.ComboBox. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: haystack   Source File: FieldsTableDelegate.java    License: MIT License 6 votes vote down vote up
public void setClass(ClassModel classModel) {
    fieldsData = classModel.getFields();
    fieldsTable.setModel(new FieldsTableModel(fieldsData));

    TableColumn column = fieldsTable.getColumnModel().getColumn(0);
    column.setPreferredWidth(30);
    fieldsTable.getColumnModel().getColumn(1).setPreferredWidth(30);

    TableColumn modifierColumn = fieldsTable.getColumnModel().getColumn(3);
    ComboBox<String> modifierCombobox = new ComboBox<>();
    List<String> typeList = languageResolver.getSupportTypeList();
    for (int i = 0; i < typeList.size(); i++) {
        modifierCombobox.addItem(typeList.get(i));
    }

    modifierColumn.setCellEditor(new DefaultCellEditor(modifierCombobox));

    DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
    centerRenderer.setHorizontalAlignment(JLabel.CENTER);
    for (int i = 2; i < columns.length; i++) {
        fieldsTable.getColumnModel().getColumn(i).setCellRenderer(centerRenderer);
    }
}
 
Example 2
Source Project: JSONToKotlinClass   Source File: FieldsTableDelegate.java    License: MIT License 6 votes vote down vote up
public void setClass(ClassModel classModel) {
    fieldsData = classModel.fields;
    fieldsTable.setModel(new FieldsTableModel(fieldsData));

    TableColumn column = fieldsTable.getColumnModel().getColumn(0);
    column.setPreferredWidth(30);

    TableColumn modifierColumn = fieldsTable.getColumnModel().getColumn(2);
    ComboBox<String> modifierCombobox = new ComboBox<>();
    modifierCombobox.addItem(languageResolver.getModifier(true));
    modifierCombobox.addItem(languageResolver.getModifier(false));

    modifierColumn.setCellEditor(new DefaultCellEditor(modifierCombobox));

    DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
    centerRenderer.setHorizontalAlignment(JLabel.CENTER);
    for (int i = 1; i < columns.length; i++) {
        if (i != 3) {
            fieldsTable.getColumnModel().getColumn(i).setCellRenderer(centerRenderer);
        }
    }
}
 
Example 3
protected JComponent doCreateCenterPanel() {
    JPanel panel = new JPanel(new BorderLayout(5, 0));

    FilterRule.FilterRuleType[] types = FilterRule.FilterRuleType.values();

    ruleType = new ComboBox(types);
    ruleType.setEnabled(true);
    ruleType.setSelectedIndex(0);

    panel.add(ruleType, BorderLayout.WEST);

    filterName = new JTextField(20);
    PromptSupport.setPrompt("Set the string name here", filterName);
    panel.add(filterName, BorderLayout.CENTER);

    return panel;
}
 
Example 4
Source Project: PackageTemplates   Source File: SelectFileTemplateDialog.java    License: Apache License 2.0 6 votes vote down vote up
@NotNull
private ComboBox getSelector() {
    ArrayList<TemplateForSearch> listTemplateForSearch = FileTemplateHelper.getTemplates(
            project,
            cbAddInternal.isSelected(),
            cbAddJ2EE.isSelected(),
            ptWrapper.getPackageTemplate().getFileTemplateSource()
    );

    ComboBox comboBox = new ComboBox(listTemplateForSearch.toArray());
    comboBox.setRenderer(new ListCellRendererWrapper<TemplateForSearch>() {
        @Override
        public void customize(JList list, TemplateForSearch template, int index, boolean selected, boolean hasFocus) {
            if (template != null) {
                setIcon(FileTemplateUtil.getIcon(template.getTemplate()));
                setText(template.getTemplate().getName());
            }
        }
    });

    new ComboboxSpeedSearch(comboBox);
    return comboBox;
}
 
Example 5
Source Project: PackageTemplates   Source File: WriteRulesDialog.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void preShow() {
    panel.setLayout(new MigLayout(new LC().gridGap("0", "8pt")));

    //Type
    ArrayList<WriteRules> actionTypes = new ArrayList<>();
    if(hasParent){
        actionTypes.add(WriteRules.FROM_PARENT);
    }
    actionTypes.add(WriteRules.USE_EXISTING);
    actionTypes.add(WriteRules.ASK_ME);
    actionTypes.add(WriteRules.OVERWRITE);

    comboBoxRules = new ComboBox(actionTypes.toArray());
    comboBoxRules.setRenderer(new WriteRulesCellRenderer());
    comboBoxRules.setSelectedItem(writeRules);

    panel.add(comboBoxRules, new CC().pushX().growX().spanX().gapY("10","10"));
}
 
Example 6
Source Project: tmc-intellij   Source File: SettingsPanelMock.java    License: MIT License 6 votes vote down vote up
public void initComponents() {
    panel1 = new JPanel();
    projectPathField = new JFormattedTextField();
    checkForNewOrCheckBox = new JCheckBox();
    checkThatAllActiveCheckBox = new JCheckBox();
    sendDiagnosticsCheckBox = new JCheckBox();
    sendSnapshotsOfYourCheckBox = new JCheckBox();
    selectErrorLanguageField = new ComboBox<>();
    browseButton = new JButton();
    okButton = new JButton();
    cancelButton = new JButton();
    downloadCourseExercisesButton = new JButton();
    logoutButton = new JButton();
    loggedUser = new JLabel();
    currentOrganization = new JLabel();
    changeOrganizationButton = new JButton();
    currentCourse = new JLabel();
    changeCourseButton = new JButton();
}
 
Example 7
Source Project: intellij   Source File: BlazeIntellijPluginConfiguration.java    License: Apache License 2.0 6 votes vote down vote up
public BlazeIntellijPluginConfigurationSettingsEditor(
    Iterable<Label> javaLabels,
    RunConfigurationStateEditor blazeFlagsEditor,
    RunConfigurationStateEditor exeFlagsEditor) {
  targetCombo =
      new ComboBox<>(
          new DefaultComboBoxModel<>(
              Ordering.usingToString().sortedCopy(javaLabels).toArray(new Label[0])));
  targetCombo.setRenderer(
      new ListCellRendererWrapper<Label>() {
        @Override
        public void customize(
            JList list, @Nullable Label value, int index, boolean selected, boolean hasFocus) {
          setText(value == null ? null : value.toString());
        }
      });
  this.blazeFlagsEditor = blazeFlagsEditor;
  this.exeFlagsEditor = exeFlagsEditor;
  ProjectSdksModel sdksModel = new ProjectSdksModel();
  sdksModel.reset(null);
  sdkCombo = new JdkComboBox(sdksModel, IdeaJdkHelper::isIdeaJdkType);

  keepInSyncCheckBox = new JBCheckBox("Keep in sync with source XML");
  keepInSyncCheckBox.addItemListener(e -> updateEnabledStatus());
}
 
Example 8
Source Project: KodeBeagle   Source File: SearchPanel.java    License: Apache License 2.0 6 votes vote down vote up
private void createFields() {
    kbApiURLComboBox = new ComboBox();
    kbApiURLComboBox.setEditable(true);
    kbApiURLComboBox.setVisible(true);
    kbApiURLOverrideCheckBox = new JCheckBox();
    kbApiURLOverrideCheckBox.setVisible(true);
    kbApiURLOverrideCheckBox.setText(OVERRIDE);
    kbApiURLOverrideCheckBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            if (kbApiURLComboBox.isEnabled()) {
                kbApiURLComboBox.setEnabled(false);
                kbApiURLComboBox.setSelectedItem(RefreshActionBase.KODEBEAGLE_API_URL_DEFAULT);
            } else {
                kbApiURLComboBox.setEnabled(true);
                kbApiURLComboBox.requestFocus();
            }
        }
    });
}
 
Example 9
public StreamConfigurationPanel(
		StreamConfiguration configuration,
		StreamConfiguration.StreamType[] allowedTypes,
		String defaultFileName,
		SizeChangedListener listener
) {
	super(new VerticalLayout());
	type = new ComboBox<>(allowedTypes);
	type.setSelectedItem(configuration.type);
	type.addActionListener(
			e -> {
				fileName.setVisible(((StreamConfiguration.StreamType) type.getSelectedItem()).hasStringParameter);
				if (listener != null) {
					listener.sizeChanged();
				}
			}
	);
	fileName = new JTextField(configuration.type.hasStringParameter ? configuration.fileName : defaultFileName);
	fileName.setVisible(((StreamConfiguration.StreamType) type.getSelectedItem()).hasStringParameter);

	add(type);
	add(fileName);
}
 
Example 10
Source Project: floobits-intellij   Source File: SelectOwner.java    License: Apache License 2.0 6 votes vote down vote up
protected SelectOwner(List<String> title, RunLater<String> runLater) {
    super(true);
    jPanel = new JPanel();
    this.runLater = runLater;
    init();
    this.setTitle("Select Workspace Owner");

    Object[] organizations = title.toArray();
    orgList = new ComboBox(organizations, 200);
    if (organizations.length > 0) {
        orgList.setSelectedIndex(0);
    }
    JLabel jLabel = new JLabel();
    jLabel.setText("Select the owner for the workspace:");
    jPanel.add(jLabel);
    jPanel.add(orgList);
}
 
Example 11
Source Project: consulo   Source File: KeymapPanel.java    License: Apache License 2.0 6 votes vote down vote up
private JPanel createKeymapListPanel() {
  JPanel panel = new JPanel();
  panel.setLayout(new GridBagLayout());

  myKeymapList = new ComboBox(myKeymapListModel);
  myKeymapList.setEditor(new MyEditor());
  myKeymapList.setRenderer(new MyKeymapRenderer(myKeymapList.getRenderer()));
  JLabel keymapLabel = new JLabel(KeyMapBundle.message("keymaps.border.factory.title"));
  keymapLabel.setLabelFor(myKeymapList);
  panel.add(keymapLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
  panel.add(myKeymapList, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 4, 0, 0), 0, 0));

  panel.add(createKeymapButtonsPanel(),
            new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
  myKeymapList.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      if (myKeymapListModel.getSelectedItem() != mySelectedKeymap) processCurrentKeymapChanged(getCurrentQuickListIds());
    }
  });
  panel.add(createKeymapNamePanel(),
            new GridBagConstraints(3, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));
  return panel;
}
 
Example 12
Source Project: consulo   Source File: CleanUnshelvedFilterDialog.java    License: Apache License 2.0 6 votes vote down vote up
public CleanUnshelvedFilterDialog(@Nullable Project project) {
  super(project);
  setTitle("Clean Unshelved Changelists");
  mySystemUnshelvedButton = new JRadioButton("created automatically", true);
  myUnshelvedWithFilterButton = new JRadioButton("older than one", false);
  myAllUnshelvedButton = new JRadioButton("all", false);
  myTimePeriodComboBox = new ComboBox(new EnumComboBoxModel<>(TimePeriod.class));
  myTimePeriodComboBox.setEnabled(myUnshelvedWithFilterButton.isSelected());
  myUnshelvedWithFilterButton.addItemListener(new ItemListener() {
    @Override
    public void itemStateChanged(ItemEvent e) {
      myTimePeriodComboBox.setEnabled(myUnshelvedWithFilterButton.isSelected());
    }
  });
  setOKButtonText("Delete");
  init();
  setResizable(false);
}
 
Example 13
Source Project: consulo   Source File: CreateNewLibraryDialog.java    License: Apache License 2.0 6 votes vote down vote up
public CreateNewLibraryDialog(@Nonnull JComponent parent, @Nonnull StructureConfigurableContext context, @Nonnull NewLibraryEditor libraryEditor,
                              @Nonnull List<LibraryTable> libraryTables, int selectedTable) {
  super(parent, new LibraryRootsComponent(context.getProject(), libraryEditor));
  myContext = context;
  myLibraryEditor = libraryEditor;
  final DefaultComboBoxModel model = new DefaultComboBoxModel();
  for (LibraryTable table : libraryTables) {
    model.addElement(table);
  }
  myLibraryLevelCombobox = new ComboBox(model);
  myLibraryLevelCombobox.setSelectedIndex(selectedTable);
  myLibraryLevelCombobox.setRenderer(new ListCellRendererWrapper() {
    @Override
    public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
      if (value instanceof LibraryTable) {
        setText(((LibraryTable)value).getPresentation().getDisplayName(false));
      }
    }
  });
  init();
}
 
Example 14
Source Project: consulo   Source File: ArtifactConfigurable.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected JComponent createTopRightComponent(final JTextField nameField) {
  final ComboBox artifactTypeBox = new ComboBox();
  for (ArtifactType type : ArtifactType.EP_NAME.getExtensions()) {
    artifactTypeBox.addItem(type);
  }

  artifactTypeBox.setRenderer(new ArtifactTypeCellRenderer());

  artifactTypeBox.setSelectedItem(getArtifact().getArtifactType());
  artifactTypeBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      final ArtifactType selected = (ArtifactType)artifactTypeBox.getSelectedItem();
      if (selected != null && !Comparing.equal(selected, getArtifact().getArtifactType())) {
        getEditor().setArtifactType(selected);
      }
    }
  });

  return LabeledComponent.left(artifactTypeBox, "Type");
}
 
Example 15
Source Project: consulo   Source File: ScopeChooserCombo.java    License: Apache License 2.0 6 votes vote down vote up
public void init(final Project project, final boolean suggestSearchInLibs, final boolean prevSearchWholeFiles, final Object selection, @Nullable Condition<? super ScopeDescriptor> scopeFilter) {
  if (myProject != null) {
    throw new IllegalStateException("scope chooser combo already initialized");
  }
  myOptions = BitUtil.set(myOptions, OPT_LIBRARIES, suggestSearchInLibs);
  myOptions = BitUtil.set(myOptions, OPT_SEARCH_RESULTS, prevSearchWholeFiles);
  myProject = project;

  NamedScopesHolder.ScopeListener scopeListener = () -> {
    SearchScope selectedScope = getSelectedScope();
    rebuildModelAndSelectScopeOnSuccess(selectedScope);
  };
  myScopeFilter = scopeFilter;
  NamedScopeManager.getInstance(project).addScopeListener(scopeListener, this);
  DependencyValidationManager.getInstance(project).addScopeListener(scopeListener, this);
  addActionListener(this::handleScopeChooserAction);

  ComboBox<ScopeDescriptor> combo = getComboBox();
  combo.setMinimumAndPreferredWidth(JBUIScale.scale(300));
  combo.setRenderer(createDefaultRenderer());
  combo.setSwingPopup(false);

  rebuildModelAndSelectScopeOnSuccess(selection);
}
 
Example 16
Source Project: consulo   Source File: NameSuggestionsField.java    License: Apache License 2.0 6 votes vote down vote up
private void setupComboBox(final ComboBox combobox, FileType fileType) {
  final EditorComboBoxEditor comboEditor = new StringComboboxEditor(myProject, fileType, combobox) {
    @Override
    public void setItem(Object anObject) {
      myNonHumanChange = true;
      super.setItem(anObject);
    }
  };

  combobox.setEditor(comboEditor);
  combobox.setRenderer(new EditorComboBoxRenderer(comboEditor));

  combobox.setEditable(true);
  combobox.setMaximumRowCount(8);

  comboEditor.selectAll();
}
 
Example 17
private void createUIComponents() {
    // place custom component creation code here
    this.remindTypeOptions = new ComboBox<>();
    for (ConfigState.RemindTypeEnum remindType : ConfigState.RemindTypeEnum.values()) {
        this.remindTypeOptions.addItem(remindType.description);
    }

    ConfigState configState = ConfigService.getInstance().getState();
    List<String> remindImages = configState.getRemindImages();
    this.pluginSettingTable = new PluginSettingTable(remindImages);
    this.imageUrlList = ToolbarDecorator.createDecorator(pluginSettingTable)
        /*
         * at version 1.5 fix a bug: 2020.1 版本 AllIcons.Actions.Reset_to_default 过时问题
         * see https://github.com/fantasticmao/ycy-intellij-plugin/issues/27
         */
        .addExtraAction(new AnActionButton("Reset", AllIcons.Actions.Rollback) {
            @Override
            public void actionPerformed(AnActionEvent e) {
                pluginSettingTable.resetTableList();
            }

            @Override
            public boolean isDumbAware() {
                return true; // 使用「后台更新」模式
            }
        })
        .createPanel();
}
 
Example 18
@Override
public void _init() {
    ProgressIndicator indicator = new EmptyProgressIndicator() {
        @Override
        public void setText(String text) {
            SwingUtilities.invokeLater(() -> panel.setLoadingText(text));
        }
    };
    try {
        QuarkusModel model = QuarkusModelRegistry.INSTANCE.load(context.getUserData(QuarkusConstants.WIZARD_ENDPOINT_URL_KEY), indicator);
        context.putUserData(QuarkusConstants.WIZARD_MODEL_KEY, model);
        final FormBuilder formBuilder = new FormBuilder();
        final CollectionComboBoxModel<ToolDelegate> toolModel = new CollectionComboBoxModel<>(Arrays.asList(ToolDelegate.getDelegates()));
        toolComboBox = new ComboBox<>(toolModel);
        toolComboBox.setRenderer(new ColoredListCellRenderer<ToolDelegate>() {
            @Override
            protected void customizeCellRenderer(@NotNull JList<? extends ToolDelegate> list, ToolDelegate toolDelegate, int index, boolean selected, boolean hasFocus) {
                this.append(toolDelegate.getDisplay());
            }
        });
        formBuilder.addLabeledComponent("Tool:", toolComboBox);
        groupIdField = new JBTextField("org.acme");
        formBuilder.addLabeledComponent("Group:", groupIdField);
        artifactIdField = new JBTextField("code-with-quarkus");
        formBuilder.addLabeledComponent("Artifact:", artifactIdField);
        versionField = new JBTextField("1.0.0-SNAPSHOT");
        formBuilder.addLabeledComponent("Version:", versionField);
        classNameField = new JBTextField("org.acme.ExampleResource");
        formBuilder.addLabeledComponent("Class name:", classNameField);
        pathField = new JBTextField("/hello");
        formBuilder.addLabeledComponent("Path:", pathField);
        panel.add(ScrollPaneFactory.createScrollPane(formBuilder.getPanel(), true), "North");
    } catch (IOException e) {
        LOGGER.error(e.getLocalizedMessage(), e);
        throw new RuntimeException(e);
    }
}
 
Example 19
Source Project: EasyCode   Source File: BaseGroupPanel.java    License: MIT License 5 votes vote down vote up
/**
 * 初始化方法
 *
 * @param defaultGroupName 默认选中分组
 */
private void init(String defaultGroupName) {
    // 创建一个内容面板
    JPanel contentPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    ComboBoxModel<String> comboBoxModel = new CollectionComboBoxModel<>(groupNameList);
    this.comboBox = new ComboBox<>(comboBoxModel);

    // 添加下拉框
    contentPanel.add(new Label("Group Name:"));
    contentPanel.add(this.comboBox);

    // 添加事件按钮
    DefaultActionGroup actionGroup = createActionGroup();

    // 添加分组选中事件
    this.comboBox.addItemListener(e -> changeGroup((String) comboBox.getSelectedItem()));

    // 选择默认分组
    this.comboBox.setSelectedItem(defaultGroupName);


    ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar("Group Toolbar", actionGroup, true);

    contentPanel.add(actionToolbar.getComponent());

    contentPanel.setPreferredSize(JBUI.size(600, 40));

    // 将内容面板添加至主面板左边(西边)
    this.add(contentPanel, BorderLayout.WEST);
}
 
Example 20
Source Project: CodeGen   Source File: SelectGroupPanel.java    License: MIT License 5 votes vote down vote up
private void createUIComponents() {
    // TODO: place custom component creation code here
    groupComboBox = new ComboBox<>();
    groupComboBox.setRenderer(new CellRenderer());
    groupsPanel = new JPanel();
    groupsPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
}
 
Example 21
@Nullable
@Override
public JComponent createComponent() {
    if (settingPanel == null) {
        settingPanel = new JPanel(new VerticalLayout(18));

        // header UI
        Container container = new Container();
        container.setLayout(new BorderLayout());

        currentEngine = TranslationEngineType.fromName(
                PropertiesComponent.getInstance().getValue(StorageDataKey.SettingLanguageEngine));
        TranslationEngineType[] items = TranslationEngineType.getLanguageEngineArray();
        languageEngineBox = new ComboBox(items);
        languageEngineBox.setEnabled(true);
        languageEngineBox.setSelectedItem(currentEngine);
        languageEngineBox.addActionListener(this);

        container.add(new JLabel("Language engine: "), BorderLayout.WEST);
        container.add(languageEngineBox, BorderLayout.CENTER);

        settingPanel.add(container);

        initContentContainer();
        initAndAddFilterContainer();
    }
    return settingPanel;
}
 
Example 22
public SdkVersionSelectionDialog(JComponent parent, String title, String name, List<String> scalaVersions)
{
    super(parent, false);
    setTitle(title);
    //Create and populate the panel.
    centerPanel = new JPanel(new SpringLayout());

    versionLabel = new JLabel(name, JLabel.TRAILING);
    versionComboBox = new ComboBox(new DefaultComboBoxModel<>(scalaVersions.toArray()));
    versionLabel.setLabelFor(versionComboBox);

    centerPanel.add(versionLabel);
    centerPanel.add(versionComboBox);

    destination = new TextFieldWithBrowseButton();
    destination.addBrowseFolderListener("Select new Mule distribution destination", null, null, FileChooserDescriptorFactory.createSingleFolderDescriptor());
    destinationLabel = new JLabel("Destination:", JLabel.TRAILING);
    destinationLabel.setLabelFor(destination);

    //By default, should be ~/mule-distro
    File distro = new File(SystemProperties.getUserHome(), "mule-distro");
    destination.setText(distro.getAbsolutePath());

    centerPanel.add(destinationLabel);
    centerPanel.add(destination);

    //Lay out the panel.
    SpringUtilities.makeCompactGrid(centerPanel,
            2, 2, //rows, cols
            6, 6,        //initX, initY
            6, 6);       //xPad, yPad

    init();
}
 
Example 23
Source Project: PackageTemplates   Source File: SettingsDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void createLanguageViews() {
    jlLanguage = new JLabel(Localizer.get("settings.Language"));

    comboLanguages = new ComboBox(new EnumComboBoxModel<>(Language.class));
    if (SaveUtil.reader().getLanguage() != null) {
        comboLanguages.setSelectedItem(SaveUtil.reader().getLanguage());
    }
}
 
Example 24
public FlutterSmallIDEGeneratorPeer() {
  sdkPathComboWithBrowse = new ComboboxWithBrowseButton(new ComboBox<>());
  sdkPathComboWithBrowse.getComboBox().setEditable(true);
  FlutterSdkUtil.addKnownSDKPathsToCombo(sdkPathComboWithBrowse.getComboBox());

  sdkPathComboWithBrowse.addBrowseFolderListener(
    FlutterBundle.message("flutter.sdk.browse.path.label"), null, null,
    FileChooserDescriptorFactory.createSingleFolderDescriptor(),
    TextComponentAccessor.STRING_COMBOBOX_WHOLE_TEXT);

  settingsFields = new FlutterCreateAdditionalSettingsFields();
}
 
Example 25
private void createUIComponents() {
  projectTypeCombo = new ComboBox<>();
  //noinspection unchecked
  projectTypeCombo.setModel(new ProjectTypeComboBoxModel());
  projectTypeCombo.setToolTipText(FlutterBundle.message("flutter.module.create.settings.type.tip"));
  androidxCheckbox = new JCheckBox();
}
 
Example 26
public FlutterSmallIDEGeneratorPeer() {
  sdkPathComboWithBrowse = new ComboboxWithBrowseButton(new ComboBox<>());
  sdkPathComboWithBrowse.getComboBox().setEditable(true);
  FlutterSdkUtil.addKnownSDKPathsToCombo(sdkPathComboWithBrowse.getComboBox());

  sdkPathComboWithBrowse.addBrowseFolderListener(
    FlutterBundle.message("flutter.sdk.browse.path.label"), null, null,
    FileChooserDescriptorFactory.createSingleFolderDescriptor(),
    TextComponentAccessor.STRING_COMBOBOX_WHOLE_TEXT);

  settingsFields = new FlutterCreateAdditionalSettingsFields();
}
 
Example 27
private void createUIComponents() {
  projectTypeCombo = new ComboBox<>();
  //noinspection unchecked
  projectTypeCombo.setModel(new ProjectTypeComboBoxModel());
  projectTypeCombo.setToolTipText(FlutterBundle.message("flutter.module.create.settings.type.tip"));
  androidxCheckbox = new JCheckBox();
}
 
Example 28
Source Project: camel-idea-plugin   Source File: CamelEditorSettingsPage.java    License: Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public JComponent createComponent() {
    downloadCatalogCheckBox = new JBCheckBox("Allow downloading camel-catalog over the internet");
    scanThirdPartyComponentsCatalogCheckBox = new JBCheckBox("Scan classpath for third party Camel components using modern component packaging");
    scanThirdPartyLegacyComponentsCatalogCheckBox = new JBCheckBox("Scan classpath for third party Camel components using legacy component packaging");
    camelIconInGutterCheckBox = new JBCheckBox("Show Camel icon in gutter");
    camelIconsComboBox = new ComboBox<>(new String[]{"Camel Icon", "Camel Animal Icon", "Camel Badge Icon"});

    camelIconsComboBox.setRenderer(new CamelChosenIconCellRender());

    // use mig layout which is like a spread-sheet with 2 columns, which we can span if we only have one element
    JPanel panel = new JPanel(new MigLayout("fillx,wrap 2", "[left]rel[grow,fill]"));
    panel.setOpaque(false);

    panel.add(downloadCatalogCheckBox, "span 2");
    panel.add(scanThirdPartyComponentsCatalogCheckBox, "span 2");
    panel.add(scanThirdPartyLegacyComponentsCatalogCheckBox, "span 2");
    panel.add(camelIconInGutterCheckBox, "span 2");

    panel.add(new JLabel("Camel icon"));
    panel.add(camelIconsComboBox);

    JPanel result = new JPanel(new BorderLayout());
    result.add(panel, BorderLayout.NORTH);
    reset();
    return result;
}
 
Example 29
Source Project: intellij   Source File: BlazeCommandState.java    License: Apache License 2.0 5 votes vote down vote up
BlazeCommandStateEditor(Project project) {
  buildSystemName = Blaze.buildSystemName(project);
  commandCombo =
      new ComboBox(new DefaultComboBoxModel<>(BlazeCommandName.knownCommands().toArray()));
  // Allow the user to manually specify an unlisted command.
  commandCombo.setEditable(true);
}
 
Example 30
Source Project: intellij   Source File: SettingComponent.java    License: Apache License 2.0 5 votes vote down vote up
/** Creates a factory for {@link ComboBox} components for selecting enum values. */
public static <E extends Enum<E>>
    ComponentFactory<LabeledComponent<E, ComboBox<E>>> comboBoxFactory(Class<E> optionsEnum) {
  return factory(
      () -> new ComboBox<>(optionsEnum.getEnumConstants()),
      c -> c.getItemAt(c.getSelectedIndex()),
      JComboBox::setSelectedItem);
}