### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/core/IJavaModelStatusConstants.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelStatusConstants.java,v retrieving revision 1.37 diff -u -r1.37 IJavaModelStatusConstants.java --- model/org/eclipse/jdt/core/IJavaModelStatusConstants.java 10 May 2006 18:03:42 -0000 1.37 +++ model/org/eclipse/jdt/core/IJavaModelStatusConstants.java 19 Jan 2007 14:30:45 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -320,4 +320,10 @@ * @since 3.2 */ public static final int UNKNOWN_JAVADOC_FORMAT = 1009; + /** + *
Status constant indicating that the variable is deprecated.
+ * + * @since 3.3 + */ + public static final int DEPRECATED_VARIABLE = 1010; } Index: model/org/eclipse/jdt/core/IClasspathEntry.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathEntry.java,v retrieving revision 1.59 diff -u -r1.59 IClasspathEntry.java --- model/org/eclipse/jdt/core/IClasspathEntry.java 29 Sep 2006 17:13:57 -0000 1.59 +++ model/org/eclipse/jdt/core/IClasspathEntry.java 19 Jan 2007 14:30:45 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,7 +15,7 @@ /** * An entry on a Java project classpath identifying one or more package fragment * roots. A classpath entry has a content kind (either source, - *K_SOURCE
, or binary, K_BINARY
), which is inherited
+ * {@link IPackageFragmentRoot#K_SOURCE}, or binary, {@link IPackageFragmentRoot#K_BINARY}), which is inherited
* by each package fragment root and package fragment associated with the entry.
* * A classpath entry can refer to any of the following:
CPE_SOURCE
constant.
+ * associated with the {@link #CPE_SOURCE} constant.
* Source classpath entries can carry inclusion and exclusion patterns for
* selecting which source files appear as compilation
* units and get compiled when the project is built.
@@ -40,7 +40,7 @@
* package fragments and .class
files. The classpath entry
* must specify the absolute path to the JAR (or root folder), and in case it refers
* to an external JAR, then there is no associated resource in the workbench. Entries
- * of this kind are associated with the CPE_LIBRARY
constant.
+ * of this kind are associated with the {@link #CPE_LIBRARY} constant.
*
* CPE_PROJECT
+ * project. Entries of this kind are associated with the {@link #CPE_PROJECT}
* constant.
* Note: referencing a required project with a classpath entry refers to the source
* code or associated .class
files located in its output location.
* It will also automatically include any other libraries or projects that the required project's classpath
* refers to, iff the corresponding classpath entries are tagged as being exported
- * (IClasspathEntry#isExported
).
+ * ({@link IClasspathEntry#isExported}).
* Unless exporting some classpath entries, classpaths are not chained by default -
* each project must specify its own classpath in its entirety.CPE_VARIABLE
constant.
- * Classpath variables are created using JavaCore#setClasspathVariable
,
+ * Entries of this kind are associated with the {@link #CPE_VARIABLE} constant.
+ * Classpath variables are created using {@link JavaCore#setClasspathVariable(String, IPath, org.eclipse.core.runtime.IProgressMonitor)},
* and gets resolved, to either a project or library entry, using
- * JavaCore#getResolvedClasspathVariable
.
- * It is also possible to register an automatic initializer (ClasspathVariableInitializer
),
+ * {@link JavaCore#getResolvedClasspathEntry(IClasspathEntry)}.
+ * It is also possible to register an automatic initializer ({@link ClasspathVariableInitializer}),
* which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer".
* After resolution, a classpath variable entry may either correspond to a project or a library entry. CPE_CONTAINER
. Typically, a classpath container can
+ * a classpath entry of kind {@link #CPE_CONTAINER}. Typically, a classpath container can
* be used to describe a complex library composed of multiple JARs, projects or classpath variables,
* considering also that containers can be mapped differently on each project. Several projects can
* reference the same generic container path, but have each of them actually bound to a different
* container object.
* The container path is a formed by a first ID segment followed with extra segments,
* which can be used as additional hints for resolving this container reference. If no container was ever
- * recorded for this container path onto this project (using setClasspathContainer
,
- * then a ClasspathContainerInitializer
will be activated if any was registered for this
+ * recorded for this container path onto this project (using {@link JavaCore#setClasspathContainer},
+ * then a {@link ClasspathContainerInitializer} will be activated if any was registered for this
* container ID onto the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
- * A classpath container entry can be resolved explicitly using JavaCore#getClasspathContainer
+ * A classpath container entry can be resolved explicitly using {@link JavaCore#getClasspathContainer}
* and the resulting container entries can contain any non-container entry. In particular, it may contain variable
* entries, which in turn needs to be resolved before being directly used.
* IJavaProject#getResolvedClasspath
will have all entries of type
- * CPE_VARIABLE
and CPE_CONTAINER
resolved to a set of
- * CPE_SOURCE
, CPE_LIBRARY
or CPE_PROJECT
+ * The result of {@link IJavaProject#getResolvedClasspath} will have all entries of type
+ * {@link #CPE_VARIABLE} and {@link #CPE_CONTAINER} resolved to a set of
+ * {@link #CPE_SOURCE}, {@link #CPE_LIBRARY} or {@link #CPE_PROJECT}
* classpath entries.
*
- * Any classpath entry other than a source folder (kind CPE_SOURCE
) can
+ * Any classpath entry other than a source folder (kind {@link #CPE_SOURCE}) can
* be marked as being exported. Exported entries are automatically contributed to
* dependent projects, along with the project's default output folder, which is
* implicitly exported, and any auxiliary output folders specified on source
@@ -102,7 +102,7 @@
* followed by the any exported entries.
*
* This interface is not intended to be implemented by clients.
- * Classpath entries can be created via methods on JavaCore
.
+ * Classpath entries can be created via methods on {@link JavaCore}.
*
IPackageFragmentRoot.K_SOURCE
for files containing
- * source code, and IPackageFragmentRoot.K_BINARY
for binary
+ * @return {@link IPackageFragmentRoot#K_SOURCE} for files containing
+ * source code, and {@link IPackageFragmentRoot#K_BINARY} for binary
* class files.
- * There is no specified value for an entry denoting a variable (CPE_VARIABLE
)
- * or a classpath container (CPE_CONTAINER
).
+ * There is no specified value for an entry denoting a variable ({@link #CPE_VARIABLE})
+ * or a classpath container ({@link #CPE_CONTAINER}).
*/
int getContentKind();
@@ -183,16 +183,16 @@
*
* @return one of:
* CPE_SOURCE
- this entry describes a source root in
+ * CPE_LIBRARY
- this entry describes a folder or JAR
+ * CPE_PROJECT
- this entry describes another project
+ * CPE_VARIABLE
- this entry describes a project or library
+ * CPE_CONTAINER
- this entry describes set of entries
+ * .class
files generated for this source entry
- * (entry kind CPE_SOURCE
).
+ * (entry kind {@link #CPE_SOURCE}).
*
* Source entries can optionally be associated with a specific output location.
* If none is provided, the source entry will be implicitly associated with its project
- * default output location (see IJavaProject#getOutputLocation
).
+ * default output location (see {@link IJavaProject#getOutputLocation}).
*
* NOTE: A specific output location cannot coincidate with another source/library entry. *
@@ -364,24 +364,24 @@ * Returns the path of this classpath entry. * * The meaning of the path of a classpath entry depends on its entry kind:CPE_SOURCE
) -
+ * CPE_LIBRARY
) - the path
+ * CPE_PROJECT
) - the path of the entry denotes the
+ * CPE_VARIABLE
) - the first segment of the path
+ * CPE_CONTAINER
) - the path of the entry
+ * IClasspathContainer
).
+ * reference (also see {@link IClasspathContainer}).
* null
value
- * if and only if getSourceAttachmentPath
returns
+ * if and only if {@link #getSourceAttachmentPath} returns
* a non-null
value.
*
* @return the path within the source archive or folder, or null
if
@@ -421,7 +421,7 @@
/**
* Returns whether this entry is exported to dependent projects.
* Always returns false
for source entries (kind
- * CPE_SOURCE
), which cannot be exported.
+ * {@link #CPE_SOURCE}), which cannot be exported.
*
* @return true
if exported, and false
otherwise
* @since 2.0
Index: model/org/eclipse/jdt/core/JavaCore.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v
retrieving revision 1.559
diff -u -r1.559 JavaCore.java
--- model/org/eclipse/jdt/core/JavaCore.java 12 Jan 2007 17:58:48 -0000 1.559
+++ model/org/eclipse/jdt/core/JavaCore.java 19 Jan 2007 14:30:47 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1669,6 +1669,17 @@
}
/**
+ * Returns deprecation message of a given classpath variable.
+ *
+ * @param variableName
+ * @return A string if the classpath variable is deprecated, null
otherwise.
+ * @since 3.3
+ */
+ public static String getClasspathVariableDeprecationMessage(String variableName) {
+ return (String) JavaModelManager.getJavaModelManager().deprecatedVariables.get(variableName);
+ }
+
+ /**
* Helper method finding the classpath variable initializer registered for a given classpath variable name
* or null
if none was found while iterating over the contributions to extension point to
* the extension point "org.eclipse.jdt.core.classpathVariableInitializer".
@@ -1690,7 +1701,8 @@
IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
for(int j = 0; j < configElements.length; j++){
try {
- String varAttribute = configElements[j].getAttribute("variable"); //$NON-NLS-1$
+ IConfigurationElement configElement = configElements[j];
+ String varAttribute = configElement.getAttribute("variable"); //$NON-NLS-1$
if (variable.equals(varAttribute)) {
if (JavaModelManager.CP_RESOLVE_VERBOSE) {
Util.verbose(
@@ -1700,7 +1712,16 @@
}
Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
if (execExt instanceof ClasspathVariableInitializer){
- return (ClasspathVariableInitializer)execExt;
+ ClasspathVariableInitializer initializer = (ClasspathVariableInitializer)execExt;
+ String deprecatedAttribute = configElement.getAttribute("deprecated"); //$NON-NLS-1$
+ if (deprecatedAttribute != null) {
+ JavaModelManager.getJavaModelManager().deprecatedVariables.put(variable, deprecatedAttribute);
+ }
+ String readOnlyAttribute = configElement.getAttribute("readOnly"); //$NON-NLS-1$
+ if (JavaModelManager.TRUE.equals(readOnlyAttribute)) {
+ JavaModelManager.getJavaModelManager().readOnlyVariables.add(variable);
+ }
+ return initializer;
}
}
} catch(CoreException e){
@@ -3012,7 +3033,19 @@
if (monitor != null) monitor.done();
}
}
-
+
+ /**
+ * Returns whether a given classpath variable is read-only or not.
+ *
+ * @param variableName
+ * @return true
if the classpath variable is read-only,
+ * false
otherwise.
+ * @since 3.3
+ */
+ public static boolean isClasspathVariableReadOnly(String variableName) {
+ return JavaModelManager.getJavaModelManager().readOnlyVariables.contains(variableName);
+ }
+
/**
* Returns whether the given file name's extension is a Java-like extension.
*
@@ -3023,7 +3056,7 @@
public static boolean isJavaLikeFileName(String fileName) {
return Util.isJavaLikeFileName(fileName);
}
-
+
/**
* Returns whether the given marker references the given Java element.
* Used for markers, which denote a Java element rather than a resource.
Index: model/org/eclipse/jdt/internal/core/JavaModelOperation.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelOperation.java,v
retrieving revision 1.64
diff -u -r1.64 JavaModelOperation.java
--- model/org/eclipse/jdt/internal/core/JavaModelOperation.java 23 Nov 2005 15:41:57 -0000 1.64
+++ model/org/eclipse/jdt/internal/core/JavaModelOperation.java 19 Jan 2007 14:30:50 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -61,7 +61,7 @@
protected HashMap attributes;
public static final String HAS_MODIFIED_RESOURCE_ATTR = "hasModifiedResource"; //$NON-NLS-1$
- public static final String TRUE = "true"; //$NON-NLS-1$
+ public static final String TRUE = JavaModelManager.TRUE;
//public static final String FALSE = "false";
/**
Index: model/org/eclipse/jdt/internal/core/JavaModelStatus.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelStatus.java,v
retrieving revision 1.42
diff -u -r1.42 JavaModelStatus.java
--- model/org/eclipse/jdt/internal/core/JavaModelStatus.java 29 Mar 2006 03:08:48 -0000 1.42
+++ model/org/eclipse/jdt/internal/core/JavaModelStatus.java 19 Jan 2007 14:30:50 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -126,7 +126,7 @@
this(code, new IJavaElement[]{element});
this.string = string;
}
-
+
/**
* Constructs an Java model status with the given corresponding
* element and path
@@ -134,7 +134,8 @@
public JavaModelStatus(int code, IJavaElement element, IPath path) {
this(code, new IJavaElement[]{element});
this.path = path;
- }
+ }
+
/**
* Constructs an Java model status with the given corresponding
* element, path and string
@@ -144,7 +145,19 @@
this.path = path;
this.string = string;
}
+
/**
+ * Constructs an Java model status with the given corresponding
+ * element and path
+ */
+ public JavaModelStatus(int severity, int code, IJavaElement element, IPath path, String msg) {
+ super(severity, JavaCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$
+ this.elements= new IJavaElement[]{element};
+ this.path = path;
+ this.string = msg;
+ }
+
+ /**
* Constructs an Java model status with no corresponding elements.
*/
public JavaModelStatus(CoreException coreException) {
@@ -326,53 +339,59 @@
if (description == null) description = path.makeRelative().toString();
return Messages.bind(Messages.classpath_invalidContainer, new String[] {description, javaProject.getElementName()});
- case CP_VARIABLE_PATH_UNBOUND:
- javaProject = (IJavaProject)elements[0];
- return Messages.bind(Messages.classpath_unboundVariablePath, new String[] {path.makeRelative().toString(), javaProject.getElementName()});
-
- case CLASSPATH_CYCLE:
- javaProject = (IJavaProject)elements[0];
- return Messages.bind(Messages.classpath_cycle, javaProject.getElementName());
-
- case DISABLED_CP_EXCLUSION_PATTERNS:
- javaProject = (IJavaProject)elements[0];
- String projectName = javaProject.getElementName();
- IPath newPath = path;
- if (path.segment(0).toString().equals(projectName)) {
- newPath = path.removeFirstSegments(1);
- }
- return Messages.bind(Messages.classpath_disabledInclusionExclusionPatterns, new String[] {newPath.makeRelative().toString(), projectName});
-
- case DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS:
- javaProject = (IJavaProject)elements[0];
- projectName = javaProject.getElementName();
- newPath = path;
- if (path.segment(0).toString().equals(projectName)) {
- newPath = path.removeFirstSegments(1);
- }
- return Messages.bind(Messages.classpath_disabledMultipleOutputLocations, new String[] {newPath.makeRelative().toString(), projectName});
+ case CP_VARIABLE_PATH_UNBOUND:
+ javaProject = (IJavaProject)elements[0];
+ return Messages.bind(Messages.classpath_unboundVariablePath, new String[] {path.makeRelative().toString(), javaProject.getElementName()});
- case INCOMPATIBLE_JDK_LEVEL:
+ case CLASSPATH_CYCLE:
javaProject = (IJavaProject)elements[0];
- return Messages.bind(Messages.classpath_incompatibleLibraryJDKLevel, new String[]{
- javaProject.getElementName(),
- javaProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true),
- path.makeRelative().toString(),
- string,
- });
- case CANNOT_RETRIEVE_ATTACHED_JAVADOC :
- if (elements != null && elements.length == 1) {
+ return Messages.bind(Messages.classpath_cycle, javaProject.getElementName());
+
+ case DISABLED_CP_EXCLUSION_PATTERNS:
+ javaProject = (IJavaProject)elements[0];
+ String projectName = javaProject.getElementName();
+ IPath newPath = path;
+ if (path.segment(0).toString().equals(projectName)) {
+ newPath = path.removeFirstSegments(1);
+ }
+ return Messages.bind(Messages.classpath_disabledInclusionExclusionPatterns, new String[] {newPath.makeRelative().toString(), projectName});
+
+ case DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS:
+ javaProject = (IJavaProject)elements[0];
+ projectName = javaProject.getElementName();
+ newPath = path;
+ if (path.segment(0).toString().equals(projectName)) {
+ newPath = path.removeFirstSegments(1);
+ }
+ return Messages.bind(Messages.classpath_disabledMultipleOutputLocations, new String[] {newPath.makeRelative().toString(), projectName});
+
+ case INCOMPATIBLE_JDK_LEVEL:
+ javaProject = (IJavaProject)elements[0];
+ return Messages.bind(Messages.classpath_incompatibleLibraryJDKLevel, new String[]{
+ javaProject.getElementName(),
+ javaProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true),
+ path.makeRelative().toString(),
+ string,
+ });
+
+ case CANNOT_RETRIEVE_ATTACHED_JAVADOC :
+ if (elements != null && elements.length == 1) {
+ if (this.string != null) {
+ return Messages.bind(Messages.status_cannot_retrieve_attached_javadoc, ((JavaElement)elements[0]).toStringWithAncestors(), this.string);
+ }
+ return Messages.bind(Messages.status_cannot_retrieve_attached_javadoc, ((JavaElement)elements[0]).toStringWithAncestors(), ""); //$NON-NLS-1$
+ }
if (this.string != null) {
- return Messages.bind(Messages.status_cannot_retrieve_attached_javadoc, ((JavaElement)elements[0]).toStringWithAncestors(), this.string);
+ return Messages.bind(Messages.status_cannot_retrieve_attached_javadoc, this.string, "");//$NON-NLS-1$
}
- return Messages.bind(Messages.status_cannot_retrieve_attached_javadoc, ((JavaElement)elements[0]).toStringWithAncestors(), ""); //$NON-NLS-1$
- }
- if (this.string != null) {
- return Messages.bind(Messages.status_cannot_retrieve_attached_javadoc, this.string, "");//$NON-NLS-1$
- }
- break;
- case UNKNOWN_JAVADOC_FORMAT :
- return Messages.bind(Messages.status_unknown_javadoc_format, ((JavaElement)elements[0]).toStringWithAncestors());
+ break;
+
+ case UNKNOWN_JAVADOC_FORMAT :
+ return Messages.bind(Messages.status_unknown_javadoc_format, ((JavaElement)elements[0]).toStringWithAncestors());
+
+ case DEPRECATED_VARIABLE :
+ javaProject = (IJavaProject)elements[0];
+ return Messages.bind(Messages.classpath_deprecated_variable, new String[] {path.segment(0).toString(), javaProject.getElementName(), this.string});
}
if (string != null) {
return string;
Index: model/org/eclipse/jdt/internal/core/ClasspathEntry.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java,v
retrieving revision 1.94
diff -u -r1.94 ClasspathEntry.java
--- model/org/eclipse/jdt/internal/core/ClasspathEntry.java 3 Oct 2006 09:43:27 -0000 1.94
+++ model/org/eclipse/jdt/internal/core/ClasspathEntry.java 19 Jan 2007 14:30:48 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,6 +26,7 @@
import org.eclipse.core.runtime.AssertionFailedException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IAccessRule;
import org.eclipse.jdt.core.IClasspathAttribute;
@@ -1627,7 +1628,18 @@
if (entry == null){
return new JavaModelStatus(IJavaModelStatusConstants.CP_VARIABLE_PATH_UNBOUND, project, path);
}
- return validateClasspathEntry(project, entry, checkSourceAttachment, recurseInContainers);
+
+ // get validation status
+ IJavaModelStatus status = validateClasspathEntry(project, entry, checkSourceAttachment, recurseInContainers);
+ if (!status.isOK()) return status;
+
+ // return deprecation status if any
+ String variableName = path.segment(0);
+ String deprecatedMessage = JavaCore.getClasspathVariableDeprecationMessage(variableName);
+ if (deprecatedMessage != null) {
+ return new JavaModelStatus(IStatus.WARNING, IJavaModelStatusConstants.DEPRECATED_VARIABLE, project, path, deprecatedMessage);
+ }
+ return status;
} else {
return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_illegalVariablePath, new String[] {entryPathMsg, projectName}));
}
Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v
retrieving revision 1.350
diff -u -r1.350 JavaModelManager.java
--- model/org/eclipse/jdt/internal/core/JavaModelManager.java 12 Jan 2007 17:58:49 -0000 1.350
+++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 19 Jan 2007 14:30:50 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -87,9 +87,11 @@
*/
public HashMap variables = new HashMap(5);
public HashSet variablesWithInitializer = new HashSet(5);
+ public HashMap deprecatedVariables = new HashMap(5);
+ public HashSet readOnlyVariables = new HashSet(5);
public HashMap previousSessionVariables = new HashMap(5);
private ThreadLocal variableInitializationInProgress = new ThreadLocal();
-
+
/**
* Classpath containers pool
*/
@@ -120,6 +122,7 @@
public final static String CP_CONTAINER_PREFERENCES_PREFIX = JavaCore.PLUGIN_ID+".classpathContainer."; //$NON-NLS-1$
public final static String CP_ENTRY_IGNORE = "##ClasspathVariableInitializer
schema:
++ <element name="classpathVariableInitializer"> + <complexType> + ... + <attribute name="deprecated" type="string"> + <annotation> + <documentation> + String explaining the reason why the associated variable is deprecated + </documentation> + <appInfo> + <meta.attribute translatable="true"/> + </appInfo> + </annotation> + </attribute> + <attribute name="readOnly" type="boolean"> + <annotation> + <documentation> + Indicates that the associated variable cannot be modified + </documentation> + </annotation> + </attribute> + </complexType> + </element> ++When deprecated attribute is set on ClasspathVariableInitializer extension point, classpath entry validation +returns a warning status if no other error was previously detected. +
classpathVariableInitializer
extension point set
+the TEST
classpath variable as deprecated and read-only:
++ <extension + point="org.eclipse.jdt.core.classpathVariableInitializer"> + <classpathVariableInitializer + class="org.eclipse.jdt.tests.model.TestInitializer" + deprecated="The reason why this variable is deprecated" + readOnly="true" + variable="TEST"> + </classpathVariableInitializer> + </extension> ++Calling
JavaConventions.validateClasspathEntry(IJavaProject, IClasspathEntry, boolean)
+method on this variable entry will return a IStatus.WARNING
status with following message:
+.
+JavaCore
API methods:
++/** + * Returns deprecation message of a given classpath variable. + * + * @param variableName + * @return A string if the classpath variable is deprecated,+null
otherwise. + * @since 3.3 + */ +public static String getClasspathVariableDeprecationMessage(String variableName) + +/** + * Returns whether a given classpath variable is read-only or not. + * + * @param variableName + * @returntrue
if the classpath variable is read-only, + *false
otherwise. + * @since 3.3 + */ +public static boolean isClasspathVariableReadOnly(String variableName) +
* org.eclipse.jdt.tests.core.ModifyingResourceTests.generateClassFile(
Index: plugin.xml
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/plugin.xml,v
retrieving revision 1.29
diff -u -r1.29 plugin.xml
--- plugin.xml 19 Oct 2006 02:47:24 -0000 1.29
+++ plugin.xml 19 Jan 2007 14:30:53 -0000
@@ -12,6 +12,22 @@
+
+
+
+
+
+