use of java.awt.event.ItemListener 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 java.awt.event.ItemListener in project intellij-community by JetBrains.
the class SelectMavenProjectDialog method createCenterPanel.
protected JComponent createCenterPanel() {
ComboBoxUtil.setModel(myMavenProjectsComboBox, new DefaultComboBoxModel(), myMavenDomProjectModels, model -> {
String projectName = model.getName().getStringValue();
MavenProject mavenProject = MavenDomUtil.findProject(model);
if (mavenProject != null) {
projectName = mavenProject.getDisplayName();
}
if (StringUtil.isEmptyOrSpaces(projectName)) {
projectName = "pom.xml";
}
return Pair.create(projectName, model);
});
myReplaceAllListener = new ItemListener() {
public void itemStateChanged(ItemEvent e) {
updateControls();
}
};
myMavenProjectsComboBox.addItemListener(myReplaceAllListener);
myMavenProjectsComboBox.setSelectedItem(0);
myReplaceAllCheckBox.setVisible(myHasUsagesInProjects);
myExtractExclusions.setVisible(myHasExclusions);
updateControls();
return myMainPanel;
}
use of java.awt.event.ItemListener in project intellij-community by JetBrains.
the class EvalExpressionDialog method init.
protected void init() {
final ToolWindow findWindow = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.FIND);
final boolean available = findWindow != null && findWindow.isAvailable();
myForm.getNewTabCheckbox().setEnabled(available);
myForm.getNewTabCheckbox().setSelected(FindSettings.getInstance().isShowResultsInSeparateView());
myForm.getHighlightCheckbox().setSelected(mySettings.HIGHLIGHT_RESULTS);
myForm.getHighlightCheckbox().addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
updateOkAction();
}
});
myForm.getUsageViewCheckbox().setSelected(mySettings.SHOW_USAGE_VIEW);
myForm.getUsageViewCheckbox().addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
myForm.getNewTabCheckbox().setEnabled(available && myForm.getUsageViewCheckbox().isSelected());
updateOkAction();
}
});
super.init();
}
use of java.awt.event.ItemListener in project intellij-community by JetBrains.
the class AddNamespaceDialog method addUpdateListener.
private void addUpdateListener(ComboBox comboBox) {
final ComboBoxEditor boxEditor = comboBox.getEditor();
if (boxEditor != null) {
final Component component = boxEditor.getEditorComponent();
if (component instanceof JTextField) {
((JTextField) component).getDocument().addDocumentListener(new DocumentAdapter() {
protected void textChanged(DocumentEvent e) {
updateOkAction();
}
});
}
}
comboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
updateOkAction();
}
});
}
use of java.awt.event.ItemListener in project zaproxy by zaproxy.
the class SpiderPanel method getShowMessagesToggleButton.
private JToggleButton getShowMessagesToggleButton() {
if (showMessageToggleButton == null) {
showMessageToggleButton = new JToggleButton(Constant.messages.getString("spider.toolbar.button.showmessages.label"), new ImageIcon(SpiderPanel.class.getResource("/resource/icon/16/178.png")));
showMessageToggleButton.setToolTipText(Constant.messages.getString("spider.toolbar.button.showmessages.tooltip"));
showMessageToggleButton.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (ItemEvent.SELECTED == e.getStateChange()) {
showTabs();
} else {
hideMessagesTab();
}
}
});
}
return showMessageToggleButton;
}
Aggregations