diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JdkComboBox.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JdkComboBox.java index e70b585dac5b..d06839e6df6c 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JdkComboBox.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JdkComboBox.java @@ -18,7 +18,6 @@ package com.intellij.openapi.roots.ui.configuration; import com.intellij.ide.DataManager; import com.intellij.ide.util.projectWizard.ProjectJdkListRenderer; import com.intellij.openapi.actionSystem.DefaultActionGroup; -import com.intellij.openapi.application.ApplicationBundle; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectBundle; import com.intellij.openapi.projectRoots.Sdk; @@ -48,7 +47,6 @@ import java.util.Comparator; * @since May 18, 2005 */ class JdkComboBox extends ComboBoxWithWidePopup { - private final JButton myEditButton = new JButton(ApplicationBundle.message("button.edit")); public JdkComboBox(@NotNull final ProjectSdksModel jdkModel) { super(new JdkComboBoxModel(jdkModel)); @@ -101,17 +99,12 @@ class JdkComboBox extends ComboBoxWithWidePopup { return minSize; } - public JButton createSetupButton(final Project project, final ProjectSdksModel jdksModel, final JdkComboBoxItem firstItem) { - return createSetupButton(project, jdksModel, firstItem, null, false); - } - - - public JButton createSetupButton(final Project project, - final ProjectSdksModel jdksModel, - final JdkComboBoxItem firstItem, - @Nullable final Condition additionalSetup, - final boolean moduleJdkSetup) { - final JButton setUpButton = new JButton(ApplicationBundle.message("button.new")); + public void setSetupButton(final JButton setUpButton, + final Project project, + final ProjectSdksModel jdksModel, + final JdkComboBoxItem firstItem, + @Nullable final Condition additionalSetup, + final boolean moduleJdkSetup) { setUpButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JdkListConfigurable configurable = JdkListConfigurable.getInstance(project); @@ -130,15 +123,15 @@ class JdkComboBox extends ComboBoxWithWidePopup { }); JBPopupFactory.getInstance() .createActionGroupPopup(ProjectBundle.message("project.roots.set.up.jdk.title", moduleJdkSetup ? 1 : 2), group, - DataManager.getInstance().getDataContext(JdkComboBox.this), JBPopupFactory.ActionSelectionAid.MNEMONICS, false) + DataManager.getInstance().getDataContext(JdkComboBox.this), JBPopupFactory.ActionSelectionAid.MNEMONICS, + false) .showUnderneathOf(setUpButton); } }); - return setUpButton; } - public void appendEditButton(final Project project, final JPanel panel, GridBagConstraints gc, final Computable retrieveJDK){ - myEditButton.addActionListener(new ActionListener() { + public void setEditButton(final JButton editButton, final Project project, final Computable retrieveJDK){ + editButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final Sdk projectJdk = retrieveJDK.compute(); if (projectJdk != null) { @@ -146,17 +139,17 @@ class JdkComboBox extends ComboBoxWithWidePopup { } } }); - addActionListener(new ActionListener(){ + addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JdkComboBoxItem selectedItem = getSelectedItem(); if (selectedItem instanceof ProjectJdkComboBoxItem) { - myEditButton.setEnabled(ProjectStructureConfigurable.getInstance(project).getProjectJdksModel().getProjectSdk() != null); - } else { - myEditButton.setEnabled(!(selectedItem instanceof InvalidJdkComboBoxItem) && selectedItem != null && selectedItem.getJdk() != null); + editButton.setEnabled(ProjectStructureConfigurable.getInstance(project).getProjectJdksModel().getProjectSdk() != null); + } + else { + editButton.setEnabled(!(selectedItem instanceof InvalidJdkComboBoxItem) && selectedItem != null && selectedItem.getJdk() != null); } } }); - panel.add(myEditButton, gc); } public JdkComboBoxItem getSelectedItem() { diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModuleJdkConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModuleJdkConfigurable.java index 718f923efcea..3dd421d20568 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModuleJdkConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModuleJdkConfigurable.java @@ -17,6 +17,7 @@ package com.intellij.openapi.roots.ui.configuration; import com.intellij.openapi.Disposable; +import com.intellij.openapi.application.ApplicationBundle; import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectBundle; @@ -119,17 +120,18 @@ public abstract class ModuleJdkConfigurable implements Disposable { GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(6, 6, 12, 0), 0, 0)); final Project project = getRootModel().getModule().getProject(); - final JButton setUpButton = myCbModuleJdk - .createSetupButton(project, myJdksModel, new JdkComboBox.ProjectJdkComboBoxItem(), new Condition(){ + final JButton setUpButton = new JButton(ApplicationBundle.message("button.new")); + myCbModuleJdk + .setSetupButton(setUpButton, project, myJdksModel, new JdkComboBox.ProjectJdkComboBoxItem(), new Condition() { public boolean value(Sdk jdk) { final Sdk projectJdk = myJdksModel.getProjectSdk(); - if (projectJdk == null){ + if (projectJdk == null) { final int res = Messages.showYesNoDialog(myJdkPanel, ProjectBundle.message("project.roots.no.jdk.on.project.message"), - ProjectBundle.message("project.roots.no.jdk.on.projecct.title"), + ProjectBundle.message("project.roots.no.jdk.on.project.title"), Messages.getInformationIcon()); - if (res == DialogWrapper.OK_EXIT_CODE){ + if (res == DialogWrapper.OK_EXIT_CODE) { myJdksModel.setProjectSdk(jdk); return true; } @@ -140,12 +142,16 @@ public abstract class ModuleJdkConfigurable implements Disposable { myJdkPanel.add(setUpButton, new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 4, 7, 0), 0, 0)); - myCbModuleJdk.appendEditButton(getRootModel().getModule().getProject(), myJdkPanel, new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 4, 7, 0), 0, 0) , new Computable() { + final JButton editButton = new JButton(ApplicationBundle.message("button.edit")); + myCbModuleJdk.setEditButton(editButton, getRootModel().getModule().getProject(), new Computable() { @Nullable public Sdk compute() { return getRootModel().getSdk(); } }); + myJdkPanel.add(editButton, + new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, + new Insets(0, 4, 7, 0), 0, 0)); } private void clearCaches() { diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectJdkConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectJdkConfigurable.java index 54a36d3c569f..ade16cb422a5 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectJdkConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectJdkConfigurable.java @@ -16,6 +16,7 @@ package com.intellij.openapi.roots.ui.configuration; +import com.intellij.openapi.application.ApplicationBundle; import com.intellij.openapi.module.Module; import com.intellij.openapi.options.UnnamedConfigurable; import com.intellij.openapi.project.Project; @@ -90,14 +91,19 @@ public class ProjectJdkConfigurable implements UnnamedConfigurable { }); myJdkPanel.add(new JLabel(ProjectBundle.message("module.libraries.target.jdk.project.radio")), new GridBagConstraints(0, 0, 3, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 4, 0), 0, 0)); myJdkPanel.add(myCbProjectJdk, new GridBagConstraints(0, 1, 1, 1, 0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 4, 0, 0), 0, 0)); - final JButton setUpButton = myCbProjectJdk.createSetupButton(myProject, myJdksModel, new JdkComboBox.NoneJdkComboBoxItem()); + final JButton setUpButton = new JButton(ApplicationBundle.message("button.new")); + myCbProjectJdk.setSetupButton(setUpButton, myProject, myJdksModel, new JdkComboBox.NoneJdkComboBoxItem(), null, false); myJdkPanel.add(setUpButton, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 4, 0, 0), 0, 0)); - myCbProjectJdk.appendEditButton(myProject, myJdkPanel, new GridBagConstraints(GridBagConstraints.RELATIVE, 1, 1, 1, 1.0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 4, 0, 0), 0, 0), new Computable() { + final JButton editButton = new JButton(ApplicationBundle.message("button.edit")); + myCbProjectJdk.setEditButton(editButton, myProject, new Computable() { @Nullable public Sdk compute() { return myJdksModel.getProjectSdk(); } }); + + myJdkPanel.add(editButton, new GridBagConstraints(GridBagConstraints.RELATIVE, 1, 1, 1, 1.0, 0, GridBagConstraints.NORTHWEST, + GridBagConstraints.NONE, new Insets(0, 4, 0, 0), 0, 0)); } return myJdkPanel; } diff --git a/platform/platform-resources-en/src/messages/ApplicationBundle.properties b/platform/platform-resources-en/src/messages/ApplicationBundle.properties index 8b853b5fa2d2..d6dd20356183 100644 --- a/platform/platform-resources-en/src/messages/ApplicationBundle.properties +++ b/platform/platform-resources-en/src/messages/ApplicationBundle.properties @@ -528,7 +528,7 @@ exclude.from.imports.no.exclusions=No exclude patterns inline.elements=Inline elements: don.t.break.if.inline.content=Don't break if inline content: edit.code.folding.options=Open code folding options -button.new=&New +button.new=&New... building.include.indices=Building include indices... loading.include.indices=Loading include indices... use.external.annotations=Use &external annotations diff --git a/platform/platform-resources-en/src/messages/ProjectBundle.properties b/platform/platform-resources-en/src/messages/ProjectBundle.properties index 694fc07924ea..c25a73143233 100644 --- a/platform/platform-resources-en/src/messages/ProjectBundle.properties +++ b/platform/platform-resources-en/src/messages/ProjectBundle.properties @@ -297,7 +297,7 @@ facet.banner.text=Facet ''{0}'' project.roots.project.banner.text=General Settings for Project ''{0}'' project.roots.set.up.jdk.title=Set up {0, choice, 1#module|2#project} SDK project.roots.no.jdk.on.project.message=Set up created sdk on project? -project.roots.no.jdk.on.projecct.title=No project sdk set up +project.roots.no.jdk.on.project.title=Create SDK project.roots.jdks.node.text=JDK stands for the Java Development Kit, a software development package that is required to write, test and debug Java applications. \ JDK also contains classes and runtime environment that are used to execute the target application.

\ Mobile SDK contains emulator of mobile phone as well as embedded Java SDK to compile/pack/run/debug J2ME applications.

\