View | Details | Raw Unified | Return to bug 138599 | Differences between
and this patch

Collapse All | Expand All

(-)model/org/eclipse/jdt/core/IJavaModelStatusConstants.java (-1 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 320-323 Link Here
320
	 * @since 3.2
320
	 * @since 3.2
321
	 */
321
	 */
322
	public static final int UNKNOWN_JAVADOC_FORMAT = 1009;
322
	public static final int UNKNOWN_JAVADOC_FORMAT = 1009;
323
	/**
324
	 * <p>Status constant indicating that the variable is deprecated.</p>
325
	 * 
326
	 * @since 3.3
327
	 */
328
	public static final int DEPRECATED_VARIABLE = 1010;
323
}
329
}
(-)model/org/eclipse/jdt/core/IClasspathEntry.java (-38 / +38 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 15-21 Link Here
15
/** 
15
/** 
16
 * An entry on a Java project classpath identifying one or more package fragment
16
 * An entry on a Java project classpath identifying one or more package fragment
17
 * roots. A classpath entry has a content kind (either source, 
17
 * roots. A classpath entry has a content kind (either source, 
18
 * <code>K_SOURCE</code>, or binary, <code>K_BINARY</code>), which is inherited
18
 * {@link IPackageFragmentRoot#K_SOURCE}, or binary, {@link IPackageFragmentRoot#K_BINARY}), which is inherited
19
 * by each package fragment root and package fragment associated with the entry.
19
 * by each package fragment root and package fragment associated with the entry.
20
 * <p>
20
 * <p>
21
 * A classpath entry can refer to any of the following:<ul>
21
 * A classpath entry can refer to any of the following:<ul>
Lines 29-35 Link Here
29
 *		represent compilation units. All compilation units will be compiled when
29
 *		represent compilation units. All compilation units will be compiled when
30
 * 		the project is built. The classpath entry must specify the
30
 * 		the project is built. The classpath entry must specify the
31
 *		absolute path to the root folder. Entries of this kind are 
31
 *		absolute path to the root folder. Entries of this kind are 
32
 *		associated with the <code>CPE_SOURCE</code> constant.
32
 *		associated with the {@link #CPE_SOURCE} constant.
33
 *      Source classpath entries can carry inclusion and exclusion patterns for
33
 *      Source classpath entries can carry inclusion and exclusion patterns for
34
 *      selecting which source files appear as compilation
34
 *      selecting which source files appear as compilation
35
 *      units and get compiled when the project is built.
35
 *      units and get compiled when the project is built.
Lines 40-46 Link Here
40
 *		package fragments and <code>.class</code> files.  The classpath entry
40
 *		package fragments and <code>.class</code> files.  The classpath entry
41
 *		must specify the absolute path to the JAR (or root folder), and in case it refers
41
 *		must specify the absolute path to the JAR (or root folder), and in case it refers
42
 *		to an external JAR, then there is no associated resource in the workbench. Entries 
42
 *		to an external JAR, then there is no associated resource in the workbench. Entries 
43
 *		of this kind are associated with the <code>CPE_LIBRARY</code> constant.</li>
43
 *		of this kind are associated with the {@link #CPE_LIBRARY} constant.</li>
44
 * 
44
 * 
45
 *	<li>A required project. In this case the entry identifies another project in
45
 *	<li>A required project. In this case the entry identifies another project in
46
 *		the workspace. The required project is used as a binary library when compiling
46
 *		the workspace. The required project is used as a binary library when compiling
Lines 51-100 Link Here
51
 *		is performed against a required project's source code, and compilation is 
51
 *		is performed against a required project's source code, and compilation is 
52
 *		performed against a required project's last built state.  The
52
 *		performed against a required project's last built state.  The
53
 *		classpath entry must specify the absolute path to the
53
 *		classpath entry must specify the absolute path to the
54
 *		project. Entries of this kind are  associated with the <code>CPE_PROJECT</code>
54
 *		project. Entries of this kind are  associated with the {@link #CPE_PROJECT}
55
 *		constant. 
55
 *		constant. 
56
 * 		Note: referencing a required project with a classpath entry refers to the source 
56
 * 		Note: referencing a required project with a classpath entry refers to the source 
57
 *     code or associated <code>.class</code> files located in its output location. 
57
 *     code or associated <code>.class</code> files located in its output location. 
58
 *     It will also automatically include any other libraries or projects that the required project's classpath 
58
 *     It will also automatically include any other libraries or projects that the required project's classpath 
59
 *     refers to, iff the corresponding classpath entries are tagged as being exported 
59
 *     refers to, iff the corresponding classpath entries are tagged as being exported 
60
 *     (<code>IClasspathEntry#isExported</code>). 
60
 *     ({@link IClasspathEntry#isExported}). 
61
 *    Unless exporting some classpath entries, classpaths are not chained by default - 
61
 *    Unless exporting some classpath entries, classpaths are not chained by default - 
62
 *    each project must specify its own classpath in its entirety.</li>
62
 *    each project must specify its own classpath in its entirety.</li>
63
 * 
63
 * 
64
 *  <li> A path beginning in a classpath variable defined globally to the workspace.
64
 *  <li> A path beginning in a classpath variable defined globally to the workspace.
65
 *		Entries of this kind are  associated with the <code>CPE_VARIABLE</code> constant.  
65
 *		Entries of this kind are  associated with the {@link #CPE_VARIABLE} constant.  
66
 *      Classpath variables are created using <code>JavaCore#setClasspathVariable</code>,
66
 *      Classpath variables are created using {@link JavaCore#setClasspathVariable(String, IPath, org.eclipse.core.runtime.IProgressMonitor)},
67
 * 		and gets resolved, to either a project or library entry, using
67
 * 		and gets resolved, to either a project or library entry, using
68
 *      <code>JavaCore#getResolvedClasspathVariable</code>.
68
 *      {@link JavaCore#getResolvedClasspathEntry(IClasspathEntry)}.
69
 *		It is also possible to register an automatic initializer (<code>ClasspathVariableInitializer</code>),
69
 *		It is also possible to register an automatic initializer ({@link ClasspathVariableInitializer}),
70
 * 	which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer".
70
 * 	which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer".
71
 * 	After resolution, a classpath variable entry may either correspond to a project or a library entry. </li>
71
 * 	After resolution, a classpath variable entry may either correspond to a project or a library entry. </li>
72
 * 
72
 * 
73
 *  <li> A named classpath container identified by its container path.
73
 *  <li> A named classpath container identified by its container path.
74
 *     A classpath container provides a way to indirectly reference a set of classpath entries through
74
 *     A classpath container provides a way to indirectly reference a set of classpath entries through
75
 *     a classpath entry of kind <code>CPE_CONTAINER</code>. Typically, a classpath container can
75
 *     a classpath entry of kind {@link #CPE_CONTAINER}. Typically, a classpath container can
76
 *     be used to describe a complex library composed of multiple JARs, projects or classpath variables,
76
 *     be used to describe a complex library composed of multiple JARs, projects or classpath variables,
77
 *     considering also that containers can be mapped differently on each project. Several projects can
77
 *     considering also that containers can be mapped differently on each project. Several projects can
78
 *     reference the same generic container path, but have each of them actually bound to a different
78
 *     reference the same generic container path, but have each of them actually bound to a different
79
 *     container object.
79
 *     container object.
80
 *     The container path is a formed by a first ID segment followed with extra segments, 
80
 *     The container path is a formed by a first ID segment followed with extra segments, 
81
 *     which can be used as additional hints for resolving this container reference. If no container was ever 
81
 *     which can be used as additional hints for resolving this container reference. If no container was ever 
82
 *     recorded for this container path onto this project (using <code>setClasspathContainer</code>, 
82
 *     recorded for this container path onto this project (using {@link JavaCore#setClasspathContainer}, 
83
 * 	then a <code>ClasspathContainerInitializer</code> will be activated if any was registered for this 
83
 * 	then a {@link ClasspathContainerInitializer} will be activated if any was registered for this 
84
 * 	container ID onto the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
84
 * 	container ID onto the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
85
 * 	A classpath container entry can be resolved explicitly using <code>JavaCore#getClasspathContainer</code>
85
 * 	A classpath container entry can be resolved explicitly using {@link JavaCore#getClasspathContainer}
86
 * 	and the resulting container entries can contain any non-container entry. In particular, it may contain variable
86
 * 	and the resulting container entries can contain any non-container entry. In particular, it may contain variable
87
 *     entries, which in turn needs to be resolved before being directly used. 
87
 *     entries, which in turn needs to be resolved before being directly used. 
88
 * 	<br> Also note that the container resolution APIs include an IJavaProject argument, so as to allow the same
88
 * 	<br> Also note that the container resolution APIs include an IJavaProject argument, so as to allow the same
89
 * 	container path to be interpreted in different ways for different projects. </li>
89
 * 	container path to be interpreted in different ways for different projects. </li>
90
 * </ul>
90
 * </ul>
91
 * </p>
91
 * </p>
92
 * The result of <code>IJavaProject#getResolvedClasspath</code> will have all entries of type
92
 * The result of {@link IJavaProject#getResolvedClasspath} will have all entries of type
93
 * <code>CPE_VARIABLE</code> and <code>CPE_CONTAINER</code> resolved to a set of 
93
 * {@link #CPE_VARIABLE} and {@link #CPE_CONTAINER} resolved to a set of 
94
 * <code>CPE_SOURCE</code>, <code>CPE_LIBRARY</code> or <code>CPE_PROJECT</code>
94
 * {@link #CPE_SOURCE}, {@link #CPE_LIBRARY} or {@link #CPE_PROJECT}
95
 * classpath entries.
95
 * classpath entries.
96
 * <p>
96
 * <p>
97
 * Any classpath entry other than a source folder (kind <code>CPE_SOURCE</code>) can
97
 * Any classpath entry other than a source folder (kind {@link #CPE_SOURCE}) can
98
 * be marked as being exported. Exported entries are automatically contributed to
98
 * be marked as being exported. Exported entries are automatically contributed to
99
 * dependent projects, along with the project's default output folder, which is
99
 * dependent projects, along with the project's default output folder, which is
100
 * implicitly exported, and any auxiliary output folders specified on source
100
 * implicitly exported, and any auxiliary output folders specified on source
Lines 102-108 Link Here
102
 * followed by the any exported entries.
102
 * followed by the any exported entries.
103
 * <p>
103
 * <p>
104
 * This interface is not intended to be implemented by clients.
104
 * This interface is not intended to be implemented by clients.
105
 * Classpath entries can be created via methods on <code>JavaCore</code>.
105
 * Classpath entries can be created via methods on {@link JavaCore}.
106
 * </p>
106
 * </p>
107
 *
107
 *
108
 * @see JavaCore#newLibraryEntry(org.eclipse.core.runtime.IPath, org.eclipse.core.runtime.IPath, org.eclipse.core.runtime.IPath)
108
 * @see JavaCore#newLibraryEntry(org.eclipse.core.runtime.IPath, org.eclipse.core.runtime.IPath, org.eclipse.core.runtime.IPath)
Lines 170-180 Link Here
170
	 * Returns the kind of files found in the package fragments identified by this
170
	 * Returns the kind of files found in the package fragments identified by this
171
	 * classpath entry.
171
	 * classpath entry.
172
	 *
172
	 *
173
	 * @return <code>IPackageFragmentRoot.K_SOURCE</code> for files containing
173
	 * @return {@link IPackageFragmentRoot#K_SOURCE} for files containing
174
	 *   source code, and <code>IPackageFragmentRoot.K_BINARY</code> for binary
174
	 *   source code, and {@link IPackageFragmentRoot#K_BINARY} for binary
175
	 *   class files.
175
	 *   class files.
176
	 *   There is no specified value for an entry denoting a variable (<code>CPE_VARIABLE</code>)
176
	 *   There is no specified value for an entry denoting a variable ({@link #CPE_VARIABLE})
177
	 *   or a classpath container (<code>CPE_CONTAINER</code>).
177
	 *   or a classpath container ({@link #CPE_CONTAINER}).
178
	 */
178
	 */
179
	int getContentKind();
179
	int getContentKind();
180
180
Lines 183-198 Link Here
183
	 *
183
	 *
184
	 * @return one of:
184
	 * @return one of:
185
	 * <ul>
185
	 * <ul>
186
	 * <li><code>CPE_SOURCE</code> - this entry describes a source root in
186
	 * <li>{@link #CPE_SOURCE} - this entry describes a source root in
187
	 		its project
187
	 		its project
188
	 * <li><code>CPE_LIBRARY</code> - this entry describes a folder or JAR
188
	 * <li>{@link #CPE_LIBRARY} - this entry describes a folder or JAR
189
	 		containing binaries
189
	 		containing binaries
190
	 * <li><code>CPE_PROJECT</code> - this entry describes another project
190
	 * <li>{@link #CPE_PROJECT} - this entry describes another project
191
	 *
191
	 *
192
	 * <li><code>CPE_VARIABLE</code> - this entry describes a project or library
192
	 * <li>{@link #CPE_VARIABLE} - this entry describes a project or library
193
	 *  	indirectly via a classpath variable in the first segment of the path
193
	 *  	indirectly via a classpath variable in the first segment of the path
194
	 * *
194
	 * *
195
	 * <li><code>CPE_CONTAINER</code> - this entry describes set of entries
195
	 * <li>{@link #CPE_CONTAINER} - this entry describes set of entries
196
	 *  	referenced indirectly via a classpath container
196
	 *  	referenced indirectly via a classpath container
197
	 * </ul>
197
	 * </ul>
198
	 */
198
	 */
Lines 344-354 Link Here
344
	/**
344
	/**
345
	 * Returns the full path to the specific location where the builder writes 
345
	 * Returns the full path to the specific location where the builder writes 
346
	 * <code>.class</code> files generated for this source entry 
346
	 * <code>.class</code> files generated for this source entry 
347
	 * (entry kind <code>CPE_SOURCE</code>).
347
	 * (entry kind {@link #CPE_SOURCE}).
348
	 * <p>
348
	 * <p>
349
	 * Source entries can optionally be associated with a specific output location.
349
	 * Source entries can optionally be associated with a specific output location.
350
	 * If none is provided, the source entry will be implicitly associated with its project
350
	 * If none is provided, the source entry will be implicitly associated with its project
351
	 * default output location (see <code>IJavaProject#getOutputLocation</code>).
351
	 * default output location (see {@link IJavaProject#getOutputLocation}).
352
	 * </p><p>
352
	 * </p><p>
353
	 * NOTE: A specific output location cannot coincidate with another source/library entry.
353
	 * NOTE: A specific output location cannot coincidate with another source/library entry.
354
	 * </p>
354
	 * </p>
Lines 364-387 Link Here
364
	 * Returns the path of this classpath entry.
364
	 * Returns the path of this classpath entry.
365
	 *
365
	 *
366
	 * The meaning of the path of a classpath entry depends on its entry kind:<ul>
366
	 * The meaning of the path of a classpath entry depends on its entry kind:<ul>
367
	 *	<li>Source code in the current project (<code>CPE_SOURCE</code>) -  
367
	 *	<li>Source code in the current project ({@link #CPE_SOURCE}) -  
368
	 *      The path associated with this entry is the absolute path to the root folder. </li>
368
	 *      The path associated with this entry is the absolute path to the root folder. </li>
369
	 *	<li>A binary library in the current project (<code>CPE_LIBRARY</code>) - the path
369
	 *	<li>A binary library in the current project ({@link #CPE_LIBRARY}) - the path
370
	 *		associated with this entry is the absolute path to the JAR (or root folder), and 
370
	 *		associated with this entry is the absolute path to the JAR (or root folder), and 
371
	 *		in case it refers to an external JAR, then there is no associated resource in 
371
	 *		in case it refers to an external JAR, then there is no associated resource in 
372
	 *		the workbench.
372
	 *		the workbench.
373
	 *	<li>A required project (<code>CPE_PROJECT</code>) - the path of the entry denotes the
373
	 *	<li>A required project ({@link #CPE_PROJECT}) - the path of the entry denotes the
374
	 *		path to the corresponding project resource.</li>
374
	 *		path to the corresponding project resource.</li>
375
	 *  <li>A variable entry (<code>CPE_VARIABLE</code>) - the first segment of the path 
375
	 *  <li>A variable entry ({@link #CPE_VARIABLE}) - the first segment of the path 
376
	 *      is the name of a classpath variable. If this classpath variable
376
	 *      is the name of a classpath variable. If this classpath variable
377
	 *		is bound to the path <i>P</i>, the path of the corresponding classpath entry
377
	 *		is bound to the path <i>P</i>, the path of the corresponding classpath entry
378
	 *		is computed by appending to <i>P</i> the segments of the returned
378
	 *		is computed by appending to <i>P</i> the segments of the returned
379
	 *		path without the variable.</li>
379
	 *		path without the variable.</li>
380
	 *  <li> A container entry (<code>CPE_CONTAINER</code>) - the path of the entry
380
	 *  <li> A container entry ({@link #CPE_CONTAINER}) - the path of the entry
381
	 * 	is the name of the classpath container, which can be bound indirectly to a set of classpath 
381
	 * 	is the name of the classpath container, which can be bound indirectly to a set of classpath 
382
	 * 	entries after resolution. The containerPath is a formed by a first ID segment followed with 
382
	 * 	entries after resolution. The containerPath is a formed by a first ID segment followed with 
383
	 *     extra segments that can be used as additional hints for resolving this container 
383
	 *     extra segments that can be used as additional hints for resolving this container 
384
	 * 	reference (also see <code>IClasspathContainer</code>).
384
	 * 	reference (also see {@link IClasspathContainer}).
385
	 * </li>
385
	 * </li>
386
	 * </ul>
386
	 * </ul>
387
	 *
387
	 *
Lines 410-416 Link Here
410
	 * Returns the path within the source archive or folder where package fragments
410
	 * Returns the path within the source archive or folder where package fragments
411
	 * are located. An empty path indicates that packages are located at
411
	 * are located. An empty path indicates that packages are located at
412
	 * the root of the source archive or folder. Returns a non-<code>null</code> value
412
	 * the root of the source archive or folder. Returns a non-<code>null</code> value
413
	 * if and only if <code>getSourceAttachmentPath</code> returns 
413
	 * if and only if {@link #getSourceAttachmentPath} returns 
414
	 * a non-<code>null</code> value.
414
	 * a non-<code>null</code> value.
415
	 *
415
	 *
416
	 * @return the path within the source archive or folder, or <code>null</code> if
416
	 * @return the path within the source archive or folder, or <code>null</code> if
Lines 421-427 Link Here
421
	/**
421
	/**
422
	 * Returns whether this entry is exported to dependent projects.
422
	 * Returns whether this entry is exported to dependent projects.
423
	 * Always returns <code>false</code> for source entries (kind
423
	 * Always returns <code>false</code> for source entries (kind
424
	 * <code>CPE_SOURCE</code>), which cannot be exported.
424
	 * {@link #CPE_SOURCE}), which cannot be exported.
425
	 * 
425
	 * 
426
	 * @return <code>true</code> if exported, and <code>false</code> otherwise
426
	 * @return <code>true</code> if exported, and <code>false</code> otherwise
427
	 * @since 2.0
427
	 * @since 2.0
(-)model/org/eclipse/jdt/core/JavaCore.java (-5 / +38 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 1669-1674 Link Here
1669
	}
1669
	}
1670
1670
1671
	/**
1671
	/**
1672
	 * Returns deprecation message of a given classpath variable.
1673
	 *
1674
	 * @param variableName
1675
	 * @return A string if the classpath variable is deprecated, <code>null</code> otherwise.
1676
	 * @since 3.3
1677
	 */
1678
	public static String getClasspathVariableDeprecationMessage(String variableName) {
1679
	    return (String) JavaModelManager.getJavaModelManager().deprecatedVariables.get(variableName);
1680
	}
1681
1682
	/**
1672
	 * Helper method finding the classpath variable initializer registered for a given classpath variable name 
1683
	 * Helper method finding the classpath variable initializer registered for a given classpath variable name 
1673
	 * or <code>null</code> if none was found while iterating over the contributions to extension point to
1684
	 * or <code>null</code> if none was found while iterating over the contributions to extension point to
1674
	 * the extension point "org.eclipse.jdt.core.classpathVariableInitializer".
1685
	 * the extension point "org.eclipse.jdt.core.classpathVariableInitializer".
Lines 1690-1696 Link Here
1690
				IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
1701
				IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
1691
				for(int j = 0; j < configElements.length; j++){
1702
				for(int j = 0; j < configElements.length; j++){
1692
					try {
1703
					try {
1693
						String varAttribute = configElements[j].getAttribute("variable"); //$NON-NLS-1$
1704
						IConfigurationElement configElement = configElements[j];
1705
						String varAttribute = configElement.getAttribute("variable"); //$NON-NLS-1$
1694
						if (variable.equals(varAttribute)) {
1706
						if (variable.equals(varAttribute)) {
1695
							if (JavaModelManager.CP_RESOLVE_VERBOSE) {
1707
							if (JavaModelManager.CP_RESOLVE_VERBOSE) {
1696
								Util.verbose(
1708
								Util.verbose(
Lines 1700-1706 Link Here
1700
							}						
1712
							}						
1701
							Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
1713
							Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
1702
							if (execExt instanceof ClasspathVariableInitializer){
1714
							if (execExt instanceof ClasspathVariableInitializer){
1703
								return (ClasspathVariableInitializer)execExt;
1715
								ClasspathVariableInitializer initializer = (ClasspathVariableInitializer)execExt;
1716
								String deprecatedAttribute = configElement.getAttribute("deprecated"); //$NON-NLS-1$
1717
								if (deprecatedAttribute != null) {
1718
									JavaModelManager.getJavaModelManager().deprecatedVariables.put(variable, deprecatedAttribute);
1719
								}
1720
								String readOnlyAttribute = configElement.getAttribute("readOnly"); //$NON-NLS-1$
1721
								if (JavaModelManager.TRUE.equals(readOnlyAttribute)) {
1722
									JavaModelManager.getJavaModelManager().readOnlyVariables.add(variable);
1723
								}
1724
								return initializer;
1704
							}
1725
							}
1705
						}
1726
						}
1706
					} catch(CoreException e){
1727
					} catch(CoreException e){
Lines 3012-3018 Link Here
3012
			if (monitor != null) monitor.done();
3033
			if (monitor != null) monitor.done();
3013
		}
3034
		}
3014
	}
3035
	}
3015
	
3036
3037
	/**
3038
	 * Returns whether a given classpath variable is read-only or not.
3039
	 *
3040
	 * @param variableName
3041
	 * @return <code>true</code> if the classpath variable is read-only,
3042
	 * 	<code>false</code> otherwise.
3043
	 * @since 3.3
3044
	 */
3045
	public static boolean isClasspathVariableReadOnly(String variableName) {
3046
	    return JavaModelManager.getJavaModelManager().readOnlyVariables.contains(variableName);
3047
	}
3048
3016
	/**
3049
	/**
3017
	 * Returns whether the given file name's extension is a Java-like extension.
3050
	 * Returns whether the given file name's extension is a Java-like extension.
3018
	 * 
3051
	 * 
Lines 3023-3029 Link Here
3023
	public static boolean isJavaLikeFileName(String fileName) {
3056
	public static boolean isJavaLikeFileName(String fileName) {
3024
		return Util.isJavaLikeFileName(fileName);
3057
		return Util.isJavaLikeFileName(fileName);
3025
	}
3058
	}
3026
	
3059
3027
	/**
3060
	/**
3028
	 * Returns whether the given marker references the given Java element.
3061
	 * Returns whether the given marker references the given Java element.
3029
	 * Used for markers, which denote a Java element rather than a resource.
3062
	 * Used for markers, which denote a Java element rather than a resource.
(-)model/org/eclipse/jdt/internal/core/JavaModelOperation.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 61-67 Link Here
61
	protected HashMap attributes;
61
	protected HashMap attributes;
62
62
63
	public static final String HAS_MODIFIED_RESOURCE_ATTR = "hasModifiedResource"; //$NON-NLS-1$
63
	public static final String HAS_MODIFIED_RESOURCE_ATTR = "hasModifiedResource"; //$NON-NLS-1$
64
	public static final String TRUE = "true"; //$NON-NLS-1$
64
	public static final String TRUE = JavaModelManager.TRUE;
65
	//public static final String FALSE = "false";
65
	//public static final String FALSE = "false";
66
		
66
		
67
	/**
67
	/**
(-)model/org/eclipse/jdt/internal/core/JavaModelStatus.java (-46 / +65 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 126-132 Link Here
126
		this(code, new IJavaElement[]{element});
126
		this(code, new IJavaElement[]{element});
127
		this.string = string;
127
		this.string = string;
128
	}
128
	}
129
	
129
130
	/**
130
	/**
131
	 * Constructs an Java model status with the given corresponding
131
	 * Constructs an Java model status with the given corresponding
132
	 * element and path
132
	 * element and path
Lines 134-140 Link Here
134
	public JavaModelStatus(int code, IJavaElement element, IPath path) {
134
	public JavaModelStatus(int code, IJavaElement element, IPath path) {
135
		this(code, new IJavaElement[]{element});
135
		this(code, new IJavaElement[]{element});
136
		this.path = path;
136
		this.path = path;
137
	}	
137
	}
138
138
	/**
139
	/**
139
	 * Constructs an Java model status with the given corresponding
140
	 * Constructs an Java model status with the given corresponding
140
	 * element, path and string
141
	 * element, path and string
Lines 144-150 Link Here
144
		this.path = path;
145
		this.path = path;
145
		this.string = string;
146
		this.string = string;
146
	}	
147
	}	
148
147
	/**
149
	/**
150
     * Constructs an Java model status with the given corresponding
151
     * element and path
152
     */
153
    public JavaModelStatus(int severity, int code, IJavaElement element, IPath path, String msg) {
154
    	super(severity, JavaCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$
155
    	this.elements= new IJavaElement[]{element};
156
    	this.path = path;
157
    	this.string = msg;
158
    }
159
160
    /**
148
	 * Constructs an Java model status with no corresponding elements.
161
	 * Constructs an Java model status with no corresponding elements.
149
	 */
162
	 */
150
	public JavaModelStatus(CoreException coreException) {
163
	public JavaModelStatus(CoreException coreException) {
Lines 326-378 Link Here
326
					if (description == null) description = path.makeRelative().toString();
339
					if (description == null) description = path.makeRelative().toString();
327
					return Messages.bind(Messages.classpath_invalidContainer, new String[] {description, javaProject.getElementName()}); 
340
					return Messages.bind(Messages.classpath_invalidContainer, new String[] {description, javaProject.getElementName()}); 
328
341
329
			case CP_VARIABLE_PATH_UNBOUND:
342
				case CP_VARIABLE_PATH_UNBOUND:
330
				javaProject = (IJavaProject)elements[0];
343
					javaProject = (IJavaProject)elements[0];
331
				return Messages.bind(Messages.classpath_unboundVariablePath, new String[] {path.makeRelative().toString(), javaProject.getElementName()}); 
344
					return Messages.bind(Messages.classpath_unboundVariablePath, new String[] {path.makeRelative().toString(), javaProject.getElementName()}); 
332
					
333
			case CLASSPATH_CYCLE: 
334
				javaProject = (IJavaProject)elements[0];
335
				return Messages.bind(Messages.classpath_cycle, javaProject.getElementName()); 
336
												 
337
			case DISABLED_CP_EXCLUSION_PATTERNS:
338
				javaProject = (IJavaProject)elements[0];
339
				String projectName = javaProject.getElementName();
340
				IPath newPath = path;
341
				if (path.segment(0).toString().equals(projectName)) {
342
					newPath = path.removeFirstSegments(1);
343
				}
344
				return Messages.bind(Messages.classpath_disabledInclusionExclusionPatterns, new String[] {newPath.makeRelative().toString(), projectName}); 
345
346
			case DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS:
347
				javaProject = (IJavaProject)elements[0];
348
				projectName = javaProject.getElementName();
349
				newPath = path;
350
				if (path.segment(0).toString().equals(projectName)) {
351
					newPath = path.removeFirstSegments(1);
352
				}
353
				return Messages.bind(Messages.classpath_disabledMultipleOutputLocations, new String[] {newPath.makeRelative().toString(), projectName}); 
354
345
355
			case INCOMPATIBLE_JDK_LEVEL:
346
				case CLASSPATH_CYCLE: 
356
					javaProject = (IJavaProject)elements[0];
347
					javaProject = (IJavaProject)elements[0];
357
					return Messages.bind(Messages.classpath_incompatibleLibraryJDKLevel, new String[]{	
348
					return Messages.bind(Messages.classpath_cycle, javaProject.getElementName()); 
358
						javaProject.getElementName(), 
349
359
						javaProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true), 
350
				case DISABLED_CP_EXCLUSION_PATTERNS:
360
						path.makeRelative().toString(),
351
					javaProject = (IJavaProject)elements[0];
361
						string,
352
					String projectName = javaProject.getElementName();
362
					});
353
					IPath newPath = path;
363
			case CANNOT_RETRIEVE_ATTACHED_JAVADOC :
354
					if (path.segment(0).toString().equals(projectName)) {
364
				if (elements != null && elements.length == 1) {
355
						newPath = path.removeFirstSegments(1);
356
					}
357
					return Messages.bind(Messages.classpath_disabledInclusionExclusionPatterns, new String[] {newPath.makeRelative().toString(), projectName}); 
358
359
				case DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS:
360
					javaProject = (IJavaProject)elements[0];
361
					projectName = javaProject.getElementName();
362
					newPath = path;
363
					if (path.segment(0).toString().equals(projectName)) {
364
						newPath = path.removeFirstSegments(1);
365
					}
366
					return Messages.bind(Messages.classpath_disabledMultipleOutputLocations, new String[] {newPath.makeRelative().toString(), projectName}); 
367
368
				case INCOMPATIBLE_JDK_LEVEL:
369
						javaProject = (IJavaProject)elements[0];
370
						return Messages.bind(Messages.classpath_incompatibleLibraryJDKLevel, new String[]{	
371
							javaProject.getElementName(), 
372
							javaProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true), 
373
							path.makeRelative().toString(),
374
							string,
375
						});
376
377
				case CANNOT_RETRIEVE_ATTACHED_JAVADOC :
378
					if (elements != null && elements.length == 1) {
379
						if (this.string != null) {
380
							return Messages.bind(Messages.status_cannot_retrieve_attached_javadoc, ((JavaElement)elements[0]).toStringWithAncestors(), this.string); 
381
						}
382
						return Messages.bind(Messages.status_cannot_retrieve_attached_javadoc, ((JavaElement)elements[0]).toStringWithAncestors(), ""); //$NON-NLS-1$
383
					}
365
					if (this.string != null) {
384
					if (this.string != null) {
366
						return Messages.bind(Messages.status_cannot_retrieve_attached_javadoc, ((JavaElement)elements[0]).toStringWithAncestors(), this.string); 
385
						return Messages.bind(Messages.status_cannot_retrieve_attached_javadoc, this.string, "");//$NON-NLS-1$
367
					}
386
					}
368
					return Messages.bind(Messages.status_cannot_retrieve_attached_javadoc, ((JavaElement)elements[0]).toStringWithAncestors(), ""); //$NON-NLS-1$
387
					break;
369
				}
388
370
				if (this.string != null) {
389
				case UNKNOWN_JAVADOC_FORMAT :
371
					return Messages.bind(Messages.status_cannot_retrieve_attached_javadoc, this.string, "");//$NON-NLS-1$
390
					return Messages.bind(Messages.status_unknown_javadoc_format, ((JavaElement)elements[0]).toStringWithAncestors()); 
372
				}
391
373
				break;
392
				case DEPRECATED_VARIABLE :
374
			case UNKNOWN_JAVADOC_FORMAT :
393
					javaProject = (IJavaProject)elements[0];
375
				return Messages.bind(Messages.status_unknown_javadoc_format, ((JavaElement)elements[0]).toStringWithAncestors()); 
394
					return Messages.bind(Messages.classpath_deprecated_variable, new String[] {path.segment(0).toString(), javaProject.getElementName(), this.string}); 
376
			}
395
			}
377
			if (string != null) {
396
			if (string != null) {
378
				return string;
397
				return string;
(-)model/org/eclipse/jdt/internal/core/ClasspathEntry.java (-2 / +14 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 26-31 Link Here
26
import org.eclipse.core.runtime.AssertionFailedException;
26
import org.eclipse.core.runtime.AssertionFailedException;
27
import org.eclipse.core.runtime.CoreException;
27
import org.eclipse.core.runtime.CoreException;
28
import org.eclipse.core.runtime.IPath;
28
import org.eclipse.core.runtime.IPath;
29
import org.eclipse.core.runtime.IStatus;
29
import org.eclipse.core.runtime.Path;
30
import org.eclipse.core.runtime.Path;
30
import org.eclipse.jdt.core.IAccessRule;
31
import org.eclipse.jdt.core.IAccessRule;
31
import org.eclipse.jdt.core.IClasspathAttribute;
32
import org.eclipse.jdt.core.IClasspathAttribute;
Lines 1627-1633 Link Here
1627
					if (entry == null){
1628
					if (entry == null){
1628
						return new JavaModelStatus(IJavaModelStatusConstants.CP_VARIABLE_PATH_UNBOUND, project, path);
1629
						return new JavaModelStatus(IJavaModelStatusConstants.CP_VARIABLE_PATH_UNBOUND, project, path);
1629
					}
1630
					}
1630
					return validateClasspathEntry(project, entry, checkSourceAttachment, recurseInContainers);
1631
1632
					// get validation status
1633
					IJavaModelStatus status = validateClasspathEntry(project, entry, checkSourceAttachment, recurseInContainers);
1634
					if (!status.isOK()) return status;
1635
1636
					// return deprecation status if any
1637
					String variableName = path.segment(0);
1638
					String deprecatedMessage = JavaCore.getClasspathVariableDeprecationMessage(variableName);
1639
					if (deprecatedMessage != null) {
1640
						return new JavaModelStatus(IStatus.WARNING, IJavaModelStatusConstants.DEPRECATED_VARIABLE, project, path, deprecatedMessage);
1641
					}
1642
					return status;
1631
				} else {
1643
				} else {
1632
					return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_illegalVariablePath, new String[] {entryPathMsg, projectName}));					 
1644
					return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_illegalVariablePath, new String[] {entryPathMsg, projectName}));					 
1633
				}
1645
				}
(-)model/org/eclipse/jdt/internal/core/JavaModelManager.java (-23 / +26 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 87-95 Link Here
87
	 */
87
	 */
88
	public HashMap variables = new HashMap(5);
88
	public HashMap variables = new HashMap(5);
89
	public HashSet variablesWithInitializer = new HashSet(5);
89
	public HashSet variablesWithInitializer = new HashSet(5);
90
	public HashMap deprecatedVariables = new HashMap(5);
91
	public HashSet readOnlyVariables = new HashSet(5);
90
	public HashMap previousSessionVariables = new HashMap(5);
92
	public HashMap previousSessionVariables = new HashMap(5);
91
	private ThreadLocal variableInitializationInProgress = new ThreadLocal();
93
	private ThreadLocal variableInitializationInProgress = new ThreadLocal();
92
		
94
93
	/**
95
	/**
94
	 * Classpath containers pool
96
	 * Classpath containers pool
95
	 */
97
	 */
Lines 120-125 Link Here
120
	public final static String CP_CONTAINER_PREFERENCES_PREFIX = JavaCore.PLUGIN_ID+".classpathContainer."; //$NON-NLS-1$
122
	public final static String CP_CONTAINER_PREFERENCES_PREFIX = JavaCore.PLUGIN_ID+".classpathContainer."; //$NON-NLS-1$
121
	public final static String CP_ENTRY_IGNORE = "##<cp entry ignore>##"; //$NON-NLS-1$
123
	public final static String CP_ENTRY_IGNORE = "##<cp entry ignore>##"; //$NON-NLS-1$
122
	public final static IPath CP_ENTRY_IGNORE_PATH = new Path(CP_ENTRY_IGNORE);
124
	public final static IPath CP_ENTRY_IGNORE_PATH = new Path(CP_ENTRY_IGNORE);
125
	public final static String TRUE = "true"; //$NON-NLS-1$
123
	
126
	
124
	private final static int VARIABLES_AND_CONTAINERS_FILE_VERSION = 2;
127
	private final static int VARIABLES_AND_CONTAINERS_FILE_VERSION = 2;
125
128
Lines 278-286 Link Here
278
						continue;
281
						continue;
279
					}
282
					}
280
					// add config element in the group it belongs to
283
					// add config element in the group it belongs to
281
					if ("true".equals(configElement.getAttribute("modifiesEnvironment"))) //$NON-NLS-1$ //$NON-NLS-2$
284
					if (TRUE.equals(configElement.getAttribute("modifiesEnvironment"))) //$NON-NLS-1$
282
						modifyingEnv.add(configElement);
285
						modifyingEnv.add(configElement);
283
					else if ("true".equals(configElement.getAttribute("createsProblems"))) //$NON-NLS-1$ //$NON-NLS-2$
286
					else if (TRUE.equals(configElement.getAttribute("createsProblems"))) //$NON-NLS-1$
284
						creatingProblems.add(configElement);
287
						creatingProblems.add(configElement);
285
					else
288
					else
286
						others.add(configElement);
289
						others.add(configElement);
Lines 1200-1257 Link Here
1200
	public void configurePluginDebugOptions(){
1203
	public void configurePluginDebugOptions(){
1201
		if(JavaCore.getPlugin().isDebugging()){
1204
		if(JavaCore.getPlugin().isDebugging()){
1202
			String option = Platform.getDebugOption(BUFFER_MANAGER_DEBUG);
1205
			String option = Platform.getDebugOption(BUFFER_MANAGER_DEBUG);
1203
			if(option != null) BufferManager.VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1206
			if(option != null) BufferManager.VERBOSE = option.equalsIgnoreCase(TRUE) ;
1204
			
1207
			
1205
			option = Platform.getDebugOption(BUILDER_DEBUG);
1208
			option = Platform.getDebugOption(BUILDER_DEBUG);
1206
			if(option != null) JavaBuilder.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1209
			if(option != null) JavaBuilder.DEBUG = option.equalsIgnoreCase(TRUE) ;
1207
			
1210
			
1208
			option = Platform.getDebugOption(COMPILER_DEBUG);
1211
			option = Platform.getDebugOption(COMPILER_DEBUG);
1209
			if(option != null) Compiler.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1212
			if(option != null) Compiler.DEBUG = option.equalsIgnoreCase(TRUE) ;
1210
1213
1211
			option = Platform.getDebugOption(COMPLETION_DEBUG);
1214
			option = Platform.getDebugOption(COMPLETION_DEBUG);
1212
			if(option != null) CompletionEngine.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1215
			if(option != null) CompletionEngine.DEBUG = option.equalsIgnoreCase(TRUE) ;
1213
			
1216
			
1214
			option = Platform.getDebugOption(CP_RESOLVE_DEBUG);
1217
			option = Platform.getDebugOption(CP_RESOLVE_DEBUG);
1215
			if(option != null) JavaModelManager.CP_RESOLVE_VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1218
			if(option != null) JavaModelManager.CP_RESOLVE_VERBOSE = option.equalsIgnoreCase(TRUE) ;
1216
1219
1217
			option = Platform.getDebugOption(DELTA_DEBUG);
1220
			option = Platform.getDebugOption(DELTA_DEBUG);
1218
			if(option != null) DeltaProcessor.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1221
			if(option != null) DeltaProcessor.DEBUG = option.equalsIgnoreCase(TRUE) ;
1219
1222
1220
			option = Platform.getDebugOption(DELTA_DEBUG_VERBOSE);
1223
			option = Platform.getDebugOption(DELTA_DEBUG_VERBOSE);
1221
			if(option != null) DeltaProcessor.VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1224
			if(option != null) DeltaProcessor.VERBOSE = option.equalsIgnoreCase(TRUE) ;
1222
1225
1223
			option = Platform.getDebugOption(HIERARCHY_DEBUG);
1226
			option = Platform.getDebugOption(HIERARCHY_DEBUG);
1224
			if(option != null) TypeHierarchy.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1227
			if(option != null) TypeHierarchy.DEBUG = option.equalsIgnoreCase(TRUE) ;
1225
1228
1226
			option = Platform.getDebugOption(INDEX_MANAGER_DEBUG);
1229
			option = Platform.getDebugOption(INDEX_MANAGER_DEBUG);
1227
			if(option != null) JobManager.VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1230
			if(option != null) JobManager.VERBOSE = option.equalsIgnoreCase(TRUE) ;
1228
			
1231
			
1229
			option = Platform.getDebugOption(JAVAMODEL_DEBUG);
1232
			option = Platform.getDebugOption(JAVAMODEL_DEBUG);
1230
			if(option != null) JavaModelManager.VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1233
			if(option != null) JavaModelManager.VERBOSE = option.equalsIgnoreCase(TRUE) ;
1231
1234
1232
			option = Platform.getDebugOption(JAVAMODELCACHE_DEBUG);
1235
			option = Platform.getDebugOption(JAVAMODELCACHE_DEBUG);
1233
			if(option != null) JavaModelCache.VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1236
			if(option != null) JavaModelCache.VERBOSE = option.equalsIgnoreCase(TRUE) ;
1234
1237
1235
			option = Platform.getDebugOption(POST_ACTION_DEBUG);
1238
			option = Platform.getDebugOption(POST_ACTION_DEBUG);
1236
			if(option != null) JavaModelOperation.POST_ACTION_VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1239
			if(option != null) JavaModelOperation.POST_ACTION_VERBOSE = option.equalsIgnoreCase(TRUE) ;
1237
1240
1238
			option = Platform.getDebugOption(RESOLUTION_DEBUG);
1241
			option = Platform.getDebugOption(RESOLUTION_DEBUG);
1239
			if(option != null) NameLookup.VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1242
			if(option != null) NameLookup.VERBOSE = option.equalsIgnoreCase(TRUE) ;
1240
1243
1241
			option = Platform.getDebugOption(SEARCH_DEBUG);
1244
			option = Platform.getDebugOption(SEARCH_DEBUG);
1242
			if(option != null) BasicSearchEngine.VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1245
			if(option != null) BasicSearchEngine.VERBOSE = option.equalsIgnoreCase(TRUE) ;
1243
1246
1244
			option = Platform.getDebugOption(SELECTION_DEBUG);
1247
			option = Platform.getDebugOption(SELECTION_DEBUG);
1245
			if(option != null) SelectionEngine.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1248
			if(option != null) SelectionEngine.DEBUG = option.equalsIgnoreCase(TRUE) ;
1246
1249
1247
			option = Platform.getDebugOption(ZIP_ACCESS_DEBUG);
1250
			option = Platform.getDebugOption(ZIP_ACCESS_DEBUG);
1248
			if(option != null) JavaModelManager.ZIP_ACCESS_VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1251
			if(option != null) JavaModelManager.ZIP_ACCESS_VERBOSE = option.equalsIgnoreCase(TRUE) ;
1249
			
1252
			
1250
			option = Platform.getDebugOption(SOURCE_MAPPER_DEBUG_VERBOSE);
1253
			option = Platform.getDebugOption(SOURCE_MAPPER_DEBUG_VERBOSE);
1251
			if(option != null) SourceMapper.VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1254
			if(option != null) SourceMapper.VERBOSE = option.equalsIgnoreCase(TRUE) ;
1252
			
1255
			
1253
			option = Platform.getDebugOption(ENABLE_NEW_FORMATTER);
1256
			option = Platform.getDebugOption(ENABLE_NEW_FORMATTER);
1254
			if(option != null) DefaultCodeFormatter.USE_NEW_FORMATTER = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
1257
			if(option != null) DefaultCodeFormatter.USE_NEW_FORMATTER = option.equalsIgnoreCase(TRUE) ;
1255
		}
1258
		}
1256
		
1259
		
1257
		// configure performance options
1260
		// configure performance options
Lines 3950-3956 Link Here
3950
		
3953
		
3951
		// Note: no need to close the Java model as this just removes Java element infos from the Java model cache
3954
		// Note: no need to close the Java model as this just removes Java element infos from the Java model cache
3952
	}
3955
	}
3953
		
3956
3954
	public synchronized IPath variableGet(String variableName){
3957
	public synchronized IPath variableGet(String variableName){
3955
		// check initialization in progress first
3958
		// check initialization in progress first
3956
		HashSet initializations = variableInitializationInProgress();
3959
		HashSet initializations = variableInitializationInProgress();
(-)schema/classpathVariableInitializer.exsd (+17 lines)
Lines 63-68 Link Here
63
               </appInfo>
63
               </appInfo>
64
            </annotation>
64
            </annotation>
65
         </attribute>
65
         </attribute>
66
         <attribute name="deprecated" type="string">
67
            <annotation>
68
               <documentation>
69
                  String explaining the reason why the associated variable is deprecated
70
               </documentation>
71
               <appInfo>
72
                  <meta.attribute translatable="true"/>
73
               </appInfo>
74
            </annotation>
75
         </attribute>
76
         <attribute name="readOnly" type="boolean">
77
            <annotation>
78
               <documentation>
79
                  Indicates that the associated variable cannot be modified
80
               </documentation>
81
            </annotation>
82
         </attribute>
66
      </complexType>
83
      </complexType>
67
   </element>
84
   </element>
68
85
(-)buildnotes_jdt-core.html (+72 lines)
Lines 51-56 Link Here
51
<br>Project org.eclipse.jdt.core v_732
51
<br>Project org.eclipse.jdt.core v_732
52
(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_732">cvs</a>).
52
(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_732">cvs</a>).
53
<h2>What's new in this drop</h2>
53
<h2>What's new in this drop</h2>
54
<ul>
55
<li>Classpath variable may now be flagged as deprecated or read-only (see bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=138599">138599</a>
56
and bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=156226">156226</a>).<br>
57
Two new attributes have been added on <code>ClasspathVariableInitializer</code> schema:
58
<pre>
59
   &lt;element name="classpathVariableInitializer"&gt;
60
      &lt;complexType&gt;
61
         ...
62
         &lt;attribute name="deprecated" type="string"&gt;
63
            &lt;annotation&gt;
64
               &lt;documentation&gt;
65
                  String explaining the reason why the associated variable is deprecated
66
               &lt;/documentation&gt;
67
               &lt;appInfo&gt;
68
                  &lt;meta.attribute translatable="true"/&gt;
69
               &lt;/appInfo&gt;
70
            &lt;/annotation&gt;
71
         &lt;/attribute&gt;
72
         &lt;attribute name="readOnly" type="boolean"&gt;
73
            &lt;annotation&gt;
74
               &lt;documentation&gt;
75
                  Indicates that the associated variable cannot be modified
76
               &lt;/documentation&gt;
77
            &lt;/annotation&gt;
78
         &lt;/attribute&gt;
79
      &lt;/complexType&gt;
80
   &lt;/element&gt;
81
</pre>
82
When deprecated attribute is set on ClasspathVariableInitializer extension point, classpath entry validation
83
returns a warning status if no other error was previously detected.
84
<br>
85
For example, following <code> classpathVariableInitializer</code> extension point set
86
the <code>TEST</code> classpath variable as deprecated and read-only:
87
<pre>
88
   &lt;extension
89
         point="org.eclipse.jdt.core.classpathVariableInitializer"&gt;
90
      &lt;classpathVariableInitializer
91
            class="org.eclipse.jdt.tests.model.TestInitializer"
92
            deprecated="The reason why this variable is deprecated"
93
            readOnly="true"
94
            variable="TEST"&gt;
95
      &lt;/classpathVariableInitializer&gt;
96
   &lt;/extension&gt;
97
</pre>
98
Calling <code>JavaConventions.validateClasspathEntry(IJavaProject, IClasspathEntry, boolean)</code>
99
method on this variable entry will return a <code>IStatus.WARNING</code> status with following message:
100
.
101
<br>
102
Classpath variable deprecation message and read-only information are accessible using two new added
103
<code>JavaCore</code> API methods:
104
<pre>
105
/**
106
 * Returns deprecation message of a given classpath variable.
107
 *
108
 * @param variableName
109
 * @return A string if the classpath variable is deprecated, <code>null</code> otherwise.
110
 * @since 3.3
111
 */
112
public static String getClasspathVariableDeprecationMessage(String variableName) 
113
114
/**
115
 * Returns whether a given classpath variable is read-only or not.
116
 *
117
 * @param variableName
118
 * @return <code>true</code> if the classpath variable is read-only,
119
 * 	<code>false</code> otherwise.
120
 * @since 3.3
121
 */
122
public static boolean isClasspathVariableReadOnly(String variableName)
123
</pre>
124
</li>
125
</ul>
54
126
55
<h3>Problem Reports Fixed</h3>
127
<h3>Problem Reports Fixed</h3>
56
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=171016">171016</a>
128
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=171016">171016</a>
(-)model/org/eclipse/jdt/internal/core/util/messages.properties (-1 / +2 lines)
Lines 1-5 Link Here
1
###############################################################################
1
###############################################################################
2
# Copyright (c) 2000, 2006 IBM Corporation and others.
2
# Copyright (c) 2000, 2007 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
5
# which accompanies this distribution, and is available at
Lines 167-172 Link Here
167
classpath_disabledMultipleOutputLocations = Multiple output locations are disabled in project {1}, cannot associate entry: ''{0}'' with a specific output
167
classpath_disabledMultipleOutputLocations = Multiple output locations are disabled in project {1}, cannot associate entry: ''{0}'' with a specific output
168
classpath_incompatibleLibraryJDKLevel = Incompatible .class files version in required binaries. Project ''{0}'' is targeting a {1} runtime, but is compiled against ''{2}'' which requires a {3} runtime
168
classpath_incompatibleLibraryJDKLevel = Incompatible .class files version in required binaries. Project ''{0}'' is targeting a {1} runtime, but is compiled against ''{2}'' which requires a {3} runtime
169
classpath_duplicateEntryExtraAttribute = Duplicate extra attribute: ''{0}'' in classpath entry ''{1}'' for project {2}
169
classpath_duplicateEntryExtraAttribute = Duplicate extra attribute: ''{0}'' in classpath entry ''{1}'' for project {2}
170
classpath_deprecated_variable = Classpath variable ''{0}'' in project {1} is deprecated: ''{2}''
170
171
171
### miscellaneous
172
### miscellaneous
172
file_notFound = File not found: ''{0}''
173
file_notFound = File not found: ''{0}''
(-)model/org/eclipse/jdt/internal/core/util/Messages.java (-1 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 161-166 Link Here
161
	public static String classpath_disabledMultipleOutputLocations;
161
	public static String classpath_disabledMultipleOutputLocations;
162
	public static String classpath_incompatibleLibraryJDKLevel;
162
	public static String classpath_incompatibleLibraryJDKLevel;
163
	public static String classpath_duplicateEntryExtraAttribute;
163
	public static String classpath_duplicateEntryExtraAttribute;
164
	public static String classpath_deprecated_variable;
164
	public static String file_notFound;
165
	public static String file_notFound;
165
	public static String file_badFormat;
166
	public static String file_badFormat;
166
	public static String path_nullPath;
167
	public static String path_nullPath;
(-)src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java (-1 / +111 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 19-24 Link Here
19
import org.eclipse.jdt.core.*;
19
import org.eclipse.jdt.core.*;
20
import org.eclipse.jdt.core.compiler.CharOperation;
20
import org.eclipse.jdt.core.compiler.CharOperation;
21
import org.eclipse.jdt.internal.core.JavaModelManager;
21
import org.eclipse.jdt.internal.core.JavaModelManager;
22
import org.eclipse.jdt.internal.core.JavaModelStatus;
22
import org.eclipse.jdt.internal.core.UserLibraryClasspathContainer;
23
import org.eclipse.jdt.internal.core.UserLibraryClasspathContainer;
23
import org.eclipse.jdt.internal.core.UserLibraryManager;
24
import org.eclipse.jdt.internal.core.UserLibraryManager;
24
25
Lines 1088-1093 Link Here
1088
}
1089
}
1089
1090
1090
/**
1091
/**
1092
 * @bug 138599: [model][classpath] Need a way to mark a classpath variable as deprecated
1093
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=138599"
1094
 */
1095
public void testVariableInitializerDeprecated() throws CoreException {
1096
	try {
1097
		// Create initializer
1098
		String varName = "TEST_DEPRECATED";
1099
		String filePath = "/P1/lib.jar";
1100
		VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {varName, filePath}));
1101
		assertEquals("JavaCore classpath value should have been initialized", JavaCore.getClasspathVariable(varName).toString(), filePath);
1102
		
1103
		// Verify that Classpath Variable is deprecated
1104
		assertEquals("JavaCore classpath variable should be deprecated", "Test deprecated flag", JavaCore.getClasspathVariableDeprecationMessage(varName));
1105
1106
		// Create project
1107
		IJavaProject project = createJavaProject("P1");
1108
		createFile("/P1/lib.jar", "");
1109
		IClasspathEntry variable = JavaCore.newVariableEntry(new Path("TEST_DEPRECATED"), null, null);
1110
		IJavaModelStatus status = JavaConventions.validateClasspathEntry(project, variable, false);
1111
		assertStatus("Classpath variable 'TEST_DEPRECATED' in project P1 is deprecated: 'Test deprecated flag'", status);
1112
		assertFalse("Status should not be OK", status.isOK());
1113
		assertEquals("Status should have WARNING severity", IStatus.WARNING, status.getSeverity());
1114
		assertEquals("Status should have deprecated code", IJavaModelStatusConstants.DEPRECATED_VARIABLE, status.getCode());
1115
	} finally {
1116
		VariablesInitializer.reset();
1117
		deleteProject("P1");
1118
	}
1119
}
1120
public void testVariableInitializerUnboundAndDeprecated() throws CoreException {
1121
	try {
1122
		// Create initializer
1123
		String varName = "TEST_DEPRECATED";
1124
		String filePath = "/P1/lib.jar";
1125
		VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {varName, filePath}));
1126
		assertEquals("JavaCore classpath value should have been initialized", JavaCore.getClasspathVariable(varName).toString(), filePath);
1127
		
1128
		// Verify that Classpath Variable is deprecated
1129
		assertEquals("JavaCore classpath variable should be deprecated", "Test deprecated flag", JavaCore.getClasspathVariableDeprecationMessage(varName));
1130
1131
		// Create project
1132
		IJavaProject project = createJavaProject("P1");
1133
		IClasspathEntry variable = JavaCore.newVariableEntry(new Path("TEST_DEPRECATED"), null, null);
1134
		IJavaModelStatus status = JavaConventions.validateClasspathEntry(project, variable, false);
1135
		assertStatus("Project P1 is missing required library: 'lib.jar'", status);
1136
		assertFalse("Status should not be OK", status.isOK());
1137
		assertEquals("Status should have WARNING severity", IStatus.ERROR, status.getSeverity());
1138
		assertEquals("Status should have deprecated code", IJavaModelStatusConstants.INVALID_CLASSPATH, status.getCode());
1139
	} finally {
1140
		VariablesInitializer.reset();
1141
		deleteProject("P1");
1142
	}
1143
}
1144
1145
/**
1146
 * @bug 156226: [model][classpath] Allow classpath variable to be marked as non modifiable
1147
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=156226"
1148
 */
1149
public void testVariableInitializerReadOnly() throws CoreException {
1150
	try {
1151
		// Create initializer
1152
		String varName = "TEST_READ_ONLY";
1153
		String path = "/P1/lib.jar";
1154
		VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] { varName, path }));
1155
		assertEquals("JavaCore classpath value should have been initialized", JavaCore.getClasspathVariable(varName).toString(), path);
1156
1157
		// verify that Classpath Variable is read-only
1158
		assertTrue("JavaCore classpath variable should be read-only", JavaCore.isClasspathVariableReadOnly(varName));
1159
1160
		// Create project
1161
		IJavaProject project = createJavaProject("P1");
1162
		createFile("/P1/lib.jar", "");
1163
		IClasspathEntry variable = JavaCore.newVariableEntry(new Path("TEST_READ_ONLY"), null, null);
1164
		IJavaModelStatus status = JavaConventions.validateClasspathEntry(project, variable, false);
1165
		assertStatus("OK", status);
1166
		assertTrue("Status should be OK", status.isOK());
1167
		assertEquals("Status should be VERIFIED_OK", JavaModelStatus.VERIFIED_OK, status);
1168
	} finally {
1169
		VariablesInitializer.reset();
1170
		deleteProject("P1");
1171
	}
