CIDR: ApplePlatform & AppleSdk refactored

This commit is contained in:
Anton Makeev
2011-03-09 18:44:03 +01:00
parent 6b2843eddc
commit 4185ccc416
3 changed files with 24 additions and 7 deletions
@@ -55,10 +55,12 @@ public final class MockJdkWrapper implements Sdk {
return StringUtil.trimEnd(homePath, File.separator);
}
@NotNull
public SdkType getSdkType() {
return myDelegate.getSdkType();
}
@NotNull
public String getName() {
return myDelegate.getName();
}
@@ -67,6 +69,7 @@ public final class MockJdkWrapper implements Sdk {
return myDelegate.getVersionString();
}
@NotNull
public RootProvider getRootProvider() {
return myDelegate.getRootProvider();
}
@@ -79,6 +82,7 @@ public final class MockJdkWrapper implements Sdk {
myDelegate.putUserData(key, value);
}
@NotNull
public Object clone() throws CloneNotSupportedException {
throw new CloneNotSupportedException();
}
@@ -87,6 +91,7 @@ public final class MockJdkWrapper implements Sdk {
return null;
}
@NotNull
public SdkModificator getSdkModificator() {
return null;
}
@@ -18,6 +18,7 @@ package com.intellij.openapi.projectRoots;
import com.intellij.openapi.roots.RootProvider;
import com.intellij.openapi.util.UserDataHolder;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -25,24 +26,30 @@ import org.jetbrains.annotations.Nullable;
* Date: Sep 23, 2004
*/
public interface Sdk extends UserDataHolder {
@NotNull
SdkType getSdkType();
@NotNull
String getName();
@Nullable
String getVersionString();
@Nullable
String getHomePath();
RootProvider getRootProvider();
SdkAdditionalData getSdkAdditionalData();
SdkModificator getSdkModificator();
@Nullable
VirtualFile getHomeDirectory();
@NotNull
RootProvider getRootProvider();
@NotNull
SdkModificator getSdkModificator();
@Nullable
SdkAdditionalData getSdkAdditionalData();
@NotNull
Object clone() throws CloneNotSupportedException;
}
@@ -71,6 +71,7 @@ public class ProjectJdkImpl extends UserDataHolderBase implements JDOMExternaliz
myRootContainer.addProjectRootContainerListener(myRootProvider);
}
@NotNull
public SdkType getSdkType() {
if (mySdkType == null) {
mySdkType = ProjectJdkTable.getInstance().getDefaultSdkType();
@@ -78,6 +79,7 @@ public class ProjectJdkImpl extends UserDataHolderBase implements JDOMExternaliz
return mySdkType;
}
@NotNull
public String getName() {
return myName;
}
@@ -214,12 +216,14 @@ public class ProjectJdkImpl extends UserDataHolderBase implements JDOMExternaliz
}
}
@NotNull
public Object clone() {
ProjectJdkImpl newJdk = new ProjectJdkImpl("", mySdkType);
copyTo(newJdk);
return newJdk;
}
@NotNull
public RootProvider getRootProvider() {
return myRootProvider;
}
@@ -303,6 +307,7 @@ public class ProjectJdkImpl extends UserDataHolderBase implements JDOMExternaliz
}
// SdkModificator implementation
@NotNull
public SdkModificator getSdkModificator() {
ProjectJdkImpl sdk = (ProjectJdkImpl)clone();
sdk.myOrigin = this;