KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > core > IClasspathContainer


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.core;
12
13 import org.eclipse.core.runtime.IPath;
14
15 /**
16  * Interface of a classpath container.
17  * A classpath container provides a way to indirectly reference a set of classpath entries through
18  * a classpath entry of kind <code>CPE_CONTAINER</code>. Typically, a classpath container can
19  * be used to describe a complex library composed of multiple JARs or projects, considering also
20  * that containers can map to different set of entries on each project, in other words, several
21  * projects can reference the same generic container path, but have each of them actually bound
22  * to a different container object.
23  * <p>
24  * The set of entries associated with a classpath container may contain any of the following:
25  * <ul>
26  * <li> library entries (<code>CPE_LIBRARY</code>) </li>
27  * <li> project entries (<code>CPE_PROJECT</code>) </li>
28  * </ul>
29  * In particular, a classpath container can neither reference further classpath containers or classpath variables.
30  * <p>
31  * Classpath container values are persisted locally to the workspace, but are not preserved from a
32  * session to another. It is thus highly recommended to register a <code>ClasspathContainerInitializer</code>
33  * for each referenced container (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer").
34  * <p>
35  * @see IClasspathEntry
36  * @since 2.0
37  */

38
39 public interface IClasspathContainer {
40     
41     /**
42      * Kind for a container mapping to an application library
43      */

44     int K_APPLICATION = 1;
45
46     /**
47      * Kind for a container mapping to a system library
48      */

49     int K_SYSTEM = 2;
50
51     /**
52      * Kind for a container mapping to a default system library, implicitly contributed by the runtime
53      */

54     int K_DEFAULT_SYSTEM = 3;
55
56     /**
57      * Answers the set of classpath entries this container is mapping to.
58      * <p>
59      * The set of entries associated with a classpath container may contain any of the following:
60      * <ul>
61      * <li> library entries (<code>CPE_LIBRARY</code>) </li>
62      * <li> project entries (<code>CPE_PROJECT</code>) </li>
63      * </ul>
64      * A classpath container can neither reference further classpath containers
65      * or classpath variables.
66      * </p>
67      * <p>
68      * This method is called by the Java model when it needs to resolve this
69      * classpath container entry into a list of library and project entries.
70      * The method is typically called exactly once for a given Java project,
71      * and the resulting list of entries cached internally by the Java model.
72      * This method must not be called by other clients.
73      * <p>
74      * There are a wide variety of conditions under which this method may be
75      * invoked. To ensure that the implementation does not interfere with
76      * correct functioning of the Java model, the implementation should use
77      * only the following Java model APIs:
78      * <ul>
79      * <li>{@link JavaCore#newLibraryEntry(IPath, IPath, IPath, boolean)} and variants</li>
80      * <li>{@link JavaCore#newProjectEntry(IPath, boolean)} and variants</li>
81      * <li>{@link JavaCore#create(org.eclipse.core.resources.IWorkspaceRoot)}</li>
82      * <li>{@link JavaCore#create(org.eclipse.core.resources.IProject)}</li>
83      * <li>{@link IJavaModel#getJavaProjects()}</li>
84      * <li>{@link IJavaProject#getRawClasspath()}</li>
85      * <li>{@link IJavaProject#readRawClasspath()}</li>
86      * <li>{@link IJavaProject#getOutputLocation()}</li>
87      * <li>{@link IJavaProject#readOutputLocation()}</li>
88      * <li>Java element operations marked as "handle-only"</li>
89      * </ul>
90      * The effects of using other Java model APIs are unspecified.
91      * </p>
92      *
93      * @return IClasspathEntry[] - the classpath entries this container represents
94      * @see IClasspathEntry
95      */

96     IClasspathEntry[] getClasspathEntries();
97
98     /**
99      * Answers a readable description of this container
100      *
101      * @return String - a string description of the container
102      */

103     String JavaDoc getDescription();
104
105     /**
106      * Answers the kind of this container. Can be either:
107      * <ul>
108      * <li><code>K_APPLICATION</code> if this container maps to an application library</li>
109      * <li><code>K_SYSTEM</code> if this container maps to a system library</li>
110      * <li><code>K_DEFAULT_SYSTEM</code> if this container maps to a default system library (library
111      * implicitly contributed by the runtime).</li>
112      * </ul>
113      * Typically, system containers should be placed first on a build path.
114      * @return the kind of this container
115      */

116     int getKind();
117
118     /**
119      * Answers the container path identifying this container.
120      * A container path is formed by a first ID segment followed with extra segments, which
121      * can be used as additional hints for resolving to this container.
122      * <p>
123      * The container ID is also used to identify a<code>ClasspathContainerInitializer</code>
124      * registered on the extension point "org.eclipse.jdt.core.classpathContainerInitializer", which can
125      * be invoked if needing to resolve the container before it is explicitly set.
126      * <p>
127      * @return IPath - the container path that is associated with this container
128      */

129     IPath getPath();
130 }
131
132
Popular Tags