use of com.intellij.ui.StringComboboxEditor 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.ui.StringComboboxEditor in project intellij-plugins by JetBrains.
the class DartIntroduceDialog method setUpNameComboBox.
private void setUpNameComboBox(Collection<String> possibleNames) {
final EditorComboBoxEditor comboEditor = new StringComboboxEditor(myProject, DartFileType.INSTANCE, myNameComboBox);
myNameComboBox.setEditor(comboEditor);
myNameComboBox.setRenderer(new EditorComboBoxRenderer(comboEditor));
myNameComboBox.setEditable(true);
myNameComboBox.setMaximumRowCount(8);
myContentPane.registerKeyboardAction(e -> IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(myNameComboBox, true)), KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.ALT_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);
for (String possibleName : possibleNames) {
myNameComboBox.addItem(possibleName);
}
}
Aggregations