From: axelcl Date: Sun, 6 Mar 2005 20:56:55 +0000 (+0000) Subject: improved PHP parser X-Git-Url: http://git.phpeclipse.com?hp=774ff39f27a215256013a23606f9f9c1200ff9e1 improved PHP parser --- diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ClasspathVariableInitializer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ClasspathVariableInitializer.java index ab9b778..54792db 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ClasspathVariableInitializer.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ClasspathVariableInitializer.java @@ -14,7 +14,7 @@ package net.sourceforge.phpdt.core; /** * Abstract base implementation of all classpath variable initializers. * Classpath variable initializers are used in conjunction with the - * "org.eclipse.jdt.core.classpathVariableInitializer" extension point. + * "net.sourceforge.phpdt.core.classpathVariableInitializer" extension point. *

* Clients should subclass this class to implement a specific classpath * variable initializer. The subclass must have a public 0-argument diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Flags.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Flags.java index a9ccaae..9182b7f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Flags.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Flags.java @@ -24,7 +24,7 @@ import net.sourceforge.phpdt.internal.compiler.env.IConstants; * Note that the numeric values of these flags match the ones for class files * as described in the Java Virtual Machine Specification. The AST class * Modifier provides the same functionality as this class, only in - * the org.eclipse.jdt.core.dom package. + * the net.sourceforge.phpdt.core.dom package. *

