From b02e6faad3bc609894038252adb2098c0ac2b649 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Tue, 8 May 2012 15:51:40 +0200 Subject: [PATCH] SdkTypeId extracted --- .../compiler/CompileServerManager.java | 2 +- .../compiler/ant/BuildPropertiesImpl.java | 6 ++--- .../javaCompiler/javac/JavacCompiler.java | 4 ++-- .../compiler/server/BuildManager.java | 2 +- .../projectRoots/impl/MockJdkWrapper.java | 6 ++--- .../configurations/CommandLineBuilder.java | 6 ++--- .../openapi/projectRoots/ui/SdkEditor.java | 14 +++++------ .../ui/OrderEntryAppearanceServiceImpl.java | 5 ++-- .../roots/ui/configuration/JdkComboBox.java | 2 +- .../JavadocOrderRootTypeUIFactory.java | 5 ++-- .../intellij/openapi/projectRoots/Sdk.java | 4 ++-- .../openapi/projectRoots/SdkType.java | 2 +- .../navigationToolbar/NavBarPresentation.java | 9 ++++++-- .../impl/nodes/NamedLibraryElementNode.java | 10 ++++---- .../impl/ProjectJdkTableImpl.java | 6 ++--- .../impl/SdkListCellRenderer.java | 3 ++- .../openapi/projectRoots/SdkTypeId.java | 23 +++++++++++++++++++ .../AndroidSdkComboBoxWithBrowseButton.java | 8 ++++--- .../execution/AntCommandLineBuilder.java | 6 ++--- plugins/devkit/src/projectRoots/IdeaJdk.java | 2 +- .../src/projectRoots/IdeaJdkConfigurable.java | 2 +- .../groovy/compiler/GroovyCompilerBase.java | 4 ++-- .../groovy/console/GroovyShellAction.java | 4 ++-- .../groovy/grape/GrabDependencies.java | 19 +++++++++++++-- .../xpath/xslt/run/XsltRunSettingsEditor.java | 5 ++-- 25 files changed, 105 insertions(+), 54 deletions(-) create mode 100644 platform/projectModel-api/src/com/intellij/openapi/projectRoots/SdkTypeId.java diff --git a/java/compiler/impl/src/com/intellij/compiler/CompileServerManager.java b/java/compiler/impl/src/com/intellij/compiler/CompileServerManager.java index 7ac97854bead..3ca46a8cba5d 100644 --- a/java/compiler/impl/src/com/intellij/compiler/CompileServerManager.java +++ b/java/compiler/impl/src/com/intellij/compiler/CompileServerManager.java @@ -517,7 +517,7 @@ public class CompileServerManager implements ApplicationComponent{ } final SdkAdditionalData data = sdk.getSdkAdditionalData(); final String additionalDataXml; - final SdkType sdkType = sdk.getSdkType(); + final SdkType sdkType = (SdkType)sdk.getSdkType(); if (data == null) { additionalDataXml = null; } diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/BuildPropertiesImpl.java b/java/compiler/impl/src/com/intellij/compiler/ant/BuildPropertiesImpl.java index ce38e67262f3..4d26ec529d4b 100644 --- a/java/compiler/impl/src/com/intellij/compiler/ant/BuildPropertiesImpl.java +++ b/java/compiler/impl/src/com/intellij/compiler/ant/BuildPropertiesImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ex.ProjectEx; import com.intellij.openapi.projectRoots.JavaSdkType; import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.projectRoots.SdkType; +import com.intellij.openapi.projectRoots.SdkTypeId; import com.intellij.openapi.roots.OrderRootType; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.roots.libraries.LibraryTable; @@ -137,7 +137,7 @@ public class BuildPropertiesImpl extends BuildProperties { if (jdk.getHomeDirectory() == null) { continue; } - final SdkType sdkType = jdk.getSdkType(); + final SdkTypeId sdkType = jdk.getSdkType(); if (!(sdkType instanceof JavaSdkType) || ((JavaSdkType)sdkType).getBinPath(jdk) == null) { continue; } diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacCompiler.java index 140cd7316644..c9675a861c96 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacCompiler.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacCompiler.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,7 +83,7 @@ public class JavacCompiler extends ExternalCompiler { continue; } checkedJdks.add(jdk); - final SdkType sdkType = jdk.getSdkType(); + final SdkTypeId sdkType = jdk.getSdkType(); if (!(sdkType instanceof JavaSdkType)) { continue; } diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java index 0cc5a1ce09e7..0efa25f378ac 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java @@ -543,7 +543,7 @@ public class BuildManager implements ApplicationComponent{ } final SdkAdditionalData data = sdk.getSdkAdditionalData(); final String additionalDataXml; - final SdkType sdkType = sdk.getSdkType(); + final SdkType sdkType = (SdkType) sdk.getSdkType(); if (data == null) { additionalDataXml = null; } diff --git a/java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java b/java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java index 48ab338af55c..c5b6c66754f2 100644 --- a/java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java +++ b/java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ package com.intellij.openapi.projectRoots.impl; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.projectRoots.SdkAdditionalData; import com.intellij.openapi.projectRoots.SdkModificator; -import com.intellij.openapi.projectRoots.SdkType; +import com.intellij.openapi.projectRoots.SdkTypeId; import com.intellij.openapi.roots.RootProvider; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.io.FileUtil; @@ -56,7 +56,7 @@ public final class MockJdkWrapper implements Sdk { } @NotNull - public SdkType getSdkType() { + public SdkTypeId getSdkType() { return myDelegate.getSdkType(); } diff --git a/java/execution/openapi/src/com/intellij/execution/configurations/CommandLineBuilder.java b/java/execution/openapi/src/com/intellij/execution/configurations/CommandLineBuilder.java index 9a9fac41638b..ac081d04b5c7 100644 --- a/java/execution/openapi/src/com/intellij/execution/configurations/CommandLineBuilder.java +++ b/java/execution/openapi/src/com/intellij/execution/configurations/CommandLineBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.JavaSdkType; import com.intellij.openapi.projectRoots.JdkUtil; import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.projectRoots.SdkType; +import com.intellij.openapi.projectRoots.SdkTypeId; import com.intellij.openapi.util.Computable; public class CommandLineBuilder { @@ -70,7 +70,7 @@ public class CommandLineBuilder { throw new CantRunException(ExecutionBundle.message("run.configuration.error.no.jdk.specified")); } - final SdkType sdkType = jdk.getSdkType(); + final SdkTypeId sdkType = jdk.getSdkType(); if (!(sdkType instanceof JavaSdkType)) { throw new CantRunException(ExecutionBundle.message("run.configuration.error.no.jdk.specified")); } diff --git a/java/idea-ui/src/com/intellij/openapi/projectRoots/ui/SdkEditor.java b/java/idea-ui/src/com/intellij/openapi/projectRoots/ui/SdkEditor.java index 66358ad755cb..e35597ae35d7 100644 --- a/java/idea-ui/src/com/intellij/openapi/projectRoots/ui/SdkEditor.java +++ b/java/idea-ui/src/com/intellij/openapi/projectRoots/ui/SdkEditor.java @@ -167,12 +167,12 @@ public class SdkEditor implements Configurable, Place.Navigator { } protected boolean showTabForType(OrderRootType type) { - return mySdk.getSdkType().isRootTypeApplicable(type); + return ((SdkType) mySdk.getSdkType()).isRootTypeApplicable(type); } private String getHomeFieldLabelValue() { if (mySdk != null) { - return mySdk.getSdkType().getHomeFieldLabel(); + return ((SdkType) mySdk.getSdkType()).getHomeFieldLabel(); } return ProjectBundle.message("sdk.configure.general.home.path"); } @@ -272,7 +272,7 @@ public class SdkEditor implements Configurable, Place.Navigator { final Color fg; if (absolutePath != null && absolutePath.length() > 0) { final File homeDir = new File(absolutePath); - boolean homeMustBeDirectory = mySdk == null || mySdk.getSdkType().getHomeChooserDescriptor().isChooseFolders(); + boolean homeMustBeDirectory = mySdk == null || ((SdkType) mySdk.getSdkType()).getHomeChooserDescriptor().isChooseFolders(); fg = homeDir.exists() && (homeDir.isDirectory() == homeMustBeDirectory) ? UIUtil.getFieldForegroundColor() : PathEditor.INVALID_COLOR; @@ -284,7 +284,7 @@ public class SdkEditor implements Configurable, Place.Navigator { } private void doSelectHomePath(){ - final SdkType sdkType = mySdk.getSdkType(); + final SdkType sdkType = (SdkType)mySdk.getSdkType(); SdkConfigurationUtil.selectSdkHome(sdkType, new Consumer() { @Override public void consume(final String path) { @@ -331,7 +331,7 @@ public class SdkEditor implements Configurable, Place.Navigator { private String suggestSdkName(final String homePath) { final String currentName = mySdk.getName(); - final String suggestedName = mySdk.getSdkType().suggestSdkName(currentName , homePath); + final String suggestedName = ((SdkType) mySdk.getSdkType()).suggestSdkName(currentName , homePath); if (Comparing.equal(currentName, suggestedName)) return currentName; String newSdkName = suggestedName; final Set allNames = new HashSet(); @@ -369,7 +369,7 @@ public class SdkEditor implements Configurable, Place.Navigator { @Nullable private AdditionalDataConfigurable initAdditionalDataConfigurable(Sdk sdk) { - final SdkType sdkType = sdk.getSdkType(); + final SdkType sdkType = (SdkType)sdk.getSdkType(); AdditionalDataConfigurable configurable = myAdditionalDataConfigurables.get(sdkType); if (configurable == null) { configurable = sdkType.createAdditionalDataConfigurable(mySdkModel, myEditedSdkModificator); @@ -394,7 +394,7 @@ public class SdkEditor implements Configurable, Place.Navigator { } public void setHomePath(String path) { - doSetHomePath(path, mySdk.getSdkType()); + doSetHomePath(path, (SdkType)mySdk.getSdkType()); } public String getVersionString() { diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/OrderEntryAppearanceServiceImpl.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/OrderEntryAppearanceServiceImpl.java index 1019e2689729..4cf01ee118f9 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/OrderEntryAppearanceServiceImpl.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/OrderEntryAppearanceServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import com.intellij.openapi.module.ModuleType; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectBundle; import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.projectRoots.SdkType; import com.intellij.openapi.roots.*; import com.intellij.openapi.roots.impl.libraries.LibraryEx; import com.intellij.openapi.roots.libraries.Library; @@ -120,7 +121,7 @@ public class OrderEntryAppearanceServiceImpl extends OrderEntryAppearanceService String name = jdk.getName(); CompositeAppearance appearance = new CompositeAppearance(); - appearance.setIcon(jdk.getSdkType().getIcon()); + appearance.setIcon(((SdkType) jdk.getSdkType()).getIcon()); VirtualFile homeDirectory = jdk.getHomeDirectory(); SimpleTextAttributes attributes = getTextAttributes(homeDirectory != null && homeDirectory.isValid(), selected); CompositeAppearance.DequeEnd ending = appearance.getEnding(); 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 2684628f6e89..9e281dab2ce9 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 @@ -74,7 +74,7 @@ public class JdkComboBox extends ComboBoxWithWidePopup { else if (value instanceof ProjectJdkComboBoxItem) { final Sdk jdk = jdkModel.getProjectSdk(); if (jdk != null) { - setIcon(jdk.getSdkType().getIcon()); + setIcon(((SdkType) jdk.getSdkType()).getIcon()); append(ProjectBundle.message("project.roots.project.jdk.inherited"), SimpleTextAttributes.REGULAR_ATTRIBUTES); append(" (" + jdk.getName() + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES); } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/JavadocOrderRootTypeUIFactory.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/JavadocOrderRootTypeUIFactory.java index f1e4ef3ff206..229f8afb4a35 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/JavadocOrderRootTypeUIFactory.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/JavadocOrderRootTypeUIFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import com.intellij.openapi.actionSystem.CustomShortcutSet; import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; import com.intellij.openapi.project.ProjectBundle; import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.projectRoots.SdkType; import com.intellij.openapi.projectRoots.ui.SdkPathEditor; import com.intellij.openapi.projectRoots.ui.Util; import com.intellij.openapi.roots.JavadocOrderRootType; @@ -85,7 +86,7 @@ public class JavadocOrderRootTypeUIFactory implements OrderRootTypeUIFactory { } private void onSpecifyUrlButtonClicked() { - final String defaultDocsUrl = mySdk == null ? "" : StringUtil.notNullize(mySdk.getSdkType().getDefaultDocumentationUrl(mySdk), ""); + final String defaultDocsUrl = mySdk == null ? "" : StringUtil.notNullize(((SdkType) mySdk.getSdkType()).getDefaultDocumentationUrl(mySdk), ""); VirtualFile virtualFile = Util.showSpecifyJavadocUrlDialog(myPanel, defaultDocsUrl); if(virtualFile != null){ addElement(virtualFile); diff --git a/platform/lang-api/src/com/intellij/openapi/projectRoots/Sdk.java b/platform/lang-api/src/com/intellij/openapi/projectRoots/Sdk.java index 81755117bb22..0952ad062fe5 100644 --- a/platform/lang-api/src/com/intellij/openapi/projectRoots/Sdk.java +++ b/platform/lang-api/src/com/intellij/openapi/projectRoots/Sdk.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable; */ public interface Sdk extends UserDataHolder { @NotNull - SdkType getSdkType(); + SdkTypeId getSdkType(); @NotNull String getName(); diff --git a/platform/lang-api/src/com/intellij/openapi/projectRoots/SdkType.java b/platform/lang-api/src/com/intellij/openapi/projectRoots/SdkType.java index 3f69ade8052a..bf87b86cf7c3 100644 --- a/platform/lang-api/src/com/intellij/openapi/projectRoots/SdkType.java +++ b/platform/lang-api/src/com/intellij/openapi/projectRoots/SdkType.java @@ -34,7 +34,7 @@ import java.util.Collection; import java.util.Collections; import java.util.List; -public abstract class SdkType { +public abstract class SdkType implements SdkTypeId { public static ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.sdkType"); private final String myName; diff --git a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPresentation.java b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPresentation.java index 50526eba63e9..e69cc2b85876 100644 --- a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPresentation.java +++ b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPresentation.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,8 @@ import com.intellij.openapi.module.ModuleType; import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.project.IndexNotReadyException; import com.intellij.openapi.project.Project; +import com.intellij.openapi.projectRoots.SdkType; +import com.intellij.openapi.projectRoots.SdkTypeId; import com.intellij.openapi.roots.JdkOrderEntry; import com.intellij.openapi.roots.LibraryOrderEntry; import com.intellij.openapi.roots.ModuleOrderEntry; @@ -84,7 +86,10 @@ public class NavBarPresentation { catch (IndexNotReadyException e) { return null; } - if (object instanceof JdkOrderEntry) return ((JdkOrderEntry)object).getJdk().getSdkType().getIcon(); + if (object instanceof JdkOrderEntry) { + final SdkTypeId sdkType = ((JdkOrderEntry)object).getJdk().getSdkType(); + return ((SdkType) sdkType).getIcon(); + } if (object instanceof LibraryOrderEntry) return IconLoader.getIcon("/nodes/ppLibClosed.png"); if (object instanceof ModuleOrderEntry) return ModuleType.get(((ModuleOrderEntry)object).getModule()).getNodeIcon(false); return null; diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/NamedLibraryElementNode.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/NamedLibraryElementNode.java index 8704225360b8..b291d6851eb9 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/NamedLibraryElementNode.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/NamedLibraryElementNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import com.intellij.ide.projectView.ViewSettings; import com.intellij.ide.util.treeView.AbstractTreeNode; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.projectRoots.SdkType; import com.intellij.openapi.roots.JdkOrderEntry; import com.intellij.openapi.roots.LibraryOrderEntry; import com.intellij.openapi.roots.OrderEntry; @@ -62,11 +63,12 @@ public class NamedLibraryElementNode extends ProjectViewNode { } protected Icon getSdkIcon(Sdk sdk) { - return sdk.getSdkType().getIcon(); + return ((SdkType) sdk.getSdkType()).getIcon(); } } diff --git a/platform/projectModel-api/src/com/intellij/openapi/projectRoots/SdkTypeId.java b/platform/projectModel-api/src/com/intellij/openapi/projectRoots/SdkTypeId.java new file mode 100644 index 000000000000..895b321f7d72 --- /dev/null +++ b/platform/projectModel-api/src/com/intellij/openapi/projectRoots/SdkTypeId.java @@ -0,0 +1,23 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.projectRoots; + +/** + * @author yole + */ +public interface SdkTypeId { + String getName(); +} diff --git a/plugins/android/src/org/jetbrains/android/newProject/AndroidSdkComboBoxWithBrowseButton.java b/plugins/android/src/org/jetbrains/android/newProject/AndroidSdkComboBoxWithBrowseButton.java index dde97b0ccd2d..6edd2b40f788 100644 --- a/plugins/android/src/org/jetbrains/android/newProject/AndroidSdkComboBoxWithBrowseButton.java +++ b/plugins/android/src/org/jetbrains/android/newProject/AndroidSdkComboBoxWithBrowseButton.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import com.intellij.ide.ui.ListCellRendererWrapper; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.projectRoots.ProjectJdkTable; import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.projectRoots.SdkType; import com.intellij.openapi.projectRoots.ui.ProjectJdksEditor; import com.intellij.openapi.ui.Messages; import com.intellij.ui.ComboboxWithBrowseButton; @@ -42,8 +43,9 @@ public class AndroidSdkComboBoxWithBrowseButton extends ComboboxWithBrowseButton @Override public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) { if (value instanceof Sdk) { - setText(((Sdk)value).getName()); - setIcon(((Sdk)value).getSdkType().getIcon()); + final Sdk sdk = (Sdk)value; + setText(sdk.getName()); + setIcon(((SdkType) sdk.getSdkType()).getIcon()); } else { setText("[none]"); diff --git a/plugins/ant/src/com/intellij/lang/ant/config/execution/AntCommandLineBuilder.java b/plugins/ant/src/com/intellij/lang/ant/config/execution/AntCommandLineBuilder.java index 6ad77a75780f..0e50c94e7df5 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/execution/AntCommandLineBuilder.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/execution/AntCommandLineBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import com.intellij.lang.ant.config.impl.*; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.projectRoots.JavaSdkType; import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.projectRoots.SdkType; +import com.intellij.openapi.projectRoots.SdkTypeId; import com.intellij.openapi.roots.OrderRootType; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.rt.ant.execution.AntMain2; @@ -121,7 +121,7 @@ public class AntCommandLineBuilder { myCommandLine.getClassPath().addAllFiles(AntBuildFileImpl.getUserHomeLibraries()); - final SdkType sdkType = jdk.getSdkType(); + final SdkTypeId sdkType = jdk.getSdkType(); if (sdkType instanceof JavaSdkType) { final String toolsJar = ((JavaSdkType)sdkType).getToolsPath(jdk); if (toolsJar != null) { diff --git a/plugins/devkit/src/projectRoots/IdeaJdk.java b/plugins/devkit/src/projectRoots/IdeaJdk.java index 9501558fb101..5fe877e24d46 100644 --- a/plugins/devkit/src/projectRoots/IdeaJdk.java +++ b/plugins/devkit/src/projectRoots/IdeaJdk.java @@ -255,7 +255,7 @@ public class IdeaJdk extends SdkType implements JavaSdkType { } public static boolean isValidInternalJdk(Sdk ideaSdk, Sdk sdk) { - final SdkType sdkType = sdk.getSdkType(); + final SdkTypeId sdkType = sdk.getSdkType(); if (sdkType instanceof JavaSdk) { final JavaSdkVersion version = JavaSdk.getInstance().getVersion(sdk); JavaSdkVersion requiredVersion = getRequiredJdkVersion(ideaSdk); diff --git a/plugins/devkit/src/projectRoots/IdeaJdkConfigurable.java b/plugins/devkit/src/projectRoots/IdeaJdkConfigurable.java index 57c920014b21..2d02bf3225bc 100644 --- a/plugins/devkit/src/projectRoots/IdeaJdkConfigurable.java +++ b/plugins/devkit/src/projectRoots/IdeaJdkConfigurable.java @@ -145,7 +145,7 @@ public class IdeaJdkConfigurable implements AdditionalDataConfigurable { if (myFreeze) return; final Sdk javaJdk = (Sdk)e.getItem(); for (OrderRootType type : OrderRootType.getAllTypes()) { - if (!javaJdk.getSdkType().isRootTypeApplicable(type)) { + if (!((SdkType) javaJdk.getSdkType()).isRootTypeApplicable(type)) { continue; } final VirtualFile[] internalRoots = javaJdk.getSdkModificator().getRoots(type); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerBase.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerBase.java index c76fad7a4e3c..7b7d9e7e504d 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerBase.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerBase.java @@ -45,7 +45,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.JavaSdkType; import com.intellij.openapi.projectRoots.JdkUtil; import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.projectRoots.SdkType; +import com.intellij.openapi.projectRoots.SdkTypeId; import com.intellij.openapi.roots.ContentIterator; import com.intellij.openapi.roots.ModuleFileIndex; import com.intellij.openapi.roots.ModuleRootManager; @@ -102,7 +102,7 @@ public abstract class GroovyCompilerBase implements TranslatingCompiler { //assert !ApplicationManager.getApplication().isDispatchThread(); final Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); assert sdk != null; //verified before - SdkType sdkType = sdk.getSdkType(); + SdkTypeId sdkType = sdk.getSdkType(); assert sdkType instanceof JavaSdkType; final String exePath = ((JavaSdkType)sdkType).getVMExecutablePath(sdk); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyShellAction.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyShellAction.java index d31fbd54c167..10d8e34bea05 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyShellAction.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyShellAction.java @@ -33,7 +33,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.JavaSdkType; import com.intellij.openapi.projectRoots.JdkUtil; import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.projectRoots.SdkType; +import com.intellij.openapi.projectRoots.SdkTypeId; import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.roots.ui.configuration.ModulesAlphaComparator; import com.intellij.openapi.ui.popup.JBPopupFactory; @@ -163,7 +163,7 @@ public class GroovyShellAction extends DumbAwareAction { final Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); assert sdk != null; - SdkType sdkType = sdk.getSdkType(); + SdkTypeId sdkType = sdk.getSdkType(); assert sdkType instanceof JavaSdkType; final String exePath = ((JavaSdkType)sdkType).getVMExecutablePath(sdk); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/grape/GrabDependencies.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/grape/GrabDependencies.java index 97dd57d2bee1..c4d58ae4fe04 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/grape/GrabDependencies.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/grape/GrabDependencies.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jetbrains.plugins.groovy.grape; import com.intellij.codeInsight.intention.IntentionAction; @@ -23,7 +38,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.JavaSdkType; import com.intellij.openapi.projectRoots.JdkUtil; import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.projectRoots.SdkType; +import com.intellij.openapi.projectRoots.SdkTypeId; import com.intellij.openapi.roots.ModifiableRootModel; import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.roots.OrderRootType; @@ -114,7 +129,7 @@ public class GrabDependencies implements IntentionAction { final Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); assert sdk != null; - SdkType sdkType = sdk.getSdkType(); + SdkTypeId sdkType = sdk.getSdkType(); assert sdkType instanceof JavaSdkType; final String exePath = ((JavaSdkType)sdkType).getVMExecutablePath(sdk); diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/run/XsltRunSettingsEditor.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/run/XsltRunSettingsEditor.java index 5a863bb91185..f5db73c9ccd9 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/run/XsltRunSettingsEditor.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/run/XsltRunSettingsEditor.java @@ -16,7 +16,7 @@ package org.intellij.lang.xpath.xslt.run; import com.intellij.ide.ui.ListCellRendererWrapper; -import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.actionSystem.LangDataKeys; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.fileChooser.FileChooserDescriptor; @@ -32,6 +32,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.JavaSdkType; import com.intellij.openapi.projectRoots.ProjectJdkTable; import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.projectRoots.SdkType; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.ui.ComboBox; import com.intellij.openapi.ui.TextComponentAccessor; @@ -311,7 +312,7 @@ class XsltRunSettingsEditor extends SettingsEditor { return jdk.getName(); } })); - setIcon(jdk.getSdkType().getIcon()); + setIcon(((SdkType) jdk.getSdkType()).getIcon()); } } });