use of com.intellij.ui.CollectionComboBoxModel in project intellij-community by JetBrains.
the class RepositoryLibraryPropertiesEditor method initVersionsPanel.
private void initVersionsPanel() {
final int selection = getSelection(model.getVersion(), versions);
CollectionComboBoxModel<String> versionSelectorModel = new CollectionComboBoxModel<>(versions);
//noinspection unchecked
versionSelector.setModel(versionSelectorModel);
versionSelector.setSelectedIndex(selection);
setState(State.Loaded);
initVersionKindSelector();
versionSelector.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
model.setVersion(getSelectedVersion());
onChangeListener.onChange(RepositoryLibraryPropertiesEditor.this);
}
});
downloadSourcesCheckBox.setSelected(model.isDownloadSources());
downloadSourcesCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
model.setDownloadSources(downloadSourcesCheckBox.isSelected());
onChangeListener.onChange(RepositoryLibraryPropertiesEditor.this);
}
});
downloadJavaDocsCheckBox.setSelected(model.isDownloadJavaDocs());
downloadJavaDocsCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
model.setDownloadJavaDocs(downloadJavaDocsCheckBox.isSelected());
onChangeListener.onChange(RepositoryLibraryPropertiesEditor.this);
}
});
}
use of com.intellij.ui.CollectionComboBoxModel in project intellij-community by JetBrains.
the class PyIdeCommonOptionsForm method updateSdkList.
public void updateSdkList(boolean preserveSelection, PyConfigurableInterpreterList myInterpreterList) {
myPythonSdks = myInterpreterList.getAllPythonSdks(myProject);
Sdk selection = preserveSelection ? (Sdk) myInterpreterComboBox.getSelectedItem() : null;
if (!myPythonSdks.contains(selection)) {
selection = null;
}
myPythonSdks.add(0, null);
myInterpreterComboBox.setModel(new CollectionComboBoxModel(myPythonSdks, selection));
}
use of com.intellij.ui.CollectionComboBoxModel in project intellij-community by JetBrains.
the class BuildoutConfigPanel method reset.
public void reset() {
final List<File> scriptFiles = BuildoutFacet.getScripts(BuildoutFacet.getInstance(myModule), myModule.getProject().getBaseDir());
final List<String> scripts = ContainerUtil.map(scriptFiles, file -> file.getPath());
myScript.getComboBox().setModel(new CollectionComboBoxModel(scripts, myConfiguration.getScriptName()));
myScript.getComboBox().getEditor().setItem(myConfiguration.getScriptName());
}
use of com.intellij.ui.CollectionComboBoxModel in project intellij-community by JetBrains.
the class PyPluginCommonOptionsForm method setSdkHome.
public void setSdkHome(String sdkHome) {
List<Sdk> sdkList = new ArrayList<>();
sdkList.add(null);
final List<Sdk> allSdks = PythonSdkType.getAllSdks();
Collections.sort(allSdks, new PreferredSdkComparator());
Sdk selection = null;
for (Sdk sdk : allSdks) {
String homePath = sdk.getHomePath();
if (homePath != null && sdkHome != null && FileUtil.pathsEqual(homePath, sdkHome))
selection = sdk;
sdkList.add(sdk);
}
myInterpreterComboBox.setModel(new CollectionComboBoxModel(sdkList, selection));
}
use of com.intellij.ui.CollectionComboBoxModel in project intellij-community by JetBrains.
the class AddRepositoryLocationDialog method createCenterPanel.
protected JComponent createCenterPanel() {
JLabel selectText = new JLabel(message("repository.browser.add.location.prompt"));
selectText.setUI(new MultiLineLabelUI());
JPanel mainPanel = new JPanel(new GridBagLayout());
GridBagConstraints gb = new GridBagConstraints(0, 0, 1, 1, 1, 0, NORTHWEST, NONE, insets(5), 0, 0);
mainPanel.add(selectText, gb);
++gb.gridy;
myCombo = new ComboBox<>(new CollectionComboBoxModel<>(myPreviousLocations));
myCombo.setEditable(true);
myCombo.setMinimumSize(size(250, 20));
gb.fill = HORIZONTAL;
mainPanel.add(myCombo, gb);
gb.fill = NONE;
myComboField = (JTextField) myCombo.getEditor().getEditorComponent();
myComboField.addInputMethodListener(new InputMethodListener() {
public void inputMethodTextChanged(InputMethodEvent event) {
validateMe();
}
public void caretPositionChanged(InputMethodEvent event) {
validateMe();
}
});
myComboField.addKeyListener(new KeyListener() {
public void keyTyped(KeyEvent e) {
validateMe();
}
public void keyPressed(KeyEvent e) {
validateMe();
}
public void keyReleased(KeyEvent e) {
validateMe();
}
});
myCombo.addActionListener(e -> validateMe());
validateMe();
JPanel wrapper = new JPanel(new GridBagLayout());
wrapper.add(mainPanel, new GridBagConstraints(0, 0, 1, 1, 1, 1, NORTHWEST, HORIZONTAL, emptyInsets(), 0, 0));
wrapper.setPreferredSize(size(400, 70));
return wrapper;
}
Aggregations