* * @see IMember#getFlags diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IClasspathEntry.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IClasspathEntry.java index 83de070..8d6e929 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IClasspathEntry.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IClasspathEntry.java @@ -65,7 +65,7 @@ import org.eclipse.core.runtime.IPath; * and gets resolved, to either a project or library entry, using * JavaCore#getResolvedClasspathVariable. * It is also possible to register an automatic initializer (ClasspathVariableInitializer), - * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer". + * which will be invoked through the extension point "net.sourceforge.phpdt.core.classpathVariableInitializer". * After resolution, a classpath variable entry may either correspond to a project or a library entry. * *
  • A named classpath container identified by its container path. @@ -79,7 +79,7 @@ import org.eclipse.core.runtime.IPath; * 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 - * container ID onto the extension point "org.eclipse.jdt.core.classpathContainerInitializer". + * container ID onto the extension point "net.sourceforge.phpdt.core.classpathContainerInitializer". * A classpath container entry can be resolved explicitly using 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. @@ -257,6 +257,55 @@ public interface IClasspathEntry { * @since 2.1 */ IPath[] getExclusionPatterns(); + /** + * Returns the set of patterns used to explicitly define resources to be + * included with this source entry. + *

    + * When no inclusion patterns are specified, the source entry includes all + * relevent files in the resource tree rooted at this source entry's path. + * Specifying one or more inclusion patterns means that only the specified + * portions of the resource tree are to be included. Each path specified + * must be a relative path, and will be interpreted relative to this source + * entry's path. File patterns are case-sensitive. A file matched by one or + * more of these patterns is included in the corresponding package fragment + * root unless it is excluded by one or more of this entrie's exclusion + * patterns. Exclusion patterns have higher precedence than inclusion + * patterns; in other words, exclusion patterns can remove files for the + * ones that are to be included, not the other way around. + *

    + *

    + * See {@link #getExclusionPatterns()} for a discussion of the syntax and + * semantics of path patterns. The absence of any inclusion patterns is + * semantically equivalent to the explicit inclusion pattern + * **. + *

    + *

    + * Examples: + *

    + *

    + * + * @return the possibly empty list of resource inclusion patterns + * associated with this source entry, and null for other + * kinds of classpath entries + * @since 3.0 + */ + IPath[] getInclusionPatterns(); /** * Returns the full path to the specific location where the builder writes diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompilationUnit.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompilationUnit.java index c25a7cc..dd57c8f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompilationUnit.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompilationUnit.java @@ -10,6 +10,8 @@ *******************************************************************************/ package net.sourceforge.phpdt.core; +import java.util.HashMap; + import net.sourceforge.phpdt.internal.core.ImportContainer; import org.eclipse.core.runtime.IProgressMonitor; @@ -234,7 +236,18 @@ IJavaElement getElementAt(int position) throws JavaModelException; * or "java.awt.*") * @return a handle onto the corresponding import declaration. The import declaration may or may not exist. */ -//IImportDeclaration getImport(String name) ; +IImportDeclaration getImport(String name) ; +/** + * Returns the import declarations in this compilation unit + * in the order in which they appear in the source. This is + * a convenience method - import declarations can also be + * accessed from a compilation unit's import container. + * + * @return the import declarations in this compilation unit + * @throws JavaModelException if this element does not exist or if an + * exception occurs while accessing its corresponding resource + */ +IImportDeclaration[] getImports() throws JavaModelException; /** * Returns the import container for this compilation unit. * This is a handle-only method. The import container may or @@ -243,7 +256,7 @@ IJavaElement getElementAt(int position) throws JavaModelException; * @return a handle onto the corresponding import container. The * import contain may or may not exist. */ -ImportContainer getImportContainer(); +IImportContainer getImportContainer(); /** * Returns the import declarations in this compilation unit * in the order in which they appear in the source. This is @@ -272,7 +285,7 @@ IPackageDeclaration getPackageDeclaration(String name); * @exception JavaModelException if this element does not exist or if an * exception occurs while accessing its corresponding resource */ -//IPackageDeclaration[] getPackageDeclarations() throws JavaModelException; +IPackageDeclaration[] getPackageDeclarations() throws JavaModelException; /** * Returns the primary compilation unit (whose owner is the primary owner) * this working copy was created from, or this compilation unit if this a primary @@ -295,7 +308,7 @@ ICompilationUnit getPrimary(); * @return a handle onto the corresponding type. The type may or may not exist. * @see JavaConventions#validateCompilationUnitName(String name) */ -IType getType(String name); +IType getType(String name); /** * Returns the top-level types declared in this compilation unit * in the order in which they appear in the source. diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IImportDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IImportDeclaration.java index c8587e9..812bc64 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IImportDeclaration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IImportDeclaration.java @@ -11,6 +11,7 @@ *******************************************************************************/ package net.sourceforge.phpdt.core; + /** * Represents an import declaration in Java compilation unit. *

    @@ -47,4 +48,5 @@ int getFlags() throws JavaModelException; * @return true if the import is on-demand, false otherwise */ boolean isOnDemand(); + } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElement.java index 07f17f3..cea7b63 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElement.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElement.java @@ -112,6 +112,12 @@ public interface IJavaElement extends IAdaptable { int IMPORT_DECLARATION = 13; /** + * Constant representing a local variable declaration. + * A Java element with this type can be safely cast to ILocalVariable. + * @since 3.0 + */ + int LOCAL_VARIABLE = 14; + /** * Returns whether this Java element exists in the model. *

    * Java elements are handle objects that may or may not be backed by an diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElementDelta.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElementDelta.java index 9fe7eb5..61f2ce9 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElementDelta.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElementDelta.java @@ -245,6 +245,22 @@ public interface IJavaElementDelta { * @since 3.0 */ public int F_PRIMARY_WORKING_COPY = 0x10000; + + /** + * Change flag indicating that the raw classpath (or the output folder) of a project has changed. + * This flag is only valid if the element is an IJavaProject. + * + * @since 3.0 + */ + public int F_CLASSPATH_CHANGED = 0x20000; + + /** + * Change flag indicating that the resource of a primary compilation unit has changed. + * This flag is only valid if the element is a primary ICompilationUnit. + * + * @since 3.0 + */ + public int F_PRIMARY_RESOURCE = 0x40000; /** * Returns deltas for the children that have been added. * @return deltas for the children that have been added diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelMarker.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelMarker.java index e31c253..9c5dd12 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelMarker.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelMarker.java @@ -21,7 +21,7 @@ package net.sourceforge.phpdt.core; public interface IJavaModelMarker { /** - * Java model problem marker type (value "org.eclipse.jdt.core.problem"). + * Java model problem marker type (value "net.sourceforge.phpdt.core.problem"). * This can be used to recognize those markers in the workspace that flag problems * detected by the Java tooling during compilation. */ @@ -29,7 +29,7 @@ public interface IJavaModelMarker { /** - * Java model transient problem marker type (value "org.eclipse.jdt.core.transient_problem"). + * Java model transient problem marker type (value "net.sourceforge.phpdt.core.transient_problem"). * This can be used to recognize those markers in the workspace that flag transient * problems detected by the Java tooling (such as a problem * detected by the outliner, or a problem detected during a code completion) @@ -37,11 +37,11 @@ public interface IJavaModelMarker { public static final String TRANSIENT_PROBLEM = JavaCore.PLUGIN_ID + ".transient_problem"; //$NON-NLS-1$ /** - * Java model task marker type (value "org.eclipse.jdt.core.task"). + * Java model task marker type (value "net.sourceforge.phpdt.core.task"). * This can be used to recognize task markers in the workspace that correspond to tasks * specified in Java source comments and detected during compilation (for example, 'TO-DO: ...'). * Tasks are identified by a task tag, which can be customized through PHPCore - * option "org.eclipse.jdt.core.compiler.taskTag". + * option "net.sourceforge.phpdt.core.compiler.taskTag". * @since 2.1 */ public static final String TASK_MARKER = JavaCore.PLUGIN_ID + ".task"; //$NON-NLS-1$ @@ -76,7 +76,7 @@ public interface IJavaModelMarker { public static final String CYCLE_DETECTED = "cycleDetected"; //$NON-NLS-1$ /** - * Build path problem marker type (value "org.eclipse.jdt.core.buildpath_problem"). + * Build path problem marker type (value "net.sourceforge.phpdt.core.buildpath_problem"). * This can be used to recognize those markers in the workspace that flag problems * detected by the Java tooling during classpath setting. */ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatus.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatus.java index 98c8565..6f55b0c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatus.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatus.java @@ -19,7 +19,7 @@ import org.eclipse.core.runtime.IStatus; * wrong. *

    * Java model status object are distinguished by their plug-in id: - * getPlugin returns "org.eclipse.jdt.core". + * getPlugin returns "net.sourceforge.phpdt.core". * getCode returns one of the status codes declared in * IJavaModelStatusConstants. *

    diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatusConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatusConstants.java index b089522..f31517d 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatusConstants.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatusConstants.java @@ -267,7 +267,7 @@ public interface IJavaModelStatusConstants { * Status constant indicating that an exclusion pattern got specified * on a classpath source entry, though it was explicitely disabled * according to its project preference settings. - * @see org.eclipse.jdt.core.IJavaProject#getOptions(boolean) + * @see net.sourceforge.phpdt.core.IJavaProject#getOptions(boolean) * @since 2.1 */ public static final int DISABLED_CP_EXCLUSION_PATTERNS = 1002; @@ -276,7 +276,7 @@ public interface IJavaModelStatusConstants { * Status constant indicating that a specific output location got associated * with a source entry, though it was explicitely disabled according to its project * preference settings. - * @see org.eclipse.jdt.core.IJavaProject#getOptions(boolean) + * @see net.sourceforge.phpdt.core.IJavaProject#getOptions(boolean) * @since 2.1 */ public static final int DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS = 1003; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ILocalVariable.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ILocalVariable.java new file mode 100644 index 0000000..1c9f549 --- /dev/null +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ILocalVariable.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package net.sourceforge.phpdt.core; + +/** + * Represents a local variable declared in a method or an initializer. + * ILocalVariable are pseudo-elements created as the result of a ICodeAssist.codeSelect(...) + * operation. They are not part of the Java model (exists() returns whether the parent exists rather than + * whether the local variable exists in the parent) and they are not included in the children of an IMethod + * or an IInitializer. + *

    + * In particular such a pseudo-element should not be used as a handle. For example its name range won't be updated + * if the underlying source changes. + *

    + * This interface is not intended to be implemented by clients. + *

    + * @since 3.0 + */ +public interface ILocalVariable extends IJavaElement, ISourceReference { + + /** + * Returns the name of this local variable. + * + * @return the name of this local variable. + */ + String getElementName(); + + /** + * Returns the source range of this local variable's name. + * + * @return the source range of this local variable's name + */ + ISourceRange getNameRange(); + + /** + * Returns the type signature of this local variable. + *

    + * The type signature may be either unresolved (for source types) + * or resolved (for binary types), and either basic (for basic types) + * or rich (for parameterized types). See {@link Signature} for details. + *

    + * + * @return the type signature of this local variable. + * @see Signature + */ + String getTypeSignature(); +} diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IMember.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IMember.java index 68446bd..8365ab6 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IMember.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IMember.java @@ -10,6 +10,8 @@ *******************************************************************************/ package net.sourceforge.phpdt.core; +import net.sourceforge.phpdt.core.IType; + /** * Common protocol for Java elements that can be members of types. * This set consists of IType, IMethod, @@ -18,7 +20,7 @@ package net.sourceforge.phpdt.core; * This interface is not intended to be implemented by clients. *

    */ -public interface IMember extends IJavaElement , ISourceReference, ISourceManipulation { +public interface IMember extends IJavaElement , ISourceReference, ISourceManipulation, IParent { /** * Returns the class file in which this member is declared, or null * if this member is not declared in a class file (for example, a source type). @@ -75,6 +77,20 @@ int getFlags() throws JavaModelException; */ ISourceRange getNameRange() throws JavaModelException; /** + * Returns the local or anonymous type declared in this source member with the given simple name and/or + * with the specified position relative to the order they are defined in the source. + * The name is empty if it is an anonymous type. + * Numbering starts at 1 (thus the first occurrence is occurrence 1, not occurrence 0). + * This is a handle-only method. The type may or may not exist. + * Throws a RuntimeException if this member is not a source member. + * + * @param name the given simple name + * @param occurrenceCount the specified position + * @return the type with the given name and/or with the specified position relative to the order they are defined in the source + * @since 3.0 + */ +IType getType(String name, int occurrenceCount); +/** * Returns whether this member is from a class file. * This is a handle-only method. * diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageFragment.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageFragment.java index 2d832d5..117ee26 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageFragment.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageFragment.java @@ -133,7 +133,7 @@ public interface IPackageFragment extends IParent, IJavaElement, IOpenable { * exception occurs while accessing its corresponding resource. * @return this package fragment's root kind encoded as an integer */ -// int getKind() throws JavaModelException; + int getKind() throws JavaModelException; /** * Returns an array of non-Java resources contained in this package fragment. *

    diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IType.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IType.java index 5feecce..264c13c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IType.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IType.java @@ -10,6 +10,11 @@ *******************************************************************************/ package net.sourceforge.phpdt.core; +import org.eclipse.core.runtime.IProgressMonitor; +import net.sourceforge.phpdt.core.ITypeHierarchy; +import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.WorkingCopyOwner; + /** * Represents either a source type in a compilation unit (either a top-level @@ -553,6 +558,26 @@ public interface IType extends IMember, IParent { * @since 2.0 */ // ITypeHierarchy newTypeHierarchy(IWorkingCopy[] workingCopies, IProgressMonitor monitor) throws JavaModelException; + /** + * Creates and returns a type hierarchy for this type containing + * this type, all of its supertypes, and all its subtypes in the workspace, + * considering types in the working copies with the given owner. + * In other words, the owner's working copies will take + * precedence over their original compilation units in the workspace. + *

    + * Note that if a working copy is empty, it will be as if the original compilation + * unit had been deleted. + *

    + * + * @param owner the owner of working copies that take precedence over their original compilation units + * @param monitor the given progress monitor + * @return a type hierarchy for this type containing + * this type, all of its supertypes, and all its subtypes in the workspace + * @exception JavaModelException if this element does not exist or if an + * exception occurs while accessing its corresponding resource. + * @since 3.0 + */ +// ITypeHierarchy newTypeHierarchy(WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException; /** * Creates and returns a type hierarchy for this type containing diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaConventions.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaConventions.java new file mode 100644 index 0000000..d82a30c --- /dev/null +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaConventions.java @@ -0,0 +1,444 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package net.sourceforge.phpdt.core; + +import java.util.StringTokenizer; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import net.sourceforge.phpdt.core.compiler.*; +import net.sourceforge.phpdt.core.compiler.InvalidInputException; +import net.sourceforge.phpdt.internal.compiler.parser.Scanner; +import net.sourceforge.phpdt.internal.compiler.util.SuffixConstants; +import net.sourceforge.phpdt.internal.core.*; +import net.sourceforge.phpdt.internal.core.JavaModelStatus; +import net.sourceforge.phpdt.internal.core.util.Util; + +/** + * Provides methods for checking Java-specific conventions such as name syntax. + *

    + * This class provides static methods and constants only; it is not intended to be + * instantiated or subclassed by clients. + *

    + */ +public final class JavaConventions { + + private final static char DOT= '.'; + private final static Scanner SCANNER = new Scanner(); + + private JavaConventions() { + // Not instantiable + } + + /** + * Returns whether the given package fragment root paths are considered + * to overlap. + *

    + * Two root paths overlap if one is a prefix of the other, or they point to + * the same location. However, a JAR is allowed to be nested in a root. + * + * @param rootPath1 the first root path + * @param rootPath2 the second root path + * @return true if the given package fragment root paths are considered to overlap, false otherwise + * @deprecated Overlapping roots are allowed in 2.1 + */ + public static boolean isOverlappingRoots(IPath rootPath1, IPath rootPath2) { + if (rootPath1 == null || rootPath2 == null) { + return false; + } +// String extension1 = rootPath1.getFileExtension(); +// String extension2 = rootPath2.getFileExtension(); +// if (extension1 != null && (extension1.equalsIgnoreCase(SuffixConstants.EXTENSION_JAR) || extension1.equalsIgnoreCase(SuffixConstants.EXTENSION_ZIP))) { +// return false; +// } +// if (extension2 != null && (extension2.equalsIgnoreCase(SuffixConstants.EXTENSION_JAR) || extension2.equalsIgnoreCase(SuffixConstants.EXTENSION_ZIP))) { +// return false; +// } + return rootPath1.isPrefixOf(rootPath2) || rootPath2.isPrefixOf(rootPath1); + } + + /* + * Returns the current identifier extracted by the scanner (without unicode + * escapes) from the given id. + * Returns null if the id was not valid + */ + private static synchronized char[] scannedIdentifier(String id) { + if (id == null) { + return null; + } + String trimmed = id.trim(); + if (!trimmed.equals(id)) { + return null; + } + try { + SCANNER.setSource(id.toCharArray()); + int token = SCANNER.getNextToken(); + char[] currentIdentifier; + try { + currentIdentifier = SCANNER.getCurrentIdentifierSource(); + } catch (ArrayIndexOutOfBoundsException e) { + return null; + } + int nextToken= SCANNER.getNextToken(); + if (token == ITerminalSymbols.TokenNameIdentifier + && nextToken == ITerminalSymbols.TokenNameEOF + && SCANNER.startPosition == SCANNER.source.length) { // to handle case where we had an ArrayIndexOutOfBoundsException + // while reading the last token + return currentIdentifier; + } else { + return null; + } + } + catch (InvalidInputException e) { + return null; + } + } + + /** + * Validate the given compilation unit name. + * A compilation unit name must obey the following rules: + *

    + *

    + * @param name the name of a compilation unit + * @return a status object with code IStatus.OK if + * the given name is valid as a compilation unit name, otherwise a status + * object indicating what is wrong with the name + */ + public static IStatus validateCompilationUnitName(String name) { + if (name == null) { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.unit.nullName"), null); //$NON-NLS-1$ + } + if (!net.sourceforge.phpdt.internal.compiler.util.Util.isJavaFileName(name)) { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.unit.notJavaName"), null); //$NON-NLS-1$ + } + String identifier; + int index; + index = name.lastIndexOf('.'); + if (index == -1) { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.unit.notJavaName"), null); //$NON-NLS-1$ + } + identifier = name.substring(0, index); + // JSR-175 metadata strongly recommends "package-info.java" as the + // file in which to store package annotations and + // the package-level spec (replaces package.html) + if (!identifier.equals("package-info")) { //$NON-NLS-1$ + IStatus status = validateIdentifier(identifier); + if (!status.isOK()) { + return status; + } + } + IStatus status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE); + if (!status.isOK()) { + return status; + } + return JavaModelStatus.VERIFIED_OK; + } + + /** + * Validate the given .class file name. + * A .class file name must obey the following rules: + * + *

    + * @param name the name of a .class file + * @return a status object with code IStatus.OK if + * the given name is valid as a .class file name, otherwise a status + * object indicating what is wrong with the name + * @since 2.0 + */ + public static IStatus validateClassFileName(String name) { + if (name == null) { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.classFile.nullName"), null); //$NON-NLS-1$ + } + if (!net.sourceforge.phpdt.internal.compiler.util.Util.isClassFileName(name)) { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.classFile.notClassFileName"), null); //$NON-NLS-1$ + } + String identifier; + int index; + index = name.lastIndexOf('.'); + if (index == -1) { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.classFile.notClassFileName"), null); //$NON-NLS-1$ + } + identifier = name.substring(0, index); + IStatus status = validateIdentifier(identifier); + if (!status.isOK()) { + return status; + } + status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE); + if (!status.isOK()) { + return status; + } + return JavaModelStatus.VERIFIED_OK; + } + + /** + * Validate the given field name. + *

    + * Syntax of a field name corresponds to VariableDeclaratorId (JLS2 8.3). + * For example, "x". + * + * @param name the name of a field + * @return a status object with code IStatus.OK if + * the given name is valid as a field name, otherwise a status + * object indicating what is wrong with the name + */ + public static IStatus validateFieldName(String name) { + return validateIdentifier(name); + } + + /** + * Validate the given Java identifier. + * The identifier must not have the same spelling as a Java keyword, + * boolean literal ("true", "false"), or null literal ("null"). + * See section 3.8 of the Java Language Specification, Second Edition (JLS2). + * A valid identifier can act as a simple type name, method name or field name. + * + * @param id the Java identifier + * @return a status object with code IStatus.OK if + * the given identifier is a valid Java identifier, otherwise a status + * object indicating what is wrong with the identifier + */ + public static IStatus validateIdentifier(String id) { + if (scannedIdentifier(id) != null) { + return JavaModelStatus.VERIFIED_OK; + } else { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.illegalIdentifier", id), null); //$NON-NLS-1$ + } + } + + /** + * Validate the given import declaration name. + *

    + * The name of an import corresponds to a fully qualified type name + * or an on-demand package name as defined by ImportDeclaration (JLS2 7.5). + * For example, "java.util.*" or "java.util.Hashtable". + * + * @param name the import declaration + * @return a status object with code IStatus.OK if + * the given name is valid as an import declaration, otherwise a status + * object indicating what is wrong with the name + */ + public static IStatus validateImportDeclaration(String name) { + if (name == null || name.length() == 0) { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.import.nullImport"), null); //$NON-NLS-1$ + } + if (name.charAt(name.length() - 1) == '*') { + if (name.charAt(name.length() - 2) == '.') { + return validatePackageName(name.substring(0, name.length() - 2)); + } else { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.import.unqualifiedImport"), null); //$NON-NLS-1$ + } + } + return validatePackageName(name); + } + + /** + * Validate the given Java type name, either simple or qualified. + * For example, "java.lang.Object", or "Object". + *

    + * + * @param name the name of a type + * @return a status object with code IStatus.OK if + * the given name is valid as a Java type name, + * a status with code IStatus.WARNING + * indicating why the given name is discouraged, + * otherwise a status object indicating what is wrong with + * the name + */ + public static IStatus validateJavaTypeName(String name) { + if (name == null) { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.nullName"), null); //$NON-NLS-1$ + } + String trimmed = name.trim(); + if (!name.equals(trimmed)) { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.nameWithBlanks"), null); //$NON-NLS-1$ + } + int index = name.lastIndexOf('.'); + char[] scannedID; + if (index == -1) { + // simple name + scannedID = scannedIdentifier(name); + } else { + // qualified name + String pkg = name.substring(0, index).trim(); + IStatus status = validatePackageName(pkg); + if (!status.isOK()) { + return status; + } + String type = name.substring(index + 1).trim(); + scannedID = scannedIdentifier(type); + } + + if (scannedID != null) { + IStatus status = ResourcesPlugin.getWorkspace().validateName(new String(scannedID), IResource.FILE); + if (!status.isOK()) { + return status; + } + if (CharOperation.contains('$', scannedID)) { + return new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.dollarName"), null); //$NON-NLS-1$ + } + if ((scannedID.length > 0 && Character.isLowerCase(scannedID[0]))) { + return new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.lowercaseName"), null); //$NON-NLS-1$ + } + return JavaModelStatus.VERIFIED_OK; + } else { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.invalidName", name), null); //$NON-NLS-1$ + } + } + + /** + * Validate the given method name. + * The special names "<init>" and "<clinit>" are not valid. + *

    + * The syntax for a method name is defined by Identifier + * of MethodDeclarator (JLS2 8.4). For example "println". + * + * @param name the name of a method + * @return a status object with code IStatus.OK if + * the given name is valid as a method name, otherwise a status + * object indicating what is wrong with the name + */ + public static IStatus validateMethodName(String name) { + + return validateIdentifier(name); + } + + /** + * Validate the given package name. + *

    + * The syntax of a package name corresponds to PackageName as + * defined by PackageDeclaration (JLS2 7.4). For example, "java.lang". + *

    + * Note that the given name must be a non-empty package name (that is, attempting to + * validate the default package will return an error status.) + * Also it must not contain any characters or substrings that are not valid + * on the file system on which workspace root is located. + * + * @param name the name of a package + * @return a status object with code IStatus.OK if + * the given name is valid as a package name, otherwise a status + * object indicating what is wrong with the name + */ + public static IStatus validatePackageName(String name) { + + if (name == null) { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.nullName"), null); //$NON-NLS-1$ + } + int length; + if ((length = name.length()) == 0) { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.emptyName"), null); //$NON-NLS-1$ + } + if (name.charAt(0) == DOT || name.charAt(length-1) == DOT) { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.dotName"), null); //$NON-NLS-1$ + } + if (CharOperation.isWhitespace(name.charAt(0)) || CharOperation.isWhitespace(name.charAt(name.length() - 1))) { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.nameWithBlanks"), null); //$NON-NLS-1$ + } + int dot = 0; + while (dot != -1 && dot < length-1) { + if ((dot = name.indexOf(DOT, dot+1)) != -1 && dot < length-1 && name.charAt(dot+1) == DOT) { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.consecutiveDotsName"), null); //$NON-NLS-1$ + } + } + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + StringTokenizer st = new StringTokenizer(name, new String(new char[] {DOT})); + boolean firstToken = true; + IStatus warningStatus = null; + while (st.hasMoreTokens()) { + String typeName = st.nextToken(); + typeName = typeName.trim(); // grammar allows spaces + char[] scannedID = scannedIdentifier(typeName); + if (scannedID == null) { + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.illegalIdentifier", typeName), null); //$NON-NLS-1$ + } + IStatus status = workspace.validateName(new String(scannedID), IResource.FOLDER); + if (!status.isOK()) { + return status; + } + if (firstToken && scannedID.length > 0 && Character.isUpperCase(scannedID[0])) { + if (warningStatus == null) { + warningStatus = new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.uppercaseName"), null); //$NON-NLS-1$ + } + } + firstToken = false; + } + if (warningStatus != null) { + return warningStatus; + } + return JavaModelStatus.VERIFIED_OK; + } + + /** + * Validate a given classpath and output location for a project, using the following rules: + *

    + * + * Note that the classpath entries are not validated automatically. Only bound variables or containers are considered + * in the checking process (this allows to perform a consistency check on a classpath which has references to + * yet non existing projects, folders, ...). + *

    + * This validation is intended to anticipate classpath issues prior to assigning it to a project. In particular, it will automatically + * be performed during the classpath setting operation (if validation fails, the classpath setting will not complete). + *

    + * @param javaProject the given java project + * @param rawClasspath the given classpath + * @param projectOutputLocation the given output location + * @return a status object with code IStatus.OK if + * the given classpath and output location are compatible, otherwise a status + * object indicating what is wrong with the classpath or output location + * @since 2.0 + */ + public static IJavaModelStatus validateClasspath(IJavaProject javaProject, IClasspathEntry[] rawClasspath, IPath projectOutputLocation) { + + return ClasspathEntry.validateClasspath(javaProject, rawClasspath, projectOutputLocation); + } + + /** + * Returns a Java model status describing the problem related to this classpath entry if any, + * a status object with code IStatus.OK if the entry is fine (that is, if the + * given classpath entry denotes a valid element to be referenced onto a classpath). + * + * @param project the given java project + * @param entry the given classpath entry + * @param checkSourceAttachment a flag to determine if source attachement should be checked + * @return a java model status describing the problem related to this classpath entry if any, a status object with code IStatus.OK if the entry is fine + * @since 2.0 + */ + public static IJavaModelStatus validateClasspathEntry(IJavaProject project, IClasspathEntry entry, boolean checkSourceAttachment){ + return ClasspathEntry.validateClasspathEntry(project, entry, checkSourceAttachment, true/*recurse in container*/); + } +} diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java index 5dd77a1..b340b76 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java @@ -15,6 +15,7 @@ import net.sourceforge.phpdt.internal.core.ClasspathEntry; import net.sourceforge.phpdt.internal.core.JavaModel; import net.sourceforge.phpdt.internal.core.JavaModelManager; import net.sourceforge.phpdt.internal.core.Region; +import net.sourceforge.phpdt.internal.core.util.MementoTokenizer; import net.sourceforge.phpdt.internal.corext.Assert; import net.sourceforge.phpeclipse.PHPeclipsePlugin; @@ -1652,6 +1653,29 @@ public class JavaCore { } /** + * Returns the Java model element corresponding to the given handle identifier + * generated by IJavaElement.getHandleIdentifier(), or + * null if unable to create the associated element. + * If the returned Java element is an ICompilationUnit, its owner + * is the given owner if such a working copy exists, otherwise the compilation unit + * is a primary compilation unit. + * + * @param handleIdentifier the given handle identifier + * @param owner the owner of the returned compilation unit, ignored if the returned + * element is not a compilation unit + * @return the Java element corresponding to the handle identifier + * @since 3.0 + */ + public static IJavaElement create(String handleIdentifier, WorkingCopyOwner owner) { + if (handleIdentifier == null) { + return null; + } + MementoTokenizer memento = new MementoTokenizer(handleIdentifier); + JavaModel model = JavaModelManager.getJavaModelManager().getJavaModel(); + return model.getHandleFromMemento(memento, owner); + } + + /** * Returns the Java element corresponding to the given file, or * null if unable to associate the given file with a Java * element. @@ -1827,7 +1851,7 @@ public class JavaCore { * (using setClasspathContainer, then a * ClasspathContainerInitializer will be activated if any was * registered for this container ID onto the extension point - * "org.eclipse.jdt.core.classpathContainerInitializer". + * "net.sourceforge.phpdt.core.classpathContainerInitializer". *

    * There is no assumption that the returned container must answer the exact * same containerPath when requested @@ -1838,7 +1862,7 @@ public class JavaCore { * are not preserved from a session to another. It is thus highly * recommended to register a ClasspathContainerInitializer * for each referenced container (through the extension point - * "org.eclipse.jdt.core.ClasspathContainerInitializer"). + * "net.sourceforge.phpdt.core.ClasspathContainerInitializer"). *

    * * @param containerPath @@ -1938,7 +1962,7 @@ public class JavaCore { * Helper method finding the classpath container initializer registered for * a given classpath container ID or null if none was found * while iterating over the contributions to extension point to the - * extension point "org.eclipse.jdt.core.classpathContainerInitializer". + * extension point "net.sourceforge.phpdt.core.classpathContainerInitializer". *

    * A containerID is the first segment of any container path, used to * identify the registered container initializer. @@ -1995,7 +2019,7 @@ public class JavaCore { *

    * Note that classpath variables can be contributed registered initializers * for, using the extension point - * "org.eclipse.jdt.core.classpathVariableInitializer". If an initializer is + * "net.sourceforge.phpdt.core.classpathVariableInitializer". If an initializer is * registered for a variable, its persisted value will be ignored: its * initializer will thus get the opportunity to rebind the variable * differently on each session. @@ -2072,7 +2096,7 @@ public class JavaCore { * 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". + * extension point "net.sourceforge.phpdt.core.classpathVariableInitializer". *

    * * @param the @@ -2150,49 +2174,49 @@ public class JavaCore { * When generated, this attribute will enable local variable names * to be displayed in debugger, only in place where variables are * definitely assigned (.class file is then bigger) - * - option id: "org.eclipse.jdt.core.compiler.debug.localVariable" + * - option id: "net.sourceforge.phpdt.core.compiler.debug.localVariable" * - possible values: { "generate", "do not generate" } * - default: "generate" * * COMPILER / Generating Line Number Debug Attribute * When generated, this attribute will enable source code highlighting in debugger * (.class file is then bigger). - * - option id: "org.eclipse.jdt.core.compiler.debug.lineNumber" + * - option id: "net.sourceforge.phpdt.core.compiler.debug.lineNumber" * - possible values: { "generate", "do not generate" } * - default: "generate" * * COMPILER / Generating Source Debug Attribute * When generated, this attribute will enable the debugger to present the * corresponding source code. - * - option id: "org.eclipse.jdt.core.compiler.debug.sourceFile" + * - option id: "net.sourceforge.phpdt.core.compiler.debug.sourceFile" * - possible values: { "generate", "do not generate" } * - default: "generate" * * COMPILER / Preserving Unused Local Variables * Unless requested to preserve unused local variables (that is, never read), the * compiler will optimize them out, potentially altering debugging - * - option id: "org.eclipse.jdt.core.compiler.codegen.unusedLocal" + * - option id: "net.sourceforge.phpdt.core.compiler.codegen.unusedLocal" * - possible values: { "preserve", "optimize out" } * - default: "preserve" * * COMPILER / Defining Target Java Platform * For binary compatibility reason, .class files can be tagged to with certain VM versions and later. * Note that "1.4" target require to toggle compliance mode to "1.4" too. - * - option id: "org.eclipse.jdt.core.compiler.codegen.targetPlatform" + * - option id: "net.sourceforge.phpdt.core.compiler.codegen.targetPlatform" * - possible values: { "1.1", "1.2", "1.3", "1.4" } * - default: "1.1" * * COMPILER / Reporting Unreachable Code * Unreachable code can optionally be reported as an error, warning or simply * ignored. The bytecode generation will always optimized it out. - * - option id: "org.eclipse.jdt.core.compiler.problem.unreachableCode" + * - option id: "net.sourceforge.phpdt.core.compiler.problem.unreachableCode" * - possible values: { "error", "warning", "ignore" } * - default: "error" * * COMPILER / Reporting Invalid Import * An import statement that cannot be resolved might optionally be reported * as an error, as a warning or ignored. - * - option id: "org.eclipse.jdt.core.compiler.problem.invalidImport" + * - option id: "net.sourceforge.phpdt.core.compiler.problem.invalidImport" * - possible values: { "error", "warning", "ignore" } * - default: "error" * @@ -2200,7 +2224,7 @@ public class JavaCore { * A package default method is not visible in a different package, and thus * cannot be overridden. When enabling this option, the compiler will signal * such scenarii either as an error or a warning. - * - option id: "org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod" + * - option id: "net.sourceforge.phpdt.core.compiler.problem.overridingPackageDefaultMethod" * - possible values: { "error", "warning", "ignore" } * - default: "warning" * @@ -2208,21 +2232,21 @@ public class JavaCore { * Naming a method with a constructor name is generally considered poor * style programming. When enabling this option, the compiler will signal such * scenarii either as an error or a warning. - * - option id: "org.eclipse.jdt.core.compiler.problem.methodWithConstructorName" + * - option id: "net.sourceforge.phpdt.core.compiler.problem.methodWithConstructorName" * - possible values: { "error", "warning", "ignore" } * - default: "warning" * * COMPILER / Reporting Deprecation * When enabled, the compiler will signal use of deprecated API either as an * error or a warning. - * - option id: "org.eclipse.jdt.core.compiler.problem.deprecation" + * - option id: "net.sourceforge.phpdt.core.compiler.problem.deprecation" * - possible values: { "error", "warning", "ignore" } * - default: "warning" * * COMPILER / Reporting Deprecation Inside Deprecated Code * When enabled, the compiler will signal use of deprecated API inside deprecated code. - * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.deprecation". - * - option id: "org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode" + * The severity of the problem is controlled with option "net.sourceforge.phpdt.core.compiler.problem.deprecation". + * - option id: "net.sourceforge.phpdt.core.compiler.problem.deprecationInDeprecatedCode" * - possible values: { "enabled", "disabled" } * - default: "disabled" * @@ -2233,49 +2257,49 @@ public class JavaCore { * } catch (java.io.IOException e) {}. * When enabling this option, the compiler will issue an error or a warning for hidden * catch blocks corresponding to checked exceptions - * - option id: "org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock" + * - option id: "net.sourceforge.phpdt.core.compiler.problem.hiddenCatchBlock" * - possible values: { "error", "warning", "ignore" } * - default: "warning" * * COMPILER / Reporting Unused Local * When enabled, the compiler will issue an error or a warning for unused local * variables (that is, variables never read from) - * - option id: "org.eclipse.jdt.core.compiler.problem.unusedLocal" + * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedLocal" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" * * COMPILER / Reporting Unused Parameter * When enabled, the compiler will issue an error or a warning for unused method * parameters (that is, parameters never read from) - * - option id: "org.eclipse.jdt.core.compiler.problem.unusedParameter" + * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedParameter" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" * * COMPILER / Reporting Unused Parameter if Implementing Abstract Method * When enabled, the compiler will signal unused parameters in abstract method implementations. - * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter". - * - option id: "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract" + * The severity of the problem is controlled with option "net.sourceforge.phpdt.core.compiler.problem.unusedParameter". + * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedParameterWhenImplementingAbstract" * - possible values: { "enabled", "disabled" } * - default: "disabled" * * COMPILER / Reporting Unused Parameter if Overriding Concrete Method * When enabled, the compiler will signal unused parameters in methods overriding concrete ones. - * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter". - * - option id: "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete" + * The severity of the problem is controlled with option "net.sourceforge.phpdt.core.compiler.problem.unusedParameter". + * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedParameterWhenOverridingConcrete" * - possible values: { "enabled", "disabled" } * - default: "disabled" * * COMPILER / Reporting Unused Import * When enabled, the compiler will issue an error or a warning for unused import * reference - * - option id: "org.eclipse.jdt.core.compiler.problem.unusedImport" + * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedImport" * - possible values: { "error", "warning", "ignore" } * - default: "warning" * * COMPILER / Reporting Unused Private Members * When enabled, the compiler will issue an error or a warning whenever a private * method or field is declared but never used within the same unit. - * - option id: "org.eclipse.jdt.core.compiler.problem.unusedPrivateMember" + * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedPrivateMember" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" * @@ -2283,21 +2307,21 @@ public class JavaCore { * When enabled, the compiler will issue an error or a warning whenever it emulates * access to a non-accessible member of an enclosing type. Such access can have * performance implications. - * - option id: "org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation" + * - option id: "net.sourceforge.phpdt.core.compiler.problem.syntheticAccessEmulation" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" * * COMPILER / Reporting Non-Externalized String Literal * When enabled, the compiler will issue an error or a warning for non externalized * String literal (that is, not tagged with //$NON-NLS-<n>$). - * - option id: "org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral" + * - option id: "net.sourceforge.phpdt.core.compiler.problem.nonExternalizedStringLiteral" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" * * COMPILER / Reporting Usage of 'assert' Identifier * When enabled, the compiler will issue an error or a warning whenever 'assert' is * used as an identifier (reserved keyword in 1.4) - * - option id: "org.eclipse.jdt.core.compiler.problem.assertIdentifier" + * - option id: "net.sourceforge.phpdt.core.compiler.problem.assertIdentifier" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" * @@ -2305,14 +2329,14 @@ public class JavaCore { * When enabled, the compiler will issue an error or a warning whenever a static field * or method is accessed with an expression receiver. A reference to a static member should * be qualified with a type name. - * - option id: "org.eclipse.jdt.core.compiler.problem.staticAccessReceiver" + * - option id: "net.sourceforge.phpdt.core.compiler.problem.staticAccessReceiver" * - possible values: { "error", "warning", "ignore" } * - default: "warning" * * COMPILER / Reporting Assignment with no Effect * When enabled, the compiler will issue an error or a warning whenever an assignment * has no effect (e.g 'x = x'). - * - option id: "org.eclipse.jdt.core.compiler.problem.noEffectAssignment" + * - option id: "net.sourceforge.phpdt.core.compiler.problem.noEffectAssignment" * - possible values: { "error", "warning", "ignore" } * - default: "warning" * @@ -2323,14 +2347,14 @@ public class JavaCore { * interface I { * int clone(); * } - * - option id: "org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod" + * - option id: "net.sourceforge.phpdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod" * - possible values: { "error", "warning", "ignore" } * - default: "warning" * * COMPILER / Reporting Usage of char[] Expressions in String Concatenations * When enabled, the compiler will issue an error or a warning whenever a char[] expression * is used in String concatenations (for example, "hello" + new char[]{'w','o','r','l','d'}). - * - option id: "org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion" + * - option id: "net.sourceforge.phpdt.core.compiler.problem.noImplicitStringConversion" * - possible values: { "error", "warning", "ignore" } * - default: "warning" * @@ -2338,20 +2362,20 @@ public class JavaCore { * Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword * reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM * level should be set to "1.4" and the compliance mode should be "1.4". - * - option id: "org.eclipse.jdt.core.compiler.source" + * - option id: "net.sourceforge.phpdt.core.compiler.source" * - possible values: { "1.3", "1.4" } * - default: "1.3" * * COMPILER / Setting Compliance Level * Select the compliance level for the compiler. In "1.3" mode, source and target settings * should not go beyond "1.3" level. - * - option id: "org.eclipse.jdt.core.compiler.compliance" + * - option id: "net.sourceforge.phpdt.core.compiler.compliance" * - possible values: { "1.3", "1.4" } * - default: "1.3" * * COMPILER / Maximum number of problems reported per compilation unit * Specify the maximum number of problems reported on each compilation unit. - * - option id: "org.eclipse.jdt.core.compiler.maxProblemPerUnit" + * - option id: "net.sourceforge.phpdt.core.compiler.maxProblemPerUnit" * - possible values: "<n>" where <n> is zero or a positive integer (if zero then all problems are reported). * - default: "100" * @@ -2360,7 +2384,7 @@ public class JavaCore { * one of the corresponding tag inside any comment in Java source code. * Generated task messages will include the tag, and range until the next line separator or comment ending. * Note that tasks messages are trimmed. - * - option id: "org.eclipse.jdt.core.compiler.taskTags" + * - option id: "net.sourceforge.phpdt.core.compiler.taskTags" * - possible values: { "<tag>[,<tag>]*" } where <tag> is a String without any wild-card or leading/trailing spaces * - default: "" * @@ -2368,34 +2392,34 @@ public class JavaCore { * In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low) * of the task markers issued by the compiler. * If the default is specified, the priority of each task marker is "NORMAL". - * - option id: "org.eclipse.jdt.core.compiler.taskPriorities" + * - option id: "net.sourceforge.phpdt.core.compiler.taskPriorities" * - possible values: { "<priority>[,<priority>]*" } where <priority> is one of "HIGH", "NORMAL" or "LOW" * - default: "" * * BUILDER / Specifying Filters for Resource Copying Control * Allow to specify some filters to control the resource copy process. - * - option id: "org.eclipse.jdt.core.builder.resourceCopyExclusionFilter" + * - option id: "net.sourceforge.phpdt.core.builder.resourceCopyExclusionFilter" * - possible values: { "<name>[,<name>]* } where <name> is a file name pattern (* and ? wild-cards allowed) * or the name of a folder which ends with '/' * - default: "" * * BUILDER / Abort if Invalid Classpath * Allow to toggle the builder to abort if the classpath is invalid - * - option id: "org.eclipse.jdt.core.builder.invalidClasspath" + * - option id: "net.sourceforge.phpdt.core.builder.invalidClasspath" * - possible values: { "abort", "ignore" } * - default: "abort" * * BUILDER / Cleaning Output Folder(s) * Indicate whether the JavaBuilder is allowed to clean the output folders * when performing full build operations. - * - option id: "org.eclipse.jdt.core.builder.cleanOutputFolder" + * - option id: "net.sourceforge.phpdt.core.builder.cleanOutputFolder" * - possible values: { "clean", "ignore" } * - default: "clean" * * BUILDER / Reporting Duplicate Resources * Indicate the severity of the problem reported when more than one occurrence * of a resource is to be copied into the output location. - * - option id: "org.eclipse.jdt.core.builder.duplicateResourceTask" + * - option id: "net.sourceforge.phpdt.core.builder.duplicateResourceTask" * - possible values: { "error", "warning" } * - default: "warning" * @@ -2403,61 +2427,61 @@ public class JavaCore { * Indicate whether JavaCore should enforce the project build order to be based on * the classpath prerequisite chain. When requesting to compute, this takes over * the platform default order (based on project references). - * - option id: "org.eclipse.jdt.core.computeJavaBuildOrder" + * - option id: "net.sourceforge.phpdt.core.computeJavaBuildOrder" * - possible values: { "compute", "ignore" } * - default: "ignore" * * JAVACORE / Specify Default Source Encoding Format * Get the encoding format for compiled sources. This setting is read-only, it is equivalent * to 'ResourcesPlugin.getEncoding()'. - * - option id: "org.eclipse.jdt.core.encoding" + * - option id: "net.sourceforge.phpdt.core.encoding" * - possible values: { any of the supported encoding name}. * - default: <platform default> * * JAVACORE / Reporting Incomplete Classpath * Indicate the severity of the problem reported when an entry on the classpath does not exist, * is not legite or is not visible (for example, a referenced project is closed). - * - option id: "org.eclipse.jdt.core.incompleteClasspath" + * - option id: "net.sourceforge.phpdt.core.incompleteClasspath" * - possible values: { "error", "warning"} * - default: "error" * * JAVACORE / Reporting Classpath Cycle * Indicate the severity of the problem reported when a project is involved in a cycle. - * - option id: "org.eclipse.jdt.core.circularClasspath" + * - option id: "net.sourceforge.phpdt.core.circularClasspath" * - possible values: { "error", "warning" } * - default: "error" * * JAVACORE / Enabling Usage of Classpath Exclusion Patterns * When disabled, no entry on a project classpath can be associated with * an exclusion pattern. - * - option id: "org.eclipse.jdt.core.classpath.exclusionPatterns" + * - option id: "net.sourceforge.phpdt.core.classpath.exclusionPatterns" * - possible values: { "enabled", "disabled" } * - default: "enabled" * * JAVACORE / Enabling Usage of Classpath Multiple Output Locations * When disabled, no entry on a project classpath can be associated with * a specific output location, preventing thus usage of multiple output locations. - * - option id: "org.eclipse.jdt.core.classpath.multipleOutputLocations" + * - option id: "net.sourceforge.phpdt.core.classpath.multipleOutputLocations" * - possible values: { "enabled", "disabled" } * - default: "enabled" * * FORMATTER / Inserting New Line Before Opening Brace * When Insert, a new line is inserted before an opening brace, otherwise nothing * is inserted - * - option id: "org.eclipse.jdt.core.formatter.newline.openingBrace" + * - option id: "net.sourceforge.phpdt.core.formatter.newline.openingBrace" * - possible values: { "insert", "do not insert" } * - default: "do not insert" * * FORMATTER / Inserting New Line Inside Control Statement * When Insert, a new line is inserted between } and following else, catch, finally - * - option id: "org.eclipse.jdt.core.formatter.newline.controlStatement" + * - option id: "net.sourceforge.phpdt.core.formatter.newline.controlStatement" * - possible values: { "insert", "do not insert" } * - default: "do not insert" * * FORMATTER / Clearing Blank Lines * When Clear all, all blank lines are removed. When Preserve one, only one is kept * and all others removed. - * - option id: "org.eclipse.jdt.core.formatter.newline.clearAll" + * - option id: "net.sourceforge.phpdt.core.formatter.newline.clearAll" * - possible values: { "clear all", "preserve one" } * - default: "preserve one" * @@ -2465,117 +2489,117 @@ public class JavaCore { * When Insert, a blank line is inserted between an else and an if when they are * contiguous. When choosing to not insert, else-if will be kept on the same * line when possible. - * - option id: "org.eclipse.jdt.core.formatter.newline.elseIf" + * - option id: "net.sourceforge.phpdt.core.formatter.newline.elseIf" * - possible values: { "insert", "do not insert" } * - default: "do not insert" * * FORMATTER / Inserting New Line In Empty Block * When insert, a line break is inserted between contiguous { and }, if } is not followed * by a keyword. - * - option id: "org.eclipse.jdt.core.formatter.newline.emptyBlock" + * - option id: "net.sourceforge.phpdt.core.formatter.newline.emptyBlock" * - possible values: { "insert", "do not insert" } * - default: "insert" * * FORMATTER / Splitting Lines Exceeding Length * Enable splitting of long lines (exceeding the configurable length). Length of 0 will * disable line splitting - * - option id: "org.eclipse.jdt.core.formatter.lineSplit" + * - option id: "net.sourceforge.phpdt.core.formatter.lineSplit" * - possible values: "<n>", where n is zero or a positive integer * - default: "80" * * FORMATTER / Compacting Assignment * Assignments can be formatted asymmetrically, for example 'int x= 2;', when Normal, a space * is inserted before the assignment operator - * - option id: "org.eclipse.jdt.core.formatter.style.assignment" + * - option id: "net.sourceforge.phpdt.core.formatter.style.assignment" * - possible values: { "compact", "normal" } * - default: "normal" * * FORMATTER / Defining Indentation Character * Either choose to indent with tab characters or spaces - * - option id: "org.eclipse.jdt.core.formatter.tabulation.char" + * - option id: "net.sourceforge.phpdt.core.formatter.tabulation.char" * - possible values: { "tab", "space" } * - default: "tab" * * FORMATTER / Defining Space Indentation Length * When using spaces, set the amount of space characters to use for each * indentation mark. - * - option id: "org.eclipse.jdt.core.formatter.tabulation.size" + * - option id: "net.sourceforge.phpdt.core.formatter.tabulation.size" * - possible values: "<n>", where n is a positive integer * - default: "4" * * FORMATTER / Inserting space in cast expression * When Insert, a space is added between the type and the expression in a cast expression. - * - option id: "org.eclipse.jdt.core.formatter.space.castexpression" + * - option id: "net.sourceforge.phpdt.core.formatter.space.castexpression" * - possible values: { "insert", "do not insert" } * - default: "insert" * * CODEASSIST / Activate Visibility Sensitive Completion * When active, completion doesn't show that you can not see * (for example, you can not see private methods of a super class). - * - option id: "org.eclipse.jdt.core.codeComplete.visibilityCheck" + * - option id: "net.sourceforge.phpdt.core.codeComplete.visibilityCheck" * - possible values: { "enabled", "disabled" } * - default: "disabled" * * CODEASSIST / Automatic Qualification of Implicit Members * When active, completion automatically qualifies completion on implicit * field references and message expressions. - * - option id: "org.eclipse.jdt.core.codeComplete.forceImplicitQualification" + * - option id: "net.sourceforge.phpdt.core.codeComplete.forceImplicitQualification" * - possible values: { "enabled", "disabled" } * - default: "disabled" * * CODEASSIST / Define the Prefixes for Field Name * When the prefixes is non empty, completion for field name will begin with * one of the proposed prefixes. - * - option id: "org.eclipse.jdt.core.codeComplete.fieldPrefixes" + * - option id: "net.sourceforge.phpdt.core.codeComplete.fieldPrefixes" * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card * - default: "" * * CODEASSIST / Define the Prefixes for Static Field Name * When the prefixes is non empty, completion for static field name will begin with * one of the proposed prefixes. - * - option id: "org.eclipse.jdt.core.codeComplete.staticFieldPrefixes" + * - option id: "net.sourceforge.phpdt.core.codeComplete.staticFieldPrefixes" * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card * - default: "" * * CODEASSIST / Define the Prefixes for Local Variable Name * When the prefixes is non empty, completion for local variable name will begin with * one of the proposed prefixes. - * - option id: "org.eclipse.jdt.core.codeComplete.localPrefixes" + * - option id: "net.sourceforge.phpdt.core.codeComplete.localPrefixes" * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card * - default: "" * * CODEASSIST / Define the Prefixes for Argument Name * When the prefixes is non empty, completion for argument name will begin with * one of the proposed prefixes. - * - option id: "org.eclipse.jdt.core.codeComplete.argumentPrefixes" + * - option id: "net.sourceforge.phpdt.core.codeComplete.argumentPrefixes" * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card * - default: "" * * CODEASSIST / Define the Suffixes for Field Name * When the suffixes is non empty, completion for field name will end with * one of the proposed suffixes. - * - option id: "org.eclipse.jdt.core.codeComplete.fieldSuffixes" + * - option id: "net.sourceforge.phpdt.core.codeComplete.fieldSuffixes" * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card * - default: "" * * CODEASSIST / Define the Suffixes for Static Field Name * When the suffixes is non empty, completion for static field name will end with * one of the proposed suffixes. - * - option id: "org.eclipse.jdt.core.codeComplete.staticFieldSuffixes" + * - option id: "net.sourceforge.phpdt.core.codeComplete.staticFieldSuffixes" * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card * - default: "" * * CODEASSIST / Define the Suffixes for Local Variable Name * When the suffixes is non empty, completion for local variable name will end with * one of the proposed suffixes. - * - option id: "org.eclipse.jdt.core.codeComplete.localSuffixes" + * - option id: "net.sourceforge.phpdt.core.codeComplete.localSuffixes" * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card * - default: "" * * CODEASSIST / Define the Suffixes for Argument Name * When the suffixes is non empty, completion for argument name will end with * one of the proposed suffixes. - * - option id: "org.eclipse.jdt.core.codeComplete.argumentSuffixes" + * - option id: "net.sourceforge.phpdt.core.codeComplete.argumentSuffixes" * - possible values: { "<suffix>[,<suffix>]*" } where <prefix> is a String without any wild-card * - default: "" * </pre> @@ -3221,13 +3245,13 @@ public class JavaCore { *

    * A container is exclusively resolved by a * ClasspathContainerInitializer registered onto the - * extension point "org.eclipse.jdt.core.classpathContainerInitializer". + * extension point "net.sourceforge.phpdt.core.classpathContainerInitializer". *

    * A container path must be formed of at least one segment, where: *