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
;
18 import org
.jetbrains
.annotations
.Nullable
;
20 import java
.util
.EventListener
;
23 * Represents the current state of the JDK list in the JDK and Global Libraries
24 * configuration dialog.
26 public interface SdkModel
{
29 * Returns the list of SDKs in the table.
30 * @return the SDK list.
35 * Returns the SDK with the specified name, or null if one is not found.
37 * @param sdkName the name of the SDK to find.
38 * @return the SDK instance or null.
41 Sdk
findSdk(String sdkName
);
44 * Allows to receive notifications when the JDK list has been changed by the
45 * user configuring the JDKs.
48 interface Listener
extends EventListener
{
50 * Called when a JDK has been added.
52 * @param sdk the added JDK.
54 void sdkAdded(Sdk sdk
);
57 * Called before a JDK is removed.
59 * @param sdk the removed JDK.
61 void beforeSdkRemove(Sdk sdk
);
64 * Called when a JDK has been changed or renamed.
66 * @param sdk the changed or renamed JDK.
67 * @param previousName the old name of the changed or renamed JDK.
70 void sdkChanged(Sdk sdk
, String previousName
);
73 * Called when the home directory of a JDK has been changed.
74 * @param sdk the changed JDK.
75 * @param newSdkHome the new home directory.
77 void sdkHomeSelected(Sdk sdk
, String newSdkHome
);
82 * Adds a listener for receiving notifications about changes in the list.
84 * @param listener the listener instance.
86 void addListener(Listener listener
);
89 * Removes a listener for receiving notifications about changes in the list.
91 * @param listener the listener instance.
93 void removeListener(Listener listener
);