1172
}
1173
public void testVariableInitializerDeprecatedAndReadOnly() throws CoreException {
1174
	try {
1175
		// Create initializer
1176
		String varName = "TEST_DEPRECATED_READ_ONLY";
1177
		String path = "/P1/lib.jar";
1178
		VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] { varName, path }));
1179
		assertEquals("JavaCore classpath value should have been initialized", JavaCore.getClasspathVariable(varName).toString(), path);
1180
1181
		// verify that Classpath Variable is read-only
1182
		assertEquals("JavaCore classpath variable should be deprecated", "A deprecated and read-only initializer", JavaCore.getClasspathVariableDeprecationMessage(varName));
1183
		assertTrue("JavaCore classpath variable should be read-only", JavaCore.isClasspathVariableReadOnly(varName));
1184
1185
		// Create project
1186
		IJavaProject project = createJavaProject("P1");
1187
		createFile("/P1/lib.jar", "");
1188
		IClasspathEntry variable = JavaCore.newVariableEntry(new Path("TEST_DEPRECATED_READ_ONLY"), null, null);
1189
		IJavaModelStatus status = JavaConventions.validateClasspathEntry(project, variable, false);
1190
		assertStatus("Classpath variable 'TEST_DEPRECATED_READ_ONLY' in project P1 is deprecated: 'A deprecated and read-only initializer'", status);
