SdkTypeId extracted

This commit is contained in:
Dmitry Jemerov
2012-05-17 13:02:29 +02:00
parent 3e185cef92
commit b02e6faad3
25 changed files with 105 additions and 54 deletions
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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();
}
@@ -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"));
}
@@ -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<String>() {
@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<String> allNames = new HashSet<String>();
@@ -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() {
@@ -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();
@@ -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);
}
@@ -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);