use of com.intellij.openapi.roots.ui.configuration.projectRoot.JdkListConfigurable in project intellij-community by JetBrains.
the class JdkComboBox method setSetupButton.
public void setSetupButton(final JButton setUpButton, @Nullable final Project project, final ProjectSdksModel jdksModel, final JdkComboBoxItem firstItem, @Nullable final Condition<Sdk> additionalSetup, final String actionGroupTitle) {
mySetUpButton = setUpButton;
mySetUpButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
DefaultActionGroup group = new DefaultActionGroup();
jdksModel.createAddActions(group, JdkComboBox.this, getSelectedJdk(), jdk -> {
if (project != null) {
final JdkListConfigurable configurable = JdkListConfigurable.getInstance(project);
configurable.addJdkNode(jdk, false);
}
reloadModel(new ActualJdkComboBoxItem(jdk), project);
setSelectedJdk(jdk);
if (additionalSetup != null) {
if (additionalSetup.value(jdk)) {
setSelectedJdk(firstItem.getJdk());
}
}
}, myCreationFilter);
final DataContext dataContext = DataManager.getInstance().getDataContext(JdkComboBox.this);
if (group.getChildrenCount() > 1) {
JBPopupFactory.getInstance().createActionGroupPopup(actionGroupTitle, group, dataContext, JBPopupFactory.ActionSelectionAid.MNEMONICS, false).showUnderneathOf(setUpButton);
} else {
final AnActionEvent event = new AnActionEvent(null, dataContext, ActionPlaces.UNKNOWN, new Presentation(""), ActionManager.getInstance(), 0);
group.getChildren(event)[0].actionPerformed(event);
}
}
});
}
Aggregations