public OCamlToolWindowSettingsForm(@NotNull final Project project) { myProject = project; final List<Sdk> allSdks = ProjectJdkTable.getInstance().getSdksOfType(OCamlSdkType.getInstance()); allSdks.add(0, null); mySdkComboBox.setModel(new CollectionComboBoxModel(allSdks, null)); mySdkComboBox.setRenderer(new SdkListCellRenderer("<Project Default>")); myConfigureButton.addActionListener(new ActionListener() { public void actionPerformed(@NotNull final ActionEvent e) { final ProjectJdksEditor editor = new ProjectJdksEditor((Sdk) mySdkComboBox.getSelectedItem(), myProject, mySdkComboBox); editor.show(); if (editor.isOK()) { setSelectedSdk(editor.getSelectedJdk()); } } }); final FileChooserDescriptor workingDirChooserDescriptor = new FileChooserDescriptor(false, true, false, false, false, false); workingDirChooserDescriptor.setRoot(myProject.getBaseDir()); myWorkingDirectoryEditor.addBrowseFolderListener("Select Working Directory", "", myProject, workingDirChooserDescriptor); }
LuaSdkComboBox() { addActionListener(e -> { Sdk selectedSdk = getSelectedSdk(); final Project project = myProject != null ? myProject : ProjectManager.getInstance().getDefaultProject(); ProjectJdksEditor editor = new ProjectJdksEditor(selectedSdk, project, LuaSdkComboBox.this); if (editor.showAndGet()) { selectedSdk = editor.getSelectedJdk(); updateSdkList(selectedSdk, false); } }); updateSdkList(null, true); }
public void editJdkTable() { ProjectJdksEditor editor = new ProjectJdksEditor((Sdk)myList.getSelectedValue(), myProject != null ? myProject : ProjectManager.getInstance().getDefaultProject(), myList); if (editor.showAndGet()) { Sdk selectedJdk = editor.getSelectedJdk(); updateList(selectedJdk, null); } }
public PythonSdkComboBox() { getComboBox().setRenderer(new PySdkListCellRenderer("<No Interpreter>", null)); addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Sdk selectedSdk = getSelectedSdk(); final Project project = myProject != null ? myProject : ProjectManager.getInstance().getDefaultProject(); ProjectJdksEditor editor = new ProjectJdksEditor(selectedSdk, project, PythonSdkComboBox.this); if (editor.showAndGet()) { selectedSdk = editor.getSelectedJdk(); updateSdkList(selectedSdk, false); } } }); updateSdkList(null, true); }
public AndroidSdkComboBoxWithBrowseButton() { final JComboBox sdkCombobox = getComboBox(); sdkCombobox.setRenderer(new ListCellRendererWrapper() { @Override public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) { if (value instanceof Sdk) { final Sdk sdk = (Sdk)value; setText(sdk.getName()); setIcon(((SdkType) sdk.getSdkType()).getIcon()); } else { setText("<html><font color='red'>[none]</font></html>"); } } }); addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ProjectJdksEditor editor = new ProjectJdksEditor(null, ProjectManager.getInstance().getDefaultProject(), AndroidSdkComboBoxWithBrowseButton.this); if (editor.showAndGet()) { final Sdk selectedJdk = editor.getSelectedJdk(); rebuildSdksListAndSelectSdk(selectedJdk); if (selectedJdk == null || !isAndroidSdk(selectedJdk)) { Messages.showErrorDialog(AndroidSdkComboBoxWithBrowseButton.this, AndroidBundle.message("select.platform.error"), CommonBundle.getErrorTitle()); } } } }); getButton().setToolTipText(AndroidBundle.message("android.add.sdk.tooltip")); }
public void editJdkTable() { ProjectJdksEditor editor = new ProjectJdksEditor((Sdk)myList.getSelectedValue(), myProject != null ? myProject : ProjectManager.getInstance().getDefaultProject(), myList); editor.show(); if (editor.isOK()) { Sdk selectedJdk = editor.getSelectedJdk(); updateList(selectedJdk, null); } }
public ExecutionTab(final GlobalAntConfiguration antConfiguration, @NotNull final Project project) { myAntGlobalConfiguration = antConfiguration; myProject = project; myAntCommandLine.attachLabel(myAntCmdLineLabel); myAntCommandLine.setDialogCaption(AntBundle.message("run.execution.tab.ant.command.line.dialog.title")); setLabelFor(myJDKLabel, myJDKs); myJDKsController = new ChooseAndEditComboBoxController<Sdk, String>(myJDKs, new Convertor<Sdk, String>() { public String convert(Sdk jdk) { return jdk != null ? jdk.getName() : ""; } }, String.CASE_INSENSITIVE_ORDER) { public Iterator<Sdk> getAllListItems() { Application application = ApplicationManager.getApplication(); if (application == null) { return Collections.singletonList((Sdk)null).iterator(); } ArrayList<Sdk> allJdks = new ArrayList<Sdk>(Arrays.asList(ProjectJdkTable.getInstance().getAllJdks())); allJdks.add(0, null); return allJdks.iterator(); } public Sdk openConfigureDialog(Sdk jdk, JComponent parent) { ProjectJdksEditor editor = new ProjectJdksEditor(jdk, myJDKs.getComboBox()); editor.show(); return editor.getSelectedJdk(); } }; UIPropertyBinding.Composite binding = getBinding(); binding.bindString(myAntCommandLine.getTextField(), AntBuildFileImpl.ANT_COMMAND_LINE_PARAMETERS); binding.bindString(myJDKs.getComboBox(), AntBuildFileImpl.CUSTOM_JDK_NAME); binding.addBinding(new RunWithAntBinding(myUseDefaultAnt, myUseCastomAnt, myAnts, myAntGlobalConfiguration)); mySetDefaultAnt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AntSetPanel antSetPanel = new AntSetPanel(myAntGlobalConfiguration); antSetPanel.reset(); antSetPanel.setSelection(myProjectDefaultAnt.find(myAntGlobalConfiguration)); AntInstallation antInstallation = antSetPanel.showDialog(mySetDefaultAnt); if (antInstallation == null) { return; } myProjectDefaultAnt = antInstallation.getReference(); updateDefaultAnt(); } }); }