update copyrights
[fedora-idea.git] / platform / lang-api / src / com / intellij / openapi / projectRoots / SdkModel.java
blobe4aac97e6f8079ebafc3aa99347999a512f8813a
1 /*
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;
22 /**
23 * Represents the current state of the JDK list in the JDK and Global Libraries
24 * configuration dialog.
26 public interface SdkModel {
28 /**
29 * Returns the list of SDKs in the table.
30 * @return the SDK list.
32 Sdk[] getSdks();
34 /**
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.
40 @Nullable
41 Sdk findSdk(String sdkName);
43 /**
44 * Allows to receive notifications when the JDK list has been changed by the
45 * user configuring the JDKs.
48 interface Listener extends EventListener {
49 /**
50 * Called when a JDK has been added.
52 * @param sdk the added JDK.
54 void sdkAdded(Sdk sdk);
56 /**
57 * Called before a JDK is removed.
59 * @param sdk the removed JDK.
61 void beforeSdkRemove(Sdk sdk);
63 /**
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.
68 * @since 5.0.1
70 void sdkChanged(Sdk sdk, String previousName);
72 /**
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);
81 /**
82 * Adds a listener for receiving notifications about changes in the list.
84 * @param listener the listener instance.
86 void addListener(Listener listener);
88 /**
89 * Removes a listener for receiving notifications about changes in the list.
91 * @param listener the listener instance.
93 void removeListener(Listener listener);