diff --git a/java/idea-ui/src/com/intellij/ide/util/projectWizard/JdkChooserPanel.java b/java/idea-ui/src/com/intellij/ide/util/projectWizard/JdkChooserPanel.java index 924f2f419bf7..3fd85200e823 100644 --- a/java/idea-ui/src/com/intellij/ide/util/projectWizard/JdkChooserPanel.java +++ b/java/idea-ui/src/com/intellij/ide/util/projectWizard/JdkChooserPanel.java @@ -26,7 +26,7 @@ import com.intellij.openapi.projectRoots.SdkType; import com.intellij.openapi.projectRoots.ui.ProjectJdksEditor; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; -import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectJdksModel; +import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.wm.ex.WindowManagerEx; @@ -152,11 +152,11 @@ public class JdkChooserPanel extends JPanel { jdks = getCompatibleJdks(type, Arrays.asList(allJdks)); } else { - final ProjectJdksModel projectJdksModel = ProjectStructureConfigurable.getInstance(myProject).getProjectJdksModel(); + final ProjectSdksModel projectJdksModel = ProjectStructureConfigurable.getInstance(myProject).getProjectJdksModel(); if (!projectJdksModel.isInitialized()){ //should be initialized projectJdksModel.reset(myProject); } - final Collection collection = projectJdksModel.getProjectJdks().values(); + final Collection collection = projectJdksModel.getProjectSdks().values(); jdks = getCompatibleJdks(type, collection); } Arrays.sort(jdks, new Comparator() { diff --git a/java/idea-ui/src/com/intellij/ide/util/projectWizard/ProjectJdkForModuleStep.java b/java/idea-ui/src/com/intellij/ide/util/projectWizard/ProjectJdkForModuleStep.java index 2ce321b52c26..823c9ef9b7e2 100644 --- a/java/idea-ui/src/com/intellij/ide/util/projectWizard/ProjectJdkForModuleStep.java +++ b/java/idea-ui/src/com/intellij/ide/util/projectWizard/ProjectJdkForModuleStep.java @@ -25,7 +25,7 @@ import com.intellij.openapi.projectRoots.SdkType; import com.intellij.openapi.roots.ex.ProjectRootManagerEx; import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; import com.intellij.openapi.roots.ui.configuration.projectRoot.JdkListConfigurable; -import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectJdksModel; +import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.MultiLineLabelUI; import com.intellij.openapi.util.IconLoader; @@ -80,7 +80,7 @@ public class ProjectJdkForModuleStep extends ModuleWizardStep { final Project project = getProject(context, type); final ProjectStructureConfigurable projectConfig = ProjectStructureConfigurable.getInstance(project); final JdkListConfigurable jdkConfig = JdkListConfigurable.getInstance(project); - final ProjectJdksModel projectJdksModel = projectConfig.getProjectJdksModel(); + final ProjectSdksModel projectJdksModel = projectConfig.getProjectJdksModel(); final boolean[] successfullyAdded = new boolean[1]; projectJdksModel.doAdd(type, myPanel, new Consumer() { public void consume(final Sdk jdk) { 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 9d44258deaa1..7529737d2b30 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 @@ -23,7 +23,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectBundle; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.roots.ui.configuration.projectRoot.JdkListConfigurable; -import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectJdksModel; +import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.Condition; @@ -47,7 +47,7 @@ import java.util.Comparator; class JdkComboBox extends JComboBox{ private final JButton myEditButton = new JButton(ApplicationBundle.message("button.edit")); - public JdkComboBox(final ProjectJdksModel jdksModel) { + public JdkComboBox(final ProjectSdksModel jdksModel) { super(new JdkComboBoxModel(jdksModel)); setRenderer(new ProjectJdkListRenderer() { protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) { @@ -59,7 +59,7 @@ class JdkComboBox extends JComboBox{ else if (value instanceof ProjectJdkComboBoxItem){ final ProjectJdkComboBoxItem item = (ProjectJdkComboBoxItem)value; final String str = item.toString(); - final Sdk jdk = jdksModel.getProjectJdk(); + final Sdk jdk = jdksModel.getProjectSdk(); if (jdk != null){ setIcon(jdk.getSdkType().getIcon()); append(ProjectBundle.message("project.roots.project.jdk.inherited"), SimpleTextAttributes.REGULAR_ATTRIBUTES); @@ -97,13 +97,13 @@ class JdkComboBox extends JComboBox{ return minSize; } - public JButton createSetupButton(final Project project, final ProjectJdksModel jdksModel, final JdkComboBoxItem firstItem) { + 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 ProjectJdksModel jdksModel, + final ProjectSdksModel jdksModel, final JdkComboBoxItem firstItem, final Condition additionalSetup, final boolean moduleJdkSetup) { @@ -144,7 +144,7 @@ class JdkComboBox extends JComboBox{ public void actionPerformed(ActionEvent e) { final JdkComboBoxItem selectedItem = getSelectedItem(); if (selectedItem instanceof ProjectJdkComboBoxItem) { - myEditButton.setEnabled(ProjectStructureConfigurable.getInstance(project).getProjectJdksModel().getProjectJdk() != null); + myEditButton.setEnabled(ProjectStructureConfigurable.getInstance(project).getProjectJdksModel().getProjectSdk() != null); } else { myEditButton.setEnabled(!(selectedItem instanceof InvalidJdkComboBoxItem) && selectedItem != null && selectedItem.getJdk() != null); } @@ -212,8 +212,8 @@ class JdkComboBox extends JComboBox{ final DefaultComboBoxModel model = ((DefaultComboBoxModel)getModel()); model.removeAllElements(); model.addElement(firstItem); - final ProjectJdksModel projectJdksModel = ProjectStructureConfigurable.getInstance(project).getProjectJdksModel(); - final ArrayList projectJdks = new ArrayList(projectJdksModel.getProjectJdks().values()); + final ProjectSdksModel projectJdksModel = ProjectStructureConfigurable.getInstance(project).getProjectJdksModel(); + final ArrayList projectJdks = new ArrayList(projectJdksModel.getProjectSdks().values()); Collections.sort(projectJdks, new Comparator() { public int compare(final Sdk o1, final Sdk o2) { return o1.getName().compareToIgnoreCase(o2.getName()); @@ -225,7 +225,7 @@ class JdkComboBox extends JComboBox{ } private static class JdkComboBoxModel extends DefaultComboBoxModel { - public JdkComboBoxModel(final ProjectJdksModel jdksModel) { + public JdkComboBoxModel(final ProjectSdksModel jdksModel) { super(); final Sdk[] jdks = jdksModel.getSdks(); Arrays.sort(jdks, new Comparator() { 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 728167753479..bbaa045e1bf0 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 @@ -24,7 +24,7 @@ import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.projectRoots.SdkModel; import com.intellij.openapi.roots.ModifiableRootModel; import com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable; -import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectJdksModel; +import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext; import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; import com.intellij.openapi.ui.DialogWrapper; @@ -47,7 +47,7 @@ public abstract class ModuleJdkConfigurable implements Disposable { private Sdk mySelectedModuleJdk = null; private JPanel myJdkPanel; private ClasspathEditor myModuleEditor; - private final ProjectJdksModel myJdksModel; + private final ProjectSdksModel myJdksModel; private boolean myFreeze = false; private final SdkModel.Listener myListener = new SdkModel.Listener() { public void sdkAdded(Sdk sdk) { @@ -67,7 +67,7 @@ public abstract class ModuleJdkConfigurable implements Disposable { } }; - public ModuleJdkConfigurable(ClasspathEditor moduleEditor, ProjectJdksModel jdksModel) { + public ModuleJdkConfigurable(ClasspathEditor moduleEditor, ProjectSdksModel jdksModel) { myModuleEditor = moduleEditor; myJdksModel = jdksModel; myJdksModel.addListener(myListener); @@ -122,7 +122,7 @@ public abstract class ModuleJdkConfigurable implements Disposable { final JButton setUpButton = myCbModuleJdk .createSetupButton(project, myJdksModel, new JdkComboBox.ProjectJdkComboBoxItem(), new Condition(){ public boolean value(Sdk jdk) { - final Sdk projectJdk = myJdksModel.getProjectJdk(); + final Sdk projectJdk = myJdksModel.getProjectSdk(); if (projectJdk == null){ final int res = Messages.showYesNoDialog(myJdkPanel, @@ -130,7 +130,7 @@ public abstract class ModuleJdkConfigurable implements Disposable { ProjectBundle.message("project.roots.no.jdk.on.projecct.title"), Messages.getInformationIcon()); if (res == DialogWrapper.OK_EXIT_CODE){ - myJdksModel.setProjectJdk(jdk); + myJdksModel.setProjectSdk(jdk); return true; } } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModulesConfigurator.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModulesConfigurator.java index 6655a196ea72..17c7ddc6cc91 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModulesConfigurator.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModulesConfigurator.java @@ -41,7 +41,7 @@ import com.intellij.openapi.roots.ModuleRootModel; import com.intellij.openapi.roots.impl.ProjectRootManagerImpl; import com.intellij.openapi.roots.ui.configuration.actions.ModuleDeleteProvider; import com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable; -import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectJdksModel; +import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext; import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; import com.intellij.openapi.ui.Messages; @@ -91,7 +91,7 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change private StructureConfigurableContext myContext; private final List myAllModulesChangeListeners = new ArrayList(); - public ModulesConfigurator(Project project, ProjectJdksModel projectJdksModel) { + public ModulesConfigurator(Project project, ProjectSdksModel projectJdksModel) { myProject = project; myModuleModel = ModuleManager.getInstance(myProject).getModifiableModel(); myProjectConfigurable = new ProjectConfigurable(project, this, projectJdksModel); diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectConfigurable.java index 3ad9750ff697..87c3740e0fad 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectConfigurable.java @@ -27,7 +27,7 @@ import com.intellij.openapi.project.ProjectBundle; import com.intellij.openapi.roots.CompilerProjectExtension; import com.intellij.openapi.roots.LanguageLevelProjectExtension; import com.intellij.openapi.roots.ModifiableRootModel; -import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectJdksModel; +import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; import com.intellij.openapi.ui.DetailsComponent; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.NamedConfigurable; @@ -82,7 +82,7 @@ public class ProjectConfigurable extends NamedConfigurable implements D private boolean myFreeze = false; private DetailsComponent myDetailsComponent; - public ProjectConfigurable(Project project, ModulesConfigurator configurator, ProjectJdksModel model) { + public ProjectConfigurable(Project project, ModulesConfigurator configurator, ProjectSdksModel model) { myProject = project; myModulesConfigurator = configurator; init(model); @@ -103,7 +103,7 @@ public class ProjectConfigurable extends NamedConfigurable implements D return myDetailsComponent.getComponent(); } - private void init(final ProjectJdksModel model) { + private void init(final ProjectSdksModel model) { myPanel = new MyJPanel(); myPanel.setPreferredSize(new Dimension(700, 500)); 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 bb39ec3efdbb..5567ef30be8d 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 @@ -25,7 +25,7 @@ import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.projectRoots.SdkModel; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable; -import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectJdksModel; +import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext; import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; import com.intellij.openapi.util.Comparing; @@ -45,7 +45,7 @@ public class ProjectJdkConfigurable implements UnnamedConfigurable { private JdkComboBox myCbProjectJdk; private JPanel myJdkPanel; private final Project myProject; - private final ProjectJdksModel myJdksModel; + private final ProjectSdksModel myJdksModel; private final SdkModel.Listener myListener = new SdkModel.Listener() { public void sdkAdded(Sdk sdk) { reloadModel(); @@ -66,7 +66,7 @@ public class ProjectJdkConfigurable implements UnnamedConfigurable { private boolean myFreeze = false; - public ProjectJdkConfigurable(Project project, final ProjectJdksModel jdksModel) { + public ProjectJdkConfigurable(Project project, final ProjectSdksModel jdksModel) { myProject = project; myJdksModel = jdksModel; myJdksModel.addListener(myListener); @@ -84,7 +84,7 @@ public class ProjectJdkConfigurable implements UnnamedConfigurable { private void reloadModel() { myFreeze = true; - final Sdk projectJdk = myJdksModel.getProjectJdk(); + final Sdk projectJdk = myJdksModel.getProjectSdk(); myCbProjectJdk.reloadModel(new JdkComboBox.NoneJdkComboBoxItem(), myProject); final String sdkName = projectJdk == null ? ProjectRootManager.getInstance(myProject).getProjectJdkName() : projectJdk.getName(); if (sdkName != null) { @@ -108,8 +108,8 @@ public class ProjectJdkConfigurable implements UnnamedConfigurable { myCbProjectJdk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (myFreeze) return; - final Sdk oldJdk = myJdksModel.getProjectJdk(); - myJdksModel.setProjectJdk(myCbProjectJdk.getSelectedJdk()); + final Sdk oldJdk = myJdksModel.getProjectSdk(); + myJdksModel.setProjectSdk(myCbProjectJdk.getSelectedJdk()); clearCaches(); } }); @@ -120,7 +120,7 @@ public class ProjectJdkConfigurable implements UnnamedConfigurable { 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() { @Nullable public Sdk compute() { - return myJdksModel.getProjectJdk(); + return myJdksModel.getProjectSdk(); } }); } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectJdksConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectJdksConfigurable.java index 7fbd1a4ed2d0..3edad868db79 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectJdksConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectJdksConfigurable.java @@ -32,7 +32,7 @@ import com.intellij.openapi.project.ProjectBundle; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; import com.intellij.openapi.roots.ui.configuration.projectRoot.JdkConfigurable; -import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectJdksModel; +import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; import com.intellij.openapi.ui.MasterDetailsComponent; import com.intellij.openapi.ui.MasterDetailsStateService; import com.intellij.openapi.ui.NamedConfigurable; @@ -56,7 +56,7 @@ import java.util.Set; public class ProjectJdksConfigurable extends MasterDetailsComponent implements Configurable.Assistant { - private final ProjectJdksModel myProjectJdksModel; + private final ProjectSdksModel myProjectJdksModel; private final Project myProject; @NonNls private static final String SPLITTER_PROPORTION = "project.jdk.splitter"; @@ -86,12 +86,12 @@ public class ProjectJdksConfigurable extends MasterDetailsComponent implements C myProjectJdksModel.reset(myProject); myRoot.removeAllChildren(); - final HashMap sdks = myProjectJdksModel.getProjectJdks(); + final HashMap sdks = myProjectJdksModel.getProjectSdks(); for (Sdk sdk : sdks.keySet()) { final JdkConfigurable configurable = new JdkConfigurable((ProjectJdkImpl)sdks.get(sdk), myProjectJdksModel, TREE_UPDATER, myHistory, myProject); addNode(new MyNode(configurable), myRoot); } - selectJdk(myProjectJdksModel.getProjectJdk()); //restore selection + selectJdk(myProjectJdksModel.getProjectSdk()); //restore selection final String value = PropertiesComponent.getInstance().getValue(SPLITTER_PROPORTION); if (value != null) { try { @@ -127,7 +127,7 @@ public class ProjectJdksConfigurable extends MasterDetailsComponent implements C } if (myProjectJdksModel.isModified() || modifiedJdks) myProjectJdksModel.apply(this); - myProjectJdksModel.setProjectJdk(getSelectedJdk()); + myProjectJdksModel.setProjectSdk(getSelectedJdk()); } @@ -168,17 +168,17 @@ public class ProjectJdksConfigurable extends MasterDetailsComponent implements C final NamedConfigurable namedConfigurable = (NamedConfigurable)node.getUserObject(); jdks.add(((JdkConfigurable)namedConfigurable).getEditableObject()); } - final HashMap sdks = new HashMap(myProjectJdksModel.getProjectJdks()); + final HashMap sdks = new HashMap(myProjectJdksModel.getProjectSdks()); for (Sdk sdk : sdks.values()) { if (!jdks.contains(sdk)) { - myProjectJdksModel.removeJdk(sdk); + myProjectJdksModel.removeSdk(sdk); } } } protected boolean wasObjectStored(Object editableObject) { //noinspection RedundantCast - return myProjectJdksModel.getProjectJdks().containsKey((Sdk)editableObject); + return myProjectJdksModel.getProjectSdks().containsKey((Sdk)editableObject); } @Nullable diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectStructureConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectStructureConfigurable.java index 1003a570f891..89b6c5db4681 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectStructureConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectStructureConfigurable.java @@ -84,7 +84,7 @@ public class ProjectStructureConfigurable extends BaseConfigurable implements Se private Configurable mySelectedConfigurable; - private final ProjectJdksModel myProjectJdksModel = new ProjectJdksModel(); + private final ProjectSdksModel myProjectJdksModel = new ProjectSdksModel(); private ProjectConfigurable myProjectConfig; private final ProjectLibrariesConfigurable myProjectLibrariesConfig; @@ -473,7 +473,7 @@ public class ProjectStructureConfigurable extends BaseConfigurable implements Se return ShowSettingsUtil.getInstance().findProjectConfigurable(project, ProjectStructureConfigurable.class); } - public ProjectJdksModel getProjectJdksModel() { + public ProjectSdksModel getProjectJdksModel() { return myProjectJdksModel; } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/UIRootConfigurationAccessor.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/UIRootConfigurationAccessor.java index b5993de2ac5d..f4e15ab614bb 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/UIRootConfigurationAccessor.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/UIRootConfigurationAccessor.java @@ -22,7 +22,7 @@ import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.roots.impl.RootConfigurationAccessor; import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable; -import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectJdksModel; +import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext; import org.jetbrains.annotations.Nullable; @@ -51,7 +51,7 @@ public class UIRootConfigurationAccessor extends RootConfigurationAccessor { @Nullable public Sdk getSdk(final Sdk sdk, final String sdkName) { - final ProjectJdksModel model = ProjectStructureConfigurable.getInstance(myProject).getJdkConfig().getJdksTreeModel(); + final ProjectSdksModel model = ProjectStructureConfigurable.getInstance(myProject).getJdkConfig().getJdksTreeModel(); return sdkName != null ? model.findSdk(sdkName) : sdk; } @@ -63,7 +63,7 @@ public class UIRootConfigurationAccessor extends RootConfigurationAccessor { } public Sdk getProjectSdk(final Project project) { - return ProjectStructureConfigurable.getInstance(project).getProjectJdksModel().getProjectJdk(); + return ProjectStructureConfigurable.getInstance(project).getProjectJdksModel().getProjectSdk(); } @Nullable @@ -74,7 +74,7 @@ public class UIRootConfigurationAccessor extends RootConfigurationAccessor { return projectJdk.getName(); } else { - final ProjectJdksModel projectJdksModel = ProjectStructureConfigurable.getInstance(project).getProjectJdksModel(); + final ProjectSdksModel projectJdksModel = ProjectStructureConfigurable.getInstance(project).getProjectJdksModel(); return projectJdksModel.findSdk(projectJdkName) == null ? projectJdkName : null; } } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/JdkConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/JdkConfigurable.java index eab16fa91cd7..0affa63122e5 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/JdkConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/JdkConfigurable.java @@ -43,7 +43,7 @@ public class JdkConfigurable extends ProjectStructureElementConfigurable im private final SdkProjectStructureElement myProjectStructureElement; public JdkConfigurable(final ProjectJdkImpl projectJdk, - final ProjectJdksModel configurable, + final ProjectSdksModel configurable, final Runnable updateTree, @NotNull History history, Project project) { super(true, updateTree); myProjectJdk = projectJdk; diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/JdkListConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/JdkListConfigurable.java index 1204e297a568..5e50739e9081 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/JdkListConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/JdkListConfigurable.java @@ -56,7 +56,7 @@ import java.util.List; ) public class JdkListConfigurable extends BaseStructureConfigurable { - private final ProjectJdksModel myJdksTreeModel; + private final ProjectSdksModel myJdksTreeModel; SdkModel.Listener myListener = new SdkModel.Listener() { @@ -124,7 +124,7 @@ public class JdkListConfigurable extends BaseStructureConfigurable { } protected void loadTree() { - final HashMap sdks = myJdksTreeModel.getProjectJdks(); + final HashMap sdks = myJdksTreeModel.getProjectSdks(); for (Sdk sdk : sdks.keySet()) { final JdkConfigurable configurable = new JdkConfigurable((ProjectJdkImpl)sdks.get(sdk), myJdksTreeModel, TREE_UPDATER, myHistory, myProject); @@ -136,7 +136,7 @@ public class JdkListConfigurable extends BaseStructureConfigurable { @Override protected Collection getProjectStructureElements() { final List result = new ArrayList(); - for (Sdk sdk : myJdksTreeModel.getProjectJdks().values()) { + for (Sdk sdk : myJdksTreeModel.getProjectSdks().values()) { result.add(new SdkProjectStructureElement(myContext, sdk)); } return result; @@ -159,7 +159,7 @@ public class JdkListConfigurable extends BaseStructureConfigurable { myJdksTreeModel.disposeUIResources(); } - public ProjectJdksModel getJdksTreeModel() { + public ProjectSdksModel getJdksTreeModel() { return myJdksTreeModel; } @@ -179,7 +179,7 @@ public class JdkListConfigurable extends BaseStructureConfigurable { } if (myJdksTreeModel.isModified() || modifiedJdks) myJdksTreeModel.apply(this); - myJdksTreeModel.setProjectJdk(ProjectRootManager.getInstance(myProject).getProjectJdk()); + myJdksTreeModel.setProjectSdk(ProjectRootManager.getInstance(myProject).getProjectJdk()); } public boolean isModified() { @@ -205,7 +205,7 @@ public class JdkListConfigurable extends BaseStructureConfigurable { } protected void removeJdk(final Sdk jdk) { - myJdksTreeModel.removeJdk(jdk); + myJdksTreeModel.removeSdk(jdk); myContext.getDaemonAnalyzer().removeElement(new SdkProjectStructureElement(myContext, jdk)); } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectJdksModel.java b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectSdksModel.java similarity index 84% rename from java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectJdksModel.java rename to platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectSdksModel.java index a4b528383fac..bd94026ada69 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectJdksModel.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectSdksModel.java @@ -45,15 +45,15 @@ import java.util.HashMap; * User: anna * Date: 05-Jun-2006 */ -public class ProjectJdksModel implements SdkModel { - private static final Logger LOG = Logger.getInstance("com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectJdksModel"); +public class ProjectSdksModel implements SdkModel { + private static final Logger LOG = Logger.getInstance("com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel"); - private final HashMap myProjectJdks = new HashMap(); - private final EventDispatcher mySdkEventsDispatcher = EventDispatcher.create(SdkModel.Listener.class); + private final HashMap myProjectSdks = new HashMap(); + private final EventDispatcher mySdkEventsDispatcher = EventDispatcher.create(Listener.class); private boolean myModified = false; - private Sdk myProjectJdk; + private Sdk myProjectSdk; private boolean myInitialized = false; public Listener getMulticaster() { @@ -61,12 +61,12 @@ public class ProjectJdksModel implements SdkModel { } public Sdk[] getSdks() { - return myProjectJdks.values().toArray(new Sdk[myProjectJdks.size()]); + return myProjectSdks.values().toArray(new Sdk[myProjectSdks.size()]); } @Nullable public Sdk findSdk(String sdkName) { - for (Sdk projectJdk : myProjectJdks.values()) { + for (Sdk projectJdk : myProjectSdks.values()) { if (Comparing.strEqual(projectJdk.getName(), sdkName)) return projectJdk; } return null; @@ -81,28 +81,28 @@ public class ProjectJdksModel implements SdkModel { } public void reset(Project project) { - myProjectJdks.clear(); + myProjectSdks.clear(); final Sdk[] projectJdks = ProjectJdkTable.getInstance().getAllJdks(); for (Sdk jdk : projectJdks) { try { - myProjectJdks.put(jdk, (Sdk)jdk.clone()); + myProjectSdks.put(jdk, (Sdk)jdk.clone()); } catch (CloneNotSupportedException e) { //can't be } } - myProjectJdk = findSdk(ProjectRootManager.getInstance(project).getProjectJdkName()); + myProjectSdk = findSdk(ProjectRootManager.getInstance(project).getProjectJdkName()); myModified = false; myInitialized = true; } public void disposeUIResources() { - myProjectJdks.clear(); + myProjectSdks.clear(); myInitialized = false; } - public HashMap getProjectJdks() { - return myProjectJdks; + public HashMap getProjectSdks() { + return myProjectSdks; } public boolean isModified(){ @@ -121,7 +121,7 @@ public class ProjectJdksModel implements SdkModel { public void run() { final ProjectJdkTable jdkTable = ProjectJdkTable.getInstance(); for (final Sdk tableItem : allFromTable) { - if (myProjectJdks.containsKey(tableItem)) { + if (myProjectSdks.containsKey(tableItem)) { itemsInTable.add(tableItem); } else { @@ -135,13 +135,13 @@ public class ProjectJdksModel implements SdkModel { // Now all removed items are deleted from table, itemsInTable contains all items in table final ProjectJdkTable jdkTable = ProjectJdkTable.getInstance(); for (Sdk originalJdk : itemsInTable) { - final Sdk modifiedJdk = myProjectJdks.get(originalJdk); + final Sdk modifiedJdk = myProjectSdks.get(originalJdk); LOG.assertTrue(modifiedJdk != null); jdkTable.updateJdk(originalJdk, modifiedJdk); } // Add new items to table final Sdk[] allJdks = jdkTable.getAllJdks(); - for (final Sdk projectJdk : myProjectJdks.keySet()) { + for (final Sdk projectJdk : myProjectSdks.keySet()) { LOG.assertTrue(projectJdk != null); if (ArrayUtil.find(allJdks, projectJdk) == -1) { jdkTable.addJdk(projectJdk); @@ -155,7 +155,7 @@ public class ProjectJdksModel implements SdkModel { private boolean canApply(String[] errorString, MasterDetailsComponent rootConfigurable) throws ConfigurationException { ArrayList allNames = new ArrayList(); Sdk itemWithError = null; - for (Sdk currItem : myProjectJdks.values()) { + for (Sdk currItem : myProjectSdks.values()) { String currName = currItem.getName(); if (currName.length() == 0) { itemWithError = currItem; @@ -188,16 +188,16 @@ public class ProjectJdksModel implements SdkModel { return false; } - public void removeJdk(final Sdk editableObject) { + public void removeSdk(final Sdk editableObject) { Sdk projectJdk = null; - for (Sdk jdk : myProjectJdks.keySet()) { - if (myProjectJdks.get(jdk) == editableObject) { + for (Sdk jdk : myProjectSdks.keySet()) { + if (myProjectSdks.get(jdk) == editableObject) { projectJdk = jdk; break; } } if (projectJdk != null) { - myProjectJdks.remove(projectJdk); + myProjectSdks.remove(projectJdk); mySdkEventsDispatcher.getMulticaster().beforeSdkRemove(projectJdk); myModified = true; } @@ -223,7 +223,7 @@ public class ProjectJdksModel implements SdkModel { if (home == null) { return; } - String newSdkName = SdkConfigurationUtil.createUniqueSdkName(type, home, myProjectJdks.values()); + String newSdkName = SdkConfigurationUtil.createUniqueSdkName(type, home, myProjectSdks.values()); final ProjectJdkImpl newJdk = new ProjectJdkImpl(newSdkName, type); newJdk.setHomePath(home); @@ -234,27 +234,27 @@ public class ProjectJdksModel implements SdkModel { ProjectBundle.message("sdk.java.corrupt.title"), Messages.getErrorIcon()); } - myProjectJdks.put(newJdk, newJdk); + myProjectSdks.put(newJdk, newJdk); updateTree.consume(newJdk); mySdkEventsDispatcher.getMulticaster().sdkAdded(newJdk); } @Nullable public Sdk findSdk(@Nullable final Sdk modelJdk) { - for (Sdk jdk : myProjectJdks.keySet()) { - if (Comparing.equal(myProjectJdks.get(jdk), modelJdk)) return jdk; + for (Sdk jdk : myProjectSdks.keySet()) { + if (Comparing.equal(myProjectSdks.get(jdk), modelJdk)) return jdk; } return null; } @Nullable - public Sdk getProjectJdk() { - if (!myProjectJdks.containsValue(myProjectJdk)) return null; - return myProjectJdk; + public Sdk getProjectSdk() { + if (!myProjectSdks.containsValue(myProjectSdk)) return null; + return myProjectSdk; } - public void setProjectJdk(final Sdk projectJdk) { - myProjectJdk = projectJdk; + public void setProjectSdk(final Sdk projectSdk) { + myProjectSdk = projectSdk; } public boolean isInitialized() {