use of com.intellij.openapi.ui.ComboBox in project intellij-community by JetBrains.
the class EduCCModuleBuilder method modifySettingsStep.
@Nullable
@Override
public ModuleWizardStep modifySettingsStep(@NotNull SettingsStep settingsStep) {
ModuleWizardStep javaSettingsStep = ProjectWizardStepFactory.getInstance().createJavaSettingsStep(settingsStep, this, Conditions.alwaysTrue());
Function<JTextField, String> getValue = JTextComponent::getText;
getWizardInputField("ccname", "", "Name:", myPanel.getNameField(), getValue).addToSettings(settingsStep);
getWizardInputField("ccauthor", "", "Author:", myPanel.getAuthorField(), getValue).addToSettings(settingsStep);
LanguageExtensionPoint[] extensions = new ExtensionPointName<LanguageExtensionPoint>(EduCourseConfigurator.EP_NAME).getExtensions();
myLanguageComboBox.removeAllItems();
for (LanguageExtensionPoint extension : extensions) {
String languageId = extension.getKey();
Language language = Language.findLanguageByID(languageId);
if (language == null) {
LOG.info("Language with id " + languageId + " not found");
}
myLanguageComboBox.addItem(new LanguageWrapper(language));
}
getWizardInputField("cclang", "", "Language:", myLanguageComboBox, comboBox -> (String) comboBox.getSelectedItem()).addToSettings(settingsStep);
getWizardInputField("ccdescr", "", "Description:", myPanel.getDescriptionField(), JTextArea::getText).addToSettings(settingsStep);
return javaSettingsStep;
}
use of com.intellij.openapi.ui.ComboBox in project intellij-community by JetBrains.
the class ParametersPerConstructorInspection method createOptionsPanel.
@Override
public JComponent createOptionsPanel() {
final JFormattedTextField valueField = prepareNumberEditor("m_limit");
final JComboBox comboBox = new ComboBox(new Object[] { Scope.NONE, Scope.PRIVATE, Scope.PACKAGE_LOCAL, Scope.PROTECTED });
comboBox.setRenderer(new ListCellRendererWrapper() {
@Override
public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof Scope)
setText(((Scope) value).getText());
}
});
comboBox.setSelectedItem(ignoreScope);
comboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ignoreScope = (Scope) comboBox.getSelectedItem();
}
});
comboBox.setPrototypeDisplayValue(Scope.PROTECTED);
final FormBuilder formBuilder = FormBuilder.createFormBuilder();
formBuilder.addLabeledComponent(getConfigurationLabel(), valueField);
formBuilder.addLabeledComponent(InspectionGadgetsBundle.message("constructor.visibility.option"), comboBox);
final JPanel panel = new JPanel(new BorderLayout());
panel.add(formBuilder.getPanel(), BorderLayout.NORTH);
return panel;
}
use of com.intellij.openapi.ui.ComboBox in project intellij-community by JetBrains.
the class GradleRunTaskDialog method setUpDialog.
private void setUpDialog() {
JComponent commandLineComponent;
if (myHistory == null) {
commandLineEditor = new EditorTextField("", myProject, PlainTextFileType.INSTANCE);
commandLineComponent = commandLineEditor;
commandLineLabel.setLabelFor(commandLineEditor);
} else {
commandLineComboBox = new ComboBox(ArrayUtilRt.toStringArray(myHistory));
commandLineComponent = commandLineComboBox;
commandLineLabel.setLabelFor(commandLineComboBox);
commandLineComboBox.setLightWeightPopupEnabled(false);
EditorComboBoxEditor editor = new StringComboboxEditor(myProject, PlainTextFileType.INSTANCE, commandLineComboBox);
//noinspection GtkPreferredJComboBoxRenderer
commandLineComboBox.setRenderer(new EditorComboBoxRenderer(editor));
commandLineComboBox.setEditable(true);
commandLineComboBox.setEditor(editor);
commandLineComboBox.setFocusable(true);
commandLineEditor = editor.getEditorComponent();
}
commandLinePanel.add(commandLineComponent);
ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(GradleConstants.SYSTEM_ID);
FileChooserDescriptor projectPathChooserDescriptor = null;
if (manager instanceof ExternalSystemUiAware) {
projectPathChooserDescriptor = ((ExternalSystemUiAware) manager).getExternalProjectConfigDescriptor();
}
if (projectPathChooserDescriptor == null) {
projectPathChooserDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor();
}
String title = ExternalSystemBundle.message("settings.label.select.project", GradleConstants.SYSTEM_ID.getReadableName());
myProjectPathField = new ExternalProjectPathField(myProject, GradleConstants.SYSTEM_ID, projectPathChooserDescriptor, title) {
@Override
public Dimension getPreferredSize() {
return commandLinePanel == null ? super.getPreferredSize() : commandLinePanel.getPreferredSize();
}
};
projectPathFieldPanel.add(myProjectPathField);
new GradleArgumentsCompletionProvider(myProject, myProjectPathField).apply(commandLineEditor);
}
use of com.intellij.openapi.ui.ComboBox in project intellij-community by JetBrains.
the class GitVcsPanel method createUIComponents.
private void createUIComponents() {
myProtectedBranchesButton = new TextFieldWithBrowseButton.NoPathCompletion(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Messages.showTextAreaDialog(myProtectedBranchesButton.getTextField(), "Protected Branches", "Git.Force.Push.Protected.Branches", ParametersListUtil.COLON_LINE_PARSER, ParametersListUtil.COLON_LINE_JOINER);
}
});
myProtectedBranchesButton.setButtonIcon(AllIcons.Actions.ShowViewer);
myUpdateMethodComboBox = new ComboBox(new EnumComboBoxModel<>(UpdateMethod.class));
myUpdateMethodComboBox.setRenderer(new ListCellRendererWrapper<UpdateMethod>() {
@Override
public void customize(JList list, UpdateMethod value, int index, boolean selected, boolean hasFocus) {
setText(StringUtil.capitalize(StringUtil.toLowerCase(value.name().replace('_', ' '))));
}
});
}
use of com.intellij.openapi.ui.ComboBox in project intellij-community by JetBrains.
the class EditVariableDialog method createVariablesTable.
private JComponent createVariablesTable() {
final String[] names = { CodeInsightBundle.message("templates.dialog.edit.variables.table.column.name"), CodeInsightBundle.message("templates.dialog.edit.variables.table.column.expression"), CodeInsightBundle.message("templates.dialog.edit.variables.table.column.default.value"), CodeInsightBundle.message("templates.dialog.edit.variables.table.column.skip.if.defined") };
// Create a model of the data.
TableModel dataModel = new VariablesModel(names);
// Create the table
myTable = new JBTable(dataModel);
myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
myTable.setPreferredScrollableViewportSize(new Dimension(500, myTable.getRowHeight() * 8));
myTable.getColumn(names[0]).setPreferredWidth(120);
myTable.getColumn(names[1]).setPreferredWidth(200);
myTable.getColumn(names[2]).setPreferredWidth(200);
myTable.getColumn(names[3]).setPreferredWidth(100);
if (myVariables.size() > 0) {
myTable.getSelectionModel().setSelectionInterval(0, 0);
}
Predicate<Macro> isAcceptableInContext = macro -> myContextTypes.stream().anyMatch(macro::isAcceptableInContext);
Stream<String> availableMacroNames = Arrays.stream(MacroFactory.getMacros()).filter(isAcceptableInContext).map(Macro::getPresentableName).sorted();
Set<String> uniqueNames = availableMacroNames.collect(Collectors.toCollection(LinkedHashSet::new));
ComboBox comboField = new ComboBox();
uniqueNames.forEach(comboField::addItem);
comboField.setEditable(true);
DefaultCellEditor cellEditor = new DefaultCellEditor(comboField);
cellEditor.setClickCountToStart(1);
myTable.getColumn(names[1]).setCellEditor(cellEditor);
myTable.setRowHeight(comboField.getPreferredSize().height);
JTextField textField = new JTextField();
/*textField.addMouseListener(
new PopupHandler(){
public void invokePopup(Component comp,int x,int y){
showCellPopup((JTextField)comp,x,y);
}
}
);*/
cellEditor = new DefaultCellEditor(textField);
cellEditor.setClickCountToStart(1);
myTable.setDefaultEditor(String.class, cellEditor);
final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myTable).disableAddAction().disableRemoveAction();
return decorator.createPanel();
}
Aggregations