1191
		assertFalse("Status should not be OK", status.isOK());
1192
		assertEquals("Status should have WARNING severity", IStatus.WARNING, status.getSeverity());
1193
		assertEquals("Status should have deprecated code", IJavaModelStatusConstants.DEPRECATED_VARIABLE, status.getCode());
1194
	} finally {
1195
		VariablesInitializer.reset();
1196
		deleteProject("P1");
1197
	}
1198
}
1199
1200
/**
1091
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=61872"
1201
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=61872"
1092
 */
1202
 */
1093
public void testUserLibraryInitializer1() throws CoreException {
1203
public void testUserLibraryInitializer1() throws CoreException {
(-)src/org/eclipse/jdt/core/tests/model/ClasspathTests.java (-18 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 35-41 Link Here
35
import org.eclipse.core.runtime.CoreException;
35
import org.eclipse.core.runtime.CoreException;
36
import org.eclipse.core.runtime.IPath;
36
import org.eclipse.core.runtime.IPath;
37
import org.eclipse.core.runtime.IProgressMonitor;
37
import org.eclipse.core.runtime.IProgressMonitor;
38
import org.eclipse.core.runtime.IStatus;
39
import org.eclipse.core.runtime.Path;
38
import org.eclipse.core.runtime.Path;
40
import org.eclipse.jdt.core.IAccessRule;
39
import org.eclipse.jdt.core.IAccessRule;
41
import org.eclipse.jdt.core.IClasspathAttribute;
40
import org.eclipse.jdt.core.IClasspathAttribute;
Lines 128-149 Link Here
128
		entry,
127
		entry,
129
		decoded);
128
		decoded);
130
}
129
}
131
protected void assertStatus(String expected, IStatus status) {
132
	String actual = status.getMessage();
133
	if (!expected.equals(actual)) {
134
	 	System.out.print(Util.displayString(actual, 2));
135
	 	System.out.println(",");
136
	}
137
	assertEquals(expected, actual);
138
}
139
protected void assertStatus(String message, String expected, IStatus status) {
140
	String actual = status.getMessage();
141
	if (!expected.equals(actual)) {
142
	 	System.out.print(Util.displayString(actual, 2));
143
	 	System.out.println(",");
144
	}
145
	assertEquals(message, expected, actual);
146
}
147
protected File createFile(File parent, String name, String content) throws IOException {
130
protected File createFile(File parent, String name, String content) throws IOException {
148
	File file = new File(parent, name);
131
	File file = new File(parent, name);
149
	FileOutputStream out = new FileOutputStream(file);
132
	FileOutputStream out = new FileOutputStream(file);
Lines 1795-1800 Link Here
1795
		this.deleteProject("P2");
1778
		this.deleteProject("P2");
1796
	}
1779
	}
1797
}
1780
}
1781
1798
/**
1782
/**
1799
 * Adding an entry to the classpath for a library that does not exist
1783
 * Adding an entry to the classpath for a library that does not exist
1800
 * should not break the model. The classpath should contain the
1784
 * should not break the model. The classpath should contain the
(-)src/org/eclipse/jdt/core/tests/model/ModifyingResourceTests.java (-4 / +17 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 20-28 Link Here
20
import org.eclipse.jdt.internal.compiler.batch.Main;
20
import org.eclipse.jdt.internal.compiler.batch.Main;
21
import org.eclipse.jdt.internal.core.JavaElement;
21
import org.eclipse.jdt.internal.core.JavaElement;
22
22
23
/*
24
 * Tests that modify resources in the workspace.
25
 */
26
public class ModifyingResourceTests extends AbstractJavaModelTests {
23
public class ModifyingResourceTests extends AbstractJavaModelTests {
27
	
24
	
28
public ModifyingResourceTests(String name) {
25
public ModifyingResourceTests(String name) {
Lines 38-43 Link Here
38
		expected,
35
		expected,
39
		actual);
36
		actual);
40
}
37
}
38
protected void assertStatus(String expected, IStatus status) {
39
	String actual = status.getMessage();
40
	if (!expected.equals(actual)) {
41
	 	System.out.print(Util.displayString(actual, 2));
42
	 	System.out.println(",");
43
	}
44
	assertEquals(expected, actual);
45
}
46
protected void assertStatus(String message, String expected, IStatus status) {
47
	String actual = status.getMessage();
48
	if (!expected.equals(actual)) {
49
	 	System.out.print(Util.displayString(actual, 2));
50
	 	System.out.println(",");
51
	}
52
	assertEquals(message, expected, actual);
53
}
41
/**
54
/**
42
 * E.g. <code>
55
 * E.g. <code>
43
 * org.eclipse.jdt.tests.core.ModifyingResourceTests.generateClassFile(
56
 * org.eclipse.jdt.tests.core.ModifyingResourceTests.generateClassFile(
(-)plugin.xml (+16 lines)
Lines 12-17 Link Here
12
		<classpathVariableInitializer
12
		<classpathVariableInitializer
13
			variable="TEST_ROOT"
13
			variable="TEST_ROOT"
14
			class="org.eclipse.jdt.core.tests.model.VariablesInitializer"/>
14
			class="org.eclipse.jdt.core.tests.model.VariablesInitializer"/>
15
  <classpathVariableInitializer
16
        class="org.eclipse.jdt.core.tests.model.VariablesInitializer"
17
        deprecated="Test deprecated flag"
18
        variable="TEST_DEPRECATED">
19
  </classpathVariableInitializer>
20
  <classpathVariableInitializer
21
        class="org.eclipse.jdt.core.tests.model.VariablesInitializer"
22
        readOnly="true"
23
        variable="TEST_READ_ONLY">
24
  </classpathVariableInitializer>
25
  <classpathVariableInitializer
26
        class="org.eclipse.jdt.core.tests.model.VariablesInitializer"
27
        deprecated="A deprecated and read-only initializer"
28
        readOnly="true"
29
        variable="TEST_DEPRECATED_READ_ONLY">
30
  </classpathVariableInitializer>
15
	</extension>		
31
	</extension>		
16
32
17
	<!-- Classpath container initializer -->
33
	<!-- Classpath container initializer -->

Return to bug 138599