use of com.intellij.ui.CollectionComboBoxModel in project intellij-community by JetBrains.
the class LibrariesDownloadUiUtil method loadItems.
private static void loadItems(@NotNull final JComboBox jComboBox, final List<Object> items, final String groupId, final URL... localUrls) {
final ModalityState state = ModalityState.current();
ApplicationManager.getApplication().executeOnPooledThread(() -> {
final List<Object> newItems = new ArrayList<>();
newItems.addAll(Arrays.asList(LibrariesDownloadAssistant.getVersions(groupId, localUrls)));
ApplicationManager.getApplication().invokeLater(() -> {
items.clear();
if (!newItems.isEmpty()) {
items.addAll(newItems);
final CollectionComboBoxModel model = (CollectionComboBoxModel) jComboBox.getModel();
model.update();
jComboBox.setSelectedIndex(0);
}
jComboBox.setEnabled(true);
}, state);
});
}
use of com.intellij.ui.CollectionComboBoxModel in project intellij-community by JetBrains.
the class LibrariesDownloadUiUtil method initAsyncComboBoxModel.
public static void initAsyncComboBoxModel(@NotNull final JComboBox jComboBox, @NotNull final String groupId, final URL... localUrls) {
final List<Object> items = new ArrayList<>();
new UiNotifyConnector.Once(jComboBox, new Activatable() {
@Override
public void showNotify() {
loadItems(jComboBox, items, groupId, localUrls);
}
@Override
public void hideNotify() {
}
});
items.add("loading...");
jComboBox.setModel(new CollectionComboBoxModel(items, items.get(0)));
jComboBox.setEnabled(false);
}
use of com.intellij.ui.CollectionComboBoxModel in project intellij-community by JetBrains.
the class VersionsComponent method createComboBox.
private JComboBox createComboBox(String ri) {
final JComboBox comboBox = new JComboBox();
List<Artifact> versions = getSupportedVersions(ri);
comboBox.setModel(new CollectionComboBoxModel(versions, null));
comboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
updateCurrentVersion(comboBox);
}
});
return comboBox;
}
use of com.intellij.ui.CollectionComboBoxModel in project Perl5-IDEA by Camelcade.
the class PerlConfigurationEditor method getGeneralComponent.
@Nullable
@Override
protected JComponent getGeneralComponent() {
myScriptField = new TextFieldWithBrowseButton();
myScriptField.addBrowseFolderListener(PerlBundle.message("perl.run.config.select.script.header"), PerlBundle.message("perl.run.config.select.script.prompt"), myProject, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor().withFileFilter(PerlConfigurationProducer::isExecutableFile), TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
myConsoleCharset = new ComboBox(new CollectionComboBoxModel(new ArrayList<>(Charset.availableCharsets().keySet())));
myScriptField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent documentEvent) {
VirtualFile file = LocalFileSystem.getInstance().findFileByPath(myScriptField.getText());
if (file != null) {
myConsoleCharset.setSelectedItem(file.getCharset().displayName());
} else {
myConsoleCharset.setSelectedItem(null);
}
}
});
myAlternativeSdkPanel = new PerlAlternativeSdkPanel();
myParametersPanel = new CommonProgramParametersPanel() {
@Override
protected void addComponents() {
LabeledComponent<?> scriptLabel = LabeledComponent.create(myScriptField, PerlBundle.message("perl.run.option.script"));
scriptLabel.setLabelLocation(BorderLayout.WEST);
add(scriptLabel);
LabeledComponent<?> consoleEncoding = LabeledComponent.create(myConsoleCharset, PerlBundle.message("perl.run.option.output.encoding"));
consoleEncoding.setLabelLocation(BorderLayout.WEST);
add(consoleEncoding);
myPerlParametersPanel = new RawCommandLineEditor();
LabeledComponent<RawCommandLineEditor> perlParametersPanel = LabeledComponent.create(myPerlParametersPanel, PerlBundle.message("perl.run.option.perl.parameters"));
perlParametersPanel.setLabelLocation(BorderLayout.WEST);
copyDialogCaption(perlParametersPanel);
add(perlParametersPanel);
super.addComponents();
add(myAlternativeSdkPanel);
setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 5, true, false));
}
};
myParametersPanel.setProgramParametersLabel(PerlBundle.message("perl.run.option.script.parameters"));
return myParametersPanel;
}
use of com.intellij.ui.CollectionComboBoxModel in project azure-tools-for-java by Microsoft.
the class FunctionsModuleInfoStep method _init.
@Override
public void _init() {
panel = new JPanel(new BorderLayout());
final String groupId = context.getUserData(AzureFunctionsConstants.WIZARD_GROUPID_KEY);
final String artifactId = context.getUserData(AzureFunctionsConstants.WIZARD_ARTIFACTID_KEY);
final String version = context.getUserData(AzureFunctionsConstants.WIZARD_VERSION_KEY);
final String packageName = context.getUserData(AzureFunctionsConstants.WIZARD_PACKAGE_NAME_KEY);
try {
final FormBuilder formBuilder = new FormBuilder();
final CollectionComboBoxModel<String> toolModel = new CollectionComboBoxModel<>(Arrays.asList(MAVEN_TOOL, GRADLE_TOOL));
toolComboBox = new ComboBox<>(toolModel);
formBuilder.addLabeledComponent("Tool:", toolComboBox);
groupIdField = new JBTextField(getCurrentOrDefaultValue(groupId, "com.example"));
formBuilder.addLabeledComponent("Group:", groupIdField);
artifactIdField = new JBTextField(getCurrentOrDefaultValue(artifactId, "azure-function-examples"));
formBuilder.addLabeledComponent("Artifact:", artifactIdField);
versionField = new JBTextField(getCurrentOrDefaultValue(version, "1.0.0-SNAPSHOT"));
formBuilder.addLabeledComponent("Version:", versionField);
packageNameField = new JBTextField(getCurrentOrDefaultValue(packageName, "org.example.functions"));
formBuilder.addLabeledComponent("Package name:", packageNameField);
panel.add(ScrollPaneFactory.createScrollPane(formBuilder.getPanel(), true), "North");
} catch (final RuntimeException e) {
LOGGER.error(e.getLocalizedMessage(), e);
throw e;
}
}
Aggregations