2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com
.intellij
.openapi
.projectRoots
.impl
;
18 import com
.intellij
.openapi
.project
.ProjectBundle
;
19 import com
.intellij
.openapi
.projectRoots
.*;
20 import com
.intellij
.openapi
.util
.IconLoader
;
21 import org
.jdom
.Element
;
24 import java
.util
.HashMap
;
28 * Used as a plug for all SDKs which type cannot be determined (for example, plugin that registered a custom type has been deinstalled)
29 * @author Eugene Zhuravlev
32 public class UnknownSdkType
extends SdkType
{
33 public static final Icon ICON
= IconLoader
.getIcon("/nodes/unknownJdkClosed.png");
34 private static final Icon JDK_ICON_EXPANDED
= IconLoader
.getIcon("/nodes/unknownJdkOpen.png");
35 private static final Map
<String
, UnknownSdkType
> ourTypeNameToInstanceMap
= new HashMap
<String
, UnknownSdkType
>();
38 * @param typeName the name of the SDK type that this SDK serves as a plug for
40 private UnknownSdkType(String typeName
) {
44 public static UnknownSdkType
getInstance(String typeName
) {
45 UnknownSdkType instance
= ourTypeNameToInstanceMap
.get(typeName
);
46 if (instance
== null) {
47 instance
= new UnknownSdkType(typeName
);
48 ourTypeNameToInstanceMap
.put(typeName
, instance
);
53 public String
suggestHomePath() {
57 public boolean isValidSdkHome(String path
) {
61 public String
getVersionString(String sdkHome
) {
65 public String
suggestSdkName(String currentSdkName
, String sdkHome
) {
66 return currentSdkName
;
69 public void setupSdkPaths(Sdk sdk
) {
72 public AdditionalDataConfigurable
createAdditionalDataConfigurable(SdkModel sdkModel
, SdkModificator sdkModificator
) {
76 public String
getBinPath(Sdk sdk
) {
80 public String
getToolsPath(Sdk sdk
) {
84 public String
getVMExecutablePath(Sdk sdk
) {
88 public void saveAdditionalData(SdkAdditionalData additionalData
, Element additional
) {
91 public SdkAdditionalData
loadAdditionalData(Element additional
) {
95 public String
getPresentableName() {
96 return ProjectBundle
.message("sdk.unknown.name");
99 public Icon
getIcon() {
103 public Icon
getIconForExpandedTreeNode() {
104 return JDK_ICON_EXPANDED
;