From 648aafa7a69550ee8320b93c3f2fb45cc87da5a5 Mon Sep 17 00:00:00 2001
From: axelcl
* 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
*
+ * 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:
+ * Modifier
provides the same functionality as this class, only in
- * the org.eclipse.jdt.core.dom
package.
+ * the net.sourceforge.phpdt.core.dom
package.
* 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.
*
* 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.
+ * **
.
+ *
+ *
+ * src/**
by itself includes all
+ * files under a root folder named src
.
+ * src/**
and
+ * tests/**
includes all files under the root folders
+ * named src
and tests
.
+ * src/**
together with the
+ * exclusion pattern src/**/Foo.java
includes all
+ * files under a root folder named src
except for ones
+ * named Foo.java
.
+ *
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
.
*
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 ofIType
, 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:
+ *
".java"
suffix
+ * 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:
+ * ".class"
suffix
+ * 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:
+ *
+ * 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: *
@@ -3279,13 +3303,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: *
@@ -3319,22 +3343,26 @@ public class JavaCore {
* @see JavaCore#newContainerEntry(IPath, boolean)
* @since 2.0
*/
- public static IClasspathEntry newContainerEntry(IPath containerPath,
- boolean isExported) {
-
- if (containerPath == null || containerPath.segmentCount() < 1) {
- Assert
- .isTrue(
- false,
- "Illegal classpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$
- }
- return new ClasspathEntry(IPackageFragmentRoot.K_SOURCE,
- IClasspathEntry.CPE_CONTAINER, containerPath,
- ClasspathEntry.NO_EXCLUSION_PATTERNS, null, // source attachment
- null, // source attachment root
- null, // specific output folder
- isExported);
- }
+
+ public static IClasspathEntry newContainerEntry(IPath containerPath, boolean isExported) {
+
+ if (containerPath == null) Assert.isTrue(false, "Container path cannot be null"); //$NON-NLS-1$
+ if (containerPath.segmentCount() < 1) {
+ Assert.isTrue(
+ false,
+ "Illegal classpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ return new ClasspathEntry(
+ IPackageFragmentRoot.K_SOURCE,
+ IClasspathEntry.CPE_CONTAINER,
+ containerPath,
+ ClasspathEntry.INCLUDE_ALL,
+ ClasspathEntry.EXCLUDE_NONE,
+ null, // source attachment
+ null, // source attachment root
+ null, // specific output folder
+ isExported);
+}
/**
* Creates and returns a new non-exported classpath entry of kind
@@ -3498,17 +3526,21 @@ public class JavaCore {
* @since 2.0
*/
public static IClasspathEntry newProjectEntry(IPath path, boolean isExported) {
-
- if (!path.isAbsolute())
- Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
-
- return new ClasspathEntry(IPackageFragmentRoot.K_SOURCE,
- IClasspathEntry.CPE_PROJECT, path,
- ClasspathEntry.NO_EXCLUSION_PATTERNS, null, // source attachment
- null, // source attachment root
- null, // specific output folder
- isExported);
- }
+
+ if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
+
+ return new ClasspathEntry(
+ IPackageFragmentRoot.K_SOURCE,
+ IClasspathEntry.CPE_PROJECT,
+ path,
+ ClasspathEntry.INCLUDE_ALL,
+ ClasspathEntry.EXCLUDE_NONE,
+ null, // source attachment
+ null, // source attachment root
+ null, // specific output folder
+ isExported);
+}
+
/**
* Returns a new empty region.
@@ -3520,184 +3552,164 @@ public class JavaCore {
}
/**
- * Creates and returns a new classpath entry of kind CPE_SOURCE
- * for the project's source folder identified by the given absolute
- * workspace-relative path. This specifies that all package fragments within
- * the root will have children of type ICompilationUnit
.
- *
- * The source folder is referred to using an absolute path relative to the
- * workspace root, e.g. /Project/src
. A project's source
- * folders are located with that project. That is, a source classpath entry
- * specifying the path /P1/src
is only usable for project
- * P1
.
- *
- * The source classpath entry created by this method includes all source
- * files below the given workspace-relative path. To selectively exclude
- * some of these source files, use the factory method
- * JavaCore.newSourceEntry(IPath,IPath[])
instead.
- *
- * Note that all sources/binaries inside a project are contributed as a
- * whole through a project entry (see JavaCore.newProjectEntry
).
- * Particular source entries cannot be selectively exported.
- *
CPE_SOURCE
+ * for all files in the project's source folder identified by the given
+ * absolute workspace-relative path.
+ * + * The convenience method is fully equivalent to: + *
+ * newSourceEntry(path, new IPath[] {}, new IPath[] {}, null); + *+ * + * + * @param path the absolute workspace-relative path of a source folder + * @return a new source classpath entry + * @see #newSourceEntry(IPath, IPath[], IPath[], IPath) + */ + public static IClasspathEntry newSourceEntry(IPath path) { - return newSourceEntry(path, ClasspathEntry.NO_EXCLUSION_PATTERNS, null /* - * output - * location - */); - } + return newSourceEntry(path, ClasspathEntry.INCLUDE_ALL, ClasspathEntry.EXCLUDE_NONE, null /*output location*/); + } + + /** + * Creates and returns a new classpath entry of kind
CPE_SOURCE
+ * for the project's source folder identified by the given absolute
+ * workspace-relative path but excluding all source files with paths
+ * matching any of the given patterns.
+ * + * The convenience method is fully equivalent to: + *
+ * newSourceEntry(path, new IPath[] {}, exclusionPatterns, null); + *+ * + * + * @param path the absolute workspace-relative path of a source folder + * @param exclusionPatterns the possibly empty list of exclusion patterns + * represented as relative paths + * @return a new source classpath entry + * @see #newSourceEntry(IPath, IPath[], IPath[], IPath) + * @since 2.1 + */ + public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns) { - /** - * Creates and returns a new classpath entry of kind
CPE_SOURCE
- * for the project's source folder identified by the given absolute
- * workspace-relative path but excluding all source files with paths
- * matching any of the given patterns. This specifies that all package
- * fragments within the root will have children of type
- * ICompilationUnit
.
- *
- * The source folder is referred to using an absolute path relative to the
- * workspace root, e.g. /Project/src
. A project's source
- * folders are located with that project. That is, a source classpath entry
- * specifying the path /P1/src
is only usable for project
- * P1
.
- *
- * The source classpath entry created by this method includes all source
- * files below the given workspace-relative path except for those matched by
- * one (or more) of the given exclusion patterns. Each exclusion pattern is
- * represented by a relative path, which is interpreted as relative to the
- * source folder. For example, if the source folder path is
- * /Project/src
and the exclusion pattern is
- * com/xyz/tests/**
, then source files like
- * /Project/src/com/xyz/Foo.java
and
- * /Project/src/com/xyz/utils/Bar.java
would be included,
- * whereas /Project/src/com/xyz/tests/T1.java
and
- * /Project/src/com/xyz/tests/quick/T2.java
would be
- * excluded. Exclusion patterns can contain can contain '**', '*' or '?'
- * wildcards; see IClasspathEntry.getExclusionPatterns
for
- * the full description of the syntax and semantics of exclusion patterns.
- *
JavaCore.newSourceEntry(IPath)
.
- *
- *
- * Note that all sources/binaries inside a project are contributed as a
- * whole through a project entry (see JavaCore.newProjectEntry
).
- * Particular source entries cannot be selectively exported.
- *
CPE_SOURCE
+ * for the project's source folder identified by the given absolute
+ * workspace-relative path but excluding all source files with paths
+ * matching any of the given patterns, and associated with a specific output location
+ * (that is, ".class" files are not going to the project default output location).
+ * + * The convenience method is fully equivalent to: + *
+ * newSourceEntry(path, new IPath[] {}, exclusionPatterns, specificOutputLocation); + *+ * + * + * @param path the absolute workspace-relative path of a source folder + * @param exclusionPatterns the possibly empty list of exclusion patterns + * represented as relative paths + * @param specificOutputLocation the specific output location for this source entry (
null
if using project default ouput location)
+ * @return a new source classpath entry
+ * @see #newSourceEntry(IPath, IPath[], IPath[], IPath)
+ * @since 2.1
+ */
+ public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns, IPath specificOutputLocation) {
- /**
- * Creates and returns a new classpath entry of kind CPE_SOURCE
- * for the project's source folder identified by the given absolute
- * workspace-relative path but excluding all source files with paths
- * matching any of the given patterns, and associated with a specific output
- * location (that is, ".class" files are not going to the project default
- * output location). All package fragments within the root will have
- * children of type ICompilationUnit
.
- *
- * The source folder is referred to using an absolute path relative to the
- * workspace root, e.g. /Project/src
. A project's source
- * folders are located with that project. That is, a source classpath entry
- * specifying the path /P1/src
is only usable for project
- * P1
.
- *
- * The source classpath entry created by this method includes all source
- * files below the given workspace-relative path except for those matched by
- * one (or more) of the given exclusion patterns. Each exclusion pattern is
- * represented by a relative path, which is interpreted as relative to the
- * source folder. For example, if the source folder path is
- * /Project/src
and the exclusion pattern is
- * com/xyz/tests/**
, then source files like
- * /Project/src/com/xyz/Foo.java
and
- * /Project/src/com/xyz/utils/Bar.java
would be included,
- * whereas /Project/src/com/xyz/tests/T1.java
and
- * /Project/src/com/xyz/tests/quick/T2.java
would be
- * excluded. Exclusion patterns can contain can contain '**', '*' or '?'
- * wildcards; see IClasspathEntry.getExclusionPatterns
for
- * the full description of the syntax and semantics of exclusion patterns.
- *
JavaCore.newSourceEntry(IPath)
.
- *
- *
- * Additionally, a source entry can be associated with a specific output
- * location. By doing so, the Java builder will ensure that the generated
- * ".class" files will be issued inside this output location, as opposed to
- * be generated into the project default output location (when output
- * location is null
). Note that multiple source entries may
- * target the same output location. The output location is referred to using
- * an absolute path relative to the workspace root, e.g.
- * "/Project/bin"
, it must be located inside the same
- * project as the source folder.
- *
- * Also note that all sources/binaries inside a project are contributed as a
- * whole through a project entry (see JavaCore.newProjectEntry
).
- * Particular source entries cannot be selectively exported.
- *
null
if using project default ouput location)
- * @return a new source classpath entry with the given exclusion patterns
- * @see #newSourceEntry(org.eclipse.core.runtime.IPath)
- * @see IClasspathEntry#getExclusionPatterns
- * @see IClasspathEntry#getOutputLocation()
- *
- * @since 2.1
- */
- public static IClasspathEntry newSourceEntry(IPath path,
- IPath[] exclusionPatterns, IPath specificOutputLocation) {
-
- if (!path.isAbsolute())
- Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
- if (exclusionPatterns == null)
- Assert.isTrue(false, "Exclusion pattern set cannot be null"); //$NON-NLS-1$
-
- return new ClasspathEntry(IPackageFragmentRoot.K_SOURCE,
- IClasspathEntry.CPE_SOURCE, path, exclusionPatterns, null, // source
- // attachment
- null, // source attachment root
- specificOutputLocation, // custom output location
- false);
- }
+ return newSourceEntry(path, ClasspathEntry.INCLUDE_ALL, exclusionPatterns, specificOutputLocation);
+ }
+
+ /**
+ * Creates and returns a new classpath entry of kind CPE_SOURCE
+ * for the project's source folder identified by the given absolute
+ * workspace-relative path using the given inclusion and exclusion patterns
+ * to determine which source files are included, and the given output path
+ * to control the output location of generated files.
+ *
+ * The source folder is referred to using an absolute path relative to the
+ * workspace root, e.g. /Project/src
. A project's source
+ * folders are located with that project. That is, a source classpath
+ * entry specifying the path /P1/src
is only usable for
+ * project P1
.
+ *
+ * The inclusion patterns determines the initial set of source files that
+ * are to be included; the exclusion patterns are then used to reduce this
+ * set. When no inclusion patterns are specified, the initial file set
+ * includes all relevent files in the resource tree rooted at the source
+ * entry's path. On the other hand, specifying one or more inclusion
+ * patterns means that all and only files matching at least one of
+ * the specified patterns are to be included. If exclusion patterns are
+ * specified, the initial set of files is then reduced by eliminating files
+ * matched by at least one of the exclusion patterns. Inclusion and
+ * exclusion patterns look like relative file paths with wildcards and are
+ * interpreted relative to the source entry's path. File patterns are
+ * case-sensitive can contain '**', '*' or '?' wildcards (see
+ * {@link IClasspathEntry#getExclusionPatterns()} for the full description
+ * of their syntax and semantics). The resulting set of files are included
+ * in the corresponding package fragment root; all package fragments within
+ * the root will have children of type ICompilationUnit
.
+ *
+ * For example, if the source folder path is
+ * /Project/src
, there are no inclusion filters, and the
+ * exclusion pattern is
+ * com/xyz/tests/**
, then source files
+ * like /Project/src/com/xyz/Foo.java
+ * and /Project/src/com/xyz/utils/Bar.java
would be included,
+ * whereas /Project/src/com/xyz/tests/T1.java
+ * and /Project/src/com/xyz/tests/quick/T2.java
would be
+ * excluded.
+ *
+ * Additionally, a source entry can be associated with a specific output location.
+ * By doing so, the Java builder will ensure that the generated ".class" files will
+ * be issued inside this output location, as opposed to be generated into the
+ * project default output location (when output location is null
).
+ * Note that multiple source entries may target the same output location.
+ * The output location is referred to using an absolute path relative to the
+ * workspace root, e.g. "/Project/bin"
, it must be located inside
+ * the same project as the source folder.
+ *
+ * Also note that all sources/binaries inside a project are contributed as
+ * a whole through a project entry
+ * (see JavaCore.newProjectEntry
). Particular source entries
+ * cannot be selectively exported.
+ *
null
if using project default ouput location)
+ * @return a new source classpath entry with the given exclusion patterns
+ * @see IClasspathEntry#getInclusionPatterns()
+ * @see IClasspathEntry#getExclusionPatterns()
+ * @see IClasspathEntry#getOutputLocation()
+ * @since 3.0
+ */
+ public static IClasspathEntry newSourceEntry(IPath path, IPath[] inclusionPatterns, IPath[] exclusionPatterns, IPath specificOutputLocation) {
+
+ if (path == null) Assert.isTrue(false, "Source path cannot be null"); //$NON-NLS-1$
+ if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
+ if (exclusionPatterns == null) Assert.isTrue(false, "Exclusion pattern set cannot be null"); //$NON-NLS-1$
+ if (inclusionPatterns == null) Assert.isTrue(false, "Inclusion pattern set cannot be null"); //$NON-NLS-1$
+
+ return new ClasspathEntry(
+ IPackageFragmentRoot.K_SOURCE,
+ IClasspathEntry.CPE_SOURCE,
+ path,
+ inclusionPatterns,
+ exclusionPatterns,
+ null, // source attachment
+ null, // source attachment root
+ specificOutputLocation, // custom output location
+ false);
+ }
/**
* Creates and returns a new non-exported classpath entry of kind
@@ -3712,7 +3724,7 @@ public class JavaCore {
* It is possible to register an automatic initializer (
* ClasspathVariableInitializer
), which will be invoked
* through the extension point
- * "org.eclipse.jdt.core.classpathVariableInitializer". After resolution, a
+ * "net.sourceforge.phpdt.core.classpathVariableInitializer". After resolution, a
* classpath variable entry may either correspond to a project or a library
* entry.
*
@@ -3773,7 +3785,7 @@ public class JavaCore {
* It is possible to register an automatic initializer (
* ClasspathVariableInitializer
), which will be invoked
* through the extension point
- * "org.eclipse.jdt.core.classpathVariableInitializer". After resolution, a
+ * "net.sourceforge.phpdt.core.classpathVariableInitializer". After resolution, a
* classpath variable entry may either correspond to a project or a library
* entry.
*
@@ -3907,7 +3919,7 @@ public class JavaCore {
* formed by a first ID segment followed with extra segments, which can be
* used as additional hints for the resolution. The container ID is used to
* identify a ClasspathContainerInitializer
registered on the
- * extension point "org.eclipse.jdt.core.classpathContainerInitializer".
+ * extension point "net.sourceforge.phpdt.core.classpathContainerInitializer".
*
* There is no assumption that each individual container value passed in
* argument (respectiveContainers
) must answer the exact
@@ -3916,7 +3928,7 @@ public class JavaCore {
* actual container object. It can be delegated to a
* ClasspathContainerInitializer
, which can be activated
* through the extension point
- * "org.eclipse.jdt.core.ClasspathContainerInitializer").
+ * "net.sourceforge.phpdt.core.ClasspathContainerInitializer").
*
* In reaction to changing container values, the JavaModel will be updated
* to reflect the new state of the updated container.
@@ -3927,7 +3939,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").
*
* Note: setting a container to null
will cause it to be
* lazily resolved again whenever its value is required. In particular, this
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaModelException.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaModelException.java
index cc88627..2f77107 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaModelException.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaModelException.java
@@ -15,7 +15,7 @@ import net.sourceforge.phpdt.internal.core.JavaModelStatus;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
-//import org.eclipse.jdt.internal.core.JavaModelStatus;
+//import net.sourceforge.phpdt.internal.core.JavaModelStatus;
/**
* A checked exception representing a failure in the Java model.
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/NamingConventions.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/NamingConventions.java
new file mode 100644
index 0000000..532ee06
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/NamingConventions.java
@@ -0,0 +1,941 @@
+/*******************************************************************************
+ * 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 net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.codeassist.impl.AssistOptions;
+import net.sourceforge.phpdt.internal.core.INamingRequestor;
+import net.sourceforge.phpdt.internal.core.InternalNamingConventions;
+
+
+/**
+ * Provides methods for computing Java-specific names.
+ *
+ * The behavior of the methods is dependent of several JavaCore options. + *
+ * The possible options are : + *
+ * For a complete description of the configurable options, see getDefaultOptions
.
+ * For programmaticaly change these options, see JavaCore#setOptions()
.
+ *
+ * This class provides static methods and constants only; it is not intended to be + * instantiated or subclassed by clients. + *
+ * + * @see JavaCore#setOptions(java.util.Hashtable) + * @see JavaCore#getDefaultOptions() + * @since 2.1 + */ +public final class NamingConventions { + private static final char[] GETTER_BOOL_NAME = "is".toCharArray(); //$NON-NLS-1$ + private static final char[] GETTER_NAME = "get".toCharArray(); //$NON-NLS-1$ + private static final char[] SETTER_NAME = "set".toCharArray(); //$NON-NLS-1$ + + private static class NamingRequestor implements INamingRequestor { + private final static int SIZE = 10; + + // for acceptNameWithPrefixAndSuffix + private char[][] firstPrefixAndFirstSuffixResults = new char[SIZE][]; + private int firstPrefixAndFirstSuffixResultsCount = 0; + private char[][] firstPrefixAndSuffixResults = new char[SIZE][]; + private int firstPrefixAndSuffixResultsCount = 0; + private char[][] prefixAndFirstSuffixResults = new char[SIZE][]; + private int prefixAndFirstSuffixResultsCount = 0; + private char[][] prefixAndSuffixResults = new char[SIZE][]; + private int prefixAndSuffixResultsCount = 0; + + // for acceptNameWithPrefix + private char[][] firstPrefixResults = new char[SIZE][]; + private int firstPrefixResultsCount = 0; + private char[][] prefixResults = new char[SIZE][]; + private int prefixResultsCount = 0; + + // for acceptNameWithSuffix + private char[][] firstSuffixResults = new char[SIZE][]; + private int firstSuffixResultsCount = 0; + private char[][] suffixResults = new char[SIZE][]; + private int suffixResultsCount = 0; + + // for acceptNameWithoutPrefixAndSuffix + private char[][] otherResults = new char[SIZE][]; + private int otherResultsCount = 0; + public void acceptNameWithPrefixAndSuffix(char[] name, boolean isFirstPrefix, boolean isFirstSuffix) { + if(isFirstPrefix && isFirstSuffix) { + int length = this.firstPrefixAndFirstSuffixResults.length; + if(length == this.firstPrefixAndFirstSuffixResultsCount) { + System.arraycopy( + this.firstPrefixAndFirstSuffixResults, + 0, + this.firstPrefixAndFirstSuffixResults = new char[length * 2][], + 0, + length); + } + this.firstPrefixAndFirstSuffixResults[this.firstPrefixAndFirstSuffixResultsCount++] = name; + } else if (isFirstPrefix) { + int length = this.firstPrefixAndSuffixResults.length; + if(length == this.firstPrefixAndSuffixResultsCount) { + System.arraycopy( + this.firstPrefixAndSuffixResults, + 0, + this.firstPrefixAndSuffixResults = new char[length * 2][], + 0, + length); + } + this.firstPrefixAndSuffixResults[this.firstPrefixAndSuffixResultsCount++] = name; + } else if(isFirstSuffix) { + int length = this.prefixAndFirstSuffixResults.length; + if(length == this.prefixAndFirstSuffixResultsCount) { + System.arraycopy( + this.prefixAndFirstSuffixResults, + 0, + this.prefixAndFirstSuffixResults = new char[length * 2][], + 0, + length); + } + this.prefixAndFirstSuffixResults[this.prefixAndFirstSuffixResultsCount++] = name; + } else { + int length = this.prefixAndSuffixResults.length; + if(length == this.prefixAndSuffixResultsCount) { + System.arraycopy( + this.prefixAndSuffixResults, + 0, + this.prefixAndSuffixResults = new char[length * 2][], + 0, + length); + } + this.prefixAndSuffixResults[this.prefixAndSuffixResultsCount++] = name; + } + } + + public void acceptNameWithPrefix(char[] name, boolean isFirstPrefix) { + if(isFirstPrefix) { + int length = this.firstPrefixResults.length; + if(length == this.firstPrefixResultsCount) { + System.arraycopy( + this.firstPrefixResults, + 0, + this.firstPrefixResults = new char[length * 2][], + 0, + length); + } + this.firstPrefixResults[this.firstPrefixResultsCount++] = name; + } else{ + int length = this.prefixResults.length; + if(length == this.prefixResultsCount) { + System.arraycopy( + this.prefixResults, + 0, + this.prefixResults = new char[length * 2][], + 0, + length); + } + this.prefixResults[this.prefixResultsCount++] = name; + } + } + + public void acceptNameWithSuffix(char[] name, boolean isFirstSuffix) { + if(isFirstSuffix) { + int length = this.firstSuffixResults.length; + if(length == this.firstSuffixResultsCount) { + System.arraycopy( + this.firstSuffixResults, + 0, + this.firstSuffixResults = new char[length * 2][], + 0, + length); + } + this.firstSuffixResults[this.firstSuffixResultsCount++] = name; + } else { + int length = this.suffixResults.length; + if(length == this.suffixResultsCount) { + System.arraycopy( + this.suffixResults, + 0, + this.suffixResults = new char[length * 2][], + 0, + length); + } + this.suffixResults[this.suffixResultsCount++] = name; + } + } + + public void acceptNameWithoutPrefixAndSuffix(char[] name) { + int length = this.otherResults.length; + if(length == this.otherResultsCount) { + System.arraycopy( + this.otherResults, + 0, + this.otherResults = new char[length * 2][], + 0, + length); + } + this.otherResults[this.otherResultsCount++] = name; + } + public char[][] getResults(){ + int count = + this.firstPrefixAndFirstSuffixResultsCount + + this.firstPrefixAndSuffixResultsCount + + this.prefixAndFirstSuffixResultsCount + + this.prefixAndSuffixResultsCount + + this.firstPrefixResultsCount + + this.prefixResultsCount + + this.firstSuffixResultsCount + + this.suffixResultsCount + + this.otherResultsCount; + + char[][] results = new char[count][]; + + int index = 0; + System.arraycopy(this.firstPrefixAndFirstSuffixResults, 0, results, index, this.firstPrefixAndFirstSuffixResultsCount); + index += this.firstPrefixAndFirstSuffixResultsCount; + System.arraycopy(this.firstPrefixAndSuffixResults, 0, results, index, this.firstPrefixAndSuffixResultsCount); + index += this.firstPrefixAndSuffixResultsCount; + System.arraycopy(this.prefixAndFirstSuffixResults, 0, results, index, this.prefixAndFirstSuffixResultsCount); + index += this.prefixAndFirstSuffixResultsCount; + System.arraycopy(this.prefixAndSuffixResults, 0, results, index, this.prefixAndSuffixResultsCount); + index += this.prefixAndSuffixResultsCount; + System.arraycopy(this.firstPrefixResults, 0, results, index, this.firstPrefixResultsCount); + index += this.firstPrefixResultsCount; + System.arraycopy(this.prefixResults, 0, results, index, this.prefixResultsCount); + index += this.prefixResultsCount; + System.arraycopy(this.firstSuffixResults, 0, results, index, this.firstSuffixResultsCount); + index += this.firstSuffixResultsCount; + System.arraycopy(this.suffixResults, 0, results, index, this.suffixResultsCount); + index += this.suffixResultsCount; + System.arraycopy(this.otherResults, 0, results, index, this.otherResultsCount); + + return results; + } + } + + + private NamingConventions() { + // Not instantiable + } + + private static char[] removePrefixAndSuffix(char[] name, char[][] prefixes, char[][] suffixes) { + // remove longer prefix + char[] withoutPrefixName = name; + if (prefixes != null) { + int bestLength = 0; + for (int i= 0; i < prefixes.length; i++) { + char[] prefix = prefixes[i]; + if (CharOperation.prefixEquals(prefix, name)) { + int currLen = prefix.length; + boolean lastCharIsLetter = Character.isLetter(prefix[currLen - 1]); + if(!lastCharIsLetter || (lastCharIsLetter && name.length > currLen && Character.isUpperCase(name[currLen]))) { + if (bestLength < currLen && name.length != currLen) { + withoutPrefixName = CharOperation.subarray(name, currLen, name.length); + bestLength = currLen; + } + } + } + } + } + + // remove longer suffix + char[] withoutSuffixName = withoutPrefixName; + if(suffixes != null) { + int bestLength = 0; + for (int i = 0; i < suffixes.length; i++) { + char[] suffix = suffixes[i]; + if(CharOperation.endsWith(withoutPrefixName, suffix)) { + int currLen = suffix.length; + if(bestLength < currLen && withoutPrefixName.length != currLen) { + withoutSuffixName = CharOperation.subarray(withoutPrefixName, 0, withoutPrefixName.length - currLen); + bestLength = currLen; + } + } + } + } + + withoutSuffixName[0] = Character.toLowerCase(withoutSuffixName[0]); + return withoutSuffixName; + } + + /** + * Remove prefix and suffix from an argument name. + *
+ * If argument name prefix is pre
and argument name suffix is suf
+ * then for an argument named preArgsuf
the result of this method is arg
.
+ * If there is no prefix or suffix defined in JavaCore options the result is the unchanged
+ * name preArgsuf
.
+ *
+ * This method is affected by the following JavaCore options : CODEASSIST_ARGUMENT_PREFIXES and + * CODEASSIST_ARGUMENT_SUFFIXES. + *
+ *
+ * For a complete description of these configurable options, see getDefaultOptions
.
+ * For programmaticaly change these options, see JavaCore#setOptions()
.
+ *
+ * If argument name prefix is pre
and argument name suffix is suf
+ * then for an argument named preArgsuf
the result of this method is arg
.
+ * If there is no prefix or suffix defined in JavaCore options the result is the unchanged
+ * name preArgsuf
.
+ *
+ * This method is affected by the following JavaCore options : CODEASSIST_ARGUMENT_PREFIXES and + * CODEASSIST_ARGUMENT_SUFFIXES. + *
+ *
+ * For a complete description of these configurable options, see getDefaultOptions
.
+ * For programmaticaly change these options, see JavaCore#setOptions()
.
+ *
+ * If field name prefix is pre
and field name suffix is suf
+ * then for a field named preFieldsuf
the result of this method is field
.
+ * If there is no prefix or suffix defined in JavaCore options the result is the unchanged
+ * name preFieldsuf
.
+ *
+ * This method is affected by the following JavaCore options : CODEASSIST_FIELD_PREFIXES, + * CODEASSIST_FIELD_SUFFIXES for instance field and CODEASSIST_STATIC_FIELD_PREFIXES, + * CODEASSIST_STATIC_FIELD_SUFFIXES for static field. + *
+ *
+ * For a complete description of these configurable options, see getDefaultOptions
.
+ * For programmaticaly change these options, see JavaCore#setOptions()
.
+ *
Flags
.
+ * @return char[] the name without prefix and suffix.
+ * @see Flags
+ * @see JavaCore#setOptions(java.util.Hashtable)
+ * @see JavaCore#getDefaultOptions()
+ */
+ public static char[] removePrefixAndSuffixForFieldName(IJavaProject javaProject, char[] fieldName, int modifiers) {
+ boolean isStatic = Flags.isStatic(modifiers);
+ AssistOptions assistOptions = new AssistOptions(javaProject.getOptions(true));
+ return removePrefixAndSuffix(
+ fieldName,
+ isStatic ? assistOptions.staticFieldPrefixes : assistOptions.fieldPrefixes,
+ isStatic ? assistOptions.staticFieldSuffixes : assistOptions.fieldSuffixes);
+ }
+
+ /**
+ * Remove prefix and suffix from a field name.
+ *
+ * If field name prefix is pre
and field name suffix is suf
+ * then for a field named preFieldsuf
the result of this method is field
.
+ * If there is no prefix or suffix defined in JavaCore options the result is the unchanged
+ * name preFieldsuf
.
+ *
+ * This method is affected by the following JavaCore options : CODEASSIST_FIELD_PREFIXES, + * CODEASSIST_FIELD_SUFFIXES for instance field and CODEASSIST_STATIC_FIELD_PREFIXES, + * CODEASSIST_STATIC_FIELD_SUFFIXES for static field. + *
+ *
+ * For a complete description of these configurable options, see getDefaultOptions
.
+ * For programmaticaly change these options, see JavaCore#setOptions()
.
+ *
Flags
.
+ * @return char[] the name without prefix and suffix.
+ * @see Flags
+ * @see JavaCore#setOptions(java.util.Hashtable)
+ * @see JavaCore#getDefaultOptions()
+ */
+ public static String removePrefixAndSuffixForFieldName(IJavaProject javaProject, String fieldName, int modifiers) {
+ return String.valueOf(removePrefixAndSuffixForFieldName(javaProject, fieldName.toCharArray(), modifiers));
+ }
+ /**
+ * Remove prefix and suffix from a local variable name.
+ *
+ * If local variable name prefix is pre
and local variable name suffix is suf
+ * then for a local variable named preLocalsuf
the result of this method is local
.
+ * If there is no prefix or suffix defined in JavaCore options the result is the unchanged
+ * name preLocalsuf
.
+ *
+ * This method is affected by the following JavaCore options : CODEASSIST_LOCAL_PREFIXES and + * CODEASSIST_LOCAL_SUFFIXES. + *
+ *
+ * For a complete description of these configurable options, see getDefaultOptions
.
+ * For programmaticaly change these options, see JavaCore#setOptions()
.
+ *
+ * If local variable name prefix is pre
and local variable name suffix is suf
+ * then for a local variable named preLocalsuf
the result of this method is local
.
+ * If there is no prefix or suffix defined in JavaCore options the result is the unchanged
+ * name preLocalsuf
.
+ *
+ * This method is affected by the following JavaCore options : CODEASSIST_LOCAL_PREFIXES and + * CODEASSIST_LOCAL_SUFFIXES. + *
+ *
+ * For a complete description of these configurable options, see getDefaultOptions
.
+ * For programmaticaly change these options, see JavaCore#setOptions()
.
+ *
+ * If the type of the argument is TypeName
, the prefix for argument is pre
+ * and the suffix for argument is suf
then the proposed names are preTypeNamesuf
+ * and preNamesuf
. If there is no prefix or suffix the proposals are typeName
+ * and name
.
+ *
+ * This method is affected by the following JavaCore options : CODEASSIST_ARGUMENT_PREFIXES and + * CODEASSIST_ARGUMENT_SUFFIXES. + *
+ *
+ * For a complete description of these configurable options, see getDefaultOptions
.
+ * For programmaticaly change these options, see JavaCore#setOptions()
.
+ *
null
if there is no excluded names.
+ * @return char[][] an array of names.
+ * @see JavaCore#setOptions(java.util.Hashtable)
+ * @see JavaCore#getDefaultOptions()
+ */
+ public static char[][] suggestArgumentNames(IJavaProject javaProject, char[] packageName, char[] qualifiedTypeName, int dim, char[][] excludedNames) {
+ NamingRequestor requestor = new NamingRequestor();
+ InternalNamingConventions.suggestArgumentNames(
+ javaProject,
+ packageName,
+ qualifiedTypeName,
+ dim,
+ excludedNames,
+ requestor);
+
+ return requestor.getResults();
+ }
+
+ /**
+ * Suggest names for an argument. The name is computed from argument's type
+ * and possible prefixes or suffixes are added.
+ *
+ * If the type of the argument is TypeName
, the prefix for argument is pre
+ * and the suffix for argument is suf
then the proposed names are preTypeNamesuf
+ * and preNamesuf
. If there is no prefix or suffix the proposals are typeName
+ * and name
.
+ *
+ * This method is affected by the following JavaCore options : CODEASSIST_ARGUMENT_PREFIXES and + * CODEASSIST_ARGUMENT_SUFFIXES. + *
+ *
+ * For a complete description of these configurable options, see getDefaultOptions
.
+ * For programmaticaly change these options, see JavaCore#setOptions()
.
+ *
null
if there is no excluded names.
+ * @return char[][] an array of names.
+ * @see JavaCore#setOptions(java.util.Hashtable)
+ * @see JavaCore#getDefaultOptions()
+ */
+ public static String[] suggestArgumentNames(IJavaProject javaProject, String packageName, String qualifiedTypeName, int dim, String[] excludedNames) {
+ return convertCharsToString(
+ suggestArgumentNames(
+ javaProject,
+ packageName.toCharArray(),
+ qualifiedTypeName.toCharArray(),
+ dim,
+ convertStringToChars(excludedNames)));
+ }
+ /**
+ * Suggest names for a field. The name is computed from field's type
+ * and possible prefixes or suffixes are added.
+ *
+ * If the type of the field is TypeName
, the prefix for field is pre
+ * and the suffix for field is suf
then the proposed names are preTypeNamesuf
+ * and preNamesuf
. If there is no prefix or suffix the proposals are typeName
+ * and name
.
+ *
+ * This method is affected by the following JavaCore options : CODEASSIST_FIELD_PREFIXES, + * CODEASSIST_FIELD_SUFFIXES and for instance field and CODEASSIST_STATIC_FIELD_PREFIXES, + * CODEASSIST_STATIC_FIELD_SUFFIXES for static field. + *
+ *
+ * For a complete description of these configurable options, see getDefaultOptions
.
+ * For programmaticaly change these options, see JavaCore#setOptions()
.
+ *
Flags
.
+ * @param excludedNames a list of names which cannot be suggested (already used names).
+ * Can be null
if there is no excluded names.
+ * @return char[][] an array of names.
+ * @see Flags
+ * @see JavaCore#setOptions(java.util.Hashtable)
+ * @see JavaCore#getDefaultOptions()
+ */
+ public static char[][] suggestFieldNames(IJavaProject javaProject, char[] packageName, char[] qualifiedTypeName, int dim, int modifiers, char[][] excludedNames) {
+ NamingRequestor requestor = new NamingRequestor();
+ InternalNamingConventions.suggestFieldNames(
+ javaProject,
+ packageName,
+ qualifiedTypeName,
+ dim,
+ modifiers,
+ excludedNames,
+ requestor);
+
+ return requestor.getResults();
+ }
+
+ /**
+ * Suggest names for a field. The name is computed from field's type
+ * and possible prefixes or suffixes are added.
+ *
+ * If the type of the field is TypeName
, the prefix for field is pre
+ * and the suffix for field is suf
then the proposed names are preTypeNamesuf
+ * and preNamesuf
. If there is no prefix or suffix the proposals are typeName
+ * and name
.
+ *
+ * This method is affected by the following JavaCore options : CODEASSIST_FIELD_PREFIXES, + * CODEASSIST_FIELD_SUFFIXES and for instance field and CODEASSIST_STATIC_FIELD_PREFIXES, + * CODEASSIST_STATIC_FIELD_SUFFIXES for static field. + *
+ *
+ * For a complete description of these configurable options, see getDefaultOptions
.
+ * For programmaticaly change these options, see JavaCore#setOptions()
.
+ *
Flags
.
+ * @param excludedNames a list of names which cannot be suggested (already used names).
+ * Can be null
if there is no excluded names.
+ * @return char[][] an array of names.
+ * @see Flags
+ * @see JavaCore#setOptions(java.util.Hashtable)
+ * @see JavaCore#getDefaultOptions()
+ */
+ public static String[] suggestFieldNames(IJavaProject javaProject, String packageName, String qualifiedTypeName, int dim, int modifiers, String[] excludedNames) {
+ return convertCharsToString(
+ suggestFieldNames(
+ javaProject,
+ packageName.toCharArray(),
+ qualifiedTypeName.toCharArray(),
+ dim,
+ modifiers,
+ convertStringToChars(excludedNames)));
+ }
+
+ /**
+ * Suggest names for a local variable. The name is computed from variable's type
+ * and possible prefixes or suffixes are added.
+ *
+ * If the type of the local variable is TypeName
, the prefix for local variable is pre
+ * and the suffix for local variable is suf
then the proposed names are preTypeNamesuf
+ * and preNamesuf
. If there is no prefix or suffix the proposals are typeName
+ * and name
.
+ *
+ * This method is affected by the following JavaCore options : CODEASSIST_LOCAL_PREFIXES and + * CODEASSIST_LOCAL_SUFFIXES. + *
+ *
+ * For a complete description of these configurable options, see getDefaultOptions
.
+ * For programmaticaly change these options, see JavaCore#setOptions()
.
+ *
null
if there is no excluded names.
+ * @return char[][] an array of names.
+ * @see JavaCore#setOptions(java.util.Hashtable)
+ * @see JavaCore#getDefaultOptions()
+ */
+ public static char[][] suggestLocalVariableNames(IJavaProject javaProject, char[] packageName, char[] qualifiedTypeName, int dim, char[][] excludedNames) {
+ NamingRequestor requestor = new NamingRequestor();
+ InternalNamingConventions.suggestLocalVariableNames(
+ javaProject,
+ packageName,
+ qualifiedTypeName,
+ dim,
+ excludedNames,
+ requestor);
+
+ return requestor.getResults();
+ }
+
+ /**
+ * Suggest names for a local variable. The name is computed from variable's type
+ * and possible prefixes or suffixes are added.
+ *
+ * If the type of the local variable is TypeName
, the prefix for local variable is pre
+ * and the suffix for local variable is suf
then the proposed names are preTypeNamesuf
+ * and preNamesuf
. If there is no prefix or suffix the proposals are typeName
+ * and name
.
+ *
+ * This method is affected by the following JavaCore options : CODEASSIST_LOCAL_PREFIXES and + * CODEASSIST_LOCAL_SUFFIXES. + *
+ *
+ * For a complete description of these configurable options, see getDefaultOptions
.
+ * For programmaticaly change these options, see JavaCore#setOptions()
.
+ *
null
if there is no excluded names.
+ * @return char[][] an array of names.
+ * @see JavaCore#setOptions(java.util.Hashtable)
+ * @see JavaCore#getDefaultOptions()
+ */
+ public static String[] suggestLocalVariableNames(IJavaProject javaProject, String packageName, String qualifiedTypeName, int dim, String[] excludedNames) {
+ return convertCharsToString(
+ suggestLocalVariableNames(
+ javaProject,
+ packageName.toCharArray(),
+ qualifiedTypeName.toCharArray(),
+ dim,
+ convertStringToChars(excludedNames)));
+ }
+
+ /**
+ * Suggest name for a getter method. The name is computed from field's name
+ * and possible prefixes or suffixes are removed.
+ *
+ * If the field name is preFieldNamesuf
and the prefix for field is pre
and
+ * the suffix for field is suf
then the prosposed name is isFieldName
for boolean field or
+ * getFieldName
for others. If there is no prefix and suffix the proposal is isPreFieldNamesuf
+ * for boolean field or getPreFieldNamesuf
for others.
+ *
+ * This method is affected by the following JavaCore options : CODEASSIST_FIELD_PREFIXES, + * CODEASSIST_FIELD_SUFFIXES for instance field and CODEASSIST_STATIC_FIELD_PREFIXES, + * CODEASSIST_STATIC_FIELD_SUFFIXES for static field. + *
+ *
+ * For a complete description of these configurable options, see getDefaultOptions
.
+ * For programmaticaly change these options, see JavaCore#setOptions()
.
+ *
Flags
.
+ * @param isBoolean true
if the field's type is boolean
+ * @param excludedNames a list of names which cannot be suggested (already used names).
+ * Can be null
if there is no excluded names.
+ * @return char[] a name.
+ * @see Flags
+ * @see JavaCore#setOptions(java.util.Hashtable)
+ * @see JavaCore#getDefaultOptions()
+ */
+ public static char[] suggestGetterName(IJavaProject project, char[] fieldName, int modifiers, boolean isBoolean, char[][] excludedNames) {
+ if (isBoolean) {
+ char[] name = removePrefixAndSuffixForFieldName(project, fieldName, modifiers);
+ int prefixLen = GETTER_BOOL_NAME.length;
+ if (CharOperation.prefixEquals(GETTER_BOOL_NAME, name)
+ && name.length > prefixLen && Character.isUpperCase(name[prefixLen])) {
+ return suggestNewName(name, excludedNames);
+ } else {
+ return suggestNewName(
+ CharOperation.concat(GETTER_BOOL_NAME, suggestAccessorName(project, fieldName, modifiers)),
+ excludedNames
+ );
+ }
+ } else {
+ return suggestNewName(
+ CharOperation.concat(GETTER_NAME, suggestAccessorName(project, fieldName, modifiers)),
+ excludedNames
+ );
+ }
+ }
+
+ /**
+ * Suggest name for a getter method. The name is computed from field's name
+ * and possible prefixes or suffixes are removed.
+ *
+ * If the field name is preFieldNamesuf
and the prefix for field is pre
and
+ * the suffix for field is suf
then the prosposed name is isFieldName
for boolean field or
+ * getFieldName
for others. If there is no prefix and suffix the proposal is isPreFieldNamesuf
+ * for boolean field or getPreFieldNamesuf
for others.
+ *
+ * This method is affected by the following JavaCore options : CODEASSIST_FIELD_PREFIXES, + * CODEASSIST_FIELD_SUFFIXES for instance field and CODEASSIST_STATIC_FIELD_PREFIXES, + * CODEASSIST_STATIC_FIELD_SUFFIXES for static field. + *
+ *
+ * For a complete description of these configurable options, see getDefaultOptions
.
+ * For programmaticaly change these options, see JavaCore#setOptions()
.
+ *
Flags
.
+ * @param isBoolean true
if the field's type is boolean
+ * @param excludedNames a list of names which cannot be suggested (already used names).
+ * Can be null
if there is no excluded names.
+ * @return char[] a name.
+ * @see Flags
+ * @see JavaCore#setOptions(java.util.Hashtable)
+ * @see JavaCore#getDefaultOptions()
+ */
+ public static String suggestGetterName(IJavaProject project, String fieldName, int modifiers, boolean isBoolean, String[] excludedNames) {
+ return String.valueOf(
+ suggestGetterName(
+ project,
+ fieldName.toCharArray(),
+ modifiers,
+ isBoolean,
+ convertStringToChars(excludedNames)));
+ }
+
+ /**
+ * Suggest name for a setter method. The name is computed from field's name
+ * and possible prefixes or suffixes are removed.
+ *
+ * If the field name is preFieldNamesuf
and the prefix for field is pre
and
+ * the suffix for field is suf
then the proposed name is setFieldName
.
+ * If there is no prefix and suffix the proposal is setPreFieldNamesuf
.
+ *
+ * This method is affected by the following JavaCore options : CODEASSIST_FIELD_PREFIXES, + * CODEASSIST_FIELD_SUFFIXES for instance field and CODEASSIST_STATIC_FIELD_PREFIXES, + * CODEASSIST_STATIC_FIELD_SUFFIXES for static field. + *
+ *
+ * For a complete description of these configurable options, see getDefaultOptions
.
+ * For programmaticaly change these options, see JavaCore#setOptions()
.
+ *
Flags
.
+ * @param isBoolean true
if the field's type is boolean
+ * @param excludedNames a list of names which cannot be suggested (already used names).
+ * Can be null
if there is no excluded names.
+ * @return char[] a name.
+ * @see Flags
+ * @see JavaCore#setOptions(java.util.Hashtable)
+ * @see JavaCore#getDefaultOptions()
+ */
+ public static char[] suggestSetterName(IJavaProject project, char[] fieldName, int modifiers, boolean isBoolean, char[][] excludedNames) {
+
+ if (isBoolean) {
+ char[] name = removePrefixAndSuffixForFieldName(project, fieldName, modifiers);
+ int prefixLen = GETTER_BOOL_NAME.length;
+ if (CharOperation.prefixEquals(GETTER_BOOL_NAME, name)
+ && name.length > prefixLen && Character.isUpperCase(name[prefixLen])) {
+ name = CharOperation.subarray(name, prefixLen, name.length);
+ return suggestNewName(
+ CharOperation.concat(SETTER_NAME, suggestAccessorName(project, name, modifiers)),
+ excludedNames
+ );
+ } else {
+ return suggestNewName(
+ CharOperation.concat(SETTER_NAME, suggestAccessorName(project, fieldName, modifiers)),
+ excludedNames
+ );
+ }
+ } else {
+ return suggestNewName(
+ CharOperation.concat(SETTER_NAME, suggestAccessorName(project, fieldName, modifiers)),
+ excludedNames
+ );
+ }
+ }
+
+ /**
+ * Suggest name for a setter method. The name is computed from field's name
+ * and possible prefixes or suffixes are removed.
+ *
+ * If the field name is preFieldNamesuf
and the prefix for field is pre
and
+ * the suffix for field is suf
then the proposed name is setFieldName
.
+ * If there is no prefix and suffix the proposal is setPreFieldNamesuf
.
+ *
+ * This method is affected by the following JavaCore options : CODEASSIST_FIELD_PREFIXES, + * CODEASSIST_FIELD_SUFFIXES for instance field and CODEASSIST_STATIC_FIELD_PREFIXES, + * CODEASSIST_STATIC_FIELD_SUFFIXES for static field. + *
+ *
+ * For a complete description of these configurable options, see getDefaultOptions
.
+ * For programmaticaly change these options, see JavaCore#setOptions()
.
+ *
Flags
.
+ * @param isBoolean true
if the field's type is boolean
+ * @param excludedNames a list of names which cannot be suggested (already used names).
+ * Can be null
if there is no excluded names.
+ * @return char[] a name.
+ * @see Flags
+ * @see JavaCore#setOptions(java.util.Hashtable)
+ * @see JavaCore#getDefaultOptions()
+ */
+ public static String suggestSetterName(IJavaProject project, String fieldName, int modifiers, boolean isBoolean, String[] excludedNames) {
+ return String.valueOf(
+ suggestSetterName(
+ project,
+ fieldName.toCharArray(),
+ modifiers,
+ isBoolean,
+ convertStringToChars(excludedNames)));
+ }
+
+ private static char[] suggestAccessorName(IJavaProject project, char[] fieldName, int modifiers) {
+ char[] name = removePrefixAndSuffixForFieldName(project, fieldName, modifiers);
+ if (name.length > 0 && Character.isLowerCase(name[0])) {
+ name[0] = Character.toUpperCase(name[0]);
+ }
+ return name;
+ }
+
+ private static char[] suggestNewName(char[] name, char[][] excludedNames){
+ if(excludedNames == null) {
+ return name;
+ }
+
+ char[] newName = name;
+ int count = 2;
+ int i = 0;
+ while (i < excludedNames.length) {
+ if(CharOperation.equals(newName, excludedNames[i], false)) {
+ newName = CharOperation.concat(name, String.valueOf(count++).toCharArray());
+ i = 0;
+ } else {
+ i++;
+ }
+ }
+ return newName;
+ }
+
+ private static String[] convertCharsToString(char[][] c) {
+ int length = c == null ? 0 : c.length;
+ String[] s = new String[length];
+ for (int i = 0; i < length; i++) {
+ s[i] = String.valueOf(c[i]);
+ }
+ return s;
+ }
+
+ private static char[][] convertStringToChars(String[] s) {
+ int length = s == null ? 0 : s.length;
+ char[][] c = new char[length][];
+ for (int i = 0; i < length; i++) {
+ if(s[i] == null) {
+ c[i] = CharOperation.NO_CHAR;
+ } else {
+ c[i] = s[i].toCharArray();
+ }
+ }
+ return c;
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IProblem.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IProblem.java
index b143082..24cd371 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IProblem.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IProblem.java
@@ -159,7 +159,10 @@ public interface IProblem {
int ImportRelated = 0x10000000;
int Internal = 0x20000000;
int Syntax = 0x40000000;
-
+ /**
+ * @since 3.0
+ */
+ int Javadoc = 0x80000000;
/**
* Mask to use in order to filter out the category portion of the problem ID.
*/
@@ -555,4 +558,114 @@ public interface IProblem {
// detected task
/** @since 2.1 */
int Task = Internal + 450;
+
+// block
+ /** @since 3.0 */
+ int UndocumentedEmptyBlock = Internal + 460;
+
+ /*
+ * Javadoc comments
+ */
+ /** @since 3.0 */
+ int JavadocUnexpectedTag = Javadoc + Internal + 470;
+ /** @since 3.0 */
+ int JavadocMissingParamTag = Javadoc + Internal + 471;
+ /** @since 3.0 */
+ int JavadocMissingParamName = Javadoc + Internal + 472;
+ /** @since 3.0 */
+ int JavadocDuplicateParamName = Javadoc + Internal + 473;
+ /** @since 3.0 */
+ int JavadocInvalidParamName = Javadoc + Internal + 474;
+ /** @since 3.0 */
+ int JavadocMissingReturnTag = Javadoc + Internal + 475;
+ /** @since 3.0 */
+ int JavadocDuplicateReturnTag = Javadoc + Internal + 476;
+ /** @since 3.0 */
+ int JavadocMissingThrowsTag = Javadoc + Internal + 477;
+ /** @since 3.0 */
+ int JavadocMissingThrowsClassName = Javadoc + Internal + 478;
+ /** @since 3.0 */
+ int JavadocInvalidThrowsClass = Javadoc + Internal + 479;
+ /** @since 3.0 */
+ int JavadocDuplicateThrowsClassName = Javadoc + Internal + 480;
+ /** @since 3.0 */
+ int JavadocInvalidThrowsClassName = Javadoc + Internal + 481;
+ /** @since 3.0 */
+ int JavadocMissingSeeReference = Javadoc + Internal + 482;
+ /** @since 3.0 */
+ int JavadocInvalidSeeReference = Javadoc + Internal + 483;
+ /** @since 3.0 */
+ int JavadocInvalidSeeHref = Javadoc + Internal + 484;
+ /** @since 3.0 */
+ int JavadocInvalidSeeArgs = Javadoc + Internal + 485;
+ /** @since 3.0 */
+ int JavadocMissing = Javadoc + Internal + 486;
+ /** @since 3.0 */
+ int JavadocInvalidTag = Javadoc + Internal + 487;
+ /*
+ * ID for field errors in Javadoc
+ */
+ /** @since 3.0 */
+ int JavadocUndefinedField = Javadoc + Internal + 488;
+ /** @since 3.0 */
+ int JavadocNotVisibleField = Javadoc + Internal + 489;
+ /** @since 3.0 */
+ int JavadocAmbiguousField = Javadoc + Internal + 490;
+ /** @since 3.0 */
+ int JavadocUsingDeprecatedField = Javadoc + Internal + 491;
+ /*
+ * IDs for constructor errors in Javadoc
+ */
+ /** @since 3.0 */
+ int JavadocUndefinedConstructor = Javadoc + Internal + 492;
+ /** @since 3.0 */
+ int JavadocNotVisibleConstructor = Javadoc + Internal + 493;
+ /** @since 3.0 */
+ int JavadocAmbiguousConstructor = Javadoc + Internal + 494;
+ /** @since 3.0 */
+ int JavadocUsingDeprecatedConstructor = Javadoc + Internal + 495;
+ /*
+ * IDs for method errors in Javadoc
+ */
+ /** @since 3.0 */
+ int JavadocUndefinedMethod = Javadoc + Internal + 496;
+ /** @since 3.0 */
+ int JavadocNotVisibleMethod = Javadoc + Internal + 497;
+ /** @since 3.0 */
+ int JavadocAmbiguousMethod = Javadoc + Internal + 498;
+ /** @since 3.0 */
+ int JavadocUsingDeprecatedMethod = Javadoc + Internal + 499;
+ /** @since 3.0 */
+ int JavadocNoMessageSendOnBaseType = Javadoc + Internal + 500;
+ /** @since 3.0 */
+ int JavadocParameterMismatch = Javadoc + Internal + 501;
+ /** @since 3.0 */
+ int JavadocNoMessageSendOnArrayType = Javadoc + Internal + 502;
+ /*
+ * IDs for type errors in Javadoc
+ */
+ /** @since 3.0 */
+ int JavadocUndefinedType = Javadoc + Internal + 503;
+ /** @since 3.0 */
+ int JavadocNotVisibleType = Javadoc + Internal + 504;
+ /** @since 3.0 */
+ int JavadocAmbiguousType = Javadoc + Internal + 505;
+ /** @since 3.0 */
+ int JavadocUsingDeprecatedType = Javadoc + Internal + 506;
+ /** @since 3.0 */
+ int JavadocInternalTypeNameProvided = Javadoc + Internal + 507;
+ /** @since 3.0 */
+ int JavadocInheritedMethodHidesEnclosingName = Javadoc + Internal + 508;
+ /** @since 3.0 */
+ int JavadocInheritedFieldHidesEnclosingName = Javadoc + Internal + 509;
+ /** @since 3.0 */
+ int JavadocInheritedNameHidesEnclosingTypeName = Javadoc + Internal + 510;
+ /** @since 3.0 */
+ int JavadocAmbiguousMethodReference = Javadoc + Internal + 511;
+ /** @since 3.0 */
+ int JavadocUnterminatedInlineTag = Javadoc + Internal + 512;
+ /** @since 3.0 */
+ int JavadocMalformedSeeReference = Javadoc + Internal + 513;
+ /** @since 3.0 */
+ int JavadocMessagePrefix = Internal + 515;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IScanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IScanner.java
index 6cb60c9..3207a73 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IScanner.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IScanner.java
@@ -1,10 +1,10 @@
/**********************************************************************
Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. Â This program and the accompanying materials
+All rights reserved. � This program and the accompanying materials
are made available under the terms of the Common Public License v0.5
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/cpl-v05.html
-Â
+�
Contributors:
IBM Corporation - initial API and implementation
**********************************************************************/
@@ -22,7 +22,7 @@ package net.sourceforge.phpdt.core.compiler;
*
* When encountering lexical errors, an InvalidInputException
is thrown.
*
- * @see org.eclipse.jdt.core.ToolFactory
+ * @see net.sourceforge.phpdt.core.ToolFactory
* @see ITerminalSymbols
* @since 2.0
*/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMMember.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMMember.java
index da5ea6b..cd4d327 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMMember.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMMember.java
@@ -35,7 +35,7 @@ public String getComment();
* Flags
class.
*
* @return the flags
- * @see org.eclipse.jdt.core.Flags
+ * @see net.sourceforge.phpdt.core.Flags
*/
public int getFlags();
/**
@@ -55,7 +55,7 @@ public void setComment(String comment);
* Flags
class. The deprecated flag passed in is ignored.
*
* @param flags the flags
- * @see org.eclipse.jdt.core.Flags
+ * @see net.sourceforge.phpdt.core.Flags
*/
public void setFlags(int flags);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/search/IJavaSearchConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/search/IJavaSearchConstants.java
index 1aec40e..6c3a8ea 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/search/IJavaSearchConstants.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/search/IJavaSearchConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package net.sourceforge.phpdt.core.search;
+//import net.sourceforge.phpdt.internal.core.search.processing.*;
/**
*
@@ -125,15 +126,18 @@ public interface IJavaSearchConstants {
/**
* The search pattern matches exactly the search result,
* that is, the source of the search result equals the search pattern.
+ * @deprecated Use {@link SearchPattern#R_EXACT_MATCH} instead.
*/
int EXACT_MATCH = 0;
/**
* The search pattern is a prefix of the search result.
+ * @deprecated Use {@link SearchPattern#R_PREFIX_MATCH} instead.
*/
int PREFIX_MATCH = 1;
/**
* The search pattern contains one or more wild cards ('*') where a
* wild-card can replace 0 or more characters in the search result.
+ * @deprecated Use {@link SearchPattern#R_PATTERN_MATCH} instead.
*/
int PATTERN_MATCH = 2;
@@ -143,31 +147,35 @@ public interface IJavaSearchConstants {
/**
* The search pattern matches the search result only
* if cases are the same.
+ * @deprecated Use the methods that take the matchMode
+ * with {@link SearchPattern#R_CASE_SENSITIVE} as a matchRule instead.
*/
boolean CASE_SENSITIVE = true;
/**
* The search pattern ignores cases in the search result.
+ * @deprecated Use the methods that take the matchMode
+ * without {@link SearchPattern#R_CASE_SENSITIVE} as a matchRule instead.
*/
boolean CASE_INSENSITIVE = false;
/* Waiting policies */
-// /**
-// * The search operation starts immediately, even if the underlying indexer
-// * has not finished indexing the workspace. Results will more likely
-// * not contain all the matches.
-// */
+ /**
+ * The search operation starts immediately, even if the underlying indexer
+ * has not finished indexing the workspace. Results will more likely
+ * not contain all the matches.
+ */
// int FORCE_IMMEDIATE_SEARCH = IJob.ForceImmediate;
-// /**
-// * The search operation throws an
+ * 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 a given classpath
+ * @param projectOutputLocation a given output location
+ * @return a status object with code
+ * Loads a previously saved ITypeHierarchy from an input stream. A type hierarchy can
+ * be stored using ITypeHierachy#store(OutputStream). A compilation unit of a
+ * loaded type has the given owner if such a working copy exists, otherwise the type's
+ * compilation unit is a primary compilation unit.
+ *
+ * Only hierarchies originally created by the following methods can be loaded:
+ * This implementation is NOT thread-safe. Synchronization wrappers would
* have to be added to ensure atomic insertions and deletions from the cache.
*
- * @see org.eclipse.jdt.internal.core.util.ILRUCacheable
+ * @see net.sourceforge.phpdt.internal.core.util.ILRUCacheable
*/
public class LRUCache implements Cloneable {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/MementoTokenizer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/MementoTokenizer.java
new file mode 100644
index 0000000..92cc164
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/MementoTokenizer.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 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.internal.core.util;
+
+import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.core.JavaElement;
+
+public class MementoTokenizer {
+ private static final String COUNT = Character.toString(JavaElement.JEM_COUNT);
+ private static final String JAVAPROJECT = Character.toString(JavaElement.JEM_JAVAPROJECT);
+ private static final String PACKAGEFRAGMENTROOT = Character.toString(JavaElement.JEM_PACKAGEFRAGMENTROOT);
+ private static final String PACKAGEFRAGMENT = Character.toString(JavaElement.JEM_PACKAGEFRAGMENT);
+ private static final String FIELD = Character.toString(JavaElement.JEM_FIELD);
+ private static final String METHOD = Character.toString(JavaElement.JEM_METHOD);
+ private static final String INITIALIZER = Character.toString(JavaElement.JEM_INITIALIZER);
+ private static final String COMPILATIONUNIT = Character.toString(JavaElement.JEM_COMPILATIONUNIT);
+// private static final String CLASSFILE = Character.toString(JavaElement.JEM_CLASSFILE);
+ private static final String TYPE = Character.toString(JavaElement.JEM_TYPE);
+ private static final String PACKAGEDECLARATION = Character.toString(JavaElement.JEM_PACKAGEDECLARATION);
+ private static final String IMPORTDECLARATION = Character.toString(JavaElement.JEM_IMPORTDECLARATION);
+ private static final String LOCALVARIABLE = Character.toString(JavaElement.JEM_LOCALVARIABLE);
+
+ private final char[] memento;
+ private final int length;
+ private int index = 0;
+
+ public MementoTokenizer(String memento) {
+ this.memento = memento.toCharArray();
+ this.length = this.memento.length;
+ }
+
+ public boolean hasMoreTokens() {
+ return this.index < this.length;
+ }
+
+ public String nextToken() {
+ int start = this.index;
+ StringBuffer buffer = null;
+ switch (this.memento[this.index++]) {
+ case JavaElement.JEM_ESCAPE:
+ buffer = new StringBuffer();
+ buffer.append(this.memento[this.index]);
+ start = ++this.index;
+ break;
+ case JavaElement.JEM_COUNT:
+ return COUNT;
+ case JavaElement.JEM_JAVAPROJECT:
+ return JAVAPROJECT;
+ case JavaElement.JEM_PACKAGEFRAGMENTROOT:
+ return PACKAGEFRAGMENTROOT;
+ case JavaElement.JEM_PACKAGEFRAGMENT:
+ return PACKAGEFRAGMENT;
+ case JavaElement.JEM_FIELD:
+ return FIELD;
+ case JavaElement.JEM_METHOD:
+ return METHOD;
+ case JavaElement.JEM_INITIALIZER:
+ return INITIALIZER;
+ case JavaElement.JEM_COMPILATIONUNIT:
+ return COMPILATIONUNIT;
+// case JavaElement.JEM_CLASSFILE:
+// return CLASSFILE;
+ case JavaElement.JEM_TYPE:
+ return TYPE;
+ case JavaElement.JEM_PACKAGEDECLARATION:
+ return PACKAGEDECLARATION;
+ case JavaElement.JEM_IMPORTDECLARATION:
+ return IMPORTDECLARATION;
+ case JavaElement.JEM_LOCALVARIABLE:
+ return LOCALVARIABLE;
+ }
+ loop: while (this.index < this.length) {
+ switch (this.memento[this.index]) {
+ case JavaElement.JEM_ESCAPE:
+ if (buffer == null) buffer = new StringBuffer();
+ buffer.append(CharOperation.subarray(this.memento, start, this.index));
+ start = ++this.index;
+ break;
+ case JavaElement.JEM_COUNT:
+ case JavaElement.JEM_JAVAPROJECT:
+ case JavaElement.JEM_PACKAGEFRAGMENTROOT:
+ case JavaElement.JEM_PACKAGEFRAGMENT:
+ case JavaElement.JEM_FIELD:
+ case JavaElement.JEM_METHOD:
+ case JavaElement.JEM_INITIALIZER:
+ case JavaElement.JEM_COMPILATIONUNIT:
+// case JavaElement.JEM_CLASSFILE:
+ case JavaElement.JEM_TYPE:
+ case JavaElement.JEM_PACKAGEDECLARATION:
+ case JavaElement.JEM_IMPORTDECLARATION:
+ case JavaElement.JEM_LOCALVARIABLE:
+ break loop;
+ }
+ this.index++;
+ }
+ if (buffer != null) {
+ buffer.append(CharOperation.subarray(this.memento, start, this.index));
+ return buffer.toString();
+ } else {
+ return new String(CharOperation.subarray(this.memento, start, this.index));
+ }
+ }
+
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleDocument.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleDocument.java
new file mode 100644
index 0000000..bccd2f0
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleDocument.java
@@ -0,0 +1,371 @@
+/*******************************************************************************
+ * 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.internal.core.util;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentListener;
+import org.eclipse.jface.text.IDocumentPartitioner;
+import org.eclipse.jface.text.IDocumentPartitioningListener;
+import org.eclipse.jface.text.IPositionUpdater;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITypedRegion;
+import org.eclipse.jface.text.Position;
+
+/**
+ * Minimal implementation of IDocument to apply text edit onto a string.
+ */
+public class SimpleDocument implements IDocument {
+
+ private StringBuffer buffer;
+
+
+ public SimpleDocument(String source) {
+ this.buffer = new StringBuffer(source);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getChar(int)
+ */
+ public char getChar(int offset) {
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getLength()
+ */
+ public int getLength() {
+ return this.buffer.length();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#get()
+ */
+ public String get() {
+ return this.buffer.toString();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#get(int, int)
+ */
+ public String get(int offset, int length) {
+ return this.buffer.substring(offset, offset + length);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#set(java.lang.String)
+ */
+ public void set(String text) {
+ // defining interface method
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#replace(int, int, java.lang.String)
+ */
+ public void replace(int offset, int length, String text) {
+
+ this.buffer.replace(offset, offset + length, text);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#addDocumentListener(org.eclipse.jface.text.IDocumentListener)
+ */
+ public void addDocumentListener(IDocumentListener listener) {
+ // defining interface method
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#removeDocumentListener(org.eclipse.jface.text.IDocumentListener)
+ */
+ public void removeDocumentListener(IDocumentListener listener) {
+ // defining interface method
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#addPrenotifiedDocumentListener(org.eclipse.jface.text.IDocumentListener)
+ */
+ public void addPrenotifiedDocumentListener(IDocumentListener documentAdapter) {
+ // defining interface method
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#removePrenotifiedDocumentListener(org.eclipse.jface.text.IDocumentListener)
+ */
+ public void removePrenotifiedDocumentListener(IDocumentListener documentAdapter) {
+ // defining interface method
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#addPositionCategory(java.lang.String)
+ */
+ public void addPositionCategory(String category) {
+ // defining interface method
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#removePositionCategory(java.lang.String)
+ */
+ public void removePositionCategory(String category) {
+ // defining interface method
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getPositionCategories()
+ */
+ public String[] getPositionCategories() {
+ // defining interface method
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#containsPositionCategory(java.lang.String)
+ */
+ public boolean containsPositionCategory(String category) {
+ // defining interface method
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#addPosition(org.eclipse.jface.text.Position)
+ */
+ public void addPosition(Position position) {
+ // defining interface method
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#removePosition(org.eclipse.jface.text.Position)
+ */
+ public void removePosition(Position position) {
+ // defining interface method
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#addPosition(java.lang.String, org.eclipse.jface.text.Position)
+ */
+ public void addPosition(String category, Position position) {
+ // defining interface method
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#removePosition(java.lang.String, org.eclipse.jface.text.Position)
+ */
+ public void removePosition(String category, Position position) {
+ // defining interface method
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getPositions(java.lang.String)
+ */
+ public Position[] getPositions(String category) {
+ // defining interface method
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#containsPosition(java.lang.String, int, int)
+ */
+ public boolean containsPosition(String category, int offset, int length) {
+ // defining interface method
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#computeIndexInCategory(java.lang.String, int)
+ */
+ public int computeIndexInCategory(String category, int offset) {
+ // defining interface method
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#addPositionUpdater(org.eclipse.jface.text.IPositionUpdater)
+ */
+ public void addPositionUpdater(IPositionUpdater updater) {
+ // defining interface method
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#removePositionUpdater(org.eclipse.jface.text.IPositionUpdater)
+ */
+ public void removePositionUpdater(IPositionUpdater updater) {
+ // defining interface method
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#insertPositionUpdater(org.eclipse.jface.text.IPositionUpdater, int)
+ */
+ public void insertPositionUpdater(IPositionUpdater updater, int index) {
+ // defining interface method
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getPositionUpdaters()
+ */
+ public IPositionUpdater[] getPositionUpdaters() {
+ // defining interface method
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getLegalContentTypes()
+ */
+ public String[] getLegalContentTypes() {
+ // defining interface method
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getContentType(int)
+ */
+ public String getContentType(int offset) {
+ // defining interface method
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getPartition(int)
+ */
+ public ITypedRegion getPartition(int offset) {
+ // defining interface method
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#computePartitioning(int, int)
+ */
+ public ITypedRegion[] computePartitioning(int offset, int length) {
+ // defining interface method
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#addDocumentPartitioningListener(org.eclipse.jface.text.IDocumentPartitioningListener)
+ */
+ public void addDocumentPartitioningListener(IDocumentPartitioningListener listener) {
+ // defining interface method
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#removeDocumentPartitioningListener(org.eclipse.jface.text.IDocumentPartitioningListener)
+ */
+ public void removeDocumentPartitioningListener(IDocumentPartitioningListener listener) {
+ // defining interface method
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#setDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner)
+ */
+ public void setDocumentPartitioner(IDocumentPartitioner partitioner) {
+ // defining interface method
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getDocumentPartitioner()
+ */
+ public IDocumentPartitioner getDocumentPartitioner() {
+ // defining interface method
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getLineLength(int)
+ */
+ public int getLineLength(int line) {
+ // defining interface method
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getLineOfOffset(int)
+ */
+ public int getLineOfOffset(int offset) {
+ // defining interface method
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getLineOffset(int)
+ */
+ public int getLineOffset(int line) {
+ // defining interface method
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getLineInformation(int)
+ */
+ public IRegion getLineInformation(int line) {
+ // defining interface method
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getLineInformationOfOffset(int)
+ */
+ public IRegion getLineInformationOfOffset(int offset) {
+ // defining interface method
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getNumberOfLines()
+ */
+ public int getNumberOfLines() {
+ // defining interface method
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getNumberOfLines(int, int)
+ */
+ public int getNumberOfLines(int offset, int length) {
+ // defining interface method
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#computeNumberOfLines(java.lang.String)
+ */
+ public int computeNumberOfLines(String text) {
+ // defining interface method
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getLegalLineDelimiters()
+ */
+ public String[] getLegalLineDelimiters() {
+ // defining interface method
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocument#getLineDelimiter(int)
+ */
+ public String getLineDelimiter(int line) {
+ // defining interface method
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jface.text.IDocument#search(int, java.lang.String, boolean, boolean, boolean)
+ * @deprecated
+ */
+ public int search(
+ int startOffset,
+ String findString,
+ boolean forwardSearch,
+ boolean caseSensitive,
+ boolean wholeWord) {
+ // defining interface method
+ return 0;
+ }
+
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleLookupTable.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleLookupTable.java
index 01c61a6..a0819d4 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleLookupTable.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleLookupTable.java
@@ -97,21 +97,23 @@ public Object put(Object key, Object value) {
return value;
}
-public void removeKey(Object key) {
+public Object removeKey(Object key) {
int length = keyTable.length;
int index = (key.hashCode() & 0x7FFFFFFF) % length;
Object currentKey;
while ((currentKey = keyTable[index]) != null) {
if (currentKey.equals(key)) {
elementSize--;
+ Object oldValue = valueTable[index];
keyTable[index] = null;
valueTable[index] = null;
if (keyTable[index + 1 == length ? 0 : index + 1] != null)
rehash(); // only needed if a possible collision existed
- return;
+ return oldValue;
}
if (++index == length) index = 0;
}
+ return null;
}
public void removeValue(Object valueToRemove) {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleSet.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleSet.java
new file mode 100644
index 0000000..3e1544f
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleSet.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * 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.internal.core.util;
+
+/**
+ * A simple lookup table is a non-synchronized Hashtable, whose keys
+ * and values are Objects. It also uses linear probing to resolve collisions
+ * rather than a linked list of hash table entries.
+ */
+public final class SimpleSet implements Cloneable {
+
+// to avoid using Enumerations, walk the individual values skipping nulls
+public Object[] values;
+public int elementSize; // number of elements in the table
+public int threshold;
+
+public SimpleSet() {
+ this(13);
+}
+
+public SimpleSet(int size) {
+ if (size < 3) size = 3;
+ this.elementSize = 0;
+ this.threshold = size + 1; // size is the expected number of elements
+ this.values = new Object[2 * size + 1];
+}
+
+public Object add(Object object) {
+ int length = values.length;
+ int index = (object.hashCode() & 0x7FFFFFFF) % length;
+ Object current;
+ while ((current = values[index]) != null) {
+ if (current.equals(object)) return values[index] = object;
+ if (++index == length) index = 0;
+ }
+ values[index] = object;
+
+ // assumes the threshold is never equal to the size of the table
+ if (++elementSize > threshold) rehash();
+ return object;
+}
+
+public Object clone() throws CloneNotSupportedException {
+ SimpleSet result = (SimpleSet) super.clone();
+ result.elementSize = this.elementSize;
+ result.threshold = this.threshold;
+
+ int length = this.values.length;
+ result.values = new Object[length];
+ System.arraycopy(this.values, 0, result.values, 0, length);
+ return result;
+}
+
+public boolean includes(Object object) {
+ int length = values.length;
+ int index = (object.hashCode() & 0x7FFFFFFF) % length;
+ Object current;
+ while ((current = values[index]) != null) {
+ if (current.equals(object)) return true;
+ if (++index == length) index = 0;
+ }
+ return false;
+}
+
+public Object remove(Object object) {
+ int length = values.length;
+ int index = (object.hashCode() & 0x7FFFFFFF) % length;
+ Object current;
+ while ((current = values[index]) != null) {
+ if (current.equals(object)) {
+ elementSize--;
+ Object oldValue = values[index];
+ values[index] = null;
+ if (values[index + 1 == length ? 0 : index + 1] != null)
+ rehash(); // only needed if a possible collision existed
+ return oldValue;
+ }
+ if (++index == length) index = 0;
+ }
+ return null;
+}
+
+private void rehash() {
+ SimpleSet newSet = new SimpleSet(elementSize * 2); // double the number of expected elements
+ Object current;
+ for (int i = values.length; --i >= 0;)
+ if ((current = values[i]) != null)
+ newSet.add(current);
+
+ this.values = newSet.values;
+ this.elementSize = newSet.elementSize;
+ this.threshold = newSet.threshold;
+}
+
+public String toString() {
+ String s = ""; //$NON-NLS-1$
+ Object object;
+ for (int i = 0, l = values.length; i < l; i++)
+ if ((object = values[i]) != null)
+ s += object.toString() + "\n"; //$NON-NLS-1$
+ return s;
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleWordSet.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleWordSet.java
new file mode 100644
index 0000000..ab69d75
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleWordSet.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.internal.core.util;
+
+import net.sourceforge.phpdt.core.compiler.CharOperation;
+
+public final class SimpleWordSet {
+
+// to avoid using Enumerations, walk the individual values skipping nulls
+public char[][] words;
+public int elementSize; // number of elements in the table
+public int threshold;
+
+public SimpleWordSet(int size) {
+ this.elementSize = 0;
+ this.threshold = size; // size represents the expected number of elements
+ int extraRoom = (int) (size * 1.5f);
+ if (this.threshold == extraRoom)
+ extraRoom++;
+ this.words = new char[extraRoom][];
+}
+
+public char[] add(char[] word) {
+ int length = this.words.length;
+ int index = CharOperation.hashCode(word) % length;
+ char[] current;
+ while ((current = words[index]) != null) {
+ if (CharOperation.equals(current, word)) return current;
+ if (++index == length) index = 0;
+ }
+ words[index] = word;
+
+ // assumes the threshold is never equal to the size of the table
+ if (++elementSize > threshold) rehash();
+ return word;
+}
+
+public boolean includes(char[] word) {
+ int length = this.words.length;
+ int index = CharOperation.hashCode(word) % length;
+ char[] current;
+ while ((current = words[index]) != null) {
+ if (CharOperation.equals(current, word)) return true;
+ if (++index == length) index = 0;
+ }
+ return false;
+}
+
+private void rehash() {
+ SimpleWordSet newSet = new SimpleWordSet(elementSize * 2); // double the number of expected elements
+ char[] current;
+ for (int i = words.length; --i >= 0;)
+ if ((current = words[i]) != null)
+ newSet.add(current);
+
+ this.words = newSet.words;
+ this.elementSize = newSet.elementSize;
+ this.threshold = newSet.threshold;
+}
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/Util.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/Util.java
index d78c6ce..39b4d39 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/Util.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/Util.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * 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
@@ -11,9 +11,13 @@
package net.sourceforge.phpdt.internal.core.util;
import java.io.BufferedInputStream;
+import java.io.DataInput;
+import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import java.io.PrintStream;
+import java.io.UTFDataFormatException;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
@@ -22,1360 +26,1767 @@ import java.util.StringTokenizer;
import net.sourceforge.phpdt.core.IJavaElement;
import net.sourceforge.phpdt.core.IJavaModelStatusConstants;
import net.sourceforge.phpdt.core.IPackageFragment;
-import net.sourceforge.phpdt.core.JavaModelException;
import net.sourceforge.phpdt.core.JavaCore;
+import net.sourceforge.phpdt.core.JavaModelException;
import net.sourceforge.phpdt.core.Signature;
import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.core.Assert;
import net.sourceforge.phpdt.internal.core.PackageFragmentRoot;
-import net.sourceforge.phpdt.internal.corext.Assert;
import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil;
+import net.sourceforge.phpeclipse.internal.compiler.ast.TypeReference;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.text.edits.MalformedTreeException;
+import org.eclipse.text.edits.TextEdit;
/**
* Provides convenient utility methods to other types in this package.
*/
public class Util {
- private final static char[] DOUBLE_QUOTES = "''".toCharArray(); //$NON-NLS-1$
- private final static char[] SINGLE_QUOTE = "'".toCharArray(); //$NON-NLS-1$
- private static final String ARGUMENTS_DELIMITER = "#"; //$NON-NLS-1$
- private static final String EMPTY_ARGUMENT = " "; //$NON-NLS-1$
-
- public interface Comparable {
- /**
- * Returns 0 if this and c are equal, >0 if this is greater than c,
- * or <0 if this is less than c.
- */
- int compareTo(Comparable c);
- }
+ public interface Comparable {
+ /**
+ * Returns 0 if this and c are equal, >0 if this is greater than c, or <0 if this is less than c.
+ */
+ int compareTo(Comparable c);
+ }
- public interface Comparer {
- /**
- * Returns 0 if a and b are equal, >0 if a is greater than b,
- * or <0 if a is less than b.
- */
- int compare(Object a, Object b);
- }
-
- public interface Displayable {
- String displayString(Object o);
- }
-
- public static final String[] fgEmptyStringArray = new String[0];
+ public interface Comparer {
+ /**
+ * Returns 0 if a and b are equal, >0 if a is greater than b, or <0 if a is less than b.
+ */
+ int compare(Object a, Object b);
+ }
- /**
- * Are we running JDK 1.1?
- */
- private static boolean JDK1_1 = false;
-
- /* Bundle containing messages */
- protected static ResourceBundle bundle;
- private final static String bundleName = "net.sourceforge.phpdt.internal.core.util.messages"; //$NON-NLS-1$
-
-// public final static char[] SUFFIX_class = ".class".toCharArray(); //$NON-NLS-1$
-// public final static char[] SUFFIX_CLASS = ".CLASS".toCharArray(); //$NON-NLS-1$
-// public final static char[] SUFFIX_java = ".java".toCharArray(); //$NON-NLS-1$
-// public final static char[] SUFFIX_JAVA = ".JAVA".toCharArray(); //$NON-NLS-1$
-// public final static char[] SUFFIX_jar = ".jar".toCharArray(); //$NON-NLS-1$
-// public final static char[] SUFFIX_JAR = ".JAR".toCharArray(); //$NON-NLS-1$
-// public final static char[] SUFFIX_zip = ".zip".toCharArray(); //$NON-NLS-1$
-// public final static char[] SUFFIX_ZIP = ".ZIP".toCharArray(); //$NON-NLS-1$
-
- static {
- String ver = System.getProperty("java.version"); //$NON-NLS-1$
- JDK1_1 = ((ver != null) && ver.startsWith("1.1")); //$NON-NLS-1$
- relocalize();
- }
-
- /**
- * Lookup the message with the given ID in this catalog
- */
- public static String bind(String id) {
- return bind(id, (String[])null);
- }
-
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given string values.
- */
- public static String bind(String id, String[] bindings) {
- if (id == null)
- return "No message available"; //$NON-NLS-1$
- String message = null;
- try {
- message = bundle.getString(id);
- } catch (MissingResourceException e) {
- // If we got an exception looking for the message, fail gracefully by just returning
- // the id we were looking for. In most cases this is semi-informative so is not too bad.
- return "Missing message: " + id + " in: " + bundleName; //$NON-NLS-2$ //$NON-NLS-1$
- }
- // for compatibility with MessageFormat which eliminates double quotes in original message
- char[] messageWithNoDoubleQuotes =
- CharOperation.replace(message.toCharArray(), DOUBLE_QUOTES, SINGLE_QUOTE);
- message = new String(messageWithNoDoubleQuotes);
-
- if (bindings == null)
- return message;
-
- int length = message.length();
- int start = -1;
- int end = length;
- StringBuffer output = new StringBuffer(80);
- while (true) {
- if ((end = message.indexOf('{', start)) > -1) {
- output.append(message.substring(start + 1, end));
- if ((start = message.indexOf('}', end)) > -1) {
- int index = -1;
- try {
- index = Integer.parseInt(message.substring(end + 1, start));
- output.append(bindings[index]);
- } catch (NumberFormatException nfe) {
- output.append(message.substring(end + 1, start + 1));
- } catch (ArrayIndexOutOfBoundsException e) {
- output.append("{missing " + Integer.toString(index) + "}"); //$NON-NLS-2$ //$NON-NLS-1$
- }
- } else {
- output.append(message.substring(end, length));
- break;
- }
- } else {
- output.append(message.substring(start + 1, length));
- break;
- }
- }
- return output.toString();
- }
+ private static final String ARGUMENTS_DELIMITER = "#"; //$NON-NLS-1$
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given string.
- */
- public static String bind(String id, String binding) {
- return bind(id, new String[] {binding});
- }
-
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given strings.
- */
- public static String bind(String id, String binding1, String binding2) {
- return bind(id, new String[] {binding1, binding2});
- }
+ /* Bundle containing messages */
+ protected static ResourceBundle bundle;
- /**
- * Checks the type signature in String sig,
- * starting at start and ending before end (end is not included).
- * Returns the index of the character immediately after the signature if valid,
- * or -1 if not valid.
- */
- private static int checkTypeSignature(String sig, int start, int end, boolean allowVoid) {
- if (start >= end) return -1;
- int i = start;
- char c = sig.charAt(i++);
- int nestingDepth = 0;
- while (c == '[') {
- ++nestingDepth;
- if (i >= end) return -1;
- c = sig.charAt(i++);
- }
- switch (c) {
- case 'B':
- case 'C':
- case 'D':
- case 'F':
- case 'I':
- case 'J':
- case 'S':
- case 'Z':
- break;
- case 'V':
- if (!allowVoid) return -1;
- // array of void is not allowed
- if (nestingDepth != 0) return -1;
- break;
- case 'L':
- int semicolon = sig.indexOf(';', i);
- // Must have at least one character between L and ;
- if (semicolon <= i || semicolon >= end) return -1;
- i = semicolon + 1;
- break;
- default:
- return -1;
- }
- return i;
- }
-
- /**
- * Combines two hash codes to make a new one.
- */
- public static int combineHashCodes(int hashCode1, int hashCode2) {
- return hashCode1 * 17 + hashCode2;
- }
-
- /**
- * Compares two byte arrays.
- * Returns <0 if a byte in a is less than the corresponding byte in b, or if a is shorter, or if a is null.
- * Returns >0 if a byte in a is greater than the corresponding byte in b, or if a is longer, or if b is null.
- * Returns 0 if they are equal or both null.
- */
- public static int compare(byte[] a, byte[] b) {
- if (a == b)
- return 0;
- if (a == null)
- return -1;
- if (b == null)
- return 1;
- int len = Math.min(a.length, b.length);
- for (int i = 0; i < len; ++i) {
- int diff = a[i] - b[i];
- if (diff != 0)
- return diff;
- }
- if (a.length > len)
- return 1;
- if (b.length > len)
- return -1;
- return 0;
- }
+ private final static String bundleName = "net.sourceforge.phpdt.internal.core.util.messages"; //$NON-NLS-1$
- /**
- * Compares two char arrays lexicographically.
- * The comparison is based on the Unicode value of each character in
- * the char arrays.
- * @return the value org.eclipse.core.runtime.OperationCanceledException
-// * if the underlying indexer has not finished indexing the workspace.
-// */
+ /**
+ * The search operation throws an org.eclipse.core.runtime.OperationCanceledException
+ * if the underlying indexer has not finished indexing the workspace.
+ */
// int CANCEL_IF_NOT_READY_TO_SEARCH = IJob.CancelIfNotReady;
-// /**
-// * The search operation waits for the underlying indexer to finish indexing
-// * the workspace before starting the search.
-// */
+ /**
+ * The search operation waits for the underlying indexer to finish indexing
+ * the workspace before starting the search.
+ */
// int WAIT_UNTIL_READY_TO_SEARCH = IJob.WaitUntilReady;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/search/ITypeNameRequestor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/search/ITypeNameRequestor.java
index 2a092b8..776560a 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/search/ITypeNameRequestor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/search/ITypeNameRequestor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * 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
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/dialog/ExternalToolVariableForm.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/dialog/ExternalToolVariableForm.java
index 201a295..5a9de70 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/dialog/ExternalToolVariableForm.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/dialog/ExternalToolVariableForm.java
@@ -5,7 +5,7 @@ Copyright (c) 2002 IBM Corp. and others. All rights reserved.
This file is 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:
**********************************************************************/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/model/ExternalToolsPlugin.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/model/ExternalToolsPlugin.java
index b4f3b26..40d31b9 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/model/ExternalToolsPlugin.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/model/ExternalToolsPlugin.java
@@ -5,7 +5,7 @@ Copyright (c) 2002 IBM Corp. and others. All rights reserved.
This file is 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:
**********************************************************************/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/ArgumentVariable.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/ArgumentVariable.java
index c46c7d3..e3fc7b2 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/ArgumentVariable.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/ArgumentVariable.java
@@ -5,7 +5,7 @@ Copyright (c) 2002 IBM Corp. and others. All rights reserved.
This file is 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:
**********************************************************************/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/ArgumentVariableRegistry.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/ArgumentVariableRegistry.java
index 3225808..5e02868 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/ArgumentVariableRegistry.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/ArgumentVariableRegistry.java
@@ -5,7 +5,7 @@ Copyright (c) 2002 IBM Corp. and others. All rights reserved.
This file is 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:
**********************************************************************/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariable.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariable.java
index 52f3a12..6fbbefb 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariable.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariable.java
@@ -5,7 +5,7 @@ Copyright (c) 2002 IBM Corp. and others. All rights reserved.
This file is 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:
**********************************************************************/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariableRegistry.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariableRegistry.java
index 978883d..bd450ba 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariableRegistry.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariableRegistry.java
@@ -5,7 +5,7 @@ Copyright (c) 2002 IBM Corp. and others. All rights reserved.
This file is 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:
**********************************************************************/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/PathLocationVariable.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/PathLocationVariable.java
index 2f14656..4385da3 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/PathLocationVariable.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/PathLocationVariable.java
@@ -5,7 +5,7 @@ Copyright (c) 2002 IBM Corp. and others. All rights reserved.
This file is 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:
**********************************************************************/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/PathLocationVariableRegistry.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/PathLocationVariableRegistry.java
index 9897442..1a2fa3e 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/PathLocationVariableRegistry.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/PathLocationVariableRegistry.java
@@ -5,7 +5,7 @@ Copyright (c) 2002 IBM Corp. and others. All rights reserved.
This file is 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:
**********************************************************************/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/RefreshScopeVariable.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/RefreshScopeVariable.java
index 24b2ab5..ea634ec 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/RefreshScopeVariable.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/RefreshScopeVariable.java
@@ -5,7 +5,7 @@ Copyright (c) 2002 IBM Corp. and others. All rights reserved.
This file is 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:
**********************************************************************/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/RefreshScopeVariableRegistry.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/RefreshScopeVariableRegistry.java
index 111a210..d0b3d99 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/RefreshScopeVariableRegistry.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/internal/registry/RefreshScopeVariableRegistry.java
@@ -5,7 +5,7 @@ Copyright (c) 2002 IBM Corp. and others. All rights reserved.
This file is 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:
**********************************************************************/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/model/IExternalToolConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/model/IExternalToolConstants.java
index 17979d0..399f237 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/model/IExternalToolConstants.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/model/IExternalToolConstants.java
@@ -5,7 +5,7 @@ Copyright (c) 2002 IBM Corp. and others. All rights reserved.
This file is 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:
**********************************************************************/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/model/StringMatcher.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/model/StringMatcher.java
index 988f842..e4c530b 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/model/StringMatcher.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/model/StringMatcher.java
@@ -9,7 +9,7 @@ http://www.eclipse.org/legal/cpl-v10.html
import java.util.Vector;
/**
- * Copied from org.eclipse.jdt.internal.ui.util.StringMatcher
+ * Copied from net.sourceforge.phpdt.internal.ui.util.StringMatcher
*
* A string pattern matcher, suppporting * and ? wildcards.
*/
@@ -44,8 +44,8 @@ public class StringMatcher {
}
/**
* StringMatcher constructor takes in a String object that is a simple
- * pattern which may contain ‘*’ for 0 and many characters and
- * ‘?’ for exactly one character.
+ * pattern which may contain �*� for 0 and many characters and
+ * �?� for exactly one character.
*
* Literal '*' and '?' characters must be escaped in the pattern
* e.g., "\*" means literal "*", etc.
@@ -222,7 +222,7 @@ public class StringMatcher {
}
/**
* Parses the given pattern into segments seperated by wildcard '*' characters.
- * @param p, a String object that is a simple regular expression with ‘*’ and/or ‘?’
+ * @param p, a String object that is a simple regular expression with �*� and/or �?�
*/
private void parseWildCards() {
if(fPattern.startsWith("*"))//$NON-NLS-1$
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/model/ToolUtil.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/model/ToolUtil.java
index be61b92..c61833e 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/model/ToolUtil.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/model/ToolUtil.java
@@ -5,7 +5,7 @@ Copyright (c) 2002 IBM Corp. and others. All rights reserved.
This file is 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:
**********************************************************************/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/variable/ResourceExpander.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/variable/ResourceExpander.java
index 2ee69aa..fe5cfa8 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/variable/ResourceExpander.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/variable/ResourceExpander.java
@@ -5,7 +5,7 @@ Copyright (c) 2002 IBM Corp. and others. All rights reserved.
This file is 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:
**********************************************************************/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/codeassist/impl/AssistOptions.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/codeassist/impl/AssistOptions.java
new file mode 100644
index 0000000..3244c02
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/codeassist/impl/AssistOptions.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * 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.internal.codeassist.impl;
+
+import java.util.Map;
+
+import net.sourceforge.phpdt.core.compiler.CharOperation;
+
+public class AssistOptions {
+ /**
+ * Option IDs
+ */
+ public static final String OPTION_PerformVisibilityCheck =
+ "net.sourceforge.phpdt.core.codeComplete.visibilityCheck"; //$NON-NLS-1$
+ public static final String OPTION_ForceImplicitQualification =
+ "net.sourceforge.phpdt.core.codeComplete.forceImplicitQualification"; //$NON-NLS-1$
+ public static final String OPTION_FieldPrefixes =
+ "net.sourceforge.phpdt.core.codeComplete.fieldPrefixes"; //$NON-NLS-1$
+ public static final String OPTION_StaticFieldPrefixes =
+ "net.sourceforge.phpdt.core.codeComplete.staticFieldPrefixes"; //$NON-NLS-1$
+ public static final String OPTION_LocalPrefixes =
+ "net.sourceforge.phpdt.core.codeComplete.localPrefixes"; //$NON-NLS-1$
+ public static final String OPTION_ArgumentPrefixes =
+ "net.sourceforge.phpdt.core.codeComplete.argumentPrefixes"; //$NON-NLS-1$
+ public static final String OPTION_FieldSuffixes =
+ "net.sourceforge.phpdt.core.codeComplete.fieldSuffixes"; //$NON-NLS-1$
+ public static final String OPTION_StaticFieldSuffixes =
+ "net.sourceforge.phpdt.core.codeComplete.staticFieldSuffixes"; //$NON-NLS-1$
+ public static final String OPTION_LocalSuffixes =
+ "net.sourceforge.phpdt.core.codeComplete.localSuffixes"; //$NON-NLS-1$
+ public static final String OPTION_ArgumentSuffixes =
+ "net.sourceforge.phpdt.core.codeComplete.argumentSuffixes"; //$NON-NLS-1$
+ public static final String ENABLED = "enabled"; //$NON-NLS-1$
+ public static final String DISABLED = "disabled"; //$NON-NLS-1$
+
+ public boolean checkVisibility = false;
+ public boolean forceImplicitQualification = false;
+ public char[][] fieldPrefixes = null;
+ public char[][] staticFieldPrefixes = null;
+ public char[][] localPrefixes = null;
+ public char[][] argumentPrefixes = null;
+ public char[][] fieldSuffixes = null;
+ public char[][] staticFieldSuffixes = null;
+ public char[][] localSuffixes = null;
+ public char[][] argumentSuffixes = null;
+
+ /**
+ * Initializing the assist options with default settings
+ */
+ public AssistOptions() {
+ // Initializing the assist options with default settings
+ }
+
+ /**
+ * Initializing the assist options with external settings
+ */
+ public AssistOptions(Map settings) {
+ if (settings == null)
+ return;
+
+ set(settings);
+ }
+ public void set(Map optionsMap) {
+
+ Object optionValue;
+ if ((optionValue = optionsMap.get(OPTION_PerformVisibilityCheck)) != null) {
+ if (ENABLED.equals(optionValue)) {
+ this.checkVisibility = true;
+ } else if (DISABLED.equals(optionValue)) {
+ this.checkVisibility = false;
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_ForceImplicitQualification)) != null) {
+ if (ENABLED.equals(optionValue)) {
+ this.forceImplicitQualification = true;
+ } else if (DISABLED.equals(optionValue)) {
+ this.forceImplicitQualification = false;
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_FieldPrefixes)) != null) {
+ if (optionValue instanceof String) {
+ String stringValue = (String) optionValue;
+ if (stringValue.length() > 0){
+ this.fieldPrefixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
+ } else {
+ this.fieldPrefixes = null;
+ }
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_StaticFieldPrefixes)) != null) {
+ if (optionValue instanceof String) {
+ String stringValue = (String) optionValue;
+ if (stringValue.length() > 0){
+ this.staticFieldPrefixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
+ } else {
+ this.staticFieldPrefixes = null;
+ }
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_LocalPrefixes)) != null) {
+ if (optionValue instanceof String) {
+ String stringValue = (String) optionValue;
+ if (stringValue.length() > 0){
+ this.localPrefixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
+ } else {
+ this.localPrefixes = null;
+ }
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_ArgumentPrefixes)) != null) {
+ if (optionValue instanceof String) {
+ String stringValue = (String) optionValue;
+ if (stringValue.length() > 0){
+ this.argumentPrefixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
+ } else {
+ this.argumentPrefixes = null;
+ }
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_FieldSuffixes)) != null) {
+ if (optionValue instanceof String) {
+ String stringValue = (String) optionValue;
+ if (stringValue.length() > 0){
+ this.fieldSuffixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
+ } else {
+ this.fieldSuffixes = null;
+ }
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_StaticFieldSuffixes)) != null) {
+ if (optionValue instanceof String) {
+ String stringValue = (String) optionValue;
+ if (stringValue.length() > 0){
+ this.staticFieldSuffixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
+ } else {
+ this.staticFieldSuffixes = null;
+ }
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_LocalSuffixes)) != null) {
+ if (optionValue instanceof String) {
+ String stringValue = (String) optionValue;
+ if (stringValue.length() > 0){
+ this.localSuffixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
+ } else {
+ this.localSuffixes = null;
+ }
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_ArgumentSuffixes)) != null) {
+ if (optionValue instanceof String) {
+ String stringValue = (String) optionValue;
+ if (stringValue.length() > 0){
+ this.argumentSuffixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
+ } else {
+ this.argumentSuffixes = null;
+ }
+ }
+ }
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ASTVisitor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ASTVisitor.java
index 06b7659..55769aa 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ASTVisitor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ASTVisitor.java
@@ -10,9 +10,75 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler;
-import net.sourceforge.phpdt.core.compiler.*;
-import net.sourceforge.phpeclipse.internal.compiler.ast.*;
-import net.sourceforge.phpdt.internal.compiler.lookup.*;
+import net.sourceforge.phpdt.core.compiler.IProblem;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
+import net.sourceforge.phpeclipse.internal.compiler.ast.AND_AND_Expression;
+import net.sourceforge.phpeclipse.internal.compiler.ast.AllocationExpression;
+import net.sourceforge.phpeclipse.internal.compiler.ast.Argument;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayAllocationExpression;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayInitializer;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayQualifiedTypeReference;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayReference;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayTypeReference;
+import net.sourceforge.phpeclipse.internal.compiler.ast.AssertStatement;
+import net.sourceforge.phpeclipse.internal.compiler.ast.Assignment;
+import net.sourceforge.phpeclipse.internal.compiler.ast.BinaryExpression;
+import net.sourceforge.phpeclipse.internal.compiler.ast.Block;
+import net.sourceforge.phpeclipse.internal.compiler.ast.BreakStatement;
+import net.sourceforge.phpeclipse.internal.compiler.ast.CaseStatement;
+import net.sourceforge.phpeclipse.internal.compiler.ast.CastExpression;
+import net.sourceforge.phpeclipse.internal.compiler.ast.Clinit;
+import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
+import net.sourceforge.phpeclipse.internal.compiler.ast.CompoundAssignment;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ConditionalExpression;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ContinueStatement;
+import net.sourceforge.phpeclipse.internal.compiler.ast.DoStatement;
+import net.sourceforge.phpeclipse.internal.compiler.ast.DoubleLiteral;
+import net.sourceforge.phpeclipse.internal.compiler.ast.EmptyStatement;
+import net.sourceforge.phpeclipse.internal.compiler.ast.EqualExpression;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ExplicitConstructorCall;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ExtendedStringLiteral;
+import net.sourceforge.phpeclipse.internal.compiler.ast.FalseLiteral;
+import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
+import net.sourceforge.phpeclipse.internal.compiler.ast.FieldReference;
+import net.sourceforge.phpeclipse.internal.compiler.ast.FloatLiteral;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ForStatement;
+import net.sourceforge.phpeclipse.internal.compiler.ast.IfStatement;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference;
+import net.sourceforge.phpeclipse.internal.compiler.ast.Initializer;
+import net.sourceforge.phpeclipse.internal.compiler.ast.InstanceOfExpression;
+import net.sourceforge.phpeclipse.internal.compiler.ast.IntLiteral;
+import net.sourceforge.phpeclipse.internal.compiler.ast.LabeledStatement;
+import net.sourceforge.phpeclipse.internal.compiler.ast.LocalDeclaration;
+import net.sourceforge.phpeclipse.internal.compiler.ast.LongLiteral;
+import net.sourceforge.phpeclipse.internal.compiler.ast.MessageSend;
+import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration;
+import net.sourceforge.phpeclipse.internal.compiler.ast.NullLiteral;
+import net.sourceforge.phpeclipse.internal.compiler.ast.OR_OR_Expression;
+import net.sourceforge.phpeclipse.internal.compiler.ast.PostfixExpression;
+import net.sourceforge.phpeclipse.internal.compiler.ast.PrefixExpression;
+import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedAllocationExpression;
+import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedNameReference;
+import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedSuperReference;
+import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedThisReference;
+import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedTypeReference;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ReturnStatement;
+import net.sourceforge.phpeclipse.internal.compiler.ast.SingleNameReference;
+import net.sourceforge.phpeclipse.internal.compiler.ast.SingleTypeReference;
+import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteral;
+import net.sourceforge.phpeclipse.internal.compiler.ast.SuperReference;
+import net.sourceforge.phpeclipse.internal.compiler.ast.SwitchStatement;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ThisReference;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ThrowStatement;
+import net.sourceforge.phpeclipse.internal.compiler.ast.TrueLiteral;
+import net.sourceforge.phpeclipse.internal.compiler.ast.TryStatement;
+import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
+import net.sourceforge.phpeclipse.internal.compiler.ast.UnaryExpression;
+import net.sourceforge.phpeclipse.internal.compiler.ast.WhileStatement;
/**
* A visitor for iterating through the parse tree.
@@ -99,21 +165,16 @@ public abstract class ASTVisitor {
public void endVisit(Block block, BlockScope scope) {
// do nothing by default
}
- public void endVisit(Break breakStatement, BlockScope scope) {
+ public void endVisit(BreakStatement breakStatement, BlockScope scope) {
// do nothing by default
}
- public void endVisit(Case caseStatement, BlockScope scope) {
+ public void endVisit(CaseStatement caseStatement, BlockScope scope) {
// do nothing by default
}
public void endVisit(CastExpression castExpression, BlockScope scope) {
// do nothing by default
}
- public void endVisit(CharLiteral charLiteral, BlockScope scope) {
- // do nothing by default
- }
- public void endVisit(ClassLiteralAccess classLiteral, BlockScope scope) {
- // do nothing by default
- }
+
public void endVisit(Clinit clinit, ClassScope scope) {
// do nothing by default
}
@@ -135,7 +196,7 @@ public abstract class ASTVisitor {
ClassScope scope) {
// do nothing by default
}
- public void endVisit(Continue continueStatement, BlockScope scope) {
+ public void endVisit(ContinueStatement continueStatement, BlockScope scope) {
// do nothing by default
}
public void endVisit(DoStatement doStatement, BlockScope scope) {
@@ -279,11 +340,7 @@ public abstract class ASTVisitor {
public void endVisit(SwitchStatement switchStatement, BlockScope scope) {
// do nothing by default
}
- public void endVisit(
- SynchronizedStatement synchronizedStatement,
- BlockScope scope) {
- // do nothing by default
- }
+
public void endVisit(ThisReference thisReference, BlockScope scope) {
// do nothing by default
}
@@ -395,21 +452,16 @@ public abstract class ASTVisitor {
public boolean visit(Block block, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(Break breakStatement, BlockScope scope) {
+ public boolean visit(BreakStatement breakStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(Case caseStatement, BlockScope scope) {
+ public boolean visit(CaseStatement caseStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
public boolean visit(CastExpression castExpression, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(CharLiteral charLiteral, BlockScope scope) {
- return true; // do nothing by default, keep traversing
- }
- public boolean visit(ClassLiteralAccess classLiteral, BlockScope scope) {
- return true; // do nothing by default, keep traversing
- }
+
public boolean visit(Clinit clinit, ClassScope scope) {
return true; // do nothing by default, keep traversing
}
@@ -431,7 +483,7 @@ public abstract class ASTVisitor {
ClassScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(Continue continueStatement, BlockScope scope) {
+ public boolean visit(ContinueStatement continueStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
public boolean visit(DoStatement doStatement, BlockScope scope) {
@@ -577,11 +629,7 @@ public abstract class ASTVisitor {
public boolean visit(SwitchStatement switchStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- SynchronizedStatement synchronizedStatement,
- BlockScope scope) {
- return true; // do nothing by default, keep traversing
- }
+
public boolean visit(ThisReference thisReference, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/AbstractSyntaxTreeVisitorAdapter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/AbstractSyntaxTreeVisitorAdapter.java
index 3185e97..a0bcea4 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/AbstractSyntaxTreeVisitorAdapter.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/AbstractSyntaxTreeVisitorAdapter.java
@@ -28,17 +28,15 @@ import net.sourceforge.phpeclipse.internal.compiler.ast.AssertStatement;
import net.sourceforge.phpeclipse.internal.compiler.ast.Assignment;
import net.sourceforge.phpeclipse.internal.compiler.ast.BinaryExpression;
import net.sourceforge.phpeclipse.internal.compiler.ast.Block;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Break;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Case;
+import net.sourceforge.phpeclipse.internal.compiler.ast.BreakStatement;
+import net.sourceforge.phpeclipse.internal.compiler.ast.CaseStatement;
import net.sourceforge.phpeclipse.internal.compiler.ast.CastExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CharLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ClassLiteralAccess;
import net.sourceforge.phpeclipse.internal.compiler.ast.Clinit;
import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
import net.sourceforge.phpeclipse.internal.compiler.ast.CompoundAssignment;
import net.sourceforge.phpeclipse.internal.compiler.ast.ConditionalExpression;
import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Continue;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ContinueStatement;
import net.sourceforge.phpeclipse.internal.compiler.ast.DefaultCase;
import net.sourceforge.phpeclipse.internal.compiler.ast.DoStatement;
import net.sourceforge.phpeclipse.internal.compiler.ast.DoubleLiteral;
@@ -78,7 +76,6 @@ import net.sourceforge.phpeclipse.internal.compiler.ast.SingleTypeReference;
import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteral;
import net.sourceforge.phpeclipse.internal.compiler.ast.SuperReference;
import net.sourceforge.phpeclipse.internal.compiler.ast.SwitchStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SynchronizedStatement;
import net.sourceforge.phpeclipse.internal.compiler.ast.ThisReference;
import net.sourceforge.phpeclipse.internal.compiler.ast.ThrowStatement;
import net.sourceforge.phpeclipse.internal.compiler.ast.TrueLiteral;
@@ -135,16 +132,12 @@ public class AbstractSyntaxTreeVisitorAdapter implements IAbstractSyntaxTreeVisi
}
public void endVisit(Block block, BlockScope scope) {
}
- public void endVisit(Break breakStatement, BlockScope scope) {
+ public void endVisit(BreakStatement breakStatement, BlockScope scope) {
}
- public void endVisit(Case caseStatement, BlockScope scope) {
+ public void endVisit(CaseStatement caseStatement, BlockScope scope) {
}
public void endVisit(CastExpression castExpression, BlockScope scope) {
}
- public void endVisit(CharLiteral charLiteral, BlockScope scope) {
- }
- public void endVisit(ClassLiteralAccess classLiteral, BlockScope scope) {
- }
public void endVisit(Clinit clinit, ClassScope scope) {
}
public void endVisit(
@@ -161,7 +154,7 @@ public class AbstractSyntaxTreeVisitorAdapter implements IAbstractSyntaxTreeVisi
ConstructorDeclaration constructorDeclaration,
ClassScope scope) {
}
- public void endVisit(Continue continueStatement, BlockScope scope) {
+ public void endVisit(ContinueStatement continueStatement, BlockScope scope) {
}
public void endVisit(DefaultCase defaultCaseStatement, BlockScope scope) {
}
@@ -269,10 +262,7 @@ public class AbstractSyntaxTreeVisitorAdapter implements IAbstractSyntaxTreeVisi
}
public void endVisit(SwitchStatement switchStatement, BlockScope scope) {
}
- public void endVisit(
- SynchronizedStatement synchronizedStatement,
- BlockScope scope) {
- }
+
public void endVisit(ThisReference thisReference, BlockScope scope) {
}
public void endVisit(ThrowStatement throwStatement, BlockScope scope) {
@@ -344,21 +334,16 @@ public class AbstractSyntaxTreeVisitorAdapter implements IAbstractSyntaxTreeVisi
public boolean visit(Block block, BlockScope scope) {
return true;
}
- public boolean visit(Break breakStatement, BlockScope scope) {
+ public boolean visit(BreakStatement breakStatement, BlockScope scope) {
return true;
}
- public boolean visit(Case caseStatement, BlockScope scope) {
+ public boolean visit(CaseStatement caseStatement, BlockScope scope) {
return true;
}
public boolean visit(CastExpression castExpression, BlockScope scope) {
return true;
}
- public boolean visit(CharLiteral charLiteral, BlockScope scope) {
- return true;
- }
- public boolean visit(ClassLiteralAccess classLiteral, BlockScope scope) {
- return true;
- }
+
public boolean visit(Clinit clinit, ClassScope scope) {
return true;
}
@@ -380,7 +365,7 @@ public class AbstractSyntaxTreeVisitorAdapter implements IAbstractSyntaxTreeVisi
ClassScope scope) {
return true;
}
- public boolean visit(Continue continueStatement, BlockScope scope) {
+ public boolean visit(ContinueStatement continueStatement, BlockScope scope) {
return true;
}
public boolean visit(DefaultCase defaultCaseStatement, BlockScope scope) {
@@ -529,11 +514,7 @@ public class AbstractSyntaxTreeVisitorAdapter implements IAbstractSyntaxTreeVisi
public boolean visit(SwitchStatement switchStatement, BlockScope scope) {
return true;
}
- public boolean visit(
- SynchronizedStatement synchronizedStatement,
- BlockScope scope) {
- return true;
- }
+
public boolean visit(ThisReference thisReference, BlockScope scope) {
return true;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/Compiler.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/Compiler.java
index 8504d33..14bded4 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/Compiler.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/Compiler.java
@@ -615,4 +615,4 @@ public class Compiler implements ITypeRequestor, ProblemSeverities {
}
}
-}
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DocumentElementParser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DocumentElementParser.java
index b2f8ef1..509ac89 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DocumentElementParser.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DocumentElementParser.java
@@ -1027,7 +1027,7 @@ public class DocumentElementParser extends UnitParser {
try {
initialize();
goForCompilationUnit();
- referenceContext = compilationUnit = compilationUnit = new CompilationUnitDeclaration(problemReporter(),
+ referenceContext = compilationUnit = new CompilationUnitDeclaration(problemReporter(),
new CompilationResult(unit, 0, 0, 10), //this.options.maxProblemsPerUnit),
regionSource.length);
scanner.resetTo(0, regionSource.length);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IAbstractSyntaxTreeVisitor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IAbstractSyntaxTreeVisitor.java
index f08807b..6d921c2 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IAbstractSyntaxTreeVisitor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IAbstractSyntaxTreeVisitor.java
@@ -28,17 +28,15 @@ import net.sourceforge.phpeclipse.internal.compiler.ast.AssertStatement;
import net.sourceforge.phpeclipse.internal.compiler.ast.Assignment;
import net.sourceforge.phpeclipse.internal.compiler.ast.BinaryExpression;
import net.sourceforge.phpeclipse.internal.compiler.ast.Block;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Break;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Case;
+import net.sourceforge.phpeclipse.internal.compiler.ast.BreakStatement;
+import net.sourceforge.phpeclipse.internal.compiler.ast.CaseStatement;
import net.sourceforge.phpeclipse.internal.compiler.ast.CastExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CharLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ClassLiteralAccess;
import net.sourceforge.phpeclipse.internal.compiler.ast.Clinit;
import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
import net.sourceforge.phpeclipse.internal.compiler.ast.CompoundAssignment;
import net.sourceforge.phpeclipse.internal.compiler.ast.ConditionalExpression;
import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Continue;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ContinueStatement;
import net.sourceforge.phpeclipse.internal.compiler.ast.DefaultCase;
import net.sourceforge.phpeclipse.internal.compiler.ast.DoStatement;
import net.sourceforge.phpeclipse.internal.compiler.ast.DoubleLiteral;
@@ -78,7 +76,6 @@ import net.sourceforge.phpeclipse.internal.compiler.ast.SingleTypeReference;
import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteral;
import net.sourceforge.phpeclipse.internal.compiler.ast.SuperReference;
import net.sourceforge.phpeclipse.internal.compiler.ast.SwitchStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SynchronizedStatement;
import net.sourceforge.phpeclipse.internal.compiler.ast.ThisReference;
import net.sourceforge.phpeclipse.internal.compiler.ast.ThrowStatement;
import net.sourceforge.phpeclipse.internal.compiler.ast.TrueLiteral;
@@ -107,17 +104,17 @@ public interface IAbstractSyntaxTreeVisitor {
void endVisit(Assignment assignment, BlockScope scope);
void endVisit(BinaryExpression binaryExpression, BlockScope scope);
void endVisit(Block block, BlockScope scope);
- void endVisit(Break breakStatement, BlockScope scope);
- void endVisit(Case caseStatement, BlockScope scope);
+ void endVisit(BreakStatement breakStatement, BlockScope scope);
+ void endVisit(CaseStatement caseStatement, BlockScope scope);
void endVisit(CastExpression castExpression, BlockScope scope);
- void endVisit(CharLiteral charLiteral, BlockScope scope);
- void endVisit(ClassLiteralAccess classLiteral, BlockScope scope);
+// void endVisit(CharLiteral charLiteral, BlockScope scope);
+// void endVisit(ClassLiteralAccess classLiteral, BlockScope scope);
void endVisit(Clinit clinit, ClassScope scope);
void endVisit(CompilationUnitDeclaration compilationUnitDeclaration, CompilationUnitScope scope);
void endVisit(CompoundAssignment compoundAssignment, BlockScope scope);
void endVisit(ConditionalExpression conditionalExpression, BlockScope scope);
void endVisit(ConstructorDeclaration constructorDeclaration, ClassScope scope);
- void endVisit(Continue continueStatement, BlockScope scope);
+ void endVisit(ContinueStatement continueStatement, BlockScope scope);
void endVisit(DefaultCase defaultCaseStatement, BlockScope scope);
void endVisit(DoStatement doStatement, BlockScope scope);
void endVisit(DoubleLiteral doubleLiteral, BlockScope scope);
@@ -159,7 +156,7 @@ public interface IAbstractSyntaxTreeVisitor {
void endVisit(StringLiteral stringLiteral, BlockScope scope);
void endVisit(SuperReference superReference, BlockScope scope);
void endVisit(SwitchStatement switchStatement, BlockScope scope);
- void endVisit(SynchronizedStatement synchronizedStatement, BlockScope scope);
+// void endVisit(SynchronizedStatement synchronizedStatement, BlockScope scope);
void endVisit(ThisReference thisReference, BlockScope scope);
void endVisit(ThrowStatement throwStatement, BlockScope scope);
void endVisit(TrueLiteral trueLiteral, BlockScope scope);
@@ -182,17 +179,17 @@ public interface IAbstractSyntaxTreeVisitor {
boolean visit(Assignment assignment, BlockScope scope);
boolean visit(BinaryExpression binaryExpression, BlockScope scope);
boolean visit(Block block, BlockScope scope);
- boolean visit(Break breakStatement, BlockScope scope);
- boolean visit(Case caseStatement, BlockScope scope);
+ boolean visit(BreakStatement breakStatement, BlockScope scope);
+ boolean visit(CaseStatement caseStatement, BlockScope scope);
boolean visit(CastExpression castExpression, BlockScope scope);
- boolean visit(CharLiteral charLiteral, BlockScope scope);
- boolean visit(ClassLiteralAccess classLiteral, BlockScope scope);
+// boolean visit(CharLiteral charLiteral, BlockScope scope);
+// boolean visit(ClassLiteralAccess classLiteral, BlockScope scope);
boolean visit(Clinit clinit, ClassScope scope);
boolean visit(CompilationUnitDeclaration compilationUnitDeclaration, CompilationUnitScope scope);
boolean visit(CompoundAssignment compoundAssignment, BlockScope scope);
boolean visit(ConditionalExpression conditionalExpression, BlockScope scope);
boolean visit(ConstructorDeclaration constructorDeclaration, ClassScope scope);
- boolean visit(Continue continueStatement, BlockScope scope);
+ boolean visit(ContinueStatement continueStatement, BlockScope scope);
boolean visit(DefaultCase defaultCaseStatement, BlockScope scope);
boolean visit(DoStatement doStatement, BlockScope scope);
boolean visit(DoubleLiteral doubleLiteral, BlockScope scope);
@@ -234,7 +231,7 @@ public interface IAbstractSyntaxTreeVisitor {
boolean visit(StringLiteral stringLiteral, BlockScope scope);
boolean visit(SuperReference superReference, BlockScope scope);
boolean visit(SwitchStatement switchStatement, BlockScope scope);
- boolean visit(SynchronizedStatement synchronizedStatement, BlockScope scope);
+// boolean visit(SynchronizedStatement synchronizedStatement, BlockScope scope);
boolean visit(ThisReference thisReference, BlockScope scope);
boolean visit(ThrowStatement throwStatement, BlockScope scope);
boolean visit(TrueLiteral trueLiteral, BlockScope scope);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ISourceElementRequestor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ISourceElementRequestor.java
index 58c2541..ddf5ff8 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ISourceElementRequestor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ISourceElementRequestor.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler;
+import java.util.HashMap;
+
import net.sourceforge.phpdt.core.compiler.IProblem;
/*
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/SourceElementParser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/SourceElementParser.java
index 7dc0c65..fc27be9 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/SourceElementParser.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/SourceElementParser.java
@@ -32,7 +32,6 @@ import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
import net.sourceforge.phpeclipse.internal.compiler.ast.ExplicitConstructorCall;
import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.LocalTypeDeclaration;
import net.sourceforge.phpeclipse.internal.compiler.ast.MemberTypeDeclaration;
import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration;
import net.sourceforge.phpeclipse.internal.compiler.ast.NameReference;
@@ -40,8 +39,6 @@ import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedAllocationExpre
import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
import net.sourceforge.phpeclipse.internal.compiler.ast.TypeReference;
-import org.eclipse.core.resources.IResource;
-
/**
* A source element parser extracts structural and reference information
* from a piece of source.
@@ -82,26 +79,16 @@ public class SourceElementParser extends CommentRecorderParser {//extends
/**
* An ast visitor that visits local type declarations.
*/
- public class LocalDeclarationVisitor extends AbstractSyntaxTreeVisitorAdapter {
- // public boolean visit(
- // AnonymousLocalTypeDeclaration anonymousTypeDeclaration,
- // BlockScope scope) {
- // notifySourceElementRequestor(anonymousTypeDeclaration, sourceType ==
- // null);
- // return false; // don't visit members as this was done during
- // notifySourceElementRequestor(...)
- // }
- public boolean visit(LocalTypeDeclaration typeDeclaration, BlockScope scope) {
- notifySourceElementRequestor(typeDeclaration, sourceType == null);
- return false; // don't visit members as this was done during
- // notifySourceElementRequestor(...)
- }
- public boolean visit(MemberTypeDeclaration typeDeclaration, ClassScope scope) {
- notifySourceElementRequestor(typeDeclaration, sourceType == null);
- return false; // don't visit members as this was done during
- // notifySourceElementRequestor(...)
- }
-
+ public class LocalDeclarationVisitor extends ASTVisitor {
+ public boolean visit(TypeDeclaration typeDeclaration, BlockScope scope) {
+ notifySourceElementRequestor(typeDeclaration, sourceType == null);
+ return false; // don't visit members as this was done during notifySourceElementRequestor(...)
+ }
+ public boolean visit(TypeDeclaration typeDeclaration, ClassScope scope) {
+ notifySourceElementRequestor(typeDeclaration, sourceType == null);
+ return false; // don't visit members as this was done during notifySourceElementRequestor(...)
+ }
+
}
public SourceElementParser(final ISourceElementRequestor requestor, IProblemFactory problemFactory, CompilerOptions options) {
@@ -128,21 +115,21 @@ public class SourceElementParser extends CommentRecorderParser {//extends
* @deprecated use SourceElementParser(ISourceElementRequestor,
* IProblemFactory, CompilerOptions)
*/
- //public SourceElementParser(
- // final ISourceElementRequestor requestor,
- // IProblemFactory problemFactory) {
- // this(requestor, problemFactory, new CompilerOptions());
- //}
- //public SourceElementParser(
- // final ISourceElementRequestor requestor,
- // IProblemFactory problemFactory,
- // CompilerOptions options,
- // boolean reportLocalDeclarations) {
- // this(requestor, problemFactory, options);
- // if (reportLocalDeclarations) {
- // this.localDeclarationVisitor = new LocalDeclarationVisitor();
- // }
- //}
+ public SourceElementParser(
+ final ISourceElementRequestor requestor,
+ IProblemFactory problemFactory) {
+ this(requestor, problemFactory, new CompilerOptions());
+ }
+ public SourceElementParser(
+ final ISourceElementRequestor requestor,
+ IProblemFactory problemFactory,
+ CompilerOptions options,
+ boolean reportLocalDeclarations) {
+ this(requestor, problemFactory, options);
+ if (reportLocalDeclarations) {
+ this.localDeclarationVisitor = new LocalDeclarationVisitor();
+ }
+ }
//public void checkAnnotation() {
// int firstCommentIndex = scanner.commentPtr;
//
@@ -923,7 +910,7 @@ public class SourceElementParser extends CommentRecorderParser {//extends
FieldDeclaration[] fields = typeDeclaration.fields;
AbstractMethodDeclaration[] methods = typeDeclaration.methods;
- MemberTypeDeclaration[] memberTypes = typeDeclaration.memberTypes;
+ TypeDeclaration[] memberTypes = typeDeclaration.memberTypes;
int fieldCount = fields == null ? 0 : fields.length;
int methodCount = methods == null ? 0 : methods.length;
int memberTypeCount = memberTypes == null ? 0 : memberTypes.length;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/ClasspathDirectory.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/ClasspathDirectory.java
new file mode 100644
index 0000000..29069bc
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/ClasspathDirectory.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * 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.internal.compiler.batch;
+
+import java.io.File;
+import java.util.Hashtable;
+
+import net.sourceforge.phpdt.internal.compiler.env.NameEnvironmentAnswer;
+import net.sourceforge.phpdt.internal.compiler.util.SuffixConstants;
+
+public class ClasspathDirectory implements FileSystem.Classpath, SuffixConstants {
+
+String path;
+Hashtable directoryCache;
+String[] missingPackageHolder = new String[1];
+String encoding;
+public int mode; // ability to only consider one kind of files (source vs. binaries), by default use both
+
+public static final int SOURCE = 1;
+public static final int BINARY = 2;
+
+ClasspathDirectory(File directory, String encoding, int mode) {
+ this.mode = mode;
+ this.path = directory.getAbsolutePath();
+ if (!this.path.endsWith(File.separator))
+ this.path += File.separator;
+ this.directoryCache = new Hashtable(11);
+ this.encoding = encoding;
+}
+
+ClasspathDirectory(File directory, String encoding) {
+ this(directory, encoding, SOURCE | BINARY); // by default consider both sources and binaries
+}
+
+String[] directoryList(String qualifiedPackageName) {
+ String[] dirList = (String[]) this.directoryCache.get(qualifiedPackageName);
+ if (dirList == this.missingPackageHolder) return null; // package exists in another classpath directory or jar
+ if (dirList != null) return dirList;
+
+ File dir = new File(this.path + qualifiedPackageName);
+ notFound : if (dir != null && dir.isDirectory()) {
+ // must protect against a case insensitive File call
+ // walk the qualifiedPackageName backwards looking for an uppercase character before the '/'
+ int index = qualifiedPackageName.length();
+ int last = qualifiedPackageName.lastIndexOf(File.separatorChar);
+ while (--index > last && !Character.isUpperCase(qualifiedPackageName.charAt(index))){/*empty*/}
+ if (index > last) {
+ if (last == -1) {
+ if (!doesFileExist(qualifiedPackageName, "")) //$NON-NLS-1$
+ break notFound;
+ } else {
+ String packageName = qualifiedPackageName.substring(last + 1);
+ String parentPackage = qualifiedPackageName.substring(0, last);
+ if (!doesFileExist(packageName, parentPackage))
+ break notFound;
+ }
+ }
+ if ((dirList = dir.list()) == null)
+ dirList = new String[0];
+ this.directoryCache.put(qualifiedPackageName, dirList);
+ return dirList;
+ }
+ this.directoryCache.put(qualifiedPackageName, this.missingPackageHolder);
+ return null;
+}
+boolean doesFileExist(String fileName, String qualifiedPackageName) {
+ String[] dirList = directoryList(qualifiedPackageName);
+ if (dirList == null) return false; // most common case
+
+ for (int i = dirList.length; --i >= 0;)
+ if (fileName.equals(dirList[i]))
+ return true;
+ return false;
+}
+public NameEnvironmentAnswer findClass(char[] typeName, String qualifiedPackageName, String qualifiedBinaryFileName) {
+ if (!isPackage(qualifiedPackageName)) return null; // most common case
+
+ String fileName = new String(typeName);
+// boolean binaryExists = ((this.mode & BINARY) != 0) && doesFileExist(fileName + SUFFIX_STRING_class, qualifiedPackageName);
+ boolean sourceExists = ((this.mode & SOURCE) != 0) && doesFileExist(fileName + SUFFIX_STRING_php, qualifiedPackageName);
+ if (sourceExists) {
+ String fullSourcePath = this.path + qualifiedBinaryFileName.substring(0, qualifiedBinaryFileName.length() - 6) + SUFFIX_STRING_php;
+// if (!binaryExists)
+ return new NameEnvironmentAnswer(new CompilationUnit(null, fullSourcePath, this.encoding));
+
+// String fullBinaryPath = this.path + qualifiedBinaryFileName;
+// long binaryModified = new File(fullBinaryPath).lastModified();
+// long sourceModified = new File(fullSourcePath).lastModified();
+// if (sourceModified > binaryModified)
+// return new NameEnvironmentAnswer(new CompilationUnit(null, fullSourcePath, this.encoding));
+ }
+// if (binaryExists) {
+// try {
+// ClassFileReader reader = ClassFileReader.read(this.path + qualifiedBinaryFileName);
+// if (reader != null) return new NameEnvironmentAnswer(reader);
+// } catch (Exception e) {
+// // treat as if file is missing
+// }
+// }
+ return null;
+}
+public boolean isPackage(String qualifiedPackageName) {
+ return directoryList(qualifiedPackageName) != null;
+}
+public void reset() {
+ this.directoryCache = new Hashtable(11);
+}
+public String toString() {
+ return "ClasspathDirectory " + this.path; //$NON-NLS-1$
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/CompilationUnit.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/CompilationUnit.java
new file mode 100644
index 0000000..c944911
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/CompilationUnit.java
@@ -0,0 +1,86 @@
+/***********************************************************************************************************************************
+ * 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.internal.compiler.batch;
+
+import java.io.File;
+import java.io.IOException;
+
+import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit;
+import net.sourceforge.phpdt.internal.compiler.util.Util;
+
+import org.eclipse.core.resources.IResource;
+
+public class CompilationUnit implements ICompilationUnit {
+ public char[] contents;
+
+ public char[] fileName;
+
+ public char[] mainTypeName;
+
+ String encoding;
+
+ public CompilationUnit(char[] contents, String fileName, String encoding) {
+ this.contents = contents;
+ if (File.separator.equals("/")) { //$NON-NLS-1$
+ if (fileName.indexOf("\\") != -1) { //$NON-NLS-1$
+ fileName = fileName.replace('\\', File.separatorChar);
+ }
+ } else {
+ // the file separator is \
+ if (fileName.indexOf('/') != -1) {
+ fileName = fileName.replace('/', File.separatorChar);
+ }
+ }
+ this.fileName = fileName.toCharArray();
+
+ int start = fileName.lastIndexOf("/") + 1; //$NON-NLS-1$
+ if (start == 0 || start < fileName.lastIndexOf("\\")) //$NON-NLS-1$
+ start = fileName.lastIndexOf("\\") + 1; //$NON-NLS-1$
+
+ int end = fileName.lastIndexOf("."); //$NON-NLS-1$
+ if (end == -1)
+ end = fileName.length();
+
+ this.mainTypeName = fileName.substring(start, end).toCharArray();
+ this.encoding = encoding;
+ }
+
+ public char[] getContents() {
+ if (this.contents != null)
+ return this.contents; // answer the cached source
+
+ // otherwise retrieve it
+ try {
+ return Util.getFileCharContent(new File(new String(this.fileName)), this.encoding);
+ } catch (IOException e) {
+ // assume no content then
+ }
+ return CharOperation.NO_CHAR;
+ }
+
+ public char[] getFileName() {
+ return this.fileName;
+ }
+
+ public char[] getMainTypeName() {
+ return this.mainTypeName;
+ }
+
+ public char[][] getPackageName() {
+ return null;
+ }
+
+ public String toString() {
+ return "CompilationUnit[" + new String(this.fileName) + "]"; //$NON-NLS-2$ //$NON-NLS-1$
+ }
+
+ public IResource getResource() {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/FileFinder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/FileFinder.java
new file mode 100644
index 0000000..61cdefe
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/FileFinder.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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.internal.compiler.batch;
+
+import java.io.File;
+
+public class FileFinder {
+ private static final int INITIAL_SIZE = 10;
+ public String[] resultFiles = new String[INITIAL_SIZE];
+ public int count = 0;
+public void find(File f, String pattern, boolean verbose) {
+ if (verbose) {
+// System.out.println(Main.bind("scanning.start",f.getAbsolutePath())); //$NON-NLS-1$
+ }
+ find0(f, pattern, verbose);
+ System.arraycopy(this.resultFiles, 0, (this.resultFiles = new String[this.count]), 0, this.count);
+}
+public void find0(File f, String pattern, boolean verbose) {
+ if (f.isDirectory()) {
+ String[] files = f.list();
+ if (files == null) return;
+ for (int i = 0, max = files.length; i < max; i++) {
+ File current = new File(f, files[i]);
+ if (current.isDirectory()) {
+ find0(current, pattern, verbose);
+ } else {
+ if (current.getName().toUpperCase().endsWith(pattern)) {
+ int length;
+ if ((length = this.resultFiles.length) == this.count) {
+ System.arraycopy(this.resultFiles, 0, (this.resultFiles = new String[length * 2]), 0, length);
+ }
+ this.resultFiles[this.count++] = current.getAbsolutePath();
+ if (verbose && (this.count % 100) == 0)
+ System.out.print('.');
+ }
+ }
+ }
+ }
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/FileSystem.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/FileSystem.java
new file mode 100644
index 0000000..30ec35a
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/FileSystem.java
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * 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.internal.compiler.batch;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.zip.ZipFile;
+
+import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.env.INameEnvironment;
+import net.sourceforge.phpdt.internal.compiler.env.NameEnvironmentAnswer;
+import net.sourceforge.phpdt.internal.compiler.util.SuffixConstants;
+
+public class FileSystem implements INameEnvironment, SuffixConstants {
+ Classpath[] classpaths;
+ String[] knownFileNames;
+
+ interface Classpath {
+ NameEnvironmentAnswer findClass(char[] typeName, String qualifiedPackageName, String qualifiedBinaryFileName);
+ boolean isPackage(String qualifiedPackageName);
+ /**
+ * This method resets the environment. The resulting state is equivalent to
+ * a new name environment without creating a new object.
+ */
+ void reset();
+ }
+/*
+ classPathNames is a collection is Strings representing the full path of each class path
+ initialFileNames is a collection is Strings, the trailing '.java' will be removed if its not already.
+*/
+
+public FileSystem(String[] classpathNames, String[] initialFileNames, String encoding) {
+ this(classpathNames, initialFileNames, encoding, null);
+}
+public FileSystem(String[] classpathNames, String[] initialFileNames, String encoding, int[] classpathDirectoryModes) {
+ int classpathSize = classpathNames.length;
+ this.classpaths = new Classpath[classpathSize];
+ String[] pathNames = new String[classpathSize];
+ int problemsOccured = 0;
+ for (int i = 0; i < classpathSize; i++) {
+// try {
+ File file = new File(convertPathSeparators(classpathNames[i]));
+ if (file.isDirectory()) {
+ if (file.exists()) {
+ if (classpathDirectoryModes == null){
+ this.classpaths[i] = new ClasspathDirectory(file, encoding);
+ } else {
+ this.classpaths[i] = new ClasspathDirectory(file, encoding, classpathDirectoryModes[i]);
+ }
+ pathNames[i] = ((ClasspathDirectory) this.classpaths[i]).path;
+ }
+ } else {
+ String lowercaseClasspathName = classpathNames[i].toLowerCase();
+// if (lowercaseClasspathName.endsWith(SUFFIX_STRING_jar)
+// || lowercaseClasspathName.endsWith(SUFFIX_STRING_zip)) {
+// this.classpaths[i] = this.getClasspathJar(file); // will throw an IOException if file does not exist
+// pathNames[i] = classpathNames[i].substring(0, classpathNames[i].lastIndexOf('.'));
+// }
+ }
+// } catch (IOException e) {
+// this.classpaths[i] = null;
+// }
+ if (this.classpaths[i] == null)
+ problemsOccured++;
+ }
+ if (problemsOccured > 0) {
+ Classpath[] newPaths = new Classpath[classpathSize - problemsOccured];
+ String[] newNames = new String[classpathSize - problemsOccured];
+ for (int i = 0, current = 0; i < classpathSize; i++)
+ if (this.classpaths[i] != null) {
+ newPaths[current] = this.classpaths[i];
+ newNames[current++] = pathNames[i];
+ }
+ classpathSize = newPaths.length;
+ this.classpaths = newPaths;
+ pathNames = newNames;
+ }
+
+ this.knownFileNames = new String[initialFileNames.length];
+ for (int i = initialFileNames.length; --i >= 0;) {
+ String fileName = initialFileNames[i];
+ String matchingPathName = null;
+ if (fileName.lastIndexOf(".") != -1) //$NON-NLS-1$
+ fileName = fileName.substring(0, fileName.lastIndexOf('.')); // remove trailing ".java"
+
+ fileName = convertPathSeparators(fileName);
+ for (int j = 0; j < classpathSize; j++)
+ if (fileName.startsWith(pathNames[j]))
+ matchingPathName = pathNames[j];
+ if (matchingPathName == null)
+ this.knownFileNames[i] = fileName; // leave as is...
+ else
+ this.knownFileNames[i] = fileName.substring(matchingPathName.length());
+ }
+}
+public void cleanup() {
+ for (int i = 0, max = this.classpaths.length; i < max; i++)
+ this.classpaths[i].reset();
+}
+private String convertPathSeparators(String path) {
+ return File.separatorChar == '/'
+ ? path.replace('\\', '/')
+ : path.replace('/', '\\');
+}
+//private NameEnvironmentAnswer findClass(String qualifiedTypeName, char[] typeName){
+// for (int i = 0, length = this.knownFileNames.length; i < length; i++)
+// if (qualifiedTypeName.equals(this.knownFileNames[i]))
+// return null; // looking for a file which we know was provided at the beginning of the compilation
+//
+// String qualifiedBinaryFileName = qualifiedTypeName + SUFFIX_STRING_class;
+// String qualifiedPackageName =
+// qualifiedTypeName.length() == typeName.length
+// ? "" //$NON-NLS-1$
+// : qualifiedBinaryFileName.substring(0, qualifiedTypeName.length() - typeName.length - 1);
+// String qp2 = File.separatorChar == '/' ? qualifiedPackageName : qualifiedPackageName.replace('/', File.separatorChar);
+// if (qualifiedPackageName == qp2) {
+// for (int i = 0, length = this.classpaths.length; i < length; i++) {
+// NameEnvironmentAnswer answer = this.classpaths[i].findClass(typeName, qualifiedPackageName, qualifiedBinaryFileName);
+// if (answer != null) return answer;
+// }
+// } else {
+// String qb2 = qualifiedBinaryFileName.replace('/', File.separatorChar);
+// for (int i = 0, length = this.classpaths.length; i < length; i++) {
+// Classpath p = this.classpaths[i];
+// NameEnvironmentAnswer answer = (p instanceof ClasspathJar)
+// ? p.findClass(typeName, qualifiedPackageName, qualifiedBinaryFileName)
+// : p.findClass(typeName, qp2, qb2);
+// if (answer != null) return answer;
+// }
+// }
+// return null;
+//}
+public NameEnvironmentAnswer findType(char[][] compoundName) {
+// if (compoundName != null)
+// return findClass(
+// new String(CharOperation.concatWith(compoundName, '/')),
+// compoundName[compoundName.length - 1]);
+ return null;
+}
+public NameEnvironmentAnswer findType(char[] typeName, char[][] packageName) {
+// if (typeName != null)
+// return findClass(
+// new String(CharOperation.concatWith(packageName, typeName, '/')),
+// typeName);
+ return null;
+}
+//public ClasspathJar getClasspathJar(File file) throws IOException {
+// return new ClasspathJar(new ZipFile(file), true);
+//}
+public boolean isPackage(char[][] compoundName, char[] packageName) {
+ String qualifiedPackageName = new String(CharOperation.concatWith(compoundName, packageName, '/'));
+ String qp2 = File.separatorChar == '/' ? qualifiedPackageName : qualifiedPackageName.replace('/', File.separatorChar);
+ if (qualifiedPackageName == qp2) {
+ for (int i = 0, length = this.classpaths.length; i < length; i++)
+ if (this.classpaths[i].isPackage(qualifiedPackageName))
+ return true;
+ }
+// else {
+// for (int i = 0, length = this.classpaths.length; i < length; i++) {
+// Classpath p = this.classpaths[i];
+// if ((p instanceof ClasspathJar) ? p.isPackage(qualifiedPackageName) : p.isPackage(qp2))
+// return true;
+// }
+// }
+ return false;
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/messages.properties b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/messages.properties
new file mode 100644
index 0000000..cc69182
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/messages.properties
@@ -0,0 +1,167 @@
+###############################################################################
+# 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
+###############################################################################
+### JavaBatchCompiler messages.
+
+### compiler
+compiler.name = Eclipse Java Compiler
+compiler.version = 0.452_R30x
+compiler.copyright = Copyright IBM Corp 2000, 2004. All rights reserved.
+
+### scanning
+scanning.start = Collecting source files inside {0}
+
+### progress
+progress.compiling = Compiling
+
+### compile
+compile.repetition = [repetition {0}/{1}]
+compile.instantTime = [compiled {0} lines in {1} ms: {2} lines/s]
+compile.totalTime = [total compilation time: {0}]
+compile.oneProblem = 1 problem
+compile.severalProblems = {0} problems
+compile.oneError = 1 error
+compile.severalErrors = {0} errors
+compile.oneWarning = 1 warning
+compile.severalWarnings = {0} warnings
+compile.oneClassFileGenerated = [1 .class file generated]
+compile.severalClassFilesGenerated = [{0} .class files generated]
+
+### configure
+configure.requiresJDK1.2orAbove = Need to use a JVM >= 1.2
+configure.duplicateLog = duplicate log specification: {0}
+configure.duplicateRepeat = duplicate repeat specification: {0}
+configure.duplicateMaxProblems = duplicate max problems specification: {0}
+configure.duplicateCompliance = duplicate compliance setting specification: {0}
+configure.source = invalid source option, source is either ''1.3'' or ''1.4'': {0}
+configure.duplicateOutputPath = duplicate output path specification: {0}
+configure.duplicateBootClasspath = duplicate bootclasspath specification: {0}
+configure.invalidDebugOption = invalid debug option: {0}
+configure.invalidWarningConfiguration = invalid warning configuration: {0}
+configure.invalidWarning = invalid warning: {0}
+configure.invalidWarningOption = invalid warning option: {0}
+configure.targetJDK = target JDK should be comprised in between ''1.1'' and ''1.4'': {0}
+configure.incompatibleTargetForSource14 = ''1.4'' source mode requires ''-target 1.4'' : {0}
+configure.incompatibleComplianceForSource14 = ''1.4'' source mode requires ''-1.4'' compliance mode: {0}
+configure.incompatibleComplianceForTarget14 = ''1.4'' target mode requires ''-1.4'' compliance mode: {0}
+configure.incompatibleComplianceForTarget11 = ''1.1'' target mode requires ''-1.3'' compliance mode: {0}
+configure.repetition = repetition must be a positive integer: {0}
+configure.maxProblems = max problems must be a positive integer: {0}
+configure.directoryNotExist = directory does not exist: {0}
+configure.IOError = i/o error : unable to retrieve .JAVA files in directory: {0}
+configure.noClasspath = no classpath defined, using default directory instead
+configure.incorrectClasspath = incorrect classpath: {0}
+configure.invalidexpansionargumentname = expansion argument file {0} doesn't exist or cannot be read
+configure.cannotOpenLog = cannot open .log file
+configure.unexpectedCustomEncoding = unexpected custom encoding specification: {0}[{1}]
+configure.unsupportedEncoding = unsupported encoding format: {0}
+configure.duplicateDefaultEncoding = duplicate default encoding format specification: {0}
+configure.invalidTaskTag ={0} is an invalid task tag
+
+### requestor
+requestor.error = ERROR
+requestor.warning = WARNING
+requestor.in = in {0}
+requestor.notRetrieveErrorMessage = Cannot retrieve the error message for {0}
+
+### unit
+unit.more = File {0} is specified more than once
+unit.missing = File {0} is missing
+
+### output
+output.noClassFileCreated = No .class file created for file named {0} because of an IOException.
+
+### miscellaneous
+misc.version = {compiler.name} {compiler.version}, {compiler.copyright}
+misc.usage = {compiler.name} {compiler.version}, {compiler.copyright}\n\
+\ \n\
+\ Usage:
+ *
+ *
+ * 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, ...).
+ *
+ * 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
+ */
+ public static IJavaModelStatus validateClasspath(IJavaProject javaProject, IClasspathEntry[] rawClasspath, IPath projectOutputLocation) {
+
+ IProject project = javaProject.getProject();
+ IPath projectPath= project.getFullPath();
+ String projectName = javaProject.getElementName();
+
+ /* validate output location */
+ if (projectOutputLocation == null) {
+ return new JavaModelStatus(IJavaModelStatusConstants.NULL_PATH);
+ }
+ if (projectOutputLocation.isAbsolute()) {
+ if (!projectPath.isPrefixOf(projectOutputLocation)) {
+ return new JavaModelStatus(IJavaModelStatusConstants.PATH_OUTSIDE_PROJECT, javaProject, projectOutputLocation.toString());
+ }
+ } else {
+ return new JavaModelStatus(IJavaModelStatusConstants.RELATIVE_PATH, projectOutputLocation);
+ }
+
+ boolean hasSource = false;
+ boolean hasLibFolder = false;
+
+
+ // tolerate null path, it will be reset to default
+ if (rawClasspath == null)
+ return JavaModelStatus.VERIFIED_OK;
+
+ // retrieve resolved classpath
+ IClasspathEntry[] classpath;
+ try {
+ classpath = ((JavaProject)javaProject).getResolvedClasspath(rawClasspath, null /*output*/, true/*ignore pb*/, false/*no marker*/, null /*no reverse map*/);
+ } catch(JavaModelException e){
+ return e.getJavaModelStatus();
+ }
+ int length = classpath.length;
+
+ int outputCount = 1;
+ IPath[] outputLocations = new IPath[length+1];
+ boolean[] allowNestingInOutputLocations = new boolean[length+1];
+ outputLocations[0] = projectOutputLocation;
+
+ // retrieve and check output locations
+ IPath potentialNestedOutput = null; // for error reporting purpose
+ int sourceEntryCount = 0;
+ boolean disableExclusionPatterns = JavaCore.DISABLED.equals(javaProject.getOption(JavaCore.CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, true));
+ boolean disableCustomOutputLocations = JavaCore.DISABLED.equals(javaProject.getOption(JavaCore.CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS, true));
+
+ for (int i = 0 ; i < length; i++) {
+ IClasspathEntry resolvedEntry = classpath[i];
+ switch(resolvedEntry.getEntryKind()){
+ case IClasspathEntry.CPE_SOURCE :
+ sourceEntryCount++;
+
+ if (disableExclusionPatterns &&
+ ((resolvedEntry.getInclusionPatterns() != null && resolvedEntry.getInclusionPatterns().length > 0)
+ || (resolvedEntry.getExclusionPatterns() != null && resolvedEntry.getExclusionPatterns().length > 0))) {
+ return new JavaModelStatus(IJavaModelStatusConstants.DISABLED_CP_EXCLUSION_PATTERNS, javaProject, resolvedEntry.getPath());
+ }
+ IPath customOutput;
+ if ((customOutput = resolvedEntry.getOutputLocation()) != null) {
+
+ if (disableCustomOutputLocations) {
+ return new JavaModelStatus(IJavaModelStatusConstants.DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS, javaProject, resolvedEntry.getPath());
+ }
+ // ensure custom output is in project
+ if (customOutput.isAbsolute()) {
+ if (!javaProject.getPath().isPrefixOf(customOutput)) {
+ return new JavaModelStatus(IJavaModelStatusConstants.PATH_OUTSIDE_PROJECT, javaProject, customOutput.toString());
+ }
+ } else {
+ return new JavaModelStatus(IJavaModelStatusConstants.RELATIVE_PATH, customOutput);
+ }
+
+ // ensure custom output doesn't conflict with other outputs
+ // check exact match
+ if (Util.indexOfMatchingPath(customOutput, outputLocations, outputCount) != -1) {
+ continue; // already found
+ }
+ // accumulate all outputs, will check nesting once all available (to handle ordering issues)
+ outputLocations[outputCount++] = customOutput;
+ }
+ }
+ }
+ // check nesting across output locations
+ for (int i = 1 /*no check for default output*/ ; i < outputCount; i++) {
+ IPath customOutput = outputLocations[i];
+ int index;
+ // check nesting
+ if ((index = Util.indexOfEnclosingPath(customOutput, outputLocations, outputCount)) != -1 && index != i) {
+ if (index == 0) {
+ // custom output is nested in project's output: need to check if all source entries have a custom
+ // output before complaining
+ if (potentialNestedOutput == null) potentialNestedOutput = customOutput;
+ } else {
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.cannotNestOutputInOutput", customOutput.makeRelative().toString(), outputLocations[index].makeRelative().toString())); //$NON-NLS-1$
+ }
+ }
+ }
+ // allow custom output nesting in project's output if all source entries have a custom output
+ if (sourceEntryCount <= outputCount-1) {
+ allowNestingInOutputLocations[0] = true;
+ } else if (potentialNestedOutput != null) {
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.cannotNestOutputInOutput", potentialNestedOutput.makeRelative().toString(), outputLocations[0].makeRelative().toString())); //$NON-NLS-1$
+ }
+
+ for (int i = 0 ; i < length; i++) {
+ IClasspathEntry resolvedEntry = classpath[i];
+ IPath path = resolvedEntry.getPath();
+ int index;
+ switch(resolvedEntry.getEntryKind()){
+
+ case IClasspathEntry.CPE_SOURCE :
+ hasSource = true;
+ if ((index = Util.indexOfMatchingPath(path, outputLocations, outputCount)) != -1){
+ allowNestingInOutputLocations[index] = true;
+ }
+ break;
+
+// case IClasspathEntry.CPE_LIBRARY:
+// hasLibFolder |= !org.eclipse.jdt.internal.compiler.util.Util.isArchiveFileName(path.lastSegment());
+// if ((index = Util.indexOfMatchingPath(path, outputLocations, outputCount)) != -1){
+// allowNestingInOutputLocations[index] = true;
+// }
+// break;
+ }
+ }
+ if (!hasSource && !hasLibFolder) { // if no source and no lib folder, then allowed
+ for (int i = 0; i < outputCount; i++) allowNestingInOutputLocations[i] = true;
+ }
+
+ HashSet pathes = new HashSet(length);
+
+ // check all entries
+ for (int i = 0 ; i < length; i++) {
+ IClasspathEntry entry = classpath[i];
+ if (entry == null) continue;
+ IPath entryPath = entry.getPath();
+ int kind = entry.getEntryKind();
+
+ // Build some common strings for status message
+ boolean isProjectRelative = entryPath.segment(0).toString().equals(projectName);
+ String entryPathMsg = isProjectRelative ? entryPath.removeFirstSegments(1).toString() : entryPath.makeRelative().toString();
+
+ // complain if duplicate path
+ if (!pathes.add(entryPath)){
+ return new JavaModelStatus(IJavaModelStatusConstants.NAME_COLLISION, Util.bind("classpath.duplicateEntryPath", entryPathMsg, projectName)); //$NON-NLS-1$
+ }
+ // no further check if entry coincidates with project or output location
+ if (entryPath.equals(projectPath)){
+ // complain if self-referring project entry
+ if (kind == IClasspathEntry.CPE_PROJECT){
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_PATH, Util.bind("classpath.cannotReferToItself", entryPath.makeRelative().toString()));//$NON-NLS-1$
+ }
+ // tolerate nesting output in src if src==prj
+ continue;
+ }
+
+ // allow nesting source entries in each other as long as the outer entry excludes the inner one
+ if (kind == IClasspathEntry.CPE_SOURCE ) {
+// || (kind == IClasspathEntry.CPE_LIBRARY && !org.eclipse.jdt.internal.compiler.util.Util.isArchiveFileName(entryPath.lastSegment()))){
+ for (int j = 0; j < classpath.length; j++){
+ IClasspathEntry otherEntry = classpath[j];
+ if (otherEntry == null) continue;
+ int otherKind = otherEntry.getEntryKind();
+ IPath otherPath = otherEntry.getPath();
+ if (entry != otherEntry
+ && (otherKind == IClasspathEntry.CPE_SOURCE ) ) {
+// || (otherKind == IClasspathEntry.CPE_LIBRARY
+// && !org.eclipse.jdt.internal.compiler.util.Util.isArchiveFileName(otherPath.lastSegment())))){
+ char[][] inclusionPatterns, exclusionPatterns;
+ if (otherPath.isPrefixOf(entryPath)
+ && !otherPath.equals(entryPath)
+ && !Util.isExcluded(entryPath.append("*"), inclusionPatterns = ((ClasspathEntry)otherEntry).fullInclusionPatternChars(), exclusionPatterns = ((ClasspathEntry)otherEntry).fullExclusionPatternChars(), false)) { //$NON-NLS-1$
+ String exclusionPattern = entryPath.removeFirstSegments(otherPath.segmentCount()).segment(0);
+ if (Util.isExcluded(entryPath, inclusionPatterns, exclusionPatterns, false)) {
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.mustEndWithSlash", exclusionPattern, entryPath.makeRelative().toString())); //$NON-NLS-1$
+ } else {
+ if (otherKind == IClasspathEntry.CPE_SOURCE) {
+ exclusionPattern += '/';
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.cannotNestEntryInEntry", new String[] {entryPath.makeRelative().toString(), otherEntry.getPath().makeRelative().toString(), exclusionPattern})); //$NON-NLS-1$
+ } else {
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.cannotNestEntryInLibrary", entryPath.makeRelative().toString(), otherEntry.getPath().makeRelative().toString())); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // prevent nesting output location inside entry unless enclosing is a source entry which explicitly exclude the output location
+ char[][] inclusionPatterns = ((ClasspathEntry)entry).fullInclusionPatternChars();
+ char[][] exclusionPatterns = ((ClasspathEntry)entry).fullExclusionPatternChars();
+ for (int j = 0; j < outputCount; j++){
+ IPath currentOutput = outputLocations[j];
+ if (entryPath.equals(currentOutput)) continue;
+ if (entryPath.isPrefixOf(currentOutput)) {
+ if (kind != IClasspathEntry.CPE_SOURCE || !Util.isExcluded(currentOutput, inclusionPatterns, exclusionPatterns, true)) {
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.cannotNestOutputInEntry", currentOutput.makeRelative().toString(), entryPath.makeRelative().toString())); //$NON-NLS-1$
+ }
+ }
+ }
+
+ // prevent nesting entry inside output location - when distinct from project or a source folder
+ for (int j = 0; j < outputCount; j++){
+ if (allowNestingInOutputLocations[j]) continue;
+ IPath currentOutput = outputLocations[j];
+ if (currentOutput.isPrefixOf(entryPath)) {
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.cannotNestEntryInOutput", entryPath.makeRelative().toString(), currentOutput.makeRelative().toString())); //$NON-NLS-1$
+ }
+ }
+ }
+ // ensure that no specific output is coincidating with another source folder (only allowed if matching current source folder)
+ // 36465 - for 2.0 backward compatibility, only check specific output locations (the default can still coincidate)
+ // perform one separate iteration so as to not take precedence over previously checked scenarii (in particular should
+ // diagnose nesting source folder issue before this one, for example, [src]"Project/", [src]"Project/source/" and output="Project/" should
+ // first complain about missing exclusion pattern
+ for (int i = 0 ; i < length; i++) {
+ IClasspathEntry entry = classpath[i];
+ if (entry == null) continue;
+ IPath entryPath = entry.getPath();
+ int kind = entry.getEntryKind();
+
+ // Build some common strings for status message
+ boolean isProjectRelative = entryPath.segment(0).toString().equals(projectName);
+ String entryPathMsg = isProjectRelative ? entryPath.removeFirstSegments(1).toString() : entryPath.makeRelative().toString();
+
+ if (kind == IClasspathEntry.CPE_SOURCE) {
+ IPath output = entry.getOutputLocation();
+ if (output == null) continue; // 36465 - for 2.0 backward compatibility, only check specific output locations (the default can still coincidate)
+ // if (output == null) output = projectOutputLocation; // if no specific output, still need to check using default output (this line would check default output)
+ for (int j = 0; j < length; j++) {
+ IClasspathEntry otherEntry = classpath[j];
+ if (otherEntry == entry) continue;
+
+ // Build some common strings for status message
+ boolean opStartsWithProject = otherEntry.getPath().segment(0).toString().equals(projectName);
+ String otherPathMsg = opStartsWithProject ? otherEntry.getPath().removeFirstSegments(1).toString() : otherEntry.getPath().makeRelative().toString();
+
+ switch (otherEntry.getEntryKind()) {
+ case IClasspathEntry.CPE_SOURCE :
+ if (otherEntry.getPath().equals(output)) {
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.cannotUseDistinctSourceFolderAsOutput", new String[] {entryPathMsg, otherPathMsg, projectName})); //$NON-NLS-1$
+ }
+ break;
+ case IClasspathEntry.CPE_LIBRARY :
+ if (otherEntry.getPath().equals(output)) {
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.cannotUseLibraryAsOutput", new String[] {entryPathMsg, otherPathMsg, projectName})); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ }
+ return JavaModelStatus.VERIFIED_OK;
+ }
+
+ /**
+ * 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
+ * @param recurseInContainers flag indicating whether validation should be applied to container entries recursively
+ * @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
+ */
+ public static IJavaModelStatus validateClasspathEntry(IJavaProject project, IClasspathEntry entry, boolean checkSourceAttachment, boolean recurseInContainers){
+
+ IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IPath path = entry.getPath();
+
+ // Build some common strings for status message
+ String projectName = project.getElementName();
+ boolean pathStartsWithProject = path.segment(0).toString().equals(projectName);
+ String entryPathMsg = pathStartsWithProject ? path.removeFirstSegments(1).toString() : path.makeRelative().toString();
+
+ switch(entry.getEntryKind()){
+
+ // container entry check
+// case IClasspathEntry.CPE_CONTAINER :
+// if (path != null && path.segmentCount() >= 1){
+// try {
+// IClasspathContainer container = JavaModelManager.getJavaModelManager().getClasspathContainer(path, project);
+// // container retrieval is performing validation check on container entry kinds.
+// if (container == null){
+// return new JavaModelStatus(IJavaModelStatusConstants.CP_CONTAINER_PATH_UNBOUND, project, path);
+// } else if (container == JavaModelManager.CONTAINER_INITIALIZATION_IN_PROGRESS) {
+// // don't create a marker if initialization is in progress (case of cp initialization batching)
+// return JavaModelStatus.VERIFIED_OK;
+// }
+// IClasspathEntry[] containerEntries = container.getClasspathEntries();
+// if (containerEntries != null){
+// for (int i = 0, length = containerEntries.length; i < length; i++){
+// IClasspathEntry containerEntry = containerEntries[i];
+// int kind = containerEntry == null ? 0 : containerEntry.getEntryKind();
+// if (containerEntry == null
+// || kind == IClasspathEntry.CPE_SOURCE
+// || kind == IClasspathEntry.CPE_VARIABLE
+// || kind == IClasspathEntry.CPE_CONTAINER){
+// String description = container.getDescription();
+// if (description == null) description = path.makeRelative().toString();
+// return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CP_CONTAINER_ENTRY, project, path);
+// }
+// if (recurseInContainers) {
+// IJavaModelStatus containerEntryStatus = validateClasspathEntry(project, containerEntry, checkSourceAttachment, recurseInContainers);
+// if (!containerEntryStatus.isOK()){
+// return containerEntryStatus;
+// }
+// }
+// }
+// }
+// } catch(JavaModelException e){
+// return new JavaModelStatus(e);
+// }
+// } else {
+// return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalContainerPath", entryPathMsg, projectName)); //$NON-NLS-1$
+// }
+// break;
+
+ // variable entry check
+ case IClasspathEntry.CPE_VARIABLE :
+ if (path != null && path.segmentCount() >= 1){
+ try {
+ entry = JavaCore.getResolvedClasspathEntry(entry);
+ } catch (Assert.AssertionFailedException e) {
+ // Catch the assertion failure and throw java model exception instead
+ // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=55992
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_PATH, e.getMessage());
+ }
+ if (entry == null){
+ return new JavaModelStatus(IJavaModelStatusConstants.CP_VARIABLE_PATH_UNBOUND, project, path);
+ }
+ return validateClasspathEntry(project, entry, checkSourceAttachment, recurseInContainers);
+ } else {
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalVariablePath", path.makeRelative().toString(), projectName)); //$NON-NLS-1$
+ }
+
+ // library entry check
+// case IClasspathEntry.CPE_LIBRARY :
+// if (path != null && path.isAbsolute() && !path.isEmpty()) {
+// IPath sourceAttachment = entry.getSourceAttachmentPath();
+// Object target = JavaModel.getTarget(workspaceRoot, path, true);
+// if (target != null && project.getOption(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, true) != JavaCore.IGNORE) {
+// long projectTargetJDK = CompilerOptions.versionToJdkLevel(project.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true));
+// long libraryJDK = Util.getJdkLevel(target);
+// if (libraryJDK != 0 && libraryJDK > projectTargetJDK) {
+// return new JavaModelStatus(IJavaModelStatusConstants.INCOMPATIBLE_JDK_LEVEL, project, path, CompilerOptions.versionFromJdkLevel(libraryJDK));
+// }
+// }
+// if (target instanceof IResource){
+// IResource resolvedResource = (IResource) target;
+// switch(resolvedResource.getType()){
+// case IResource.FILE :
+// if (org.eclipse.jdt.internal.compiler.util.Util.isArchiveFileName(resolvedResource.getName())) {
+// if (checkSourceAttachment
+// && sourceAttachment != null
+// && !sourceAttachment.isEmpty()
+// && JavaModel.getTarget(workspaceRoot, sourceAttachment, true) == null){
+// return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundSourceAttachment", new String [] {sourceAttachment.makeRelative().toString(), path.makeRelative().toString(), projectName})); //$NON-NLS-1$
+// }
+// } else {
+// return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalLibraryArchive", entryPathMsg, projectName)); //$NON-NLS-1$
+// }
+// break;
+// case IResource.FOLDER : // internal binary folder
+// if (checkSourceAttachment
+// && sourceAttachment != null
+// && !sourceAttachment.isEmpty()
+// && JavaModel.getTarget(workspaceRoot, sourceAttachment, true) == null){
+// return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundSourceAttachment", new String [] {sourceAttachment.makeRelative().toString(), path.makeRelative().toString(), projectName})); //$NON-NLS-1$
+// }
+// }
+// } else if (target instanceof File){
+// File file = (File) target;
+// if (!file.isFile()) {
+// return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalExternalFolder", path.toOSString(), projectName)); //$NON-NLS-1$
+// } else if (!org.eclipse.jdt.internal.compiler.util.Util.isArchiveFileName(file.getName())) {
+// return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalLibraryArchive", path.toOSString(), projectName)); //$NON-NLS-1$
+// } else if (checkSourceAttachment
+// && sourceAttachment != null
+// && !sourceAttachment.isEmpty()
+// && JavaModel.getTarget(workspaceRoot, sourceAttachment, true) == null){
+// return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundSourceAttachment", new String [] {sourceAttachment.toString(), path.makeRelative().toString(), projectName})); //$NON-NLS-1$
+// }
+// } else {
+// return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundLibrary", path.makeRelative().toString(), projectName)); //$NON-NLS-1$
+// }
+// } else {
+// return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalLibraryPath", path.makeRelative().toString(), projectName)); //$NON-NLS-1$
+// }
+// break;
+
+ // project entry check
+ case IClasspathEntry.CPE_PROJECT :
+ if (path != null && path.isAbsolute() && !path.isEmpty()) {
+ IProject prereqProjectRsc = workspaceRoot.getProject(path.segment(0));
+ IJavaProject prereqProject = JavaCore.create(prereqProjectRsc);
+ try {
+ if (!prereqProjectRsc.exists() || !prereqProjectRsc.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)){
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundProject", path.makeRelative().segment(0).toString(), projectName)); //$NON-NLS-1$
+ }
+ if (!prereqProjectRsc.isOpen()){
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.closedProject", path.segment(0).toString())); //$NON-NLS-1$
+ }
+// if (project.getOption(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, true) != JavaCore.IGNORE) {
+// long projectTargetJDK = CompilerOptions.versionToJdkLevel(project.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true));
+// long prereqProjectTargetJDK = CompilerOptions.versionToJdkLevel(prereqProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true));
+// if (prereqProjectTargetJDK > projectTargetJDK) {
+// return new JavaModelStatus(IJavaModelStatusConstants.INCOMPATIBLE_JDK_LEVEL, project, path, CompilerOptions.versionFromJdkLevel(prereqProjectTargetJDK));
+// }
+// }
+ } catch (CoreException e){
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundProject", path.segment(0).toString(), projectName)); //$NON-NLS-1$
+ }
+ } else {
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalProjectPath", path.segment(0).toString(), projectName)); //$NON-NLS-1$
+ }
+ break;
+
+ // project source folder
+ case IClasspathEntry.CPE_SOURCE :
+ if (((entry.getInclusionPatterns() != null && entry.getInclusionPatterns().length > 0)
+ || (entry.getExclusionPatterns() != null && entry.getExclusionPatterns().length > 0))
+ && JavaCore.DISABLED.equals(project.getOption(JavaCore.CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, true))) {
+ return new JavaModelStatus(IJavaModelStatusConstants.DISABLED_CP_EXCLUSION_PATTERNS, project, path);
+ }
+ if (entry.getOutputLocation() != null && JavaCore.DISABLED.equals(project.getOption(JavaCore.CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS, true))) {
+ return new JavaModelStatus(IJavaModelStatusConstants.DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS, project, path);
+ }
+ if (path != null && path.isAbsolute() && !path.isEmpty()) {
+ IPath projectPath= project.getProject().getFullPath();
+ if (!projectPath.isPrefixOf(path) || JavaModel.getTarget(workspaceRoot, path, true) == null){
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundSourceFolder", entryPathMsg, projectName)); //$NON-NLS-1$
+ }
+ } else {
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalSourceFolderPath", entryPathMsg, projectName)); //$NON-NLS-1$
+ }
+ break;
+ }
+ return JavaModelStatus.VERIFIED_OK;
+ }
}
+
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnit.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnit.java
index 2fb069d..d150dd3 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnit.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnit.java
@@ -16,7 +16,10 @@ import java.util.Map;
import net.sourceforge.phpdt.core.IBuffer;
import net.sourceforge.phpdt.core.IBufferFactory;
+import net.sourceforge.phpdt.core.ICodeAssist;
+import net.sourceforge.phpdt.core.ICodeCompletionRequestor;
import net.sourceforge.phpdt.core.ICompilationUnit;
+import net.sourceforge.phpdt.core.IImportContainer;
import net.sourceforge.phpdt.core.IImportDeclaration;
import net.sourceforge.phpdt.core.IJavaElement;
import net.sourceforge.phpdt.core.IJavaModelStatusConstants;
@@ -42,6 +45,7 @@ import net.sourceforge.phpdt.internal.compiler.IProblemFactory;
import net.sourceforge.phpdt.internal.compiler.SourceElementParser;
import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions;
import net.sourceforge.phpdt.internal.compiler.problem.DefaultProblemFactory;
+import net.sourceforge.phpdt.internal.core.util.MementoTokenizer;
import net.sourceforge.phpdt.internal.core.util.Util;
import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
@@ -60,7 +64,6 @@ import org.eclipse.core.runtime.Path;
public class CompilationUnit extends Openable implements ICompilationUnit,
net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit {
public WorkingCopyOwner owner;
-
/**
* Constructs a handle to a compilation unit with the given name in the specified package for the specified owner
*
@@ -193,7 +196,6 @@ public class CompilationUnit extends Openable implements ICompilationUnit,
// update timestamp (might be IResource.NULL_STAMP if original does not exist)
unitInfo.timestamp = ((IFile) underlyingResource).getModificationStamp();
-
// compute other problems if needed
CompilationUnitDeclaration compilationUnitDeclaration = null;
try {
@@ -206,7 +208,7 @@ public class CompilationUnit extends Openable implements ICompilationUnit,
// if (info instanceof ASTHolderCUInfo) {
// int astLevel = ((ASTHolderCUInfo) info).astLevel;
- // org.eclipse.jdt.core.dom.CompilationUnit cu = AST.convertCompilationUnit(astLevel, unit, contents, options, pm);
+ // net.sourceforge.phpdt.core.dom.CompilationUnit cu = AST.convertCompilationUnit(astLevel, unit, contents, options, pm);
// ((ASTHolderCUInfo) info).ast = cu;
// }
} finally {
@@ -222,7 +224,7 @@ public class CompilationUnit extends Openable implements ICompilationUnit,
// * @see ICodeAssist#codeComplete(int, ICompletionRequestor)
// */
//public void codeComplete(int offset, ICompletionRequestor requestor) throws JavaModelException {
- // codeComplete(this, isWorkingCopy() ? (org.eclipse.jdt.internal.compiler.env.ICompilationUnit) getOriginalElement() : this,
+ // codeComplete(this, isWorkingCopy() ? (net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit) getOriginalElement() : this,
// offset, requestor);
//}
/**
@@ -303,8 +305,8 @@ public class CompilationUnit extends Openable implements ICompilationUnit,
// String source = ""; //$NON-NLS-1$
// if (pkg.getElementName().length() > 0) {
// //not the default package...add the package declaration
- // source = "package " + pkg.getElementName() + ";" + org.eclipse.jdt.internal.compiler.util.ProjectPrefUtil.LINE_SEPARATOR +
- // org.eclipse.jdt.internal.compiler.util.ProjectPrefUtil.LINE_SEPARATOR; //$NON-NLS-1$ //$NON-NLS-2$
+ // source = "package " + pkg.getElementName() + ";" + net.sourceforge.phpdt.internal.compiler.util.ProjectPrefUtil.LINE_SEPARATOR +
+ // net.sourceforge.phpdt.internal.compiler.util.ProjectPrefUtil.LINE_SEPARATOR; //$NON-NLS-1$ //$NON-NLS-2$
// }
// CreateCompilationUnitOperation op = new CreateCompilationUnitOperation(pkg, fName, source, force);
// runOperation(op, monitor);
@@ -534,7 +536,7 @@ public class CompilationUnit extends Openable implements ICompilationUnit,
}
/**
- * @see org.eclipse.jdt.internal.compiler.env.ICompilationUnit#getContents()
+ * @see net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit#getContents()
*/
public char[] getContents() {
try {
@@ -582,47 +584,68 @@ public class CompilationUnit extends Openable implements ICompilationUnit,
public char[] getFileName() {
return getElementName().toCharArray();
}
+ /*
+ * @see JavaElement
+ */
+ public IJavaElement getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner workingCopyOwner) {
+ switch (token.charAt(0)) {
+ case JEM_COUNT:
+ return getHandleUpdatingCountFromMemento(memento, workingCopyOwner);
+ case JEM_IMPORTDECLARATION:
+ JavaElement container = (JavaElement)getImportContainer();
+ return container.getHandleFromMemento(token, memento, workingCopyOwner);
+ case JEM_PACKAGEDECLARATION:
+ String pkgName = memento.nextToken();
+ JavaElement pkgDecl = (JavaElement)getPackageDeclaration(pkgName);
+ return pkgDecl.getHandleFromMemento(memento, workingCopyOwner);
+ case JEM_TYPE:
+ String typeName = memento.nextToken();
+ JavaElement type = (JavaElement)getType(typeName);
+ return type.getHandleFromMemento(memento, workingCopyOwner);
+ }
+ return null;
+ }
/**
* @see JavaElement#getHandleMementoDelimiter()
*/
protected char getHandleMementoDelimiter() {
- return JavaElement.JEM_COMPILATIONUNIT;
+ return JavaElement.JEM_COMPILATIONUNIT;
}
-
/**
* @see ICompilationUnit#getImport(String)
*/
public IImportDeclaration getImport(String importName) {
- return new ImportDeclaration((ImportContainer) getImportContainer(), importName);
+ return new ImportDeclaration((ImportContainer)getImportContainer(), importName);
}
-
/**
* @see ICompilationUnit#getImportContainer()
*/
- public ImportContainer getImportContainer() {
- return new ImportContainer(this);
+ public IImportContainer getImportContainer() {
+ return new ImportContainer(this);
}
+
/**
* @see ICompilationUnit#getImports()
*/
- //public IImportDeclaration[] getImports() throws JavaModelException {
- // IImportContainer container= getImportContainer();
- // if (container.exists()) {
- // IJavaElement[] elements= container.getChildren();
- // IImportDeclaration[] imprts= new IImportDeclaration[elements.length];
- // System.arraycopy(elements, 0, imprts, 0, elements.length);
- // return imprts;
- // } else if (!exists()) {
- // throw newNotPresentException();
- // } else {
- // return new IImportDeclaration[0];
- // }
- //
- //}
+ public IImportDeclaration[] getImports() throws JavaModelException {
+ IImportContainer container= getImportContainer();
+ if (container.exists()) {
+ IJavaElement[] elements= container.getChildren();
+ IImportDeclaration[] imprts= new IImportDeclaration[elements.length];
+ System.arraycopy(elements, 0, imprts, 0, elements.length);
+ return imprts;
+ } else if (!exists()) {
+ throw newNotPresentException();
+ } else {
+ return new IImportDeclaration[0];
+ }
+
+ }
+
/**
- * @see org.eclipse.jdt.internal.compiler.env.ICompilationUnit#getMainTypeName()
+ * @see net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit#getMainTypeName()
*/
public char[] getMainTypeName() {
String name = getElementName();
@@ -684,7 +707,7 @@ public class CompilationUnit extends Openable implements ICompilationUnit,
}
/**
- * @see org.eclipse.jdt.internal.compiler.env.ICompilationUnit#getPackageName()
+ * @see net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit#getPackageName()
*/
public char[][] getPackageName() {
return null;
@@ -1015,7 +1038,7 @@ public class CompilationUnit extends Openable implements ICompilationUnit,
// ASTHolderCUInfo info = new ASTHolderCUInfo();
// info.astLevel = astLevel;
// openWhenClosed(info, monitor);
- // org.eclipse.jdt.core.dom.CompilationUnit result = info.ast;
+ // net.sourceforge.phpdt.core.dom.CompilationUnit result = info.ast;
// info.ast = null;
// return result;
// } else {
@@ -1166,7 +1189,7 @@ public class CompilationUnit extends Openable implements ICompilationUnit,
* @see ICompilationUnit#reconcile(int, boolean, WorkingCopyOwner, IProgressMonitor)
* @since 3.0
*/
- //public org.eclipse.jdt.core.dom.CompilationUnit reconcile(
+ //public net.sourceforge.phpdt.core.dom.CompilationUnit reconcile(
public Object reconcile(int astLevel, boolean forceProblemDetection, WorkingCopyOwner workingCopyOwner, IProgressMonitor monitor)
throws JavaModelException {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitProblemFinder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitProblemFinder.java
index 24255af..5ebd54c 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitProblemFinder.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitProblemFinder.java
@@ -132,7 +132,7 @@ public class CompilationUnitProblemFinder extends Compiler {
throws JavaModelException {
return (SearchableEnvironment) ((JavaProject) sourceUnit.getJavaProject())
.getSearchableNameEnvironment();
- }
+ }
/*
* Answer the component to which will be handed back compilation results from the compiler
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitStructureRequestor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitStructureRequestor.java
index 8b9fcb0..a09a6c6 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitStructureRequestor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitStructureRequestor.java
@@ -10,9 +10,17 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.core;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Stack;
+import net.sourceforge.phpdt.internal.core.ImportContainer;
+import net.sourceforge.phpdt.internal.core.ImportDeclaration;
+import net.sourceforge.phpdt.internal.core.ImportDeclarationElementInfo;
+import net.sourceforge.phpdt.internal.core.JavaElement;
+import net.sourceforge.phpdt.internal.core.JavaElementInfo;
+
import net.sourceforge.phpdt.core.Flags;
import net.sourceforge.phpdt.core.ICompilationUnit;
import net.sourceforge.phpdt.core.IField;
@@ -36,17 +44,17 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
/**
* The handle to the compilation unit being parsed
*/
- protected ICompilationUnit fUnit;
+ protected ICompilationUnit unit;
/**
* The info object for the compilation unit being parsed
*/
- protected CompilationUnitElementInfo fUnitInfo;
+ protected CompilationUnitElementInfo unitInfo;
/**
* The import container info - null until created
*/
- protected JavaElementInfo fImportContainerInfo = null;
+ protected JavaElementInfo importContainerInfo = null;
/**
* Hashtable of children elements of the compilation unit.
@@ -54,7 +62,7 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
* the parser. Keys are handles, values are corresponding
* info objects.
*/
- protected Map fNewElements;
+ protected Map newElements;
/**
* Stack of parent scope info objects. The info on the
@@ -62,14 +70,14 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
* For example, when we locate a method, the parent info object
* will be the type the method is contained in.
*/
- protected Stack fInfoStack;
+ protected Stack infoStack;
/**
* Stack of parent handles, corresponding to the info stack. We
* keep both, since info objects do not have back pointers to
* handles.
*/
- protected Stack fHandleStack;
+ protected Stack handleStack;
/**
* The name of the source file being parsed.
@@ -126,29 +134,31 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
protected CompilationUnitStructureRequestor(ICompilationUnit unit, CompilationUnitElementInfo unitInfo, Map newElements)
throws JavaModelException {
- this.fUnit = unit;
- this.fUnitInfo = unitInfo;
- this.fNewElements = newElements;
+ this.unit = unit;
+ this.unitInfo = unitInfo;
+ this.newElements = newElements;
this.fSourceFileName = unit.getElementName().toCharArray();
}
/**
* @see ISourceElementRequestor
*/
- public void acceptImport(int declarationStart, int declarationEnd, char[] name, boolean onDemand) {
- JavaElementInfo parentInfo = (JavaElementInfo) fInfoStack.peek();
- JavaElement parentHandle= (JavaElement)fHandleStack.peek();
+ public void acceptImport(int declarationStart, int declarationEnd, char[] name, boolean onDemand) {
+ //, int modifiers) {
+
+ JavaElementInfo parentInfo = (JavaElementInfo) this.infoStack.peek();
+ JavaElement parentHandle= (JavaElement) this.handleStack.peek();
if (!(parentHandle.getElementType() == IJavaElement.COMPILATION_UNIT)) {
Assert.isTrue(false); // Should not happen
}
-
+
ICompilationUnit parentCU= (ICompilationUnit)parentHandle;
//create the import container and its info
- ImportContainer importContainer= parentCU.getImportContainer();
- if (fImportContainerInfo == null) {
- fImportContainerInfo= new JavaElementInfo();
- fImportContainerInfo.setIsStructureKnown(true);
+ ImportContainer importContainer= (ImportContainer)parentCU.getImportContainer();
+ if (this.importContainerInfo == null) {
+ this.importContainerInfo= new JavaElementInfo();
+ this.importContainerInfo.setIsStructureKnown(true);
parentInfo.addChild(importContainer);
- fNewElements.put(importContainer, fImportContainerInfo);
+ this.newElements.put(importContainer, this.importContainerInfo);
}
// tack on the '.*' if it is onDemand
@@ -160,16 +170,22 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
}
ImportDeclaration handle = new ImportDeclaration(importContainer, importName);
-// ImportDeclaration handle = new ImportDeclaration(null, importName);
-// resolveDuplicates(handle);
+ resolveDuplicates(handle);
- SourceRefElementInfo info = new SourceRefElementInfo();
+ ImportDeclarationElementInfo info = new ImportDeclarationElementInfo();
info.setSourceRangeStart(declarationStart);
info.setSourceRangeEnd(declarationEnd);
-
- fImportContainerInfo.addChild(handle);
- fNewElements.put(handle, info);
+// info.setFlags(modifiers);
+ info.setName(name); // no trailing * if onDemand
+ info.setOnDemand(onDemand);
+
+ this.importContainerInfo.addChild(handle);
+ this.newElements.put(handle, info);
}
+ /**
+ * @see ISourceElementRequestor
+ */
+
/*
* Table of line separator position. This table is passed once at the end
* of the parse action, so as to allow computation of normalized ranges.
@@ -246,10 +262,10 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
* @see ISourceElementRequestor
*/
public void enterCompilationUnit() {
- fInfoStack = new Stack();
- fHandleStack = new Stack();
- fInfoStack.push(fUnitInfo);
- fHandleStack.push(fUnit);
+ infoStack = new Stack();
+ handleStack = new Stack();
+ infoStack.push(unitInfo);
+ handleStack.push(unit);
}
/**
* @see ISourceElementRequestor
@@ -282,8 +298,8 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
*/
public void enterField(int declarationStart, int modifiers, char[] type, char[] name, int nameSourceStart, int nameSourceEnd) {
- SourceTypeElementInfo parentInfo = (SourceTypeElementInfo) fInfoStack.peek();
- JavaElement parentHandle = (JavaElement) fHandleStack.peek();
+ SourceTypeElementInfo parentInfo = (SourceTypeElementInfo) infoStack.peek();
+ JavaElement parentHandle = (JavaElement) handleStack.peek();
IField handle = null;
if (parentHandle.getElementType() == IJavaElement.TYPE) {
@@ -302,10 +318,10 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
info.setTypeName(type);
parentInfo.addChild(handle);
- fNewElements.put(handle, info);
+ newElements.put(handle, info);
- fInfoStack.push(info);
- fHandleStack.push(handle);
+ infoStack.push(info);
+ handleStack.push(handle);
}
/**
* @see ISourceElementRequestor
@@ -391,11 +407,11 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
boolean isConstructor) {
SourceTypeElementInfo parentInfo = null;
try {
- parentInfo = (SourceTypeElementInfo) fInfoStack.peek();
+ parentInfo = (SourceTypeElementInfo) infoStack.peek();
} catch (ClassCastException e) {
// parentInfo = null;
}
- JavaElement parentHandle = (JavaElement) fHandleStack.peek();
+ JavaElement parentHandle = (JavaElement) handleStack.peek();
IMethod handle = null;
// translate nulls to empty arrays
@@ -434,13 +450,13 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
info.setExceptionTypeNames(exceptionTypes);
if (parentInfo == null) {
- fUnitInfo.addChild(handle);
+ unitInfo.addChild(handle);
} else {
parentInfo.addChild(handle);
}
- fNewElements.put(handle, info);
- fInfoStack.push(info);
- fHandleStack.push(handle);
+ newElements.put(handle, info);
+ infoStack.push(info);
+ handleStack.push(handle);
}
/**
* Common processing for classes and interfaces.
@@ -457,8 +473,8 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
char[] enclosingTypeName = null;
char[] qualifiedName = null;
- JavaElementInfo parentInfo = (JavaElementInfo) fInfoStack.peek();
- JavaElement parentHandle = (JavaElement) fHandleStack.peek();
+ JavaElementInfo parentInfo = (JavaElementInfo) infoStack.peek();
+ JavaElement parentHandle = (JavaElement) handleStack.peek();
IType handle = null;
String nameString = new String(name);
@@ -498,10 +514,10 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
// }
parentInfo.addChild(handle);
- fNewElements.put(handle, info);
+ newElements.put(handle, info);
- fInfoStack.push(info);
- fHandleStack.push(handle);
+ infoStack.push(info);
+ handleStack.push(handle);
}
/**
@@ -515,10 +531,10 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
* @see ISourceElementRequestor
*/
public void exitCompilationUnit(int declarationEnd) {
- fUnitInfo.setSourceLength(declarationEnd + 1);
+ unitInfo.setSourceLength(declarationEnd + 1);
// determine if there were any parsing errors
- fUnitInfo.setIsStructureKnown(!this.hasSyntaxErrors);
+ unitInfo.setIsStructureKnown(!this.hasSyntaxErrors);
}
/**
* @see ISourceElementRequestor
@@ -530,7 +546,7 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
* @see ISourceElementRequestor
*/
public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd) {
- SourceFieldElementInfo info = (SourceFieldElementInfo) fInfoStack.pop();
+ SourceFieldElementInfo info = (SourceFieldElementInfo) infoStack.pop();
info.setSourceRangeEnd(declarationSourceEnd);
// remember initializer source if field is a constant
@@ -538,7 +554,7 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
int flags = info.flags;
Object typeInfo;
if (Flags.isStatic(flags) && Flags.isFinal(flags)
- || ((typeInfo = fInfoStack.peek()) instanceof SourceTypeElementInfo
+ || ((typeInfo = infoStack.peek()) instanceof SourceTypeElementInfo
&& (Flags.isInterface(((SourceTypeElementInfo)typeInfo).flags)))) {
int length = declarationEnd - initializationStart;
if (length > 0) {
@@ -548,7 +564,7 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
}
}
}
- fHandleStack.pop();
+ handleStack.pop();
}
/**
* @see ISourceElementRequestor
@@ -566,9 +582,9 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
* common processing for classes and interfaces
*/
protected void exitMember(int declarationEnd) {
- SourceRefElementInfo info = (SourceRefElementInfo) fInfoStack.pop();
+ SourceRefElementInfo info = (SourceRefElementInfo) infoStack.pop();
info.setSourceRangeEnd(declarationEnd);
- fHandleStack.pop();
+ handleStack.pop();
}
/**
* @see ISourceElementRequestor
@@ -582,7 +598,7 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
* of the handle being created until there is no conflict.
*/
protected void resolveDuplicates(IJavaElement handle) {
- while (fNewElements.containsKey(handle)) {
+ while (newElements.containsKey(handle)) {
JavaElement h = (JavaElement) handle;
h.setOccurrenceCount(h.getOccurrenceCount() + 1);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/INamingRequestor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/INamingRequestor.java
new file mode 100644
index 0000000..4efbb83
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/INamingRequestor.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * 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.internal.core;
+
+public interface INamingRequestor {
+ void acceptNameWithPrefixAndSuffix(char[] name, boolean isFirstPrefix, boolean isFirstSuffix);
+ void acceptNameWithPrefix(char[] name, boolean isFirstPrefix);
+ void acceptNameWithSuffix(char[] name, boolean isFirstSuffix);
+ void acceptNameWithoutPrefixAndSuffix(char[] name);
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/IPathRequestor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/IPathRequestor.java
new file mode 100644
index 0000000..1cf2eee
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/IPathRequestor.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * 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.internal.core;
+
+public interface IPathRequestor {
+ void acceptPath(String path, boolean containsLocalTypes);
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ImportContainer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ImportContainer.java
index 54089a2..e8da010 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ImportContainer.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ImportContainer.java
@@ -17,106 +17,126 @@ import net.sourceforge.phpdt.core.IParent;
import net.sourceforge.phpdt.core.ISourceRange;
import net.sourceforge.phpdt.core.ISourceReference;
import net.sourceforge.phpdt.core.JavaModelException;
+import net.sourceforge.phpdt.core.WorkingCopyOwner;
+import net.sourceforge.phpdt.internal.core.util.MementoTokenizer;
+
//import net.sourceforge.phpdt.internal.core.util.MementoTokenizer;
/**
* @see IImportContainer
*/
public class ImportContainer extends SourceRefElement implements IImportContainer {
-protected ImportContainer(CompilationUnit parent) {
- super(parent, ""); //$NON-NLS-1$
-}
-public boolean equals(Object o) {
- if (!(o instanceof ImportContainer)) return false;
- return super.equals(o);
-}
-/**
- * @see IJavaElement
- */
-public int getElementType() {
- return IMPORT_CONTAINER;
-}
-/*
- * @see JavaElement
- */
-//public IJavaElement getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner workingCopyOwner) {
-// switch (token.charAt(0)) {
-// case JEM_COUNT:
-// return getHandleUpdatingCountFromMemento(memento, workingCopyOwner);
-// case JEM_IMPORTDECLARATION:
-// if (memento.hasMoreTokens()) {
-// String importName = memento.nextToken();
-// JavaElement importDecl = (JavaElement)getImport(importName);
-// return importDecl.getHandleFromMemento(memento, workingCopyOwner);
-// } else {
-// return this;
-// }
-// }
-// return null;
-//}
-/**
- * @see JavaElement#getHandleMemento()
- */
-protected char getHandleMementoDelimiter() {
- return JavaElement.JEM_IMPORTDECLARATION;
-}
-/**
- * @see IImportContainer
- */
-public IImportDeclaration getImport(String importName) {
- return new ImportDeclaration(this, importName);
-}
-/*
- * @see JavaElement#getPrimaryElement(boolean)
- */
-public IJavaElement getPrimaryElement(boolean checkOwner) {
- CompilationUnit cu = (CompilationUnit)this.parent;
- if (checkOwner && cu.isPrimary()) return this;
- return cu.getImportContainer();
-}
-/**
- * @see ISourceReference
- */
-public ISourceRange getSourceRange() throws JavaModelException {
- IJavaElement[] imports= getChildren();
- ISourceRange firstRange= ((ISourceReference)imports[0]).getSourceRange();
- ISourceRange lastRange= ((ISourceReference)imports[imports.length - 1]).getSourceRange();
- SourceRange range= new SourceRange(firstRange.getOffset(), lastRange.getOffset() + lastRange.getLength() - firstRange.getOffset());
- return range;
-}
-/**
- * Import containers only exist if they have children.
- * @see IParent
- */
-public boolean hasChildren() {
- return true;
-}
-/**
- */
-public String readableName() {
+ protected ImportContainer(CompilationUnit parent) {
+ super(parent, ""); //$NON-NLS-1$
+ }
- return null;
-}
-/**
- * @private Debugging purposes
- */
-protected void toString(int tab, StringBuffer buffer) {
- Object info = JavaModelManager.getJavaModelManager().peekAtInfo(this);
- if (info == null || !(info instanceof JavaElementInfo)) return;
- IJavaElement[] children = ((JavaElementInfo)info).getChildren();
- for (int i = 0; i < children.length; i++) {
- if (i > 0) buffer.append("\n"); //$NON-NLS-1$
- ((JavaElement)children[i]).toString(tab, buffer);
- }
-}
-/**
- * Debugging purposes
- */
-protected void toStringInfo(int tab, StringBuffer buffer, Object info) {
- buffer.append(this.tabString(tab));
- buffer.append("null
if this element does not
- * have a parent.
+ * This element's parent, or null
if this
+ * element does not have a parent.
*/
- protected IJavaElement parent;
+ protected JavaElement parent;
/**
* This element's name, or an empty String
if this element
@@ -159,6 +163,30 @@ public abstract class JavaElement extends PlatformObject
protected boolean equalsDOMNode(IDOMNode node) throws JavaModelException {
return false;
}
+ protected void escapeMementoName(StringBuffer buffer, String mementoName) {
+ for (int i = 0, length = mementoName.length(); i < length; i++) {
+ char character = mementoName.charAt(i);
+ switch (character) {
+ case JEM_ESCAPE:
+ case JEM_COUNT:
+ case JEM_JAVAPROJECT:
+ case JEM_PACKAGEFRAGMENTROOT:
+ case JEM_PACKAGEFRAGMENT:
+ case JEM_FIELD:
+ case JEM_METHOD:
+ case JEM_INITIALIZER:
+ case JEM_COMPILATIONUNIT:
+// case JEM_CLASSFILE:
+ case JEM_TYPE:
+ case JEM_PACKAGEDECLARATION:
+ case JEM_IMPORTDECLARATION:
+ case JEM_LOCALVARIABLE:
+ buffer.append(JEM_ESCAPE);
+ }
+ buffer.append(character);
+ }
+ }
+
/**
* @see IJavaElement
*/
@@ -332,6 +360,31 @@ public abstract class JavaElement extends PlatformObject
return name;
}
+ /*
+ * Creates a Java element handle from the given memento.
+ * The given token is the current delimiter indicating the type of the next token(s).
+ * The given working copy owner is used only for compilation unit handles.
+ */
+ public abstract IJavaElement getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner owner);
+ /*
+ * Creates a Java element handle from the given memento.
+ * The given working copy owner is used only for compilation unit handles.
+ */
+ public IJavaElement getHandleFromMemento(MementoTokenizer memento, WorkingCopyOwner owner) {
+ if (!memento.hasMoreTokens()) return this;
+ String token = memento.nextToken();
+ return getHandleFromMemento(token, memento, owner);
+ }
+ /*
+ * Update the occurence count of the receiver and creates a Java element handle from the given memento.
+ * The given working copy owner is used only for compilation unit handles.
+ */
+ public IJavaElement getHandleUpdatingCountFromMemento(MementoTokenizer memento, WorkingCopyOwner owner) {
+ this.occurrenceCount = Integer.parseInt(memento.nextToken());
+ if (!memento.hasMoreTokens()) return this;
+ String token = memento.nextToken();
+ return getHandleFromMemento(token, memento, owner);
+ }
/**
* @see IJavaElement
*/
@@ -341,17 +394,25 @@ public abstract class JavaElement extends PlatformObject
/**
* @see JavaElement#getHandleMemento()
*/
- public String getHandleMemento() {
- StringBuffer buff = new StringBuffer(((JavaElement) getParent())
- .getHandleMemento());
+ public String getHandleMemento(){
+ StringBuffer buff= new StringBuffer(((JavaElement)getParent()).getHandleMemento());
buff.append(getHandleMementoDelimiter());
- buff.append(getElementName());
+ escapeMementoName(buff, getElementName());
+ if (this.occurrenceCount > 1) {
+ buff.append(JEM_COUNT);
+ buff.append(this.occurrenceCount);
+ }
return buff.toString();
}
/**
* Returns the char
that marks the start of this handles
* contribution to a memento.
*/
+
+ /**
+ * Returns the char
that marks the start of this handles
+ * contribution to a memento.
+ */
protected abstract char getHandleMementoDelimiter();
/**
* @see IJavaElement
@@ -399,6 +460,7 @@ public abstract class JavaElement extends PlatformObject
return (IOpenable) parent;
}
+
/**
* @see IJavaElement
*/
@@ -434,9 +496,13 @@ public abstract class JavaElement extends PlatformObject
int i;
for (i = 0; i < children.length; i++) {
IJavaElement aChild = children[i];
+
if (aChild instanceof SourceRefElement) {
SourceRefElement child = (SourceRefElement) children[i];
ISourceRange range = child.getSourceRange();
+// if (child.name.equals("stopObject")||range==null || range.getOffset()<=0) {
+// System.out.println(child.name);
+// }
if (position < range.getOffset() + range.getLength()
&& position >= range.getOffset()) {
if (child instanceof IParent) {
@@ -463,7 +529,7 @@ public abstract class JavaElement extends PlatformObject
/*
* (non-Javadoc)
*
- * @see org.eclipse.jdt.core.IJavaElement#getSchedulingRule()
+ * @see net.sourceforge.phpdt.core.IJavaElement#getSchedulingRule()
*/
public ISchedulingRule getSchedulingRule() {
IResource resource = getResource();
@@ -523,19 +589,18 @@ public abstract class JavaElement extends PlatformObject
return Util.combineHashCodes(this.name.hashCode(), this.parent
.hashCode());
}
-
/**
* Returns true if this element is an ancestor of the given element,
* otherwise false.
*/
- protected boolean isAncestorOf(IJavaElement e) {
- IJavaElement parent = e.getParent();
- while (parent != null && !parent.equals(this)) {
- parent = parent.getParent();
+ public boolean isAncestorOf(IJavaElement e) {
+ IJavaElement parentElement= e.getParent();
+ while (parentElement != null && !parentElement.equals(this)) {
+ parentElement= parentElement.getParent();
}
- return parent != null;
+ return parentElement != null;
}
-
+
/**
* @see IJavaElement
*/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModel.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModel.java
index 489e3c6..e184748 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModel.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModel.java
@@ -18,7 +18,10 @@ import java.util.Map;
import net.sourceforge.phpdt.core.IJavaElement;
import net.sourceforge.phpdt.core.IJavaModel;
import net.sourceforge.phpdt.core.IJavaProject;
+import net.sourceforge.phpdt.core.IOpenable;
import net.sourceforge.phpdt.core.JavaModelException;
+import net.sourceforge.phpdt.core.WorkingCopyOwner;
+import net.sourceforge.phpdt.internal.core.util.MementoTokenizer;
import net.sourceforge.phpdt.internal.core.util.Util;
import org.eclipse.core.resources.IContainer;
@@ -31,9 +34,6 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
-import net.sourceforge.phpdt.internal.core.JavaModelInfo;
-import net.sourceforge.phpdt.internal.core.JavaProject;
-import net.sourceforge.phpdt.internal.core.OpenableElementInfo;
import org.eclipse.jface.util.Assert;
@@ -358,6 +358,20 @@ protected boolean generateInfos(
//}
+/*
+ * @see JavaElement
+ */
+public IJavaElement getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner owner) {
+ switch (token.charAt(0)) {
+ case JEM_COUNT:
+ return getHandleUpdatingCountFromMemento(memento, owner);
+ case JEM_JAVAPROJECT:
+ String projectName = memento.nextToken();
+ JavaElement project = (JavaElement)getJavaProject(projectName);
+ return project.getHandleFromMemento(memento, owner);
+ }
+ return null;
+}
/**
* @see JavaElement#getHandleMemento()
*/
@@ -372,6 +386,7 @@ protected char getHandleMementoDelimiter(){
Assert.isTrue(false, "Should not be called"); //$NON-NLS-1$
return 0;
}
+
/**
* @see IJavaModel
*/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java
index 6ed2fdb..f860394 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java
@@ -52,7 +52,6 @@ import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
@@ -88,7 +87,7 @@ public class JavaModelManager implements ISaveParticipant {
* Unique handle onto the JavaModel
*/
final JavaModel javaModel = new JavaModel();
-
+// public IndexManager indexManager = new IndexManager();
/**
* Classpath variables pool
*/
@@ -96,13 +95,13 @@ public class JavaModelManager implements ISaveParticipant {
public static HashMap PreviousSessionVariables = new HashMap(5);
public static HashSet OptionNames = new HashSet(20);
public final static String CP_VARIABLE_PREFERENCES_PREFIX = PHPeclipsePlugin.PLUGIN_ID+".classpathVariable."; //$NON-NLS-1$
-// public final static String CP_CONTAINER_PREFERENCES_PREFIX = PHPCore.PLUGIN_ID+".classpathContainer."; //$NON-NLS-1$
+ public final static String CP_CONTAINER_PREFERENCES_PREFIX = PHPeclipsePlugin.PLUGIN_ID+".classpathContainer."; //$NON-NLS-1$
public final static String CP_ENTRY_IGNORE = "##IJavaElement
represented by the
* String
memento.
@@ -1582,9 +1645,14 @@ public class JavaModelManager implements ISaveParticipant {
}
}
-// PROTECTED VOID REMOVEINFO(IJAVAELEMENT ELEMENT) {
-// THIS.CACHE.REMOVEINFO(ELEMENT);
-// }
+ /**
+ * Remembers the given scope in a weak set
+ * (so no need to remove it: it will be removed by the garbage collector)
+ */
+// public void rememberScope(AbstractSearchScope scope) {
+// // NB: The value has to be null so as to not create a strong reference on the scope
+// this.searchScopes.put(scope, null);
+// }
/*
* Removes all cached info for the given element (including all children)
* from the cache.
@@ -1689,11 +1757,55 @@ public class JavaModelManager implements ISaveParticipant {
System.out.println(Util.bind("build.saveStateComplete", String.valueOf(t))); //$NON-NLS-1$
}
}
-
+ private synchronized Map containerClone(IJavaProject project) {
+ Map originalProjectContainers = (Map)this.containers.get(project);
+ if (originalProjectContainers == null) return null;
+ Map projectContainers = new HashMap(originalProjectContainers.size());
+ projectContainers.putAll(originalProjectContainers);
+ return projectContainers;
+ }
/**
* @see ISaveParticipant
*/
public void saving(ISaveContext context) throws CoreException {
+
+ // save container values on snapshot/full save
+ Preferences preferences = JavaCore.getPlugin().getPluginPreferences();
+ IJavaProject[] projects = getJavaModel().getJavaProjects();
+ for (int i = 0, length = projects.length; i < length; i++) {
+ IJavaProject project = projects[i];
+ // clone while iterating (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=59638)
+ Map projectContainers = containerClone(project);
+ if (projectContainers == null) continue;
+ for (Iterator keys = projectContainers.keySet().iterator(); keys.hasNext();) {
+ IPath containerPath = (IPath) keys.next();
+// IClasspathContainer container = (IClasspathContainer) projectContainers.get(containerPath);
+ String containerKey = CP_CONTAINER_PREFERENCES_PREFIX+project.getElementName() +"|"+containerPath;//$NON-NLS-1$
+ String containerString = CP_ENTRY_IGNORE;
+// try {
+// if (container != null) {
+// containerString = ((JavaProject)project).encodeClasspath(container.getClasspathEntries(), null, false);
+// }
+// } catch(JavaModelException e){
+// // could not encode entry: leave it as CP_ENTRY_IGNORE
+// }
+ preferences.setDefault(containerKey, CP_ENTRY_IGNORE); // use this default to get rid of removed ones
+ preferences.setValue(containerKey, containerString);
+ }
+ }
+ JavaCore.getPlugin().savePluginPreferences();
+
+// if (context.getKind() == ISaveContext.FULL_SAVE) {
+// // will need delta since this save (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=38658)
+// context.needDelta();
+//
+// // clean up indexes on workspace full save
+// // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=52347)
+// IndexManager manager = this.indexManager;
+// if (manager != null) {
+// manager.cleanUpIndexes();
+// }
+// }
IProject savedProject = context.getProject();
if (savedProject != null) {
@@ -1720,6 +1832,36 @@ public class JavaModelManager implements ISaveParticipant {
throw new CoreException(new MultiStatus(JavaCore.PLUGIN_ID, IStatus.ERROR, stats, Util.bind("build.cannotSaveStates"), null)); //$NON-NLS-1$
}
}
+ /**
+ * @see ISaveParticipant
+ */
+// public void saving(ISaveContext context) throws CoreException {
+//
+// IProject savedProject = context.getProject();
+// if (savedProject != null) {
+// if (!JavaProject.hasJavaNature(savedProject)) return; // ignore
+// PerProjectInfo info = getPerProjectInfo(savedProject, true /* create info */);
+// saveState(info, context);
+// return;
+// }
+//
+// ArrayList vStats= null; // lazy initialized
+// for (Iterator iter = perProjectInfo.values().iterator(); iter.hasNext();) {
+// try {
+// PerProjectInfo info = (PerProjectInfo) iter.next();
+// saveState(info, context);
+// } catch (CoreException e) {
+// if (vStats == null)
+// vStats= new ArrayList();
+// vStats.add(e.getStatus());
+// }
+// }
+// if (vStats != null) {
+// IStatus[] stats= new IStatus[vStats.size()];
+// vStats.toArray(stats);
+// throw new CoreException(new MultiStatus(JavaCore.PLUGIN_ID, IStatus.ERROR, stats, Util.bind("build.cannotSaveStates"), null)); //$NON-NLS-1$
+// }
+// }
/**
* Record the order in which to build the java projects (batch build). This order is based
@@ -1903,4 +2045,29 @@ public class JavaModelManager implements ISaveParticipant {
return result;
}
}
+
+ /*
+ * A HashSet that contains the IJavaProject whose classpath is being resolved.
+ */
+ private ThreadLocal classpathsBeingResolved = new ThreadLocal();
+
+ private HashSet getClasspathBeingResolved() {
+ HashSet result = (HashSet) this.classpathsBeingResolved.get();
+ if (result == null) {
+ result = new HashSet();
+ this.classpathsBeingResolved.set(result);
+ }
+ return result;
+ }
+ public boolean isClasspathBeingResolved(IJavaProject project) {
+ return getClasspathBeingResolved().contains(project);
+ }
+
+ public void setClasspathBeingResolved(IJavaProject project, boolean classpathIsResolved) {
+ if (classpathIsResolved) {
+ getClasspathBeingResolved().add(project);
+ } else {
+ getClasspathBeingResolved().remove(project);
+ }
+ }
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java
index f803855..e3fdb4d 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java
@@ -49,6 +49,7 @@ import net.sourceforge.phpdt.core.JavaModelException;
import net.sourceforge.phpdt.core.WorkingCopyOwner;
import net.sourceforge.phpdt.internal.codeassist.ISearchableNameEnvironment;
import net.sourceforge.phpdt.internal.compiler.util.ObjectVector;
+import net.sourceforge.phpdt.internal.core.util.MementoTokenizer;
import net.sourceforge.phpdt.internal.core.util.Util;
import net.sourceforge.phpdt.internal.corext.Assert;
import net.sourceforge.phpeclipse.LoadPathEntry;
@@ -136,7 +137,11 @@ public class JavaProject
public static final IClasspathEntry[] INVALID_CLASSPATH = new IClasspathEntry[0];
private static final String CUSTOM_DEFAULT_OPTION_VALUE = "#\r\n\r#custom-non-empty-default-value#\r\n\r#"; //$NON-NLS-1$
-
+ /*
+ * Value of project's resolved classpath while it is being resolved
+ */
+ private static final IClasspathEntry[] RESOLUTION_IN_PROGRESS = new IClasspathEntry[0];
+
/**
* Returns a canonicalized path from the given external path.
* Note that the return path contains the same number of segments
@@ -426,57 +431,117 @@ public class JavaProject
// }
-
/**
* Internal computation of an expanded classpath. It will eliminate duplicates, and produce copies
* of exported classpath entries to avoid possible side-effects ever after.
*/
private void computeExpandedClasspath(
- JavaProject initialProject,
+ JavaProject initialProject,
boolean ignoreUnresolvedVariable,
boolean generateMarkerOnError,
- HashSet visitedProjects,
- ObjectVector accumulatedEntries) throws JavaModelException {
+ HashSet rootIDs,
+ ObjectVector accumulatedEntries,
+ Map preferredClasspaths,
+ Map preferredOutputs) throws JavaModelException {
- if (visitedProjects.contains(this)){
+ String projectRootId = this.rootID();
+ if (rootIDs.contains(projectRootId)){
return; // break cycles if any
}
- visitedProjects.add(this);
+ rootIDs.add(projectRootId);
- if (generateMarkerOnError && !this.equals(initialProject)){
- generateMarkerOnError = false;
- }
+ IClasspathEntry[] preferredClasspath = preferredClasspaths != null ? (IClasspathEntry[])preferredClasspaths.get(this) : null;
+ IPath preferredOutput = preferredOutputs != null ? (IPath)preferredOutputs.get(this) : null;
IClasspathEntry[] immediateClasspath =
- getResolvedClasspath(ignoreUnresolvedVariable, generateMarkerOnError);
+ preferredClasspath != null
+ ? getResolvedClasspath(preferredClasspath, preferredOutput, ignoreUnresolvedVariable, generateMarkerOnError, null)
+ : getResolvedClasspath(ignoreUnresolvedVariable, generateMarkerOnError, false/*don't returnResolutionInProgress*/);
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ boolean isInitialProject = this.equals(initialProject);
for (int i = 0, length = immediateClasspath.length; i < length; i++){
- IClasspathEntry entry = immediateClasspath[i];
-
- boolean isInitialProject = this.equals(initialProject);
+ ClasspathEntry entry = (ClasspathEntry) immediateClasspath[i];
if (isInitialProject || entry.isExported()){
+ String rootID = entry.rootID();
+ if (rootIDs.contains(rootID)) {
+ continue;
+ }
accumulatedEntries.add(entry);
// recurse in project to get all its indirect exports (only consider exported entries from there on)
- if (entry.getEntryKind() == ClasspathEntry.CPE_PROJECT) {
+ if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
IResource member = workspaceRoot.findMember(entry.getPath());
if (member != null && member.getType() == IResource.PROJECT){ // double check if bound to project (23977)
IProject projRsc = (IProject) member;
if (JavaProject.hasJavaNature(projRsc)) {
- JavaProject project = (JavaProject) JavaCore.create(projRsc);
- project.computeExpandedClasspath(
+ JavaProject javaProject = (JavaProject) JavaCore.create(projRsc);
+ javaProject.computeExpandedClasspath(
initialProject,
ignoreUnresolvedVariable,
- generateMarkerOnError,
- visitedProjects,
- accumulatedEntries);
+ false /* no marker when recursing in prereq*/,
+ rootIDs,
+ accumulatedEntries,
+ preferredClasspaths,
+ preferredOutputs);
}
}
+ } else {
+ rootIDs.add(rootID);
}
}
}
}
+ /**
+ * Internal computation of an expanded classpath. It will eliminate duplicates, and produce copies
+ * of exported classpath entries to avoid possible side-effects ever after.
+ */
+// private void computeExpandedClasspath(
+// JavaProject initialProject,
+// boolean ignoreUnresolvedVariable,
+// boolean generateMarkerOnError,
+// HashSet visitedProjects,
+// ObjectVector accumulatedEntries) throws JavaModelException {
+//
+// if (visitedProjects.contains(this)){
+// return; // break cycles if any
+// }
+// visitedProjects.add(this);
+//
+// if (generateMarkerOnError && !this.equals(initialProject)){
+// generateMarkerOnError = false;
+// }
+// IClasspathEntry[] immediateClasspath =
+// getResolvedClasspath(ignoreUnresolvedVariable, generateMarkerOnError);
+//
+// IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+// for (int i = 0, length = immediateClasspath.length; i < length; i++){
+// IClasspathEntry entry = immediateClasspath[i];
+//
+// boolean isInitialProject = this.equals(initialProject);
+// if (isInitialProject || entry.isExported()){
+//
+// accumulatedEntries.add(entry);
+//
+// // recurse in project to get all its indirect exports (only consider exported entries from there on)
+// if (entry.getEntryKind() == ClasspathEntry.CPE_PROJECT) {
+// IResource member = workspaceRoot.findMember(entry.getPath());
+// if (member != null && member.getType() == IResource.PROJECT){ // double check if bound to project (23977)
+// IProject projRsc = (IProject) member;
+// if (JavaProject.hasJavaNature(projRsc)) {
+// JavaProject project = (JavaProject) JavaCore.create(projRsc);
+// project.computeExpandedClasspath(
+// initialProject,
+// ignoreUnresolvedVariable,
+// generateMarkerOnError,
+// visitedProjects,
+// accumulatedEntries);
+// }
+// }
+// }
+// }
+// }
+// }
/**
* Returns (local/all) the package fragment roots identified by the given project's classpath.
@@ -1301,38 +1366,95 @@ public class JavaProject
* This is a helper method returning the expanded classpath for the project, as a list of classpath entries,
* where all classpath variable entries have been resolved and substituted with their final target entries.
* All project exports have been appended to project entries.
+ * @param ignoreUnresolvedVariable boolean
+ * @return IClasspathEntry[]
+ * @throws JavaModelException
*/
public IClasspathEntry[] getExpandedClasspath(boolean ignoreUnresolvedVariable) throws JavaModelException {
- return getExpandedClasspath(ignoreUnresolvedVariable, false);
+ return getExpandedClasspath(ignoreUnresolvedVariable, false/*don't create markers*/, null, null);
}
+ /*
+ * @see JavaElement
+ */
+ public IJavaElement getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner owner) {
+ switch (token.charAt(0)) {
+ case JEM_COUNT:
+ return getHandleUpdatingCountFromMemento(memento, owner);
+ case JEM_PACKAGEFRAGMENTROOT:
+ String rootPath = IPackageFragmentRoot.DEFAULT_PACKAGEROOT_PATH;
+ token = null;
+ while (memento.hasMoreTokens()) {
+ token = memento.nextToken();
+ char firstChar = token.charAt(0);
+ if (firstChar != JEM_PACKAGEFRAGMENT && firstChar != JEM_COUNT) {
+ rootPath += token;
+ } else {
+ break;
+ }
+ }
+ JavaElement root = (JavaElement)getPackageFragmentRoot(new Path(rootPath));
+ if (token != null && token.charAt(0) == JEM_PACKAGEFRAGMENT) {
+ return root.getHandleFromMemento(token, memento, owner);
+ } else {
+ return root.getHandleFromMemento(memento, owner);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the char
that marks the start of this handles
+ * contribution to a memento.
+ */
+ protected char getHandleMementoDelimiter() {
+
+ return JEM_JAVAPROJECT;
+ }
+
/**
* Internal variant which can create marker on project for invalid entries,
* it will also perform classpath expansion in presence of project prerequisites
* exporting their entries.
+ * @param ignoreUnresolvedVariable boolean
+ * @param generateMarkerOnError boolean
+ * @param preferredClasspaths Map
+ * @param preferredOutputs Map
+ * @return IClasspathEntry[]
+ * @throws JavaModelException
*/
public IClasspathEntry[] getExpandedClasspath(
boolean ignoreUnresolvedVariable,
- boolean generateMarkerOnError) throws JavaModelException {
+ boolean generateMarkerOnError,
+ Map preferredClasspaths,
+ Map preferredOutputs) throws JavaModelException {
ObjectVector accumulatedEntries = new ObjectVector();
- computeExpandedClasspath(this, ignoreUnresolvedVariable, generateMarkerOnError, new HashSet(5), accumulatedEntries);
+ computeExpandedClasspath(this, ignoreUnresolvedVariable, generateMarkerOnError, new HashSet(5), accumulatedEntries, preferredClasspaths, preferredOutputs);
IClasspathEntry[] expandedPath = new IClasspathEntry[accumulatedEntries.size()];
accumulatedEntries.copyInto(expandedPath);
return expandedPath;
}
-
- /**
- * Returns the char
that marks the start of this handles
- * contribution to a memento.
- */
- protected char getHandleMementoDelimiter() {
-
- return JEM_JAVAPROJECT;
- }
+// /**
+// * Internal variant which can create marker on project for invalid entries,
+// * it will also perform classpath expansion in presence of project prerequisites
+// * exporting their entries.
+// */
+// public IClasspathEntry[] getExpandedClasspath(
+// boolean ignoreUnresolvedVariable,
+// boolean generateMarkerOnError) throws JavaModelException {
+//
+// ObjectVector accumulatedEntries = new ObjectVector();
+// computeExpandedClasspath(this, ignoreUnresolvedVariable, generateMarkerOnError, new HashSet(5), accumulatedEntries);
+//
+// IClasspathEntry[] expandedPath = new IClasspathEntry[accumulatedEntries.size()];
+// accumulatedEntries.copyInto(expandedPath);
+//
+// return expandedPath;
+// }
/**
* Find the specific Java command amongst the build spec of a given description
@@ -1405,7 +1527,7 @@ public class JavaProject
// }
/**
- * @see org.eclipse.jdt.core.IJavaProject#getOption(String, boolean)
+ * @see net.sourceforge.phpdt.core.IJavaProject#getOption(String, boolean)
*/
public String getOption(String optionName, boolean inheritJavaCoreOptions) {
@@ -1421,7 +1543,7 @@ public class JavaProject
}
/**
- * @see org.eclipse.jdt.core.IJavaProject#getOptions(boolean)
+ * @see net.sourceforge.phpdt.core.IJavaProject#getOptions(boolean)
*/
public Map getOptions(boolean inheritJavaCoreOptions) {
@@ -1456,21 +1578,48 @@ public class JavaProject
/**
* @see IJavaProject
*/
+// public IPath getOutputLocation() throws JavaModelException {
+//
+// JavaModelManager.PerProjectInfo perProjectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfoCheckExistence(project);
+// IPath outputLocation = perProjectInfo.outputLocation;
+// if (outputLocation != null) return outputLocation;
+//
+// // force to read classpath - will position output location as well
+// this.getRawClasspath();
+// outputLocation = perProjectInfo.outputLocation;
+// if (outputLocation == null) {
+// return defaultOutputLocation();
+// }
+// return outputLocation;
+// }
+ /**
+ * @see IJavaProject
+ */
public IPath getOutputLocation() throws JavaModelException {
+ // Do not create marker but log problems while getting output location
+ return this.getOutputLocation(false, true);
+ }
+
+ /**
+ * @param createMarkers boolean
+ * @param logProblems boolean
+ * @return IPath
+ * @throws JavaModelException
+ */
+ public IPath getOutputLocation(boolean createMarkers, boolean logProblems) throws JavaModelException {
- JavaModelManager.PerProjectInfo perProjectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfoCheckExistence(project);
+ JavaModelManager.PerProjectInfo perProjectInfo = getPerProjectInfo();
IPath outputLocation = perProjectInfo.outputLocation;
if (outputLocation != null) return outputLocation;
// force to read classpath - will position output location as well
- this.getRawClasspath();
+ this.getRawClasspath(createMarkers, logProblems);
outputLocation = perProjectInfo.outputLocation;
if (outputLocation == null) {
return defaultOutputLocation();
}
return outputLocation;
}
-
/**
* @return A handle to the package fragment root identified by the given path.
* This method is handle-only and the element may or may not exist. Returns
@@ -1638,6 +1787,10 @@ public class JavaProject
return this.getProject().getFullPath();
}
+ public JavaModelManager.PerProjectInfo getPerProjectInfo() throws JavaModelException {
+ return JavaModelManager.getJavaModelManager().getPerProjectInfoCheckExistence(this.project);
+ }
+
/**
* @see IJavaProject
*/
@@ -1694,13 +1847,61 @@ public class JavaProject
/**
* @see IJavaProject
*/
+// public IClasspathEntry[] getRawClasspath() throws JavaModelException {
+//
+// JavaModelManager.PerProjectInfo perProjectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfoCheckExistence(project);
+// IClasspathEntry[] classpath = perProjectInfo.classpath;
+// if (classpath != null) return classpath;
+// classpath = this.readClasspathFile(false/*don't create markers*/, true/*log problems*/);
+//
+// // extract out the output location
+// IPath outputLocation = null;
+// if (classpath != null && classpath.length > 0) {
+// IClasspathEntry entry = classpath[classpath.length - 1];
+// if (entry.getContentKind() == ClasspathEntry.K_OUTPUT) {
+// outputLocation = entry.getPath();
+// IClasspathEntry[] copy = new IClasspathEntry[classpath.length - 1];
+// System.arraycopy(classpath, 0, copy, 0, copy.length);
+// classpath = copy;
+// }
+// }
+// if (classpath == null) {
+// return defaultClasspath();
+// }
+// /* Disable validate: classpath can contain CP variables and container that need to be resolved
+// if (classpath != INVALID_CLASSPATH
+// && !JavaConventions.validateClasspath(this, classpath, outputLocation).isOK()) {
+// classpath = INVALID_CLASSPATH;
+// }
+// */
+// perProjectInfo.classpath = classpath;
+// perProjectInfo.outputLocation = outputLocation;
+// return classpath;
+// }
+ /**
+ * @see IJavaProject
+ */
public IClasspathEntry[] getRawClasspath() throws JavaModelException {
+ // Do not create marker but log problems while getting raw classpath
+ return getRawClasspath(false, true);
+ }
- JavaModelManager.PerProjectInfo perProjectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfoCheckExistence(project);
- IClasspathEntry[] classpath = perProjectInfo.classpath;
- if (classpath != null) return classpath;
- classpath = this.readClasspathFile(false/*don't create markers*/, true/*log problems*/);
-
+ /*
+ * Internal variant allowing to parameterize problem creation/logging
+ */
+ public IClasspathEntry[] getRawClasspath(boolean createMarkers, boolean logProblems) throws JavaModelException {
+
+ JavaModelManager.PerProjectInfo perProjectInfo = null;
+ IClasspathEntry[] classpath;
+ if (createMarkers) {
+ this.flushClasspathProblemMarkers(false/*cycle*/, true/*format*/);
+ classpath = this.readClasspathFile(createMarkers, logProblems);
+ } else {
+ perProjectInfo = getPerProjectInfo();
+ classpath = perProjectInfo.rawClasspath;
+ if (classpath != null) return classpath;
+ classpath = this.readClasspathFile(createMarkers, logProblems);
+ }
// extract out the output location
IPath outputLocation = null;
if (classpath != null && classpath.length > 0) {
@@ -1721,11 +1922,13 @@ public class JavaProject
classpath = INVALID_CLASSPATH;
}
*/
- perProjectInfo.classpath = classpath;
- perProjectInfo.outputLocation = outputLocation;
+ if (!createMarkers) {
+ perProjectInfo.rawClasspath = classpath;
+ perProjectInfo.outputLocation = outputLocation;
+ }
return classpath;
}
-
+
/**
* @see IJavaProject#getRequiredProjectNames
*/
@@ -1754,39 +1957,108 @@ public class JavaProject
boolean ignoreUnresolvedEntry,
boolean generateMarkerOnError)
throws JavaModelException {
+ return
+ getResolvedClasspath(
+ ignoreUnresolvedEntry,
+ generateMarkerOnError,
+ true // returnResolutionInProgress
+ );
+// JavaModelManager manager = JavaModelManager.getJavaModelManager();
+// JavaModelManager.PerProjectInfo perProjectInfo = manager.getPerProjectInfoCheckExistence(project);
+//
+// // reuse cache if not needing to refresh markers or checking bound variables
+// if (ignoreUnresolvedEntry && !generateMarkerOnError && perProjectInfo != null){
+// // resolved path is cached on its info
+// IClasspathEntry[] infoPath = perProjectInfo.lastResolvedClasspath;
+// if (infoPath != null) return infoPath;
+// }
+// Map reverseMap = perProjectInfo == null ? null : new HashMap(5);
+// IClasspathEntry[] resolvedPath = getResolvedClasspath(
+// getRawClasspath(),
+// generateMarkerOnError ? getOutputLocation() : null,
+// ignoreUnresolvedEntry,
+// generateMarkerOnError,
+// reverseMap);
+//
+// if (perProjectInfo != null){
+// if (perProjectInfo.classpath == null // .classpath file could not be read
+// && generateMarkerOnError
+// && JavaProject.hasJavaNature(project)) {
+// this.createClasspathProblemMarker(new JavaModelStatus(
+// IJavaModelStatusConstants.INVALID_CLASSPATH_FILE_FORMAT,
+// Util.bind("classpath.cannotReadClasspathFile", this.getElementName()))); //$NON-NLS-1$
+// }
+//
+// perProjectInfo.lastResolvedClasspath = resolvedPath;
+// perProjectInfo.resolvedPathToRawEntries = reverseMap;
+// }
+// return resolvedPath;
+ }
+ /*
+ * Internal variant which can create marker on project for invalid entries
+ * and caches the resolved classpath on perProjectInfo.
+ * If requested, return a special classpath (RESOLUTION_IN_PROGRESS) if the classpath is being resolved.
+ */
+ public IClasspathEntry[] getResolvedClasspath(
+ boolean ignoreUnresolvedEntry,
+ boolean generateMarkerOnError,
+ boolean returnResolutionInProgress)
+ throws JavaModelException {
- JavaModelManager manager = JavaModelManager.getJavaModelManager();
- JavaModelManager.PerProjectInfo perProjectInfo = manager.getPerProjectInfoCheckExistence(project);
-
- // reuse cache if not needing to refresh markers or checking bound variables
- if (ignoreUnresolvedEntry && !generateMarkerOnError && perProjectInfo != null){
- // resolved path is cached on its info
- IClasspathEntry[] infoPath = perProjectInfo.lastResolvedClasspath;
- if (infoPath != null) return infoPath;
+ JavaModelManager manager = JavaModelManager.getJavaModelManager();
+ JavaModelManager.PerProjectInfo perProjectInfo = null;
+ if (ignoreUnresolvedEntry && !generateMarkerOnError) {
+ perProjectInfo = getPerProjectInfo();
+ if (perProjectInfo != null) {
+ // resolved path is cached on its info
+ IClasspathEntry[] infoPath = perProjectInfo.resolvedClasspath;
+ if (infoPath != null) {
+ return infoPath;
+ } else if (returnResolutionInProgress && manager.isClasspathBeingResolved(this)) {
+ if (JavaModelManager.CP_RESOLVE_VERBOSE) {
+ Util.verbose(
+ "CPResolution: reentering raw classpath resolution, will use empty classpath instead" + //$NON-NLS-1$
+ " project: " + getElementName() + '\n' + //$NON-NLS-1$
+ " invocation stack trace:"); //$NON-NLS-1$
+ new Exception("null
if none could be found.
- *
- * @param sourceAttachmentPath the given absolute path to the source archive or folder
- * @return the computed source attachment root path or null if none could be found
- * @throws JavaModelException
- */
-//public IPath computeSourceAttachmentRootPath(IPath sourceAttachmentPath) throws JavaModelException {
-// IPath sourcePath = this.getSourceAttachmentPath();
-// if (sourcePath == null) return null;
-// SourceMapper mapper =
-// new SourceMapper(
-// sourcePath,
-// null, // detect root path
-// this.isExternal() ? JavaCore.getOptions() : this.getJavaProject().getOptions(true) // only project options if associated with resource
-// );
-// if (mapper.rootPath == null) return null;
-// return new Path(mapper.rootPath);
-//}
-/*
- * @see org.eclipse.jdt.core.IPackageFragmentRoot#copy
- */
-//public void copy(
-// IPath destination,
-// int updateResourceFlags,
-// int updateModelFlags,
-// IClasspathEntry sibling,
-// IProgressMonitor monitor)
-// throws JavaModelException {
-//
-// CopyPackageFragmentRootOperation op =
-// new CopyPackageFragmentRootOperation(this, destination, updateResourceFlags, updateModelFlags, sibling);
-// runOperation(op, monitor);
-//}
-
-
-
- /**
- * Returns a new element info for this element.
- */
- protected Object createElementInfo() {
- return new PackageFragmentRootInfo();
- }
-
-/**
- * @see IPackageFragmentRoot
- */
-//public IPackageFragment createPackageFragment(String name, boolean force, IProgressMonitor monitor) throws JavaModelException {
-// CreatePackageFragmentOperation op = new CreatePackageFragmentOperation(this, name, force);
-// runOperation(op, monitor);
-// return getPackageFragment(name);
-//}
-
-/**
- * Returns the root's kind - K_SOURCE or K_BINARY, defaults
- * to K_SOURCE if it is not on the classpath.
- *
- * @exception NotPresentException if the project and root do
- * not exist.
- */
-//protected int determineKind(IResource underlyingResource) throws JavaModelException {
-// IClasspathEntry[] entries= ((JavaProject)getJavaProject()).getExpandedClasspath(true);
-// for (int i= 0; i < entries.length; i++) {
-// IClasspathEntry entry= entries[i];
-// if (entry.getPath().equals(underlyingResource.getFullPath())) {
-// return entry.getContentKind();
-// }
-// }
-// return IPackageFragmentRoot.K_SOURCE;
-//}
-
-/**
- * Compares two objects for equality;
- * for
or "\r" or "\r\n",
- * or PackageFragmentRoot
s, equality is having the
- * same JavaModel
, same resources, and occurrence count.
- *
- */
-public boolean equals(Object o) {
- if (this == o)
- return true;
- if (!(o instanceof PackageFragmentRoot))
- return false;
- PackageFragmentRoot other = (PackageFragmentRoot) o;
- return getJavaModel().equals(other.getJavaModel()) &&
- this.resource.equals(other.resource) &&
- occurrenceCount == other.occurrenceCount;
-}
-
-/**
- * @see IJavaElement
- */
-//public boolean exists() {
-// return super.exists()
-// && isOnClasspath();
-//}
-
-//public IClasspathEntry findSourceAttachmentRecommendation() {
-// try {
-// IPath rootPath = this.getPath();
-// IClasspathEntry entry;
-// IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
-//
-// // try on enclosing project first
-// JavaProject parentProject = (JavaProject) getJavaProject();
-// try {
-// entry = parentProject.getClasspathEntryFor(rootPath);
-// if (entry != null){
-// Object target = JavaModel.getTarget(workspaceRoot, entry.getSourceAttachmentPath(), true);
-// if (target instanceof IFile){
-// IFile file = (IFile) target;
-// if (ProjectPrefUtil.isArchiveFileName(file.getName())){
-// return entry;
-// }
-// } else if (target instanceof IFolder) {
-// return entry;
-// }
-// if (target instanceof java.io.File){
-// java.io.File file = (java.io.File) target;
-// if (file.isFile()) {
-// if (ProjectPrefUtil.isArchiveFileName(file.getName())){
-// return entry;
-// }
-// } else {
-// // external directory
-// return entry;
-// }
-// }
-// }
-// } catch(JavaModelException e){
-// }
-//
-// // iterate over all projects
-// IJavaModel model = getJavaModel();
-// IJavaProject[] jProjects = model.getJavaProjects();
-// for (int i = 0, max = jProjects.length; i < max; i++){
-// JavaProject jProject = (JavaProject) jProjects[i];
-// if (jProject == parentProject) continue; // already done
-// try {
-// entry = jProject.getClasspathEntryFor(rootPath);
-// if (entry != null){
-// Object target = JavaModel.getTarget(workspaceRoot, entry.getSourceAttachmentPath(), true);
-// if (target instanceof IFile){
-// IFile file = (IFile) target;
-// if (ProjectPrefUtil.isArchiveFileName(file.getName())){
-// return entry;
-// }
-// } else if (target instanceof IFolder) {
-// return entry;
-// }
-// if (target instanceof java.io.File){
-// java.io.File file = (java.io.File) target;
-// if (file.isFile()) {
-// if (ProjectPrefUtil.isArchiveFileName(file.getName())){
-// return entry;
-// }
-// } else {
-// // external directory
-// return entry;
-// }
-// }
-// }
-// } catch(JavaModelException e){
-// }
-// }
-// } catch(JavaModelException e){
-// }
-//
-// return null;
-//}
-
-/*
- * Returns the exclusion patterns from the classpath entry associated with this root.
- */
-char[][] fullExclusionPatternChars() {
- return null;
-// try {
-
-// if (this.isOpen() && this.getKind() != IPackageFragmentRoot.K_SOURCE) return null;
-// ClasspathEntry entry = (ClasspathEntry)getRawClasspathEntry();
-// if (entry == null) {
-// return null;
-// } else {
-// return entry.fullExclusionPatternChars();
-// }
-// } catch (JavaModelException e) {
-// return null;
-// }
-}
-
-/**
- * @see Openable
- */
-protected boolean generateInfos(OpenableElementInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource) throws JavaModelException {
-
-// ((PackageFragmentRootInfo) info).setRootKind(determineKind(underlyingResource));
-// return computeChildren(info);
- return false;
-}
-
-/**
- * @see JavaElement#getHandleMemento()
- */
-protected char getHandleMementoDelimiter() {
- return JavaElement.JEM_PACKAGEFRAGMENTROOT;
-}
-/**
- * @see IJavaElement
- */
-public int getElementType() {
- return PACKAGE_FRAGMENT_ROOT;
-}
-/**
- * @see JavaElement#getHandleMemento()
- */
-public String getHandleMemento(){
- IPath path;
- IResource resource = getResource();
- if (resource != null) {
- // internal jar or regular root
- if (getResource().getProject().equals(getJavaProject().getProject())) {
- path = resource.getProjectRelativePath();
- } else {
- path = resource.getFullPath();
- }
- } else {
- // external jar
- path = getPath();
- }
- StringBuffer buff= new StringBuffer(((JavaElement)getParent()).getHandleMemento());
- buff.append(getHandleMementoDelimiter());
- buff.append(path.toString());
- return buff.toString();
-}
-/**
- * @see IPackageFragmentRoot
- */
-public int getKind() throws JavaModelException {
- return ((PackageFragmentRootInfo)getElementInfo()).getRootKind();
-}
-
-/**
- * Returns an array of non-java resources contained in the receiver.
- */
-//public Object[] getNonJavaResources() throws JavaModelException {
-// return ((PackageFragmentRootInfo) getElementInfo()).getNonJavaResources(getJavaProject(), getResource(), this);
-//}
-
-/**
- * @see IPackageFragmentRoot
- */
-public IPackageFragment getPackageFragment(String packageName) {
- if (packageName.indexOf(' ') != -1) { // tolerate package names with spaces (e.g. 'x . y') (http://bugs.eclipse.org/bugs/show_bug.cgi?id=21957)
- char[][] compoundName = Util.toCompoundChars(packageName);
- StringBuffer buffer = new StringBuffer(packageName.length());
- for (int i = 0, length = compoundName.length; i < length; i++) {
- buffer.append(CharOperation.trim(compoundName[i]));
- if (i != length-1) {
- buffer.append('.');
- }
- }
- packageName = buffer.toString();
- }
- return new PackageFragment(this, packageName);
-}
-
-/**
- * Returns the package name for the given folder
- * (which is a decendent of this root).
- */
-protected String getPackageName(IFolder folder) throws JavaModelException {
- IPath myPath= getPath();
- IPath pkgPath= folder.getFullPath();
- int mySegmentCount= myPath.segmentCount();
- int pkgSegmentCount= pkgPath.segmentCount();
- StringBuffer name = new StringBuffer(IPackageFragment.DEFAULT_PACKAGE_NAME);
- for (int i= mySegmentCount; i < pkgSegmentCount; i++) {
- if (i > mySegmentCount) {
- name.append('.');
- }
- name.append(pkgPath.segment(i));
- }
- return name.toString();
-}
-
-/**
- * @see IJavaElement
- */
-public IPath getPath() {
- return getResource().getFullPath();
-}
-
-/*
- * @see IPackageFragmentRoot
- */
-//public IClasspathEntry getRawClasspathEntry() throws JavaModelException {
-//
-// IClasspathEntry rawEntry = null;
-// IJavaProject project = this.getJavaProject();
-// project.getResolvedClasspath(true); // force the reverse rawEntry cache to be populated
-// JavaModelManager.PerProjectInfo perProjectInfo =
-// JavaModelManager.getJavaModelManager().getPerProjectInfoCheckExistence(project.getProject());
-// if (perProjectInfo != null && perProjectInfo.resolvedPathToRawEntries != null) {
-// rawEntry = (IClasspathEntry) perProjectInfo.resolvedPathToRawEntries.get(this.getPath());
-// }
-// return rawEntry;
-//}
-
-/*
- * @see IJavaElement
- */
-public IResource getResource() {
- return (IResource)this.resource;
-}
-
-/**
- * @see IPackageFragmentRoot
- */
-//public IPath getSourceAttachmentPath() throws JavaModelException {
-// if (getKind() != K_BINARY) return null;
-//
-// String serverPathString= getSourceAttachmentProperty();
-// if (serverPathString == null) {
-// return null;
-// }
-// int index= serverPathString.lastIndexOf(ATTACHMENT_PROPERTY_DELIMITER);
-// if (index < 0) {
-// // no root path specified
-// return new Path(serverPathString);
-// } else {
-// String serverSourcePathString= serverPathString.substring(0, index);
-// return new Path(serverSourcePathString);
-// }
-//}
-
-/**
- * Returns the server property for this package fragment root's
- * source attachement.
- */
-//protected String getSourceAttachmentProperty() throws JavaModelException {
-// String propertyString = null;
-// QualifiedName qName= getSourceAttachmentPropertyName();
-// try {
-// propertyString = ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(qName);
-//
-// // if no existing source attachment information, then lookup a recommendation from classpath entries
-// if (propertyString == null) {
-// IClasspathEntry recommendation = findSourceAttachmentRecommendation();
-// if (recommendation != null) {
-// IPath rootPath = recommendation.getSourceAttachmentRootPath();
-// propertyString =
-// recommendation.getSourceAttachmentPath().toString()
-// + ((rootPath == null)
-// ? "" : //$NON-NLS-1$
-// (ATTACHMENT_PROPERTY_DELIMITER + rootPath.toString()));
-// setSourceAttachmentProperty(propertyString);
-// } else {
-// // mark as being already looked up
-// setSourceAttachmentProperty(NO_SOURCE_ATTACHMENT);
-// }
-// } else if (NO_SOURCE_ATTACHMENT.equals(propertyString)) {
-// // already looked up and no source attachment found
-// return null;
-// }
-// return propertyString;
-// } catch (CoreException ce) {
-// throw new JavaModelException(ce);
-// }
-//}
-
-/**
- * Returns the qualified name for the source attachment property
- * of this root.
- */
-protected QualifiedName getSourceAttachmentPropertyName() throws JavaModelException {
- return new QualifiedName(JavaCore.PLUGIN_ID, "sourceattachment: " + this.getPath().toOSString()); //$NON-NLS-1$
-}
-
-public void setSourceAttachmentProperty(String property) {
- try {
- ResourcesPlugin.getWorkspace().getRoot().setPersistentProperty(this.getSourceAttachmentPropertyName(), property);
- } catch (CoreException ce) {
- }
-}
-
-/**
- * For use by AttachSourceOperation
only.
- * Sets the source mapper associated with this root.
- */
-//public void setSourceMapper(SourceMapper mapper) throws JavaModelException {
-// ((PackageFragmentRootInfo) getElementInfo()).setSourceMapper(mapper);
-//}
-
-
-
-/**
- * @see IPackageFragmentRoot
- */
-//public IPath getSourceAttachmentRootPath() throws JavaModelException {
-// if (getKind() != K_BINARY) return null;
-//
-// String serverPathString= getSourceAttachmentProperty();
-// if (serverPathString == null) {
-// return null;
-// }
-// int index = serverPathString.lastIndexOf(ATTACHMENT_PROPERTY_DELIMITER);
-// if (index == -1) return null;
-// String serverRootPathString= IPackageFragmentRoot.DEFAULT_PACKAGEROOT_PATH;
-// if (index != serverPathString.length() - 1) {
-// serverRootPathString= serverPathString.substring(index + 1);
-// }
-// return new Path(serverRootPathString);
-//}
-
-/**
- * @see JavaElement
- */
-//public SourceMapper getSourceMapper() {
-// SourceMapper mapper;
-// try {
-// PackageFragmentRootInfo rootInfo = (PackageFragmentRootInfo) getElementInfo();
-// mapper = rootInfo.getSourceMapper();
-// if (mapper == null) {
-// // first call to this method
-// IPath sourcePath= getSourceAttachmentPath();
-// if (sourcePath != null) {
-// IPath rootPath= getSourceAttachmentRootPath();
-// mapper = this.createSourceMapper(sourcePath, rootPath);
-// if (rootPath == null && mapper.rootPath != null) {
-// // as a side effect of calling the SourceMapper constructor, the root path was computed
-// rootPath = new Path(mapper.rootPath);
-//
-// //set the property to the path of the mapped source
-// this.setSourceAttachmentProperty(
-// sourcePath.toString()
-// + ATTACHMENT_PROPERTY_DELIMITER
-// + rootPath.toString());
-// }
-// rootInfo.setSourceMapper(mapper);
-// } else {
-// // remember that no source is attached
-// rootInfo.setSourceMapper(NO_SOURCE_MAPPER);
-// mapper = null;
-// }
-// } else if (mapper == NO_SOURCE_MAPPER) {
-// // a previous call to this method found out that no source was attached
-// mapper = null;
-// }
-// } catch (JavaModelException e) {
-// // no source can be attached
-// mapper = null;
-// }
-// return mapper;
-//}
-
-/**
- * @see IJavaElement
- */
-public IResource getUnderlyingResource() throws JavaModelException {
- if (!exists()) throw newNotPresentException();
- return getResource();
-}
-
-public int hashCode() {
- return this.resource.hashCode();
-}
-
-/**
- * @see IPackageFragmentRoot
- */
-public boolean isArchive() {
- return false;
-}
-
-/**
- * @see IPackageFragmentRoot
- */
-public boolean isExternal() {
- return false;
-}
-
-/*
- * Returns whether this package fragment root is on the classpath of its project.
- */
-//protected boolean isOnClasspath() {
-// if (this.getElementType() == IJavaElement.JAVA_PROJECT){
-// return true;
-// }
-//
-// IPath path = this.getPath();
-// try {
-// // check package fragment root on classpath of its project
-// IJavaProject project = this.getJavaProject();
-// IClasspathEntry[] classpath = project.getResolvedClasspath(true);
-// for (int i = 0, length = classpath.length; i < length; i++) {
-// IClasspathEntry entry = classpath[i];
-// if (entry.getPath().equals(path)) {
-// return true;
-// }
-// }
-// } catch(JavaModelException e){
-// // could not read classpath, then assume it is outside
-// }
-// return false;
-//}
-/*
- * @see org.eclipse.jdt.core.IPackageFragmentRoot#move
- */
-//public void move(
-// IPath destination,
-// int updateResourceFlags,
-// int updateModelFlags,
-// IClasspathEntry sibling,
-// IProgressMonitor monitor)
-// throws JavaModelException {
-//
-// MovePackageFragmentRootOperation op =
-// new MovePackageFragmentRootOperation(this, destination, updateResourceFlags, updateModelFlags, sibling);
-// runOperation(op, monitor);
-//}
-//
-//
-//protected void openWhenClosed(IProgressMonitor pm) throws JavaModelException {
-// if (!this.resourceExists()
-// || !this.isOnClasspath()) {
-// throw newNotPresentException();
-// }
-// super.openWhenClosed(pm);
-//}
-
-/**
- * Recomputes the children of this element, based on the current state
- * of the workbench.
- */
-//public void refreshChildren() {
-// try {
-// OpenableElementInfo info= (OpenableElementInfo)getElementInfo();
-// computeChildren(info);
-// } catch (JavaModelException e) {
-// // do nothing.
-// }
-//}
-
-///*
-// * @see JavaElement#rootedAt(IJavaProject)
-// */
-//public IJavaElement rootedAt(IJavaProject project) {
-// return
-// new PackageFragmentRoot(
-// getResource(),
-// project,
-// name);
-//}
-
-/**
- * @private Debugging purposes
- */
-protected void toStringInfo(int tab, StringBuffer buffer, Object info) {
- buffer.append(this.tabString(tab));
- if (getElementName().length() == 0) {
- buffer.append("[project root]"); //$NON-NLS-1$
- } else {
- IPath path = getPath();
- if (getJavaProject().getElementName().equals(path.segment(0))) {
- buffer.append(path.removeFirstSegments(1).makeRelative());
- } else {
- buffer.append(path);
- }
- }
- if (info == null) {
- buffer.append(" (not open)"); //$NON-NLS-1$
- }
-}
-
-/**
- * Possible failures:
- *
- */
-//protected void verifyAttachSource(IPath sourcePath) throws JavaModelException {
-// if (!exists()) {
-// throw newNotPresentException();
-// } else if (this.getKind() != K_BINARY) {
-// throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_ELEMENT_TYPES, this));
-// } else if (sourcePath != null && !sourcePath.isAbsolute()) {
-// throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.RELATIVE_PATH, sourcePath));
-// }
-//}
-
-}
+ /**
+ * The delimiter between the source path and root path in the attachment server property.
+ */
+ protected final static char ATTACHMENT_PROPERTY_DELIMITER = '*';
+
+ /*
+ * No source attachment property
+ */
+ protected final static String NO_SOURCE_ATTACHMENT = ""; //$NON-NLS-1$
+
+ /*
+ * No source mapper singleton
+ */
+ // protected final static SourceMapper NO_SOURCE_MAPPER = new SourceMapper();
+ /**
+ * The resource associated with this root. (an IResource or a java.io.File (for external jar only))
+ */
+ protected Object resource;
+
+ /**
+ * Constructs a package fragment root which is the root of the java package directory hierarchy.
+ */
+ protected PackageFragmentRoot(IResource resource, JavaProject project, String name) {
+ super(project, name);
+ this.resource = resource;
+ }
+
+ /**
+ * @see Openable
+ */
+ protected boolean buildStructure(OpenableElementInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource)
+ throws JavaModelException {
+
+ // check whether this pkg fragment root can be opened
+ if (!resourceExists()) { //|| !isOnClasspath()) {
+ throw newNotPresentException();
+ }
+
+ ((PackageFragmentRootInfo) info).setRootKind(determineKind(underlyingResource));
+ return computeChildren(info, newElements);
+ }
+
+ /**
+ * Returns the root's kind - K_SOURCE or K_BINARY, defaults to K_SOURCE if it is not on the classpath.
+ *
+ * @exception NotPresentException
+ * if the project and root do not exist.
+ */
+ protected int determineKind(IResource underlyingResource) throws JavaModelException {
+ // IClasspathEntry[] entries= ((JavaProject)getJavaProject()).getExpandedClasspath(true);
+ // for (int i= 0; i < entries.length; i++) {
+ // IClasspathEntry entry= entries[i];
+ // if (entry.getPath().equals(underlyingResource.getFullPath())) {
+ // return entry.getContentKind();
+ // }
+ // }
+ return IPackageFragmentRoot.K_SOURCE;
+ }
+
+ /**
+ * Compute the package fragment children of this package fragment root.
+ *
+ * @exception JavaModelException
+ * The resource associated with this package fragment root does not exist
+ */
+ protected boolean computeChildren(OpenableElementInfo info, Map newElements) throws JavaModelException {
+ // Note the children are not opened (so not added to newElements) for a regular package fragment root
+ // Howver they are opened for a Jar package fragment root (see JarPackageFragmentRoot#computeChildren)
+ try {
+ // the underlying resource may be a folder or a project (in the case that the project folder
+ // is actually the package fragment root)
+ IResource underlyingResource = getResource();
+ if (underlyingResource.getType() == IResource.FOLDER || underlyingResource.getType() == IResource.PROJECT) {
+ ArrayList vChildren = new ArrayList(5);
+ IContainer rootFolder = (IContainer) underlyingResource;
+ // char[][] inclusionPatterns = fullInclusionPatternChars();
+ char[][] exclusionPatterns = fullExclusionPatternChars();
+ computeFolderChildren(rootFolder, !Util.isExcluded(rootFolder, exclusionPatterns), "", vChildren, exclusionPatterns); //$NON-NLS-1$
+
+ IJavaElement[] children = new IJavaElement[vChildren.size()];
+ vChildren.toArray(children);
+ info.setChildren(children);
+ }
+ } catch (JavaModelException e) {
+ //problem resolving children; structure remains unknown
+ info.setChildren(new IJavaElement[] {});
+ throw e;
+ }
+ return true;
+ }
+
+ /**
+ * Starting at this folder, create package fragments and add the fragments that are not exclused to the collection of children.
+ *
+ * @exception JavaModelException
+ * The resource associated with this package fragment does not exist
+ */
+ protected void computeFolderChildren(IContainer folder, boolean isIncluded, String prefix, ArrayList vChildren,
+ char[][] exclusionPatterns) throws JavaModelException {
+ //, char[][] inclusionPatterns, char[][] exclusionPatterns) throws JavaModelException {
+
+ if (isIncluded) {
+ IPackageFragment pkg = getPackageFragment(prefix);
+ vChildren.add(pkg);
+ }
+ try {
+ JavaProject javaProject = (JavaProject) getJavaProject();
+ IResource[] members = folder.members();
+ boolean hasIncluded = isIncluded;
+ for (int i = 0, max = members.length; i < max; i++) {
+ IResource member = members[i];
+ String memberName = member.getName();
+
+ switch (member.getType()) {
+
+ case IResource.FOLDER:
+ if (Util.isValidFolderNameForPackage(memberName)) {
+ boolean isMemberIncluded = !Util.isExcluded(member, exclusionPatterns);
+ // keep looking inside as long as included already, or may have child included due to inclusion patterns
+ // if (isMemberIncluded || inclusionPatterns != null) {
+ // // eliminate binary output only if nested inside direct subfolders
+ // if (javaProject.contains(member)) {
+ // String newPrefix;
+ // if (prefix.length() == 0) {
+ // newPrefix = memberName;
+ // } else {
+ // newPrefix = prefix + "." + memberName; //$NON-NLS-1$
+ // }
+ // computeFolderChildren((IFolder) member, isMemberIncluded, newPrefix, vChildren, inclusionPatterns,
+ // exclusionPatterns);
+ // }
+ // }
+ }
+ break;
+ case IResource.FILE:
+ // inclusion filter may only include files, in which case we still want to include the immediate parent package (lazily)
+ if (!hasIncluded && Util.isValidCompilationUnitName(memberName) && !Util.isExcluded(member, exclusionPatterns)) {
+ hasIncluded = true;
+ IPackageFragment pkg = getPackageFragment(prefix);
+ vChildren.add(pkg);
+ }
+ break;
+ }
+ }
+ } catch (IllegalArgumentException e) {
+ throw new JavaModelException(e, IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST); // could be thrown by ElementTree when path
+ // is not found
+ } catch (CoreException e) {
+ throw new JavaModelException(e);
+ }
+ }
+
+ /**
+ * @see IPackageFragmentRoot
+ */
+ //public void attachSource(IPath sourcePath, IPath rootPath, IProgressMonitor monitor) throws JavaModelException {
+ // try {
+ // verifyAttachSource(sourcePath);
+ // if (monitor != null) {
+ // monitor.beginTask(ProjectPrefUtil.bind("element.attachingSource"), 2); //$NON-NLS-1$
+ // }
+ // SourceMapper oldMapper= getSourceMapper();
+ // IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ // boolean rootNeedsToBeClosed= false;
+ //
+ // if (sourcePath == null) {
+ // //source being detached
+ // rootNeedsToBeClosed= true;
+ // setSourceMapper(null);
+ // /* Disable deltas (see 1GDTUSD)
+ // // fire a delta to notify the UI about the source detachement.
+ // JavaModelManager manager = (JavaModelManager) JavaModelManager.getJavaModelManager();
+ // JavaModel model = (JavaModel) getJavaModel();
+ // JavaElementDelta attachedSourceDelta = new JavaElementDelta(model);
+ // attachedSourceDelta .sourceDetached(this); // this would be a PackageFragmentRoot
+ // manager.registerResourceDelta(attachedSourceDelta );
+ // manager.fire(); // maybe you want to fire the change later. Let us know about it.
+ // */
+ // } else {
+ // /*
+ // // fire a delta to notify the UI about the source attachement.
+ // JavaModelManager manager = (JavaModelManager) JavaModelManager.getJavaModelManager();
+ // JavaModel model = (JavaModel) getJavaModel();
+ // JavaElementDelta attachedSourceDelta = new JavaElementDelta(model);
+ // attachedSourceDelta .sourceAttached(this); // this would be a PackageFragmentRoot
+ // manager.registerResourceDelta(attachedSourceDelta );
+ // manager.fire(); // maybe you want to fire the change later. Let us know about it.
+ // */
+ //
+ // //check if different from the current attachment
+ // IPath storedSourcePath= getSourceAttachmentPath();
+ // IPath storedRootPath= getSourceAttachmentRootPath();
+ // if (monitor != null) {
+ // monitor.worked(1);
+ // }
+ // if (storedSourcePath != null) {
+ // if (!(storedSourcePath.equals(sourcePath) && (rootPath != null && rootPath.equals(storedRootPath)) || storedRootPath == null))
+ // {
+ // rootNeedsToBeClosed= true;
+ // }
+ // }
+ // // check if source path is valid
+ // Object target = JavaModel.getTarget(workspace.getRoot(), sourcePath, false);
+ // if (target == null) {
+ // if (monitor != null) {
+ // monitor.done();
+ // }
+ // throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_PATH, sourcePath));
+ // }
+ // SourceMapper mapper = createSourceMapper(sourcePath, rootPath);
+ // if (rootPath == null && mapper.rootPath != null) {
+ // // as a side effect of calling the SourceMapper constructor, the root path was computed
+ // rootPath = new Path(mapper.rootPath);
+ // }
+ // setSourceMapper(mapper);
+ // }
+ // if (sourcePath == null) {
+ // setSourceAttachmentProperty(null); //remove the property
+ // } else {
+ // //set the property to the path of the mapped source
+ // setSourceAttachmentProperty(
+ // sourcePath.toString()
+ // + (rootPath == null ? "" : (ATTACHMENT_PROPERTY_DELIMITER + rootPath.toString()))); //$NON-NLS-1$
+ // }
+ // if (rootNeedsToBeClosed) {
+ // if (oldMapper != null) {
+ // oldMapper.close();
+ // }
+ // BufferManager manager= BufferManager.getDefaultBufferManager();
+ // Enumeration openBuffers= manager.getOpenBuffers();
+ // while (openBuffers.hasMoreElements()) {
+ // IBuffer buffer= (IBuffer) openBuffers.nextElement();
+ // IOpenable possibleMember= buffer.getOwner();
+ // if (isAncestorOf((IJavaElement) possibleMember)) {
+ // buffer.close();
+ // }
+ // }
+ // if (monitor != null) {
+ // monitor.worked(1);
+ // }
+ // }
+ // } catch (JavaModelException e) {
+ // setSourceAttachmentProperty(null); // loose info - will be recomputed
+ // throw e;
+ // } finally {
+ // if (monitor != null) {
+ // monitor.done();
+ // }
+ // }
+ //}
+ //SourceMapper createSourceMapper(IPath sourcePath, IPath rootPath) {
+ // SourceMapper mapper = new SourceMapper(
+ // sourcePath,
+ // rootPath == null ? null : rootPath.toOSString(),
+ // this.isExternal() ? JavaCore.getOptions() : this.getJavaProject().getOptions(true)); // only project options if associated with
+ // resource
+ // return mapper;
+ //}
+ /*
+ * @see net.sourceforge.phpdt.core.IPackageFragmentRoot#delete
+ */
+ //public void delete(
+ // int updateResourceFlags,
+ // int updateModelFlags,
+ // IProgressMonitor monitor)
+ // throws JavaModelException {
+ //
+ // DeletePackageFragmentRootOperation op = new DeletePackageFragmentRootOperation(this, updateResourceFlags, updateModelFlags);
+ // runOperation(op, monitor);
+ //}
+ /**
+ * This root is being closed. If this root has an associated source attachment, close it too.
+ *
+ * @see JavaElement
+ */
+ //protected void closing(Object info) throws JavaModelException { TODO remove after 2.1
+ // ((PackageFragmentRootInfo) info).sourceMapper = null;
+ // super.closing(info);
+ //}
+ /**
+ * Compute the package fragment children of this package fragment root.
+ *
+ * @exception JavaModelException
+ * The resource associated with this package fragment root does not exist
+ */
+ //protected boolean computeChildren(OpenableElementInfo info) throws JavaModelException {
+ // try {
+ // // the underlying resource may be a folder or a project (in the case that the project folder
+ // // is actually the package fragment root)
+ // IResource resource = getResource();
+ // if (resource.getType() == IResource.FOLDER || resource.getType() == IResource.PROJECT) {
+ // ArrayList vChildren = new ArrayList(5);
+ // char[][] exclusionPatterns = fullExclusionPatternChars();
+ // computeFolderChildren((IContainer) resource, "", vChildren, exclusionPatterns); //$NON-NLS-1$
+ // IJavaElement[] children = new IJavaElement[vChildren.size()];
+ // vChildren.toArray(children);
+ // info.setChildren(children);
+ // }
+ // } catch (JavaModelException e) {
+ // //problem resolving children; structure remains unknown
+ // info.setChildren(new IJavaElement[]{});
+ // throw e;
+ // }
+ // return true;
+ //}
+ /**
+ * Starting at this folder, create package fragments and add the fragments that are not exclused to the collection of children.
+ *
+ * @exception JavaModelException
+ * The resource associated with this package fragment does not exist
+ */
+ //protected void computeFolderChildren(IContainer folder, String prefix, ArrayList vChildren, char[][] exclusionPatterns) throws
+ // JavaModelException {
+ // IPackageFragment pkg = getPackageFragment(prefix);
+ // vChildren.add(pkg);
+ // try {
+ // JavaProject javaProject = (JavaProject)getJavaProject();
+ // IResource[] members = folder.members();
+ // for (int i = 0, max = members.length; i < max; i++) {
+ // IResource member = members[i];
+ // String memberName = member.getName();
+ // if (member.getType() == IResource.FOLDER
+ // && ProjectPrefUtil.isValidFolderNameForPackage(memberName)
+ // && !ProjectPrefUtil.isExcluded(member, exclusionPatterns)) {
+ //
+ // // eliminate binary output only if nested inside direct subfolders
+ // if (javaProject.contains(member)) {
+ // String newPrefix;
+ // if (prefix.length() == 0) {
+ // newPrefix = memberName;
+ // } else {
+ // newPrefix = prefix + "." + memberName; //$NON-NLS-1$
+ // }
+ // computeFolderChildren((IFolder) member, newPrefix, vChildren, exclusionPatterns);
+ // }
+ // }
+ // }
+ // } catch(IllegalArgumentException e){
+ // throw new JavaModelException(e, IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST); // could be thrown by ElementTree when path
+ // is not found
+ // } catch (CoreException e) {
+ // throw new JavaModelException(e);
+ // }
+ //}
+ /*
+ * Computes and returns the source attachment root path for the given source attachment path. Returns null
if none
+ * could be found.
+ *
+ * @param sourceAttachmentPath the given absolute path to the source archive or folder @return the computed source attachment root
+ * path or null if none could be found @throws JavaModelException
+ */
+ //public IPath computeSourceAttachmentRootPath(IPath sourceAttachmentPath) throws JavaModelException {
+ // IPath sourcePath = this.getSourceAttachmentPath();
+ // if (sourcePath == null) return null;
+ // SourceMapper mapper =
+ // new SourceMapper(
+ // sourcePath,
+ // null, // detect root path
+ // this.isExternal() ? JavaCore.getOptions() : this.getJavaProject().getOptions(true) // only project options if associated with
+ // resource
+ // );
+ // if (mapper.rootPath == null) return null;
+ // return new Path(mapper.rootPath);
+ //}
+ /*
+ * @see net.sourceforge.phpdt.core.IPackageFragmentRoot#copy
+ */
+ //public void copy(
+ // IPath destination,
+ // int updateResourceFlags,
+ // int updateModelFlags,
+ // IClasspathEntry sibling,
+ // IProgressMonitor monitor)
+ // throws JavaModelException {
+ //
+ // CopyPackageFragmentRootOperation op =
+ // new CopyPackageFragmentRootOperation(this, destination, updateResourceFlags, updateModelFlags, sibling);
+ // runOperation(op, monitor);
+ //}
+
+ /**
+ * Returns a new element info for this element.
+ */
+ protected Object createElementInfo() {
+ return new PackageFragmentRootInfo();
+ }
+
+ /**
+ * @see IPackageFragmentRoot
+ */
+ //public IPackageFragment createPackageFragment(String name, boolean force, IProgressMonitor monitor) throws JavaModelException {
+ // CreatePackageFragmentOperation op = new CreatePackageFragmentOperation(this, name, force);
+ // runOperation(op, monitor);
+ // return getPackageFragment(name);
+ //}
+ /**
+ * Returns the root's kind - K_SOURCE or K_BINARY, defaults to K_SOURCE if it is not on the classpath.
+ *
+ * @exception NotPresentException
+ * if the project and root do not exist.
+ */
+ //protected int determineKind(IResource underlyingResource) throws JavaModelException {
+ // IClasspathEntry[] entries= ((JavaProject)getJavaProject()).getExpandedClasspath(true);
+ // for (int i= 0; i < entries.length; i++) {
+ // IClasspathEntry entry= entries[i];
+ // if (entry.getPath().equals(underlyingResource.getFullPath())) {
+ // return entry.getContentKind();
+ // }
+ // }
+ // return IPackageFragmentRoot.K_SOURCE;
+ //}
+ /**
+ * Compares two objects for equality; for
"\n"PackageFragmentRoot
s, equality is having the same JavaModel
,
+ * same resources, and occurrence count.
+ *
+ */
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (!(o instanceof PackageFragmentRoot))
+ return false;
+ PackageFragmentRoot other = (PackageFragmentRoot) o;
+ return getJavaModel().equals(other.getJavaModel()) && this.resource.equals(other.resource)
+ && occurrenceCount == other.occurrenceCount;
+ }
+
+ /**
+ * @see IJavaElement
+ */
+ //public boolean exists() {
+ // return super.exists()
+ // && isOnClasspath();
+ //}
+ //public IClasspathEntry findSourceAttachmentRecommendation() {
+ // try {
+ // IPath rootPath = this.getPath();
+ // IClasspathEntry entry;
+ // IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ //
+ // // try on enclosing project first
+ // JavaProject parentProject = (JavaProject) getJavaProject();
+ // try {
+ // entry = parentProject.getClasspathEntryFor(rootPath);
+ // if (entry != null){
+ // Object target = JavaModel.getTarget(workspaceRoot, entry.getSourceAttachmentPath(), true);
+ // if (target instanceof IFile){
+ // IFile file = (IFile) target;
+ // if (ProjectPrefUtil.isArchiveFileName(file.getName())){
+ // return entry;
+ // }
+ // } else if (target instanceof IFolder) {
+ // return entry;
+ // }
+ // if (target instanceof java.io.File){
+ // java.io.File file = (java.io.File) target;
+ // if (file.isFile()) {
+ // if (ProjectPrefUtil.isArchiveFileName(file.getName())){
+ // return entry;
+ // }
+ // } else {
+ // // external directory
+ // return entry;
+ // }
+ // }
+ // }
+ // } catch(JavaModelException e){
+ // }
+ //
+ // // iterate over all projects
+ // IJavaModel model = getJavaModel();
+ // IJavaProject[] jProjects = model.getJavaProjects();
+ // for (int i = 0, max = jProjects.length; i < max; i++){
+ // JavaProject jProject = (JavaProject) jProjects[i];
+ // if (jProject == parentProject) continue; // already done
+ // try {
+ // entry = jProject.getClasspathEntryFor(rootPath);
+ // if (entry != null){
+ // Object target = JavaModel.getTarget(workspaceRoot, entry.getSourceAttachmentPath(), true);
+ // if (target instanceof IFile){
+ // IFile file = (IFile) target;
+ // if (ProjectPrefUtil.isArchiveFileName(file.getName())){
+ // return entry;
+ // }
+ // } else if (target instanceof IFolder) {
+ // return entry;
+ // }
+ // if (target instanceof java.io.File){
+ // java.io.File file = (java.io.File) target;
+ // if (file.isFile()) {
+ // if (ProjectPrefUtil.isArchiveFileName(file.getName())){
+ // return entry;
+ // }
+ // } else {
+ // // external directory
+ // return entry;
+ // }
+ // }
+ // }
+ // } catch(JavaModelException e){
+ // }
+ // }
+ // } catch(JavaModelException e){
+ // }
+ //
+ // return null;
+ //}
+ /*
+ * Returns the exclusion patterns from the classpath entry associated with this root.
+ */
+ char[][] fullExclusionPatternChars() {
+ return null;
+ // try {
+
+ // if (this.isOpen() && this.getKind() != IPackageFragmentRoot.K_SOURCE) return null;
+ // ClasspathEntry entry = (ClasspathEntry)getRawClasspathEntry();
+ // if (entry == null) {
+ // return null;
+ // } else {
+ // return entry.fullExclusionPatternChars();
+ // }
+ // } catch (JavaModelException e) {
+ // return null;
+ // }
+ }
+
+ /**
+ * @see Openable
+ */
+ protected boolean generateInfos(OpenableElementInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource)
+ throws JavaModelException {
+
+ // ((PackageFragmentRootInfo) info).setRootKind(determineKind(underlyingResource));
+ // return computeChildren(info);
+ return false;
+ }
+
+ /**
+ * @see JavaElement#getHandleMemento()
+ */
+ protected char getHandleMementoDelimiter() {
+ return JavaElement.JEM_PACKAGEFRAGMENTROOT;
+ }
+
+ /**
+ * @see IJavaElement
+ */
+ public int getElementType() {
+ return PACKAGE_FRAGMENT_ROOT;
+ }
+
+ /*
+ * @see JavaElement
+ */
+ public IJavaElement getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner owner) {
+ switch (token.charAt(0)) {
+ case JEM_COUNT:
+ return getHandleUpdatingCountFromMemento(memento, owner);
+ case JEM_PACKAGEFRAGMENT:
+ String pkgName;
+ if (memento.hasMoreTokens()) {
+ pkgName = memento.nextToken();
+ char firstChar = pkgName.charAt(0);
+ // if (firstChar == JEM_CLASSFILE || firstChar == JEM_COMPILATIONUNIT || firstChar == JEM_COUNT) {
+ if (firstChar == JEM_COMPILATIONUNIT || firstChar == JEM_COUNT) {
+ token = pkgName;
+ pkgName = IPackageFragment.DEFAULT_PACKAGE_NAME;
+ } else {
+ token = null;
+ }
+ } else {
+ pkgName = IPackageFragment.DEFAULT_PACKAGE_NAME;
+ token = null;
+ }
+ JavaElement pkg = (JavaElement) getPackageFragment(pkgName);
+ if (token == null) {
+ return pkg.getHandleFromMemento(memento, owner);
+ } else {
+ return pkg.getHandleFromMemento(token, memento, owner);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @see JavaElement#getHandleMemento()
+ */
+ public String getHandleMemento() {
+ IPath path;
+ IResource underlyingResource = getResource();
+ if (underlyingResource != null) {
+ // internal jar or regular root
+ if (getResource().getProject().equals(getJavaProject().getProject())) {
+ path = underlyingResource.getProjectRelativePath();
+ } else {
+ path = underlyingResource.getFullPath();
+ }
+ } else {
+ // external jar
+ path = getPath();
+ }
+ StringBuffer buff = new StringBuffer(((JavaElement) getParent()).getHandleMemento());
+ buff.append(getHandleMementoDelimiter());
+ escapeMementoName(buff, path.toString());
+ if (this.occurrenceCount > 1) {
+ buff.append(JEM_COUNT);
+ buff.append(this.occurrenceCount);
+ }
+ return buff.toString();
+ }
+
+ /**
+ * @see IPackageFragmentRoot
+ */
+ public int getKind() throws JavaModelException {
+ return ((PackageFragmentRootInfo) getElementInfo()).getRootKind();
+ }
+
+ /**
+ * Returns an array of non-java resources contained in the receiver.
+ */
+ //public Object[] getNonJavaResources() throws JavaModelException {
+ // return ((PackageFragmentRootInfo) getElementInfo()).getNonJavaResources(getJavaProject(), getResource(), this);
+ //}
+ /**
+ * @see IPackageFragmentRoot
+ */
+ public IPackageFragment getPackageFragment(String packageName) {
+ if (packageName.indexOf(' ') != -1) { // tolerate package names with spaces (e.g. 'x . y')
+ // (http://bugs.eclipse.org/bugs/show_bug.cgi?id=21957)
+ char[][] compoundName = Util.toCompoundChars(packageName);
+ StringBuffer buffer = new StringBuffer(packageName.length());
+ for (int i = 0, length = compoundName.length; i < length; i++) {
+ buffer.append(CharOperation.trim(compoundName[i]));
+ if (i != length - 1) {
+ buffer.append('.');
+ }
+ }
+ packageName = buffer.toString();
+ }
+ return new PackageFragment(this, packageName);
+ }
+
+ /**
+ * Returns the package name for the given folder (which is a decendent of this root).
+ */
+ protected String getPackageName(IFolder folder) throws JavaModelException {
+ IPath myPath = getPath();
+ IPath pkgPath = folder.getFullPath();
+ int mySegmentCount = myPath.segmentCount();
+ int pkgSegmentCount = pkgPath.segmentCount();
+ StringBuffer name = new StringBuffer(IPackageFragment.DEFAULT_PACKAGE_NAME);
+ for (int i = mySegmentCount; i < pkgSegmentCount; i++) {
+ if (i > mySegmentCount) {
+ name.append('.');
+ }
+ name.append(pkgPath.segment(i));
+ }
+ return name.toString();
+ }
+
+ /**
+ * @see IJavaElement
+ */
+ public IPath getPath() {
+ return getResource().getFullPath();
+ }
+
+ /*
+ * @see IPackageFragmentRoot
+ */
+ //public IClasspathEntry getRawClasspathEntry() throws JavaModelException {
+ //
+ // IClasspathEntry rawEntry = null;
+ // IJavaProject project = this.getJavaProject();
+ // project.getResolvedClasspath(true); // force the reverse rawEntry cache to be populated
+ // JavaModelManager.PerProjectInfo perProjectInfo =
+ // JavaModelManager.getJavaModelManager().getPerProjectInfoCheckExistence(project.getProject());
+ // if (perProjectInfo != null && perProjectInfo.resolvedPathToRawEntries != null) {
+ // rawEntry = (IClasspathEntry) perProjectInfo.resolvedPathToRawEntries.get(this.getPath());
+ // }
+ // return rawEntry;
+ //}
+ /*
+ * @see IJavaElement
+ */
+ public IResource getResource() {
+ return (IResource) this.resource;
+ }
+
+ /**
+ * @see IPackageFragmentRoot
+ */
+ //public IPath getSourceAttachmentPath() throws JavaModelException {
+ // if (getKind() != K_BINARY) return null;
+ //
+ // String serverPathString= getSourceAttachmentProperty();
+ // if (serverPathString == null) {
+ // return null;
+ // }
+ // int index= serverPathString.lastIndexOf(ATTACHMENT_PROPERTY_DELIMITER);
+ // if (index < 0) {
+ // // no root path specified
+ // return new Path(serverPathString);
+ // } else {
+ // String serverSourcePathString= serverPathString.substring(0, index);
+ // return new Path(serverSourcePathString);
+ // }
+ //}
+ /**
+ * Returns the server property for this package fragment root's source attachement.
+ */
+ //protected String getSourceAttachmentProperty() throws JavaModelException {
+ // String propertyString = null;
+ // QualifiedName qName= getSourceAttachmentPropertyName();
+ // try {
+ // propertyString = ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(qName);
+ //
+ // // if no existing source attachment information, then lookup a recommendation from classpath entries
+ // if (propertyString == null) {
+ // IClasspathEntry recommendation = findSourceAttachmentRecommendation();
+ // if (recommendation != null) {
+ // IPath rootPath = recommendation.getSourceAttachmentRootPath();
+ // propertyString =
+ // recommendation.getSourceAttachmentPath().toString()
+ // + ((rootPath == null)
+ // ? "" : //$NON-NLS-1$
+ // (ATTACHMENT_PROPERTY_DELIMITER + rootPath.toString()));
+ // setSourceAttachmentProperty(propertyString);
+ // } else {
+ // // mark as being already looked up
+ // setSourceAttachmentProperty(NO_SOURCE_ATTACHMENT);
+ // }
+ // } else if (NO_SOURCE_ATTACHMENT.equals(propertyString)) {
+ // // already looked up and no source attachment found
+ // return null;
+ // }
+ // return propertyString;
+ // } catch (CoreException ce) {
+ // throw new JavaModelException(ce);
+ // }
+ //}
+ /**
+ * Returns the qualified name for the source attachment property of this root.
+ */
+ protected QualifiedName getSourceAttachmentPropertyName() throws JavaModelException {
+ return new QualifiedName(JavaCore.PLUGIN_ID, "sourceattachment: " + this.getPath().toOSString()); //$NON-NLS-1$
+ }
+
+ public void setSourceAttachmentProperty(String property) {
+ try {
+ ResourcesPlugin.getWorkspace().getRoot().setPersistentProperty(this.getSourceAttachmentPropertyName(), property);
+ } catch (CoreException ce) {
+ }
+ }
+
+ /**
+ * For use by AttachSourceOperation
only. Sets the source mapper associated with this root.
+ */
+ //public void setSourceMapper(SourceMapper mapper) throws JavaModelException {
+ // ((PackageFragmentRootInfo) getElementInfo()).setSourceMapper(mapper);
+ //}
+
+ /**
+ * @see IPackageFragmentRoot
+ */
+ //public IPath getSourceAttachmentRootPath() throws JavaModelException {
+ // if (getKind() != K_BINARY) return null;
+ //
+ // String serverPathString= getSourceAttachmentProperty();
+ // if (serverPathString == null) {
+ // return null;
+ // }
+ // int index = serverPathString.lastIndexOf(ATTACHMENT_PROPERTY_DELIMITER);
+ // if (index == -1) return null;
+ // String serverRootPathString= IPackageFragmentRoot.DEFAULT_PACKAGEROOT_PATH;
+ // if (index != serverPathString.length() - 1) {
+ // serverRootPathString= serverPathString.substring(index + 1);
+ // }
+ // return new Path(serverRootPathString);
+ //}
+ /**
+ * @see JavaElement
+ */
+ //public SourceMapper getSourceMapper() {
+ // SourceMapper mapper;
+ // try {
+ // PackageFragmentRootInfo rootInfo = (PackageFragmentRootInfo) getElementInfo();
+ // mapper = rootInfo.getSourceMapper();
+ // if (mapper == null) {
+ // // first call to this method
+ // IPath sourcePath= getSourceAttachmentPath();
+ // if (sourcePath != null) {
+ // IPath rootPath= getSourceAttachmentRootPath();
+ // mapper = this.createSourceMapper(sourcePath, rootPath);
+ // if (rootPath == null && mapper.rootPath != null) {
+ // // as a side effect of calling the SourceMapper constructor, the root path was computed
+ // rootPath = new Path(mapper.rootPath);
+ //
+ // //set the property to the path of the mapped source
+ // this.setSourceAttachmentProperty(
+ // sourcePath.toString()
+ // + ATTACHMENT_PROPERTY_DELIMITER
+ // + rootPath.toString());
+ // }
+ // rootInfo.setSourceMapper(mapper);
+ // } else {
+ // // remember that no source is attached
+ // rootInfo.setSourceMapper(NO_SOURCE_MAPPER);
+ // mapper = null;
+ // }
+ // } else if (mapper == NO_SOURCE_MAPPER) {
+ // // a previous call to this method found out that no source was attached
+ // mapper = null;
+ // }
+ // } catch (JavaModelException e) {
+ // // no source can be attached
+ // mapper = null;
+ // }
+ // return mapper;
+ //}
+ /**
+ * @see IJavaElement
+ */
+ public IResource getUnderlyingResource() throws JavaModelException {
+ if (!exists())
+ throw newNotPresentException();
+ return getResource();
+ }
+
+ public int hashCode() {
+ return this.resource.hashCode();
+ }
+
+ /**
+ * @see IPackageFragmentRoot
+ */
+ public boolean isArchive() {
+ return false;
+ }
+
+ /**
+ * @see IPackageFragmentRoot
+ */
+ public boolean isExternal() {
+ return false;
+ }
+
+ /*
+ * Returns whether this package fragment root is on the classpath of its project.
+ */
+ //protected boolean isOnClasspath() {
+ // if (this.getElementType() == IJavaElement.JAVA_PROJECT){
+ // return true;
+ // }
+ //
+ // IPath path = this.getPath();
+ // try {
+ // // check package fragment root on classpath of its project
+ // IJavaProject project = this.getJavaProject();
+ // IClasspathEntry[] classpath = project.getResolvedClasspath(true);
+ // for (int i = 0, length = classpath.length; i < length; i++) {
+ // IClasspathEntry entry = classpath[i];
+ // if (entry.getPath().equals(path)) {
+ // return true;
+ // }
+ // }
+ // } catch(JavaModelException e){
+ // // could not read classpath, then assume it is outside
+ // }
+ // return false;
+ //}
+ /*
+ * @see net.sourceforge.phpdt.core.IPackageFragmentRoot#move
+ */
+ //public void move(
+ // IPath destination,
+ // int updateResourceFlags,
+ // int updateModelFlags,
+ // IClasspathEntry sibling,
+ // IProgressMonitor monitor)
+ // throws JavaModelException {
+ //
+ // MovePackageFragmentRootOperation op =
+ // new MovePackageFragmentRootOperation(this, destination, updateResourceFlags, updateModelFlags, sibling);
+ // runOperation(op, monitor);
+ //}
+ //
+ //
+ //protected void openWhenClosed(IProgressMonitor pm) throws JavaModelException {
+ // if (!this.resourceExists()
+ // || !this.isOnClasspath()) {
+ // throw newNotPresentException();
+ // }
+ // super.openWhenClosed(pm);
+ //}
+ /**
+ * Recomputes the children of this element, based on the current state of the workbench.
+ */
+ //public void refreshChildren() {
+ // try {
+ // OpenableElementInfo info= (OpenableElementInfo)getElementInfo();
+ // computeChildren(info);
+ // } catch (JavaModelException e) {
+ // // do nothing.
+ // }
+ //}
+ ///*
+ // * @see JavaElement#rootedAt(IJavaProject)
+ // */
+ //public IJavaElement rootedAt(IJavaProject project) {
+ // return
+ // new PackageFragmentRoot(
+ // getResource(),
+ // project,
+ // name);
+ //}
+ /**
+ * @private Debugging purposes
+ */
+ protected void toStringInfo(int tab, StringBuffer buffer, Object info) {
+ buffer.append(this.tabString(tab));
+ if (getElementName().length() == 0) {
+ buffer.append("[project root]"); //$NON-NLS-1$
+ } else {
+ IPath path = getPath();
+ if (getJavaProject().getElementName().equals(path.segment(0))) {
+ buffer.append(path.removeFirstSegments(1).makeRelative());
+ } else {
+ buffer.append(path);
+ }
+ }
+ if (info == null) {
+ buffer.append(" (not open)"); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Possible failures:
+ *
+ *
+ */
+ //protected void verifyAttachSource(IPath sourcePath) throws JavaModelException {
+ // if (!exists()) {
+ // throw newNotPresentException();
+ // } else if (this.getKind() != K_BINARY) {
+ // throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_ELEMENT_TYPES, this));
+ // } else if (sourcePath != null && !sourcePath.isAbsolute()) {
+ // throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.RELATIVE_PATH, sourcePath));
+ // }
+ //}
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ReconcileWorkingCopyOperation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ReconcileWorkingCopyOperation.java
index be6bb19..64e55bf 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ReconcileWorkingCopyOperation.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ReconcileWorkingCopyOperation.java
@@ -28,7 +28,7 @@ public class ReconcileWorkingCopyOperation extends JavaModelOperation {
int astLevel;
boolean forceProblemDetection;
WorkingCopyOwner workingCopyOwner;
-// org.eclipse.jdt.core.dom.CompilationUnit ast;
+// net.sourceforge.phpdt.core.dom.CompilationUnit ast;
public ReconcileWorkingCopyOperation(IJavaElement workingCopy, boolean forceProblemDetection) {
super(new IJavaElement[] {workingCopy});
@@ -124,7 +124,6 @@ public class ReconcileWorkingCopyOperation extends JavaModelOperation {
problemRequestor.beginReporting();
char[] contents = workingCopy.getContents();
unit = CompilationUnitProblemFinder.process(workingCopy, contents, this.workingCopyOwner, problemRequestor, false/*don't cleanup cu*/, this.progressMonitor);
-
CompilationUnitProblemFinder.process(workingCopy, problemRequestor, progressMonitor);
problemRequestor.endReporting();
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SetClasspathOperation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SetClasspathOperation.java
index ac51e61..0329e7e 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SetClasspathOperation.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SetClasspathOperation.java
@@ -11,8 +11,10 @@
package net.sourceforge.phpdt.internal.core;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Map;
import net.sourceforge.phpdt.core.IClasspathEntry;
import net.sourceforge.phpdt.core.IJavaElement;
@@ -22,6 +24,7 @@ import net.sourceforge.phpdt.core.IJavaModelStatus;
import net.sourceforge.phpdt.core.IJavaProject;
import net.sourceforge.phpdt.core.IPackageFragmentRoot;
import net.sourceforge.phpdt.core.JavaModelException;
+import net.sourceforge.phpdt.internal.compiler.util.ObjectVector;
import net.sourceforge.phpdt.internal.core.util.Util;
import org.eclipse.core.resources.IFolder;
@@ -43,6 +46,7 @@ public class SetClasspathOperation extends JavaModelOperation {
IClasspathEntry[] oldResolvedPath, newResolvedPath;
IClasspathEntry[] newRawPath;
boolean canChangeResources;
+ boolean classpathWasSaved;
boolean needCycleCheck;
boolean needValidation;
boolean needSave;
@@ -273,109 +277,112 @@ public class SetClasspathOperation extends JavaModelOperation {
* Use three deltas in case the same root is removed/added/reordered (for
* instance, if it is changed from K_SOURCE to K_BINARY or vice versa)
*/
-// protected void generateClasspathChangeDeltas(
-// IClasspathEntry[] oldResolvedPath,
-// IClasspathEntry[] newResolvedPath,
-// final JavaProject project) {
-//
-// JavaModelManager manager = JavaModelManager.getJavaModelManager();
-// boolean needToUpdateDependents = false;
-// JavaElementDelta delta = new JavaElementDelta(getJavaModel());
-// boolean hasDelta = false;
-// int oldLength = oldResolvedPath.length;
-// int newLength = newResolvedPath.length;
-//
+ protected void generateClasspathChangeDeltas() {
+
+ JavaModelManager manager = JavaModelManager.getJavaModelManager();
+ boolean needToUpdateDependents = false;
+ JavaElementDelta delta = new JavaElementDelta(getJavaModel());
+ boolean hasDelta = false;
+ if (this.classpathWasSaved) {
+ delta.changed(this.project, IJavaElementDelta.F_CLASSPATH_CHANGED);
+ hasDelta = true;
+ }
+ int oldLength = oldResolvedPath.length;
+ int newLength = newResolvedPath.length;
+
// final IndexManager indexManager = manager.getIndexManager();
-// Map oldRoots = null;
-// IPackageFragmentRoot[] roots = null;
-// if (project.isOpen()) {
-// try {
-// roots = project.getPackageFragmentRoots();
-// } catch (JavaModelException e) {
-// }
-// } else {
-// Map allRemovedRoots ;
-// if ((allRemovedRoots = manager.deltaProcessor.removedRoots) != null) {
-// roots = (IPackageFragmentRoot[]) allRemovedRoots.get(project);
-// }
-// }
-// if (roots != null) {
-// oldRoots = new HashMap();
-// for (int i = 0; i < roots.length; i++) {
-// IPackageFragmentRoot root = roots[i];
-// oldRoots.put(root.getPath(), root);
-// }
-// }
-// for (int i = 0; i < oldLength; i++) {
-//
-// int index = classpathContains(newResolvedPath, oldResolvedPath[i]);
-// if (index == -1) {
-// // do not notify remote project changes
-// if (oldResolvedPath[i].getEntryKind() == IClasspathEntry.CPE_PROJECT){
-// needToUpdateDependents = true;
-// this.needCycleCheck = true;
-// continue;
-// }
-//
-// IPackageFragmentRoot[] pkgFragmentRoots = null;
-// if (oldRoots != null) {
-// IPackageFragmentRoot oldRoot = (IPackageFragmentRoot) oldRoots.get(oldResolvedPath[i].getPath());
-// if (oldRoot != null) { // use old root if any (could be none if entry wasn't bound)
-// pkgFragmentRoots = new IPackageFragmentRoot[] { oldRoot };
-// }
-// }
-// if (pkgFragmentRoots == null) {
-// try {
-// ObjectVector accumulatedRoots = new ObjectVector();
-// HashSet rootIDs = new HashSet(5);
-// rootIDs.add(project.rootID());
-// project.computePackageFragmentRoots(
-// oldResolvedPath[i],
-// accumulatedRoots,
-// rootIDs,
-// true, // inside original project
-// false, // don't check existency
-// false); // don't retrieve exported roots
-// pkgFragmentRoots = new IPackageFragmentRoot[accumulatedRoots.size()];
-// accumulatedRoots.copyInto(pkgFragmentRoots);
-// } catch (JavaModelException e) {
-// pkgFragmentRoots = new IPackageFragmentRoot[] {};
-// }
-// }
-// addClasspathDeltas(pkgFragmentRoots, IJavaElementDelta.F_REMOVED_FROM_CLASSPATH, delta);
-//
-// int changeKind = oldResolvedPath[i].getEntryKind();
-// needToUpdateDependents |= (changeKind == IClasspathEntry.CPE_SOURCE) || oldResolvedPath[i].isExported();
-//
-// // Remove the .java files from the index for a source folder
-// // For a lib folder or a .jar file, remove the corresponding index if not shared.
+ Map oldRoots = null;
+ IPackageFragmentRoot[] roots = null;
+ if (project.isOpen()) {
+ try {
+ roots = project.getPackageFragmentRoots();
+ } catch (JavaModelException e) {
+ // ignore
+ }
+ } else {
+ Map allRemovedRoots ;
+ if ((allRemovedRoots = manager.getDeltaProcessor().removedRoots) != null) {
+ roots = (IPackageFragmentRoot[]) allRemovedRoots.get(project);
+ }
+ }
+ if (roots != null) {
+ oldRoots = new HashMap();
+ for (int i = 0; i < roots.length; i++) {
+ IPackageFragmentRoot root = roots[i];
+ oldRoots.put(root.getPath(), root);
+ }
+ }
+ for (int i = 0; i < oldLength; i++) {
+
+ int index = classpathContains(newResolvedPath, oldResolvedPath[i]);
+ if (index == -1) {
+ // do not notify remote project changes
+ if (oldResolvedPath[i].getEntryKind() == IClasspathEntry.CPE_PROJECT){
+ needToUpdateDependents = true;
+ this.needCycleCheck = true;
+ continue;
+ }
+
+ IPackageFragmentRoot[] pkgFragmentRoots = null;
+ if (oldRoots != null) {
+ IPackageFragmentRoot oldRoot = (IPackageFragmentRoot) oldRoots.get(oldResolvedPath[i].getPath());
+ if (oldRoot != null) { // use old root if any (could be none if entry wasn't bound)
+ pkgFragmentRoots = new IPackageFragmentRoot[] { oldRoot };
+ }
+ }
+ if (pkgFragmentRoots == null) {
+ try {
+ ObjectVector accumulatedRoots = new ObjectVector();
+ HashSet rootIDs = new HashSet(5);
+ rootIDs.add(project.rootID());
+ project.computePackageFragmentRoots(
+ oldResolvedPath[i],
+ accumulatedRoots,
+ rootIDs,
+ true, // inside original project
+ false, // don't check existency
+ false); // don't retrieve exported roots
+ pkgFragmentRoots = new IPackageFragmentRoot[accumulatedRoots.size()];
+ accumulatedRoots.copyInto(pkgFragmentRoots);
+ } catch (JavaModelException e) {
+ pkgFragmentRoots = new IPackageFragmentRoot[] {};
+ }
+ }
+ addClasspathDeltas(pkgFragmentRoots, IJavaElementDelta.F_REMOVED_FROM_CLASSPATH, delta);
+
+ int changeKind = oldResolvedPath[i].getEntryKind();
+ needToUpdateDependents |= (changeKind == IClasspathEntry.CPE_SOURCE) || oldResolvedPath[i].isExported();
+
+ // Remove the .java files from the index for a source folder
+ // For a lib folder or a .jar file, remove the corresponding index if not shared.
// if (indexManager != null) {
// IClasspathEntry oldEntry = oldResolvedPath[i];
// final IPath path = oldEntry.getPath();
// switch (changeKind) {
// case IClasspathEntry.CPE_SOURCE:
+// final char[][] inclusionPatterns = null; //((ClasspathEntry)oldEntry).fullInclusionPatternChars();
// final char[][] exclusionPatterns = ((ClasspathEntry)oldEntry).fullExclusionPatternChars();
// postAction(new IPostAction() {
// public String getID() {
// return path.toString();
// }
-// public void run() throws JavaModelException {
-// indexManager.removeSourceFolderFromIndex(project, path, exclusionPatterns);
+// public void run() /* throws JavaModelException */ {
+// indexManager.removeSourceFolderFromIndex(project, path, inclusionPatterns, exclusionPatterns);
// }
// },
// REMOVEALL_APPEND);
// break;
// case IClasspathEntry.CPE_LIBRARY:
-// final DeltaProcessor deltaProcessor = manager.deltaProcessor;
+// final DeltaProcessingState deltaState = manager.deltaState;
// postAction(new IPostAction() {
// public String getID() {
// return path.toString();
// }
-// public void run() throws JavaModelException {
-// if (deltaProcessor.otherRoots.get(path) == null) { // if root was not shared
+// public void run() /* throws JavaModelException */ {
+// if (deltaState.otherRoots.get(path) == null) { // if root was not shared
// indexManager.discardJobs(path.toString());
// indexManager.removeIndex(path);
-// // TODO: we could just remove the in-memory index and have the indexing check for timestamps
+// // TODO (kent) we could just remove the in-memory index and have the indexing check for timestamps
// }
// }
// },
@@ -383,66 +390,76 @@ public class SetClasspathOperation extends JavaModelOperation {
// break;
// }
// }
-// hasDelta = true;
-//
-// } else {
-// // do not notify remote project changes
-// if (oldResolvedPath[i].getEntryKind() == IClasspathEntry.CPE_PROJECT){
-// this.needCycleCheck |= (oldResolvedPath[i].isExported() != newResolvedPath[index].isExported());
-// continue;
-// }
-// needToUpdateDependents |= (oldResolvedPath[i].isExported() != newResolvedPath[index].isExported());
-// if (index != i) { //reordering of the classpath
-// addClasspathDeltas(
-// project.computePackageFragmentRoots(oldResolvedPath[i]),
-// IJavaElementDelta.F_REORDER,
-// delta);
-// int changeKind = oldResolvedPath[i].getEntryKind();
-// needToUpdateDependents |= (changeKind == IClasspathEntry.CPE_SOURCE);
-//
-// hasDelta = true;
-// }
-//
-// // check source attachment
-// IPath newSourcePath = newResolvedPath[index].getSourceAttachmentPath();
-// int sourceAttachmentFlags =
-// this.getSourceAttachmentDeltaFlag(
-// oldResolvedPath[i].getSourceAttachmentPath(),
-// newSourcePath,
-// null/*not a source root path*/);
-// int sourceAttachmentRootFlags =
-// this.getSourceAttachmentDeltaFlag(
-// oldResolvedPath[i].getSourceAttachmentRootPath(),
-// newResolvedPath[index].getSourceAttachmentRootPath(),
-// newSourcePath/*in case both root paths are null*/);
-// int flags = sourceAttachmentFlags | sourceAttachmentRootFlags;
-// if (flags != 0) {
-// addClasspathDeltas(
-// project.computePackageFragmentRoots(oldResolvedPath[i]),
-// flags,
-// delta);
-// hasDelta = true;
-// }
-// }
-// }
-//
-// for (int i = 0; i < newLength; i++) {
-//
-// int index = classpathContains(oldResolvedPath, newResolvedPath[i]);
-// if (index == -1) {
-// // do not notify remote project changes
-// if (newResolvedPath[i].getEntryKind() == IClasspathEntry.CPE_PROJECT){
-// needToUpdateDependents = true;
-// this.needCycleCheck = true;
-// continue;
-// }
-// addClasspathDeltas(
-// project.computePackageFragmentRoots(newResolvedPath[i]),
-// IJavaElementDelta.F_ADDED_TO_CLASSPATH,
-// delta);
-// int changeKind = newResolvedPath[i].getEntryKind();
-//
-// // Request indexing
+ hasDelta = true;
+
+ } else {
+ // do not notify remote project changes
+ if (oldResolvedPath[i].getEntryKind() == IClasspathEntry.CPE_PROJECT){
+ this.needCycleCheck |= (oldResolvedPath[i].isExported() != newResolvedPath[index].isExported());
+ continue;
+ }
+ needToUpdateDependents |= (oldResolvedPath[i].isExported() != newResolvedPath[index].isExported());
+ if (index != i) { //reordering of the classpath
+ addClasspathDeltas(
+ project.computePackageFragmentRoots(oldResolvedPath[i]),
+ IJavaElementDelta.F_REORDER,
+ delta);
+ int changeKind = oldResolvedPath[i].getEntryKind();
+ needToUpdateDependents |= (changeKind == IClasspathEntry.CPE_SOURCE);
+
+ hasDelta = true;
+ }
+
+ // check source attachment
+ IPath newSourcePath = newResolvedPath[index].getSourceAttachmentPath();
+ int sourceAttachmentFlags =
+ this.getSourceAttachmentDeltaFlag(
+ oldResolvedPath[i].getSourceAttachmentPath(),
+ newSourcePath);
+ IPath oldRootPath = oldResolvedPath[i].getSourceAttachmentRootPath();
+ IPath newRootPath = newResolvedPath[index].getSourceAttachmentRootPath();
+ int sourceAttachmentRootFlags = getSourceAttachmentDeltaFlag(oldRootPath, newRootPath);
+ int flags = sourceAttachmentFlags | sourceAttachmentRootFlags;
+ if (flags != 0) {
+ addClasspathDeltas(project.computePackageFragmentRoots(oldResolvedPath[i]), flags, delta);
+ hasDelta = true;
+ } else {
+ if (oldRootPath == null && newRootPath == null) {
+ // if source path is specified and no root path, it needs to be recomputed dynamically
+ // force detach source on jar package fragment roots (source will be lazily computed when needed)
+ IPackageFragmentRoot[] computedRoots = project.computePackageFragmentRoots(oldResolvedPath[i]);
+ for (int j = 0; j < computedRoots.length; j++) {
+ IPackageFragmentRoot root = computedRoots[j];
+ // force detach source on jar package fragment roots (source will be lazily computed when needed)
+ try {
+ root.close();
+ } catch (JavaModelException e) {
+ // ignore
+ }
+ ((PackageFragmentRoot) root).setSourceAttachmentProperty(null);// loose info - will be recomputed
+ }
+ }
+ }
+ }
+ }
+
+ for (int i = 0; i < newLength; i++) {
+
+ int index = classpathContains(oldResolvedPath, newResolvedPath[i]);
+ if (index == -1) {
+ // do not notify remote project changes
+ if (newResolvedPath[i].getEntryKind() == IClasspathEntry.CPE_PROJECT){
+ needToUpdateDependents = true;
+ this.needCycleCheck = true;
+ continue;
+ }
+ addClasspathDeltas(
+ project.computePackageFragmentRoots(newResolvedPath[i]),
+ IJavaElementDelta.F_ADDED_TO_CLASSPATH,
+ delta);
+ int changeKind = newResolvedPath[i].getEntryKind();
+
+ // Request indexing
// if (indexManager != null) {
// switch (changeKind) {
// case IClasspathEntry.CPE_LIBRARY:
@@ -460,7 +477,7 @@ public class SetClasspathOperation extends JavaModelOperation {
// public String getID() {
// return newPath.toString();
// }
-// public void run() throws JavaModelException {
+// public void run() /* throws JavaModelException */ {
// indexManager.indexLibrary(newPath, project.getProject());
// }
// },
@@ -470,34 +487,58 @@ public class SetClasspathOperation extends JavaModelOperation {
// case IClasspathEntry.CPE_SOURCE:
// IClasspathEntry entry = newResolvedPath[i];
// final IPath path = entry.getPath();
+// final char[][] inclusionPatterns = null; //((ClasspathEntry)entry).fullInclusionPatternChars();
// final char[][] exclusionPatterns = ((ClasspathEntry)entry).fullExclusionPatternChars();
// postAction(new IPostAction() {
// public String getID() {
// return path.toString();
// }
-// public void run() throws JavaModelException {
-// indexManager.indexSourceFolder(project, path, exclusionPatterns);
+// public void run() /* throws JavaModelException */ {
+// indexManager.indexSourceFolder(project, path, inclusionPatterns, exclusionPatterns);
// }
// },
// APPEND); // append so that a removeSourceFolder action is not removed
// break;
// }
// }
-//
-// needToUpdateDependents |= (changeKind == IClasspathEntry.CPE_SOURCE) || newResolvedPath[i].isExported();
-// hasDelta = true;
-//
-// } // classpath reordering has already been generated in previous loop
-// }
-//
-// if (hasDelta) {
-// this.addDelta(delta);
-// }
-// if (needToUpdateDependents){
-// updateAffectedProjects(project.getProject().getFullPath());
-// }
-// }
+
+ needToUpdateDependents |= (changeKind == IClasspathEntry.CPE_SOURCE) || newResolvedPath[i].isExported();
+ hasDelta = true;
+ } // classpath reordering has already been generated in previous loop
+ }
+
+ if (hasDelta) {
+ this.addDelta(delta);
+ } else {
+ this.identicalRoots = true;
+ }
+ if (needToUpdateDependents){
+ updateAffectedProjects(project.getProject().getFullPath());
+ }
+ }
+ protected void saveClasspathIfNecessary() throws JavaModelException {
+
+ if (!this.canChangeResources || !this.needSave) return;
+
+ IClasspathEntry[] classpathForSave;
+ if (this.newRawPath == ReuseClasspath || this.newRawPath == UpdateClasspath){
+ classpathForSave = project.getRawClasspath();
+ } else {
+ classpathForSave = this.newRawPath;
+ }
+ IPath outputLocationForSave;
+ if (this.newOutputLocation == ReuseOutputLocation){
+ outputLocationForSave = project.getOutputLocation();
+ } else {
+ outputLocationForSave = this.newOutputLocation;
+ }
+ // if read-only .classpath, then the classpath setting will never been performed completely
+ if (project.saveClasspath(classpathForSave, outputLocationForSave)) {
+ this.classpathWasSaved = true;
+ this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);
+ }
+ }
protected JavaProject getProject() {
return ((JavaProject) getElementsToProcess()[0]);
}
@@ -528,6 +569,27 @@ public class SetClasspathOperation extends JavaModelOperation {
}
}
+ /*
+ * Returns the source attachment flag for the delta between the 2 give source paths.
+ * Returns either F_SOURCEATTACHED, F_SOURCEDETACHED, F_SOURCEATTACHED | F_SOURCEDETACHED
+ * or 0 if there is no difference.
+ */
+ private int getSourceAttachmentDeltaFlag(IPath oldPath, IPath newPath) {
+ if (oldPath == null) {
+ if (newPath != null) {
+ return IJavaElementDelta.F_SOURCEATTACHED;
+ } else {
+ return 0;
+ }
+ } else if (newPath == null) {
+ return IJavaElementDelta.F_SOURCEDETACHED;
+ } else if (!oldPath.equals(newPath)) {
+ return IJavaElementDelta.F_SOURCEATTACHED | IJavaElementDelta.F_SOURCEDETACHED;
+ } else {
+ return 0;
+ }
+ }
+
/**
* Returns true
if this operation performs no resource modifications,
* otherwise false
. Subclasses must override.
@@ -536,28 +598,28 @@ public class SetClasspathOperation extends JavaModelOperation {
return !this.canChangeResources;
}
- protected void saveClasspathIfNecessary() throws JavaModelException {
-
- if (!this.canChangeResources || !this.needSave) return;
-
- IClasspathEntry[] classpathForSave;
- JavaProject project = getProject();
- if (this.newRawPath == ReuseClasspath || this.newRawPath == UpdateClasspath){
- classpathForSave = project.getRawClasspath();
- } else {
- classpathForSave = this.newRawPath;
- }
- IPath outputLocationForSave;
- if (this.newOutputLocation == ReuseOutputLocation){
- outputLocationForSave = project.getOutputLocation();
- } else {
- outputLocationForSave = this.newOutputLocation;
- }
- // if read-only .classpath, then the classpath setting will never been performed completely
- if (project.saveClasspath(classpathForSave, outputLocationForSave)) {
- this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);
- }
- }
+// protected void saveClasspathIfNecessary() throws JavaModelException {
+//
+// if (!this.canChangeResources || !this.needSave) return;
+//
+// IClasspathEntry[] classpathForSave;
+// JavaProject project = getProject();
+// if (this.newRawPath == ReuseClasspath || this.newRawPath == UpdateClasspath){
+// classpathForSave = project.getRawClasspath();
+// } else {
+// classpathForSave = this.newRawPath;
+// }
+// IPath outputLocationForSave;
+// if (this.newOutputLocation == ReuseOutputLocation){
+// outputLocationForSave = project.getOutputLocation();
+// } else {
+// outputLocationForSave = this.newOutputLocation;
+// }
+// // if read-only .classpath, then the classpath setting will never been performed completely
+// if (project.saveClasspath(classpathForSave, outputLocationForSave)) {
+// this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);
+// }
+// }
public String toString(){
StringBuffer buffer = new StringBuffer(20);
@@ -582,31 +644,52 @@ public class SetClasspathOperation extends JavaModelOperation {
return buffer.toString();
}
+// private void updateClasspath() throws JavaModelException {
+//
+// JavaProject project = ((JavaProject) getElementsToProcess()[0]);
+//
+// beginTask(Util.bind("classpath.settingProgress", project.getElementName()), 2); //$NON-NLS-1$
+//
+// // SIDE-EFFECT: from thereon, the classpath got modified
+// project.setRawClasspath0(this.newRawPath);
+//
+// // resolve new path (asking for marker creation if problems)
+// if (this.newResolvedPath == null) {
+// this.newResolvedPath = project.getResolvedClasspath(true, this.canChangeResources);
+// }
+//
+//// if (this.oldResolvedPath != null) {
+//// generateClasspathChangeDeltas(
+//// this.oldResolvedPath,
+//// this.newResolvedPath,
+//// project);
+//// } else {
+// this.needCycleCheck = true;
+// updateAffectedProjects(project.getProject().getFullPath());
+//// }
+//
+// updateCycleMarkersIfNecessary(newResolvedPath);
+// }
private void updateClasspath() throws JavaModelException {
- JavaProject project = ((JavaProject) getElementsToProcess()[0]);
-
beginTask(Util.bind("classpath.settingProgress", project.getElementName()), 2); //$NON-NLS-1$
// SIDE-EFFECT: from thereon, the classpath got modified
- project.setRawClasspath0(this.newRawPath);
+ project.getPerProjectInfo().updateClasspathInformation(this.newRawPath);
// resolve new path (asking for marker creation if problems)
if (this.newResolvedPath == null) {
- this.newResolvedPath = project.getResolvedClasspath(true, this.canChangeResources);
+ this.newResolvedPath = project.getResolvedClasspath(true, this.canChangeResources, false/*don't returnResolutionInProgress*/);
}
-// if (this.oldResolvedPath != null) {
-// generateClasspathChangeDeltas(
-// this.oldResolvedPath,
-// this.newResolvedPath,
-// project);
-// } else {
+ if (this.oldResolvedPath != null) {
+ generateClasspathChangeDeltas();
+ } else {
this.needCycleCheck = true;
updateAffectedProjects(project.getProject().getFullPath());
-// }
+ }
- updateCycleMarkersIfNecessary(newResolvedPath);
+ updateCycleMarkersIfNecessary();
}
/**
@@ -654,30 +737,53 @@ public class SetClasspathOperation extends JavaModelOperation {
/**
* Update cycle markers
*/
- protected void updateCycleMarkersIfNecessary(IClasspathEntry[] newResolvedPath) {
+ protected void updateCycleMarkersIfNecessary() {
if (!this.needCycleCheck) return;
if (!this.canChangeResources) return;
- try {
- JavaProject project = getProject();
- if (!project.hasCycleMarker() && !project.hasClasspathCycle(project.getResolvedClasspath(true))){
- return;
- }
-
- postAction(
- new IPostAction() {
- public String getID() {
- return "updateCycleMarkers"; //$NON-NLS-1$
- }
- public void run() throws JavaModelException {
- JavaProject.updateAllCycleMarkers();
- }
- },
- REMOVEALL_APPEND);
- } catch(JavaModelException e){
+ if (!project.hasCycleMarker() && !project.hasClasspathCycle(newResolvedPath)){
+ return;
}
+
+ postAction(
+ new IPostAction() {
+ public String getID() {
+ return "updateCycleMarkers"; //$NON-NLS-1$
+ }
+ public void run() throws JavaModelException {
+ JavaProject.updateAllCycleMarkers();
+ }
+ },
+ REMOVEALL_APPEND);
}
+// /**
+// * Update cycle markers
+// */
+// protected void updateCycleMarkersIfNecessary(IClasspathEntry[] newResolvedPath) {
+//
+// if (!this.needCycleCheck) return;
+// if (!this.canChangeResources) return;
+//
+// try {
+// JavaProject project = getProject();
+// if (!project.hasCycleMarker() && !project.hasClasspathCycle(project.getResolvedClasspath(true))){
+// return;
+// }
+//
+// postAction(
+// new IPostAction() {
+// public String getID() {
+// return "updateCycleMarkers"; //$NON-NLS-1$
+// }
+// public void run() throws JavaModelException {
+// JavaProject.updateAllCycleMarkers();
+// }
+// },
+// REMOVEALL_APPEND);
+// } catch(JavaModelException e){
+// }
+// }
/**
* Sets the output location of the pre-specified project.
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceMethod.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceMethod.java
index c1e4ab7..91f17a5 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceMethod.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceMethod.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.core;
+import java.util.HashMap;
+
import net.sourceforge.phpdt.core.Flags;
import net.sourceforge.phpdt.core.IJavaElement;
import net.sourceforge.phpdt.core.IMethod;
@@ -25,7 +27,7 @@ import net.sourceforge.phpdt.internal.corext.Assert;
* @see IMethod
*/
-/* package */ class SourceMethod extends Member implements IMethod {
+public class SourceMethod extends Member implements IMethod {
/**
* The parameter type signatures of the method - stored locally
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceRefElement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceRefElement.java
index d3dcce0..6f89844 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceRefElement.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceRefElement.java
@@ -22,6 +22,8 @@ import net.sourceforge.phpdt.core.ISourceManipulation;
import net.sourceforge.phpdt.core.ISourceRange;
import net.sourceforge.phpdt.core.ISourceReference;
import net.sourceforge.phpdt.core.JavaModelException;
+import net.sourceforge.phpdt.core.WorkingCopyOwner;
+import net.sourceforge.phpdt.internal.core.util.MementoTokenizer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
@@ -101,6 +103,16 @@ public IResource getCorrespondingResource() throws JavaModelException {
if (!exists()) throw newNotPresentException();
return null;
}
+/*
+ * @see JavaElement
+ */
+public IJavaElement getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner workingCopyOwner) {
+ switch (token.charAt(0)) {
+ case JEM_COUNT:
+ return getHandleUpdatingCountFromMemento(memento, workingCopyOwner);
+ }
+ return this;
+}
/**
* Return the first instance of IOpenable in the hierarchy of this
* type (going up the hierarchy from this type);
@@ -115,6 +127,7 @@ public IOpenable getOpenableParent() {
}
return null;
}
+
/*
* @see IJavaElement
*/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceRefElementInfo.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceRefElementInfo.java
index 73b267b..70a171e 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceRefElementInfo.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceRefElementInfo.java
@@ -22,17 +22,17 @@ protected SourceRefElementInfo() {
setIsStructureKnown(true);
}
/**
- * @see org.eclipse.jdt.internal.compiler.env.ISourceType#getDeclarationSourceEnd()
- * @see org.eclipse.jdt.internal.compiler.env.ISourceMethod#getDeclarationSourceEnd()
- * @see org.eclipse.jdt.internal.compiler.env.ISourceField#getDeclarationSourceEnd()
+ * @see net.sourceforge.phpdt.internal.compiler.env.ISourceType#getDeclarationSourceEnd()
+ * @see net.sourceforge.phpdt.internal.compiler.env.ISourceMethod#getDeclarationSourceEnd()
+ * @see net.sourceforge.phpdt.internal.compiler.env.ISourceField#getDeclarationSourceEnd()
*/
public int getDeclarationSourceEnd() {
return fSourceRangeEnd;
}
/**
- * @see org.eclipse.jdt.internal.compiler.env.ISourceType#getDeclarationSourceStart()
- * @see org.eclipse.jdt.internal.compiler.env.ISourceMethod#getDeclarationSourceStart()
- * @see org.eclipse.jdt.internal.compiler.env.ISourceField#getDeclarationSourceStart()
+ * @see net.sourceforge.phpdt.internal.compiler.env.ISourceType#getDeclarationSourceStart()
+ * @see net.sourceforge.phpdt.internal.compiler.env.ISourceMethod#getDeclarationSourceStart()
+ * @see net.sourceforge.phpdt.internal.compiler.env.ISourceField#getDeclarationSourceStart()
*/
public int getDeclarationSourceStart() {
return fSourceRangeStart;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceType.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceType.java
index 9af3643..4088fad 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceType.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceType.java
@@ -10,20 +10,28 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.core;
+import java.io.InputStream;
import java.util.ArrayList;
+import net.sourceforge.phpdt.core.ICompilationUnit;
import net.sourceforge.phpdt.core.IField;
import net.sourceforge.phpdt.core.IJavaElement;
+import net.sourceforge.phpdt.core.IJavaProject;
import net.sourceforge.phpdt.core.IMember;
import net.sourceforge.phpdt.core.IMethod;
import net.sourceforge.phpdt.core.IPackageFragment;
import net.sourceforge.phpdt.core.IParent;
import net.sourceforge.phpdt.core.IType;
+import net.sourceforge.phpdt.core.ITypeHierarchy;
+import net.sourceforge.phpdt.core.IWorkingCopy;
import net.sourceforge.phpdt.core.JavaModelException;
+import net.sourceforge.phpdt.core.WorkingCopyOwner;
import net.sourceforge.phpdt.core.jdom.IDOMNode;
import net.sourceforge.phpdt.internal.core.util.Util;
import net.sourceforge.phpdt.internal.corext.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+
/**
* Handle for a source type. Info object is a SourceTypeElementInfo.
*
@@ -37,7 +45,6 @@ public class SourceType extends Member implements IType {
* An empty list of Strings
*/
protected static final String[] fgEmptyList = new String[] {};
-
protected SourceType(JavaElement parent, String name) {
super(parent, name);
Assert.isTrue(name.indexOf('.') == -1, Util.bind("sourcetype.invalidName", name)); //$NON-NLS-1$
@@ -365,66 +372,186 @@ public class SourceType extends Member implements IType {
/**
* @see IType
*/
- //public ITypeHierarchy loadTypeHierachy(InputStream input, IProgressMonitor monitor) throws JavaModelException {
- // return TypeHierarchy.load(this, input);
- //}
+// public ITypeHierarchy loadTypeHierachy(InputStream input, IProgressMonitor monitor) throws JavaModelException {
+// return loadTypeHierachy(input, DefaultWorkingCopyOwner.PRIMARY, monitor);
+// }
+ /**
+ * NOTE: This method is not part of the API has it is not clear clients would easily use it: they would need to
+ * first make sure all working copies for the given owner exist before calling it. This is especially har at startup
+ * time.
+ * In case clients want this API, here is how it should be specified:
+ *
+ *
null
if this type does not implement or extend
* any interfaces.
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/SimpleDOMBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/SimpleDOMBuilder.java
index a308317..37414d2 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/SimpleDOMBuilder.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/SimpleDOMBuilder.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.core.jdom;
+import java.util.HashMap;
import java.util.Map;
import net.sourceforge.phpdt.core.JavaCore;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/ASTNodeFinder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/ASTNodeFinder.java
new file mode 100644
index 0000000..40f0d2a
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/ASTNodeFinder.java
@@ -0,0 +1,187 @@
+/*******************************************************************************
+ * 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.internal.core.util;
+
+import java.util.ArrayList;
+
+import net.sourceforge.phpdt.core.IField;
+import net.sourceforge.phpdt.core.IJavaElement;
+import net.sourceforge.phpdt.core.IMethod;
+import net.sourceforge.phpdt.core.IType;
+import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
+import net.sourceforge.phpdt.internal.core.SourceType;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
+import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
+import net.sourceforge.phpeclipse.internal.compiler.ast.Argument;
+import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
+import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
+import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
+import net.sourceforge.phpeclipse.internal.compiler.ast.TypeReference;
+
+/**
+ * Finds an ASTNode given an IJavaElement in a CompilationUnitDeclaration
+ */
+public class ASTNodeFinder {
+ private CompilationUnitDeclaration unit;
+
+ public ASTNodeFinder(CompilationUnitDeclaration unit) {
+ this.unit = unit;
+ }
+
+ /*
+ * Finds the FieldDeclaration in the given ast corresponding to the given field handle.
+ * Returns null if not found.
+ */
+ public FieldDeclaration findField(IField fieldHandle) {
+ TypeDeclaration typeDecl = findType((IType)fieldHandle.getParent());
+ if (typeDecl == null) return null;
+ FieldDeclaration[] fields = typeDecl.fields;
+ if (fields != null) {
+ char[] fieldName = fieldHandle.getElementName().toCharArray();
+ for (int i = 0, length = fields.length; i < length; i++) {
+ FieldDeclaration field = fields[i];
+ if (CharOperation.equals(fieldName, field.name)) {
+ return field;
+ }
+ }
+ }
+ return null;
+ }
+
+ /*
+ * Finds the Initializer in the given ast corresponding to the given initializer handle.
+ * Returns null if not found.
+ */
+// public Initializer findInitializer(IInitializer initializerHandle) {
+// TypeDeclaration typeDecl = findType((IType)initializerHandle.getParent());
+// if (typeDecl == null) return null;
+// FieldDeclaration[] fields = typeDecl.fields;
+// if (fields != null) {
+// int occurenceCount = ((JavaElement)initializerHandle).occurrenceCount;
+// for (int i = 0, length = fields.length; i < length; i++) {
+// FieldDeclaration field = fields[i];
+// if (field instanceof Initializer && --occurenceCount == 0) {
+// return (Initializer)field;
+// }
+// }
+// }
+// return null;
+// }
+
+ /*
+ * Finds the AbstractMethodDeclaration in the given ast corresponding to the given method handle.
+ * Returns null if not found.
+ */
+ public AbstractMethodDeclaration findMethod(IMethod methodHandle) {
+ TypeDeclaration typeDecl = findType((IType)methodHandle.getParent());
+ if (typeDecl == null) return null;
+ AbstractMethodDeclaration[] methods = typeDecl.methods;
+ if (methods != null) {
+ char[] selector = methodHandle.getElementName().toCharArray();
+ String[] parameterTypeSignatures = methodHandle.getParameterTypes();
+ int parameterCount = parameterTypeSignatures.length;
+ nextMethod: for (int i = 0, length = methods.length; i < length; i++) {
+ AbstractMethodDeclaration method = methods[i];
+ if (CharOperation.equals(selector, method.selector)) {
+ Argument[] args = method.arguments;
+ int argsLength = args == null ? 0 : args.length;
+ if (argsLength == parameterCount) {
+ for (int j = 0; j < parameterCount; j++) {
+ TypeReference type = args[j].type;
+ String signature = Util.typeSignature(type);
+ if (!signature.equals(parameterTypeSignatures[j])) {
+ continue nextMethod;
+ }
+ }
+ return method;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /*
+ * Finds the TypeDeclaration in the given ast corresponding to the given type handle.
+ * Returns null if not found.
+ */
+ public TypeDeclaration findType(IType typeHandle) {
+ IJavaElement parent = typeHandle.getParent();
+ final char[] typeName = typeHandle.getElementName().toCharArray();
+// final int occurenceCount = ((SourceType)typeHandle).occurrenceCount;
+ final boolean findAnonymous = typeName.length == 0;
+ class Visitor extends ASTVisitor {
+ TypeDeclaration result;
+ int count = 0;
+ public boolean visit(TypeDeclaration typeDeclaration, BlockScope scope) {
+ if (result != null) return false;
+// if ((typeDeclaration.bits & ASTNode.IsAnonymousTypeMASK) != 0) {
+// if (findAnonymous && ++count == occurenceCount) {
+// result = typeDeclaration;
+// }
+// } else {
+ if (!findAnonymous && CharOperation.equals(typeName, typeDeclaration.name)) {
+ result = typeDeclaration;
+ }
+// }
+ return false; // visit only one level
+ }
+ }
+ switch (parent.getElementType()) {
+ case IJavaElement.COMPILATION_UNIT:
+ ArrayList types = this.unit.types;
+ if (types != null) {
+ for (int i = 0, length = types.size(); i < length; i++) {
+ TypeDeclaration type = (TypeDeclaration)types.get(i);//[i];
+ if (CharOperation.equals(typeName, type.name)) {
+ return type;
+ }
+ }
+ }
+ break;
+ case IJavaElement.TYPE:
+ TypeDeclaration parentDecl = findType((IType)parent);
+ if (parentDecl == null) return null;
+// types = parentDecl.memberTypes;
+// if (types != null) {
+// for (int i = 0, length = types.length; i < length; i++) {
+// TypeDeclaration type = types[i];
+// if (CharOperation.equals(typeName, type.name)) {
+// return type;
+// }
+// }
+// }
+ break;
+ case IJavaElement.FIELD:
+ FieldDeclaration fieldDecl = findField((IField)parent);
+ if (fieldDecl == null) return null;
+ Visitor visitor = new Visitor();
+ fieldDecl.traverse(visitor, null);
+ return visitor.result;
+// case IJavaElement.INITIALIZER:
+// Initializer initializer = findInitializer((IInitializer)parent);
+// if (initializer == null) return null;
+// visitor = new Visitor();
+// initializer.traverse(visitor, null);
+// return visitor.result;
+ case IJavaElement.METHOD:
+ AbstractMethodDeclaration methodDecl = findMethod((IMethod)parent);
+ if (methodDecl == null) return null;
+ visitor = new Visitor();
+ methodDecl.traverse(visitor, (ClassScope)null);
+ return visitor.result;
+ }
+ return null;
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CommentRecorderParser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CommentRecorderParser.java
index ae22db0..9133d69 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CommentRecorderParser.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CommentRecorderParser.java
@@ -84,28 +84,28 @@ public class CommentRecorderParser extends UnitParser {
// }
// /* (non-Javadoc)
-// * @see org.eclipse.jdt.internal.compiler.parser.Parser#consumeClassHeader()
+// * @see net.sourceforge.phpdt.internal.compiler.parser.Parser#consumeClassHeader()
// */
// protected void consumeClassHeader() {
// pushOnCommentsStack(0, this.scanner.commentPtr);
// super.consumeClassHeader();
// }
// /* (non-Javadoc)
-// * @see org.eclipse.jdt.internal.compiler.parser.Parser#consumeEmptyClassMemberDeclaration()
+// * @see net.sourceforge.phpdt.internal.compiler.parser.Parser#consumeEmptyClassMemberDeclaration()
// */
// protected void consumeEmptyClassMemberDeclaration() {
// pushOnCommentsStack(0, this.scanner.commentPtr);
// super.consumeEmptyClassMemberDeclaration();
// }
// /* (non-Javadoc)
-// * @see org.eclipse.jdt.internal.compiler.parser.Parser#consumeEmptyTypeDeclaration()
+// * @see net.sourceforge.phpdt.internal.compiler.parser.Parser#consumeEmptyTypeDeclaration()
// */
// protected void consumeEmptyTypeDeclaration() {
// pushOnCommentsStack(0, this.scanner.commentPtr);
// super.consumeEmptyTypeDeclaration();
// }
// /* (non-Javadoc)
-// * @see org.eclipse.jdt.internal.compiler.parser.Parser#consumeInterfaceHeader()
+// * @see net.sourceforge.phpdt.internal.compiler.parser.Parser#consumeInterfaceHeader()
// */
// protected void consumeInterfaceHeader() {
// pushOnCommentsStack(0, this.scanner.commentPtr);
@@ -114,7 +114,7 @@ public class CommentRecorderParser extends UnitParser {
/**
* Insure that start position is always positive.
- * @see org.eclipse.jdt.internal.compiler.parser.Parser#containsComment(int, int)
+ * @see net.sourceforge.phpdt.internal.compiler.parser.Parser#containsComment(int, int)
*/
public boolean containsComment(int sourceStart, int sourceEnd) {
int iComment = this.scanner.commentPtr;
@@ -133,7 +133,7 @@ public class CommentRecorderParser extends UnitParser {
}
/* (non-Javadoc)
- * @see org.eclipse.jdt.internal.compiler.parser.Parser#endParse(int)
+ * @see net.sourceforge.phpdt.internal.compiler.parser.Parser#endParse(int)
*/
protected CompilationUnitDeclaration endParse(int act) {
CompilationUnitDeclaration unit = super.endParse(act);
@@ -146,7 +146,7 @@ public class CommentRecorderParser extends UnitParser {
/* (non-Javadoc)
* Save all source comments currently stored before flushing them.
- * @see org.eclipse.jdt.internal.compiler.parser.Parser#flushCommentsDefinedPriorTo(int)
+ * @see net.sourceforge.phpdt.internal.compiler.parser.Parser#flushCommentsDefinedPriorTo(int)
*/
public int flushCommentsDefinedPriorTo(int position) {
@@ -204,7 +204,7 @@ public class CommentRecorderParser extends UnitParser {
}
/* (non-Javadoc)
- * @see org.eclipse.jdt.internal.compiler.parser.Parser#initialize()
+ * @see net.sourceforge.phpdt.internal.compiler.parser.Parser#initialize()
*/
public void initialize(boolean phpMode) {
super.initialize(phpMode);
@@ -213,7 +213,7 @@ public class CommentRecorderParser extends UnitParser {
/* (non-Javadoc)
* Create and store a specific comment recorder scanner.
- * @see org.eclipse.jdt.internal.compiler.parser.Parser#initializeScanner()
+ * @see net.sourceforge.phpdt.internal.compiler.parser.Parser#initializeScanner()
*/
public void initializeScanner() {
this.scanner = new CommentRecorderScanner(
@@ -257,7 +257,7 @@ public class CommentRecorderParser extends UnitParser {
}
/* (non-Javadoc)
* Save all source comments currently stored before flushing them.
- * @see org.eclipse.jdt.internal.compiler.parser.Parser#resetModifiers()
+ * @see net.sourceforge.phpdt.internal.compiler.parser.Parser#resetModifiers()
*/
protected void resetModifiers() {
pushOnCommentsStack(0, this.scanner.commentPtr);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CommentRecorderScanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CommentRecorderScanner.java
index ce634b8..6abef12 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CommentRecorderScanner.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CommentRecorderScanner.java
@@ -38,7 +38,7 @@ public class CommentRecorderScanner extends Scanner {
/**
* Set start position negative for line comments.
- * @see org.eclipse.jdt.internal.compiler.parser.Scanner#recordComment(int)
+ * @see net.sourceforge.phpdt.internal.compiler.parser.Scanner#recordComment(int)
*/
public void recordComment(int token) {
super.recordComment(token);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/LRUCache.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/LRUCache.java
index e1a933a..9bc14b9 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/LRUCache.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/LRUCache.java
@@ -26,7 +26,7 @@ import java.util.Hashtable;
* 0
if a is equal to
- * b; a value less than 0
if a
- * is lexicographically less than b; and a
- * value greater than 0
if a is
- * lexicographically greater than b.
- */
- public static int compare(char[] v1, char[] v2) {
- int len1 = v1.length;
- int len2 = v2.length;
- int n = Math.min(len1, len2);
- int i = 0;
- while (n-- != 0) {
- if (v1[i] != v2[i]) {
- return v1[i] - v2[i];
- }
- ++i;
- }
- return len1 - len2;
- }
+ private final static char[] DOUBLE_QUOTES = "''".toCharArray(); //$NON-NLS-1$
- /**
- * Concatenate two strings with a char in between.
- * @see #concat(String, String)
- */
- public static String concat(String s1, char c, String s2) {
- if (s1 == null) s1 = "null"; //$NON-NLS-1$
- if (s2 == null) s2 = "null"; //$NON-NLS-1$
- int l1 = s1.length();
- int l2 = s2.length();
- char[] buf = new char[l1 + 1 + l2];
- s1.getChars(0, l1, buf, 0);
- buf[l1] = c;
- s2.getChars(0, l2, buf, l1 + 1);
- return new String(buf);
- }
-
- /**
- * Concatenate two strings.
- * Much faster than using +, which:
- * - creates a StringBuffer,
- * - which is synchronized,
- * - of default size, so the resulting char array is
- * often larger than needed.
- * This implementation creates an extra char array, since the
- * String constructor copies its argument, but there's no way around this.
- */
- public static String concat(String s1, String s2) {
- if (s1 == null) s1 = "null"; //$NON-NLS-1$
- if (s2 == null) s2 = "null"; //$NON-NLS-1$
- int l1 = s1.length();
- int l2 = s2.length();
- char[] buf = new char[l1 + l2];
- s1.getChars(0, l1, buf, 0);
- s2.getChars(0, l2, buf, l1);
- return new String(buf);
- }
+ private static final String EMPTY_ARGUMENT = " "; //$NON-NLS-1$
- /**
- * Concatenate three strings.
- * @see #concat(String, String)
- */
- public static String concat(String s1, String s2, String s3) {
- if (s1 == null) s1 = "null"; //$NON-NLS-1$
- if (s2 == null) s2 = "null"; //$NON-NLS-1$
- if (s3 == null) s3 = "null"; //$NON-NLS-1$
- int l1 = s1.length();
- int l2 = s2.length();
- int l3 = s3.length();
- char[] buf = new char[l1 + l2 + l3];
- s1.getChars(0, l1, buf, 0);
- s2.getChars(0, l2, buf, l1);
- s3.getChars(0, l3, buf, l1 + l2);
- return new String(buf);
- }
-
- /**
- * Converts a type signature from the IBinaryType representation to the DC representation.
- */
- public static String convertTypeSignature(char[] sig) {
- return new String(sig).replace('/', '.');
- }
+ public static final String[] fgEmptyStringArray = new String[0];
- /**
- * Returns true iff str.toLowerCase().endsWith(end.toLowerCase())
- * implementation is not creating extra strings.
- */
- public final static boolean endsWithIgnoreCase(String str, String end) {
-
- int strLength = str == null ? 0 : str.length();
- int endLength = end == null ? 0 : end.length();
-
- // return false if the string is smaller than the end.
- if(endLength > strLength)
- return false;
-
- // return false if any character of the end are
- // not the same in lower case.
- for(int i = 1 ; i <= endLength; i++){
- if(Character.toLowerCase(end.charAt(endLength - i)) != Character.toLowerCase(str.charAt(strLength - i)))
- return false;
- }
-
- return true;
- }
+ private final static char[] SINGLE_QUOTE = "'".toCharArray(); //$NON-NLS-1$
- /**
- * Compares two arrays using equals() on the elements.
- * Either or both arrays may be null.
- * Returns true if both are null.
- * Returns false if only one is null.
- * If both are arrays, returns true iff they have the same length and
- * all elements are equal.
- */
- public static boolean equalArraysOrNull(int[] a, int[] b) {
- if (a == b)
- return true;
- if (a == null || b == null)
- return false;
- int len = a.length;
- if (len != b.length)
- return false;
- for (int i = 0; i < len; ++i) {
- if (a[i] != b[i])
- return false;
- }
- return true;
- }
+ static {
+ relocalize();
+ }
- /**
- * Compares two arrays using equals() on the elements.
- * Either or both arrays may be null.
- * Returns true if both are null.
- * Returns false if only one is null.
- * If both are arrays, returns true iff they have the same length and
- * all elements compare true with equals.
- */
- public static boolean equalArraysOrNull(Object[] a, Object[] b) {
- if (a == b) return true;
- if (a == null || b == null) return false;
-
- int len = a.length;
- if (len != b.length) return false;
- for (int i = 0; i < len; ++i) {
- if (a[i] == null) {
- if (b[i] != null) return false;
- } else {
- if (!a[i].equals(b[i])) return false;
- }
- }
- return true;
- }
-
- /**
- * Compares two String arrays using equals() on the elements.
- * The arrays are first sorted.
- * Either or both arrays may be null.
- * Returns true if both are null.
- * Returns false if only one is null.
- * If both are arrays, returns true iff they have the same length and
- * iff, after sorting both arrays, all elements compare true with equals.
- * The original arrays are left untouched.
- */
- public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) {
- if (a == b) return true;
- if (a == null || b == null) return false;
- int len = a.length;
- if (len != b.length) return false;
- if (len >= 2) { // only need to sort if more than two items
- a = sortCopy(a);
- b = sortCopy(b);
- }
- for (int i = 0; i < len; ++i) {
- if (!a[i].equals(b[i])) return false;
- }
- return true;
- }
-
- /**
- * Compares two arrays using equals() on the elements.
- * The arrays are first sorted.
- * Either or both arrays may be null.
- * Returns true if both are null.
- * Returns false if only one is null.
- * If both are arrays, returns true iff they have the same length and
- * iff, after sorting both arrays, all elements compare true with equals.
- * The original arrays are left untouched.
- */
- public static boolean equalArraysOrNullSortFirst(Comparable[] a, Comparable[] b) {
- if (a == b) return true;
- if (a == null || b == null) return false;
- int len = a.length;
- if (len != b.length) return false;
- if (len >= 2) { // only need to sort if more than two items
- a = sortCopy(a);
- b = sortCopy(b);
- }
- for (int i = 0; i < len; ++i) {
- if (!a[i].equals(b[i])) return false;
- }
- return true;
- }
-
- /**
- * Compares two objects using equals().
- * Either or both array may be null.
- * Returns true if both are null.
- * Returns false if only one is null.
- * Otherwise, return the result of comparing with equals().
- */
- public static boolean equalOrNull(Object a, Object b) {
- if (a == b) {
- return true;
- }
- if (a == null || b == null) {
- return false;
- }
- return a.equals(b);
- }
-
- /**
- * Given a qualified name, extract the last component.
- * If the input is not qualified, the same string is answered.
- */
- public static String extractLastName(String qualifiedName) {
- int i = qualifiedName.lastIndexOf('.');
- if (i == -1) return qualifiedName;
- return qualifiedName.substring(i+1);
- }
-
- /**
- * Extracts the parameter types from a method signature.
- */
- public static String[] extractParameterTypes(char[] sig) {
- int count = getParameterCount(sig);
- String[] result = new String[count];
- if (count == 0)
- return result;
- int i = CharOperation.indexOf('(', sig) + 1;
- count = 0;
- int len = sig.length;
- int start = i;
- for (;;) {
- if (i == len)
- break;
- char c = sig[i];
- if (c == ')')
- break;
- if (c == '[') {
- ++i;
- } else
- if (c == 'L') {
- i = CharOperation.indexOf(';', sig, i + 1) + 1;
- Assert.isTrue(i != 0);
- result[count++] = convertTypeSignature(CharOperation.subarray(sig, start, i));
- start = i;
- } else {
- ++i;
- result[count++] = convertTypeSignature(CharOperation.subarray(sig, start, i));
- start = i;
- }
- }
- return result;
- }
+ private Util() {
+ // cannot be instantiated
+ }
- /**
- * Extracts the return type from a method signature.
- */
- public static String extractReturnType(String sig) {
- int i = sig.lastIndexOf(')');
- Assert.isTrue(i != -1);
- return sig.substring(i+1);
- }
-
- /**
- * Finds the first line separator used by the given text.
- *
- * @return null
if none found
- */
- public static String findLineSeparator(char[] text) {
- // find the first line separator
- int length = text.length;
- if (length > 0) {
- char nextChar = text[0];
- for (int i = 0; i < length; i++) {
- char currentChar = nextChar;
- nextChar = i < length-1 ? text[i+1] : ' ';
- switch (currentChar) {
- case '\n': return "\n"; //$NON-NLS-1$
- case '\r': return nextChar == '\n' ? "\r\n" : "\r"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- }
- // not found
- return null;
- }
-
- /**
- * Returns the line separator used by the given buffer.
- * Uses the given text if none found.
- *
- * @return "\n" or "\r" or "\r\n"
- */
- private static String getLineSeparator(char[] text, char[] buffer) {
- // search in this buffer's contents first
- String lineSeparator = findLineSeparator(buffer);
- if (lineSeparator == null) {
- // search in the given text
- lineSeparator = findLineSeparator(text);
- if (lineSeparator == null) {
- // default to system line separator
- return System.getProperty("line.separator");
- }
- }
- return lineSeparator;
- }
-
- /**
- * Returns the number of parameter types in a method signature.
- */
- public static int getParameterCount(char[] sig) {
- int i = CharOperation.indexOf('(', sig) + 1;
- Assert.isTrue(i != 0);
- int count = 0;
- int len = sig.length;
- for (;;) {
- if (i == len)
- break;
- char c = sig[i];
- if (c == ')')
- break;
- if (c == '[') {
- ++i;
- } else
- if (c == 'L') {
- ++count;
- i = CharOperation.indexOf(';', sig, i + 1) + 1;
- Assert.isTrue(i != 0);
- } else {
- ++count;
- ++i;
- }
- }
- return count;
- }
-
- /**
- * Returns the given file's contents as a byte array.
- */
- public static byte[] getResourceContentsAsByteArray(IFile file) throws JavaModelException {
- InputStream stream= null;
- try {
- stream = new BufferedInputStream(file.getContents(true));
- } catch (CoreException e) {
- throw new JavaModelException(e);
- }
- try {
- return net.sourceforge.phpdt.internal.compiler.util.Util.getInputStreamAsByteArray(stream, -1);
- } catch (IOException e) {
- throw new JavaModelException(e, IJavaModelStatusConstants.IO_EXCEPTION);
- } finally {
- try {
- stream.close();
- } catch (IOException e) {
- }
- }
- }
-
- /**
- * Returns the given file's contents as a character array.
- */
- public static char[] getResourceContentsAsCharArray(IFile file) throws JavaModelException {
- String encoding = JavaCore.create(file.getProject()).getOption(JavaCore.CORE_ENCODING, true);
- return getResourceContentsAsCharArray(file, encoding);
- }
+ /**
+ * Lookup the message with the given ID in this catalog
+ */
+ public static String bind(String id) {
+ return bind(id, (String[]) null);
+ }
- public static char[] getResourceContentsAsCharArray(IFile file, String encoding) throws JavaModelException {
- InputStream stream= null;
- try {
- stream = new BufferedInputStream(file.getContents(true));
- } catch (CoreException e) {
- throw new JavaModelException(e, IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST);
- }
- try {
- return net.sourceforge.phpdt.internal.compiler.util.Util.getInputStreamAsCharArray(stream, -1, encoding);
- } catch (IOException e) {
- throw new JavaModelException(e, IJavaModelStatusConstants.IO_EXCEPTION);
- } finally {
- try {
- stream.close();
- } catch (IOException e) {
- }
- }
- }
-
- /**
- * Returns a trimmed version the simples names returned by Signature.
- */
- public static String[] getTrimmedSimpleNames(String name) {
- String[] result = Signature.getSimpleNames(name);
- if (result == null) return null;
- for (int i = 0, length = result.length; i < length; i++) {
- result[i] = result[i].trim();
- }
- return result;
- }
-
- /**
- * Returns true iff str.toLowerCase().endsWith(".class")
- * implementation is not creating extra strings.
- */
-// public final static boolean isClassFileName(String name) {
-// int nameLength = name == null ? 0 : name.length();
-// int suffixLength = SUFFIX_CLASS.length;
-// if (nameLength < suffixLength) return false;
-//
-// for (int i = 0, offset = nameLength - suffixLength; i < suffixLength; i++) {
-// char c = name.charAt(offset + i);
-// if (c != SUFFIX_class[i] && c != SUFFIX_CLASS[i]) return false;
-// }
-// return true;
-// }
-
- /*
- * Returns whether the given java element is exluded from its root's classpath.
- */
- public static final boolean isExcluded(IJavaElement element) {
- int elementType = element.getElementType();
- PackageFragmentRoot root = null;
- IResource resource = null;
- switch (elementType) {
-// case IJavaElement.PACKAGE_FRAGMENT:
-// PackageFragmentRoot root = (PackageFragmentRoot)element.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
-// IResource resource = element.getResource();
-// return resource != null && ProjectPrefUtil.isExcluded(resource, root.fullExclusionPatternChars());
- case IJavaElement.COMPILATION_UNIT:
- root = (PackageFragmentRoot)element.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
- resource = element.getResource();
-// if (resource != null && ProjectPrefUtil.isExcluded(resource, root.fullExclusionPatternChars()))
-// return true;
- return isExcluded(element.getParent());
- default:
- IJavaElement cu = element.getAncestor(IJavaElement.COMPILATION_UNIT);
- return cu != null && isExcluded(cu);
- }
- }
- /*
- * Returns whether the given resource path matches one of the exclusion
- * patterns.
- *
- * @see IClasspathEntry#getExclusionPatterns
- */
- public final static boolean isExcluded(IPath resourcePath, char[][] exclusionPatterns) {
- if (exclusionPatterns == null) return false;
- char[] path = resourcePath.toString().toCharArray();
- for (int i = 0, length = exclusionPatterns.length; i < length; i++)
- if (CharOperation.pathMatch(exclusionPatterns[i], path, true, '/'))
- return true;
- return false;
- }
-
- /*
- * Returns whether the given resource matches one of the exclusion patterns.
- *
- * @see IClasspathEntry#getExclusionPatterns
- */
- public final static boolean isExcluded(IResource resource, char[][] exclusionPatterns) {
- IPath path = resource.getFullPath();
- // ensure that folders are only excluded if all of their children are excluded
- if (resource.getType() == IResource.FOLDER)
- path = path.append("*"); //$NON-NLS-1$
- return isExcluded(path, exclusionPatterns);
- }
+ /**
+ * Lookup the message with the given ID in this catalog and bind its substitution locations with the given string.
+ */
+ public static String bind(String id, String binding) {
+ return bind(id, new String[] { binding });
+ }
- /**
- * Returns true iff str.toLowerCase().endsWith(".jar" or ".zip")
- * implementation is not creating extra strings.
- */
-// public final static boolean isArchiveFileName(String name) {
-// int nameLength = name == null ? 0 : name.length();
-// int suffixLength = SUFFIX_JAR.length;
-// if (nameLength < suffixLength) return false;
-//
-// int i, offset;
-// for ( i = 0, offset = nameLength - suffixLength; i < suffixLength; i++) {
-// char c = name.charAt(offset + i);
-// if (c != SUFFIX_jar[i] && c != SUFFIX_JAR[i]) break;
-// }
-// if (i == suffixLength) return true;
-// for ( i = 0, offset = nameLength - suffixLength; i < suffixLength; i++) {
-// char c = name.charAt(offset + i);
-// if (c != SUFFIX_zip[i] && c != SUFFIX_ZIP[i]) return false;
-// }
-// return true;
-// }
-
- /**
- * Validate the given compilation unit name.
- * A compilation unit name must obey the following rules:
- *
- *
- * ".java"
suffix
- * 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 boolean isValidCompilationUnitName(String name) {
- return PHPFileUtil.isPHPFileName(name);
-// return JavaConventions.validateCompilationUnitName(name).getSeverity() != IStatus.ERROR;
- }
+ /**
+ * Lookup the message with the given ID in this catalog and bind its substitution locations with the given strings.
+ */
+ public static String bind(String id, String binding1, String binding2) {
+ return bind(id, new String[] { binding1, binding2 });
+ }
- /**
- * Validate the given .class file name.
- * A .class file name must obey the following rules:
- *
- *
- * ".class"
suffix
- *
IStatus.OK
if
- * the given name is valid as a .class file name, otherwise a status
- * object indicating what is wrong with the name
- */
-// public static boolean isValidClassFileName(String name) {
-// return JavaConventions.validateClassFileName(name).getSeverity() != IStatus.ERROR;
-// }
+ /**
+ * Lookup the message with the given ID in this catalog and bind its substitution locations with the given string values.
+ */
+ public static String bind(String id, String[] bindings) {
+ if (id == null)
+ return "No message available"; //$NON-NLS-1$
+ String message = null;
+ try {
+ message = bundle.getString(id);
+ } catch (MissingResourceException e) {
+ // If we got an exception looking for the message, fail gracefully by just returning
+ // the id we were looking for. In most cases this is semi-informative so is not too bad.
+ return "Missing message: " + id + " in: " + bundleName; //$NON-NLS-2$ //$NON-NLS-1$
+ }
+ // for compatibility with MessageFormat which eliminates double quotes in original message
+ char[] messageWithNoDoubleQuotes = CharOperation.replace(message.toCharArray(), DOUBLE_QUOTES, SINGLE_QUOTE);
- /**
- * Returns true if the given method signature is valid,
- * false if it is not.
- */
- public static boolean isValidMethodSignature(String sig) {
- int len = sig.length();
- if (len == 0) return false;
- int i = 0;
- char c = sig.charAt(i++);
- if (c != '(') return false;
- if (i >= len) return false;
- while (sig.charAt(i) != ')') {
- // Void is not allowed as a parameter type.
- i = checkTypeSignature(sig, i, len, false);
- if (i == -1) return false;
- if (i >= len) return false;
- }
- ++i;
- i = checkTypeSignature(sig, i, len, true);
- return i == len;
- }
-
- /**
- * Returns true if the given type signature is valid,
- * false if it is not.
- */
- public static boolean isValidTypeSignature(String sig, boolean allowVoid) {
- int len = sig.length();
- return checkTypeSignature(sig, 0, len, allowVoid) == len;
- }
-
- /**
- * Returns true if the given folder name is valid for a package,
- * false if it is not.
- */
- public static boolean isValidFolderNameForPackage(String folderName) {
-// return JavaConventions.validateIdentifier(folderName).getSeverity() != IStatus.ERROR;
- return true;
- }
+ if (bindings == null)
+ return new String(messageWithNoDoubleQuotes);
- /*
- * Add a log entry
- */
-// public static void log(Throwable e, String message) {
-// Throwable nestedException;
-// if (e instanceof JavaModelException
-// && (nestedException = ((JavaModelException)e).getException()) != null) {
-// e = nestedException;
-// }
-// IStatus status= new Status(
-// IStatus.ERROR,
-// JavaCore.getPlugin().getDescriptor().getUniqueIdentifier(),
-// IStatus.ERROR,
-// message,
-// e);
-// JavaCore.getPlugin().getLog().log(status);
-// }
- /*
- * Add a log entry
- */
- public static void log(Throwable e, String message) {
- Throwable nestedException;
- if (e instanceof JavaModelException
- && (nestedException = ((JavaModelException)e).getException()) != null) {
- e = nestedException;
- }
- IStatus status= new Status(
- IStatus.ERROR,
- JavaCore.PLUGIN_ID,
- IStatus.ERROR,
- message,
- e);
- JavaCore.getPlugin().getLog().log(status);
- }
- /**
- * Normalizes the cariage returns in the given text.
- * They are all changed to use the given buffer's line separator.
- */
- public static char[] normalizeCRs(char[] text, char[] buffer) {
- CharArrayBuffer result = new CharArrayBuffer();
- int lineStart = 0;
- int length = text.length;
- if (length == 0) return text;
- String lineSeparator = getLineSeparator(text, buffer);
- char nextChar = text[0];
- for (int i = 0; i < length; i++) {
- char currentChar = nextChar;
- nextChar = i < length-1 ? text[i+1] : ' ';
- switch (currentChar) {
- case '\n':
- int lineLength = i-lineStart;
- char[] line = new char[lineLength];
- System.arraycopy(text, lineStart, line, 0, lineLength);
- result.append(line);
- result.append(lineSeparator);
- lineStart = i+1;
- break;
- case '\r':
- lineLength = i-lineStart;
- if (lineLength >= 0) {
- line = new char[lineLength];
- System.arraycopy(text, lineStart, line, 0, lineLength);
- result.append(line);
- result.append(lineSeparator);
- if (nextChar == '\n') {
- nextChar = ' ';
- lineStart = i+2;
- } else {
- // when line separator are mixed in the same file
- // \r might not be followed by a \n. If not, we should increment
- // lineStart by one and not by two.
- lineStart = i+1;
- }
- } else {
- // when line separator are mixed in the same file
- // we need to prevent NegativeArraySizeException
- lineStart = i+1;
- }
- break;
- }
- }
- char[] lastLine;
- if (lineStart > 0) {
- int lastLineLength = length-lineStart;
- if (lastLineLength > 0) {
- lastLine = new char[lastLineLength];
- System.arraycopy(text, lineStart, lastLine, 0, lastLineLength);
- result.append(lastLine);
- }
- return result.getContents();
- } else {
- return text;
- }
- }
+ int length = messageWithNoDoubleQuotes.length;
+ int start = 0;
+ int end = length;
+ StringBuffer output = null;
+ while (true) {
+ if ((end = CharOperation.indexOf('{', messageWithNoDoubleQuotes, start)) > -1) {
+ if (output == null)
+ output = new StringBuffer(length + bindings.length * 20);
+ output.append(messageWithNoDoubleQuotes, start, end - start);
+ if ((start = CharOperation.indexOf('}', messageWithNoDoubleQuotes, end + 1)) > -1) {
+ int index = -1;
+ String argId = new String(messageWithNoDoubleQuotes, end + 1, start - end - 1);
+ try {
+ index = Integer.parseInt(argId);
+ output.append(bindings[index]);
+ } catch (NumberFormatException nfe) { // could be nested message ID {compiler.name}
+ boolean done = false;
+ if (!id.equals(argId)) {
+ String argMessage = null;
+ try {
+ argMessage = bundle.getString(argId);
+ output.append(argMessage);
+ done = true;
+ } catch (MissingResourceException e) {
+ // unable to bind argument, ignore (will leave argument in)
+ }
+ }
+ if (!done)
+ output.append(messageWithNoDoubleQuotes, end + 1, start - end);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ output.append("{missing " + Integer.toString(index) + "}"); //$NON-NLS-2$ //$NON-NLS-1$
+ }
+ start++;
+ } else {
+ output.append(messageWithNoDoubleQuotes, end, length);
+ break;
+ }
+ } else {
+ if (output == null)
+ return new String(messageWithNoDoubleQuotes);
+ output.append(messageWithNoDoubleQuotes, start, length - start);
+ break;
+ }
+ }
+ return output.toString();
+ }
- /**
- * Normalizes the cariage returns in the given text.
- * They are all changed to use given buffer's line sepatator.
- */
- public static String normalizeCRs(String text, String buffer) {
- return new String(normalizeCRs(text.toCharArray(), buffer.toCharArray()));
- }
+ /**
+ * Checks the type signature in String sig, starting at start and ending before end (end is not included). Returns the index of
+ * the character immediately after the signature if valid, or -1 if not valid.
+ */
+ private static int checkTypeSignature(String sig, int start, int end, boolean allowVoid) {
+ if (start >= end)
+ return -1;
+ int i = start;
+ char c = sig.charAt(i++);
+ int nestingDepth = 0;
+ while (c == '[') {
+ ++nestingDepth;
+ if (i >= end)
+ return -1;
+ c = sig.charAt(i++);
+ }
+ switch (c) {
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'F':
+ case 'I':
+ case 'J':
+ case 'S':
+ case 'Z':
+ break;
+ case 'V':
+ if (!allowVoid)
+ return -1;
+ // array of void is not allowed
+ if (nestingDepth != 0)
+ return -1;
+ break;
+ case 'L':
+ int semicolon = sig.indexOf(';', i);
+ // Must have at least one character between L and ;
+ if (semicolon <= i || semicolon >= end)
+ return -1;
+ i = semicolon + 1;
+ break;
+ default:
+ return -1;
+ }
+ return i;
+ }
- /**
- * Sort the objects in the given collection using the given sort order.
- */
- private static void quickSort(Object[] sortedCollection, int left, int right, int[] sortOrder) {
- int original_left = left;
- int original_right = right;
- int mid = sortOrder[ (left + right) / 2];
- do {
- while (sortOrder[left] < mid) {
- left++;
- }
- while (mid < sortOrder[right]) {
- right--;
- }
- if (left <= right) {
- Object tmp = sortedCollection[left];
- sortedCollection[left] = sortedCollection[right];
- sortedCollection[right] = tmp;
- int tmp2 = sortOrder[left];
- sortOrder[left] = sortOrder[right];
- sortOrder[right] = tmp2;
- left++;
- right--;
- }
- } while (left <= right);
- if (original_left < right) {
- quickSort(sortedCollection, original_left, right, sortOrder);
- }
- if (left < original_right) {
- quickSort(sortedCollection, left, original_right, sortOrder);
- }
- }
+ /**
+ * Combines two hash codes to make a new one.
+ */
+ public static int combineHashCodes(int hashCode1, int hashCode2) {
+ return hashCode1 * 17 + hashCode2;
+ }
- /**
- * Sort the objects in the given collection using the given comparer.
- */
- private static void quickSort(Object[] sortedCollection, int left, int right, Comparer comparer) {
- int original_left = left;
- int original_right = right;
- Object mid = sortedCollection[ (left + right) / 2];
- do {
- while (comparer.compare(sortedCollection[left], mid) < 0) {
- left++;
- }
- while (comparer.compare(mid, sortedCollection[right]) < 0) {
- right--;
- }
- if (left <= right) {
- Object tmp = sortedCollection[left];
- sortedCollection[left] = sortedCollection[right];
- sortedCollection[right] = tmp;
- left++;
- right--;
- }
- } while (left <= right);
- if (original_left < right) {
- quickSort(sortedCollection, original_left, right, comparer);
- }
- if (left < original_right) {
- quickSort(sortedCollection, left, original_right, comparer);
- }
- }
+ /**
+ * Compares two byte arrays. Returns <0 if a byte in a is less than the corresponding byte in b, or if a is shorter, or if a is
+ * null. Returns >0 if a byte in a is greater than the corresponding byte in b, or if a is longer, or if b is null. Returns 0 if
+ * they are equal or both null.
+ */
+ public static int compare(byte[] a, byte[] b) {
+ if (a == b)
+ return 0;
+ if (a == null)
+ return -1;
+ if (b == null)
+ return 1;
+ int len = Math.min(a.length, b.length);
+ for (int i = 0; i < len; ++i) {
+ int diff = a[i] - b[i];
+ if (diff != 0)
+ return diff;
+ }
+ if (a.length > len)
+ return 1;
+ if (b.length > len)
+ return -1;
+ return 0;
+ }
- /**
- * Sort the strings in the given collection.
- */
- private static void quickSort(String[] sortedCollection, int left, int right) {
- int original_left = left;
- int original_right = right;
- String mid = sortedCollection[ (left + right) / 2];
- do {
- while (sortedCollection[left].compareTo(mid) < 0) {
- left++;
- }
- while (mid.compareTo(sortedCollection[right]) < 0) {
- right--;
- }
- if (left <= right) {
- String tmp = sortedCollection[left];
- sortedCollection[left] = sortedCollection[right];
- sortedCollection[right] = tmp;
- left++;
- right--;
- }
- } while (left <= right);
- if (original_left < right) {
- quickSort(sortedCollection, original_left, right);
- }
- if (left < original_right) {
- quickSort(sortedCollection, left, original_right);
- }
- }
+ /**
+ * Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings.
+ *
+ * @return the value 0
if the str1 is equal to str2; a value less than 0
if str1 is
+ * lexicographically less than str2; and a value greater than 0
if str1 is lexicographically greater than
+ * str2.
+ */
+ public static int compare(char[] str1, char[] str2) {
+ int len1 = str1.length;
+ int len2 = str2.length;
+ int n = Math.min(len1, len2);
+ int i = 0;
+ while (n-- != 0) {
+ char c1 = str1[i];
+ char c2 = str2[i++];
+ if (c1 != c2) {
+ return c1 - c2;
+ }
+ }
+ return len1 - len2;
+ }
- /**
- * Converts the given relative path into a package name.
- * Returns null if the path is not a valid package name.
- */
- public static String packageName(IPath pkgPath) {
- StringBuffer pkgName = new StringBuffer(IPackageFragment.DEFAULT_PACKAGE_NAME);
- for (int j = 0, max = pkgPath.segmentCount(); j < max; j++) {
- String segment = pkgPath.segment(j);
- if (!isValidFolderNameForPackage(segment)) {
- return null;
- }
- pkgName.append(segment);
- if (j < pkgPath.segmentCount() - 1) {
- pkgName.append("." ); //$NON-NLS-1$
- }
- }
- return pkgName.toString();
- }
+ /**
+ * Concatenate two strings with a char in between.
+ *
+ * @see #concat(String, String)
+ */
+ public static String concat(String s1, char c, String s2) {
+ if (s1 == null)
+ s1 = "null"; //$NON-NLS-1$
+ if (s2 == null)
+ s2 = "null"; //$NON-NLS-1$
+ int l1 = s1.length();
+ int l2 = s2.length();
+ char[] buf = new char[l1 + 1 + l2];
+ s1.getChars(0, l1, buf, 0);
+ buf[l1] = c;
+ s2.getChars(0, l2, buf, l1 + 1);
+ return new String(buf);
+ }
- /**
- * Sort the comparable objects in the given collection.
- */
- private static void quickSort(Comparable[] sortedCollection, int left, int right) {
- int original_left = left;
- int original_right = right;
- Comparable mid = sortedCollection[ (left + right) / 2];
- do {
- while (sortedCollection[left].compareTo(mid) < 0) {
- left++;
- }
- while (mid.compareTo(sortedCollection[right]) < 0) {
- right--;
- }
- if (left <= right) {
- Comparable tmp = sortedCollection[left];
- sortedCollection[left] = sortedCollection[right];
- sortedCollection[right] = tmp;
- left++;
- right--;
- }
- } while (left <= right);
- if (original_left < right) {
- quickSort(sortedCollection, original_left, right);
- }
- if (left < original_right) {
- quickSort(sortedCollection, left, original_right);
- }
- }
+ /**
+ * Concatenate two strings. Much faster than using +, which: - creates a StringBuffer, - which is synchronized, - of default size,
+ * so the resulting char array is often larger than needed. This implementation creates an extra char array, since the String
+ * constructor copies its argument, but there's no way around this.
+ */
+ public static String concat(String s1, String s2) {
+ if (s1 == null)
+ s1 = "null"; //$NON-NLS-1$
+ if (s2 == null)
+ s2 = "null"; //$NON-NLS-1$
+ int l1 = s1.length();
+ int l2 = s2.length();
+ char[] buf = new char[l1 + l2];
+ s1.getChars(0, l1, buf, 0);
+ s2.getChars(0, l2, buf, l1);
+ return new String(buf);
+ }
- /**
- * Sort the strings in the given collection in reverse alphabetical order.
- */
- private static void quickSortReverse(String[] sortedCollection, int left, int right) {
- int original_left = left;
- int original_right = right;
- String mid = sortedCollection[ (left + right) / 2];
- do {
- while (sortedCollection[left].compareTo(mid) > 0) {
- left++;
- }
- while (mid.compareTo(sortedCollection[right]) > 0) {
- right--;
- }
- if (left <= right) {
- String tmp = sortedCollection[left];
- sortedCollection[left] = sortedCollection[right];
- sortedCollection[right] = tmp;
- left++;
- right--;
- }
- } while (left <= right);
- if (original_left < right) {
- quickSortReverse(sortedCollection, original_left, right);
- }
- if (left < original_right) {
- quickSortReverse(sortedCollection, left, original_right);
- }
- }
+ /**
+ * Concatenate three strings.
+ *
+ * @see #concat(String, String)
+ */
+ public static String concat(String s1, String s2, String s3) {
+ if (s1 == null)
+ s1 = "null"; //$NON-NLS-1$
+ if (s2 == null)
+ s2 = "null"; //$NON-NLS-1$
+ if (s3 == null)
+ s3 = "null"; //$NON-NLS-1$
+ int l1 = s1.length();
+ int l2 = s2.length();
+ int l3 = s3.length();
+ char[] buf = new char[l1 + l2 + l3];
+ s1.getChars(0, l1, buf, 0);
+ s2.getChars(0, l2, buf, l1);
+ s3.getChars(0, l3, buf, l1 + l2);
+ return new String(buf);
+ }
- /**
- * Sorts an array of objects in place, using the sort order given for each item.
- */
- public static void sort(Object[] objects, int[] sortOrder) {
- if (objects.length > 1)
- quickSort(objects, 0, objects.length - 1, sortOrder);
- }
+ /**
+ * Converts a type signature from the IBinaryType representation to the DC representation.
+ */
+ public static String convertTypeSignature(char[] sig) {
+ return new String(sig).replace('/', '.');
+ }
- /**
- * Sorts an array of objects in place.
- * The given comparer compares pairs of items.
- */
- public static void sort(Object[] objects, Comparer comparer) {
- if (objects.length > 1)
- quickSort(objects, 0, objects.length - 1, comparer);
- }
+ /**
+ * Apply the given edit on the given string and return the updated string. Return the given string if anything wrong happen while
+ * applying the edit.
+ *
+ * @param original
+ * the given string
+ * @param edit
+ * the given edit
+ *
+ * @return the updated string
+ */
+ public final static String editedString(String original, TextEdit edit) {
+ if (edit == null) {
+ return original;
+ }
+ SimpleDocument document = new SimpleDocument(original);
+ try {
+ edit.apply(document, TextEdit.NONE);
+ return document.get();
+ } catch (MalformedTreeException e) {
+ e.printStackTrace();
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ }
+ return original;
+ }
- /**
- * Sorts an array of strings in place using quicksort.
- */
- public static void sort(String[] strings) {
- if (strings.length > 1)
- quickSort(strings, 0, strings.length - 1);
- }
+ /**
+ * Returns true iff str.toLowerCase().endsWith(end.toLowerCase()) implementation is not creating extra strings.
+ */
+ public final static boolean endsWithIgnoreCase(String str, String end) {
- /**
- * Sorts an array of Comparable objects in place.
- */
- public static void sort(Comparable[] objects) {
- if (objects.length > 1)
- quickSort(objects, 0, objects.length - 1);
- }
+ int strLength = str == null ? 0 : str.length();
+ int endLength = end == null ? 0 : end.length();
- /**
- * Sorts an array of Strings, returning a new array
- * with the sorted items. The original array is left untouched.
- */
- public static Object[] sortCopy(Object[] objects, Comparer comparer) {
- int len = objects.length;
- Object[] copy = new Object[len];
- System.arraycopy(objects, 0, copy, 0, len);
- sort(copy, comparer);
- return copy;
- }
+ // return false if the string is smaller than the end.
+ if (endLength > strLength)
+ return false;
- /**
- * Sorts an array of Strings, returning a new array
- * with the sorted items. The original array is left untouched.
- */
- public static String[] sortCopy(String[] objects) {
- int len = objects.length;
- String[] copy = new String[len];
- System.arraycopy(objects, 0, copy, 0, len);
- sort(copy);
- return copy;
- }
+ // return false if any character of the end are
+ // not the same in lower case.
+ for (int i = 1; i <= endLength; i++) {
+ if (Character.toLowerCase(end.charAt(endLength - i)) != Character.toLowerCase(str.charAt(strLength - i)))
+ return false;
+ }
- /**
- * Sorts an array of Comparable objects, returning a new array
- * with the sorted items. The original array is left untouched.
- */
- public static Comparable[] sortCopy(Comparable[] objects) {
- int len = objects.length;
- Comparable[] copy = new Comparable[len];
- System.arraycopy(objects, 0, copy, 0, len);
- sort(copy);
- return copy;
- }
+ return true;
+ }
- /**
- * Sorts an array of strings in place using quicksort
- * in reverse alphabetical order.
- */
- public static void sortReverseOrder(String[] strings) {
- if (strings.length > 1)
- quickSortReverse(strings, 0, strings.length - 1);
- }
+ /**
+ * Compares two arrays using equals() on the elements. Either or both arrays may be null. Returns true if both are null. Returns
+ * false if only one is null. If both are arrays, returns true iff they have the same length and all elements are equal.
+ */
+ public static boolean equalArraysOrNull(int[] a, int[] b) {
+ if (a == b)
+ return true;
+ if (a == null || b == null)
+ return false;
+ int len = a.length;
+ if (len != b.length)
+ return false;
+ for (int i = 0; i < len; ++i) {
+ if (a[i] != b[i])
+ return false;
+ }
+ return true;
+ }
- /**
- * Converts a String[] to char[][].
- */
- public static char[][] toCharArrays(String[] a) {
- int len = a.length;
- char[][] result = new char[len][];
- for (int i = 0; i < len; ++i) {
- result[i] = toChars(a[i]);
- }
- return result;
- }
+ /**
+ * Compares two arrays using equals() on the elements. Either or both arrays may be null. Returns true if both are null. Returns
+ * false if only one is null. If both are arrays, returns true iff they have the same length and all elements compare true with
+ * equals.
+ */
+ public static boolean equalArraysOrNull(Object[] a, Object[] b) {
+ if (a == b)
+ return true;
+ if (a == null || b == null)
+ return false;
- /**
- * Converts a String to char[].
- */
- public static char[] toChars(String s) {
- int len = s.length();
- char[] chars = new char[len];
- s.getChars(0, len, chars, 0);
- return chars;
- }
+ int len = a.length;
+ if (len != b.length)
+ return false;
+ for (int i = 0; i < len; ++i) {
+ if (a[i] == null) {
+ if (b[i] != null)
+ return false;
+ } else {
+ if (!a[i].equals(b[i]))
+ return false;
+ }
+ }
+ return true;
+ }
- /**
- * Converts a String to char[][], where segments are separate by '.'.
- */
- public static char[][] toCompoundChars(String s) {
- int len = s.length();
- if (len == 0) {
- return CharOperation.NO_CHAR_CHAR;
- }
- int segCount = 1;
- for (int off = s.indexOf('.'); off != -1; off = s.indexOf('.', off + 1)) {
- ++segCount;
- }
- char[][] segs = new char[segCount][];
- int start = 0;
- for (int i = 0; i < segCount; ++i) {
- int dot = s.indexOf('.', start);
- int end = (dot == -1 ? s.length() : dot);
- segs[i] = new char[end - start];
- s.getChars(start, end, segs[i], 0);
- start = end + 1;
- }
- return segs;
- }
+ /**
+ * Compares two arrays using equals() on the elements. The arrays are first sorted. Either or both arrays may be null. Returns
+ * true if both are null. Returns false if only one is null. If both are arrays, returns true iff they have the same length and
+ * iff, after sorting both arrays, all elements compare true with equals. The original arrays are left untouched.
+ */
+ public static boolean equalArraysOrNullSortFirst(Comparable[] a, Comparable[] b) {
+ if (a == b)
+ return true;
+ if (a == null || b == null)
+ return false;
+ int len = a.length;
+ if (len != b.length)
+ return false;
+ if (len >= 2) { // only need to sort if more than two items
+ a = sortCopy(a);
+ b = sortCopy(b);
+ }
+ for (int i = 0; i < len; ++i) {
+ if (!a[i].equals(b[i]))
+ return false;
+ }
+ return true;
+ }
- /**
- * Converts a char[][] to String, where segments are separated by '.'.
- */
- public static String toString(char[][] c) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0, max = c.length; i < max; ++i) {
- if (i != 0) sb.append('.');
- sb.append(c[i]);
- }
- return sb.toString();
- }
+ /**
+ * Compares two String arrays using equals() on the elements. The arrays are first sorted. Either or both arrays may be null.
+ * Returns true if both are null. Returns false if only one is null. If both are arrays, returns true iff they have the same
+ * length and iff, after sorting both arrays, all elements compare true with equals. The original arrays are left untouched.
+ */
+ public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) {
+ if (a == b)
+ return true;
+ if (a == null || b == null)
+ return false;
+ int len = a.length;
+ if (len != b.length)
+ return false;
+ if (len >= 2) { // only need to sort if more than two items
+ a = sortCopy(a);
+ b = sortCopy(b);
+ }
+ for (int i = 0; i < len; ++i) {
+ if (!a[i].equals(b[i]))
+ return false;
+ }
+ return true;
+ }
- /**
- * Converts a char[][] and a char[] to String, where segments are separated by '.'.
- */
- public static String toString(char[][] c, char[] d) {
- if (c == null) return new String(d);
- StringBuffer sb = new StringBuffer();
- for (int i = 0, max = c.length; i < max; ++i) {
- sb.append(c[i]);
- sb.append('.');
- }
- sb.append(d);
- return sb.toString();
- }
+ /**
+ * Compares two objects using equals(). Either or both array may be null. Returns true if both are null. Returns false if only one
+ * is null. Otherwise, return the result of comparing with equals().
+ */
+ public static boolean equalOrNull(Object a, Object b) {
+ if (a == b) {
+ return true;
+ }
+ if (a == null || b == null) {
+ return false;
+ }
+ return a.equals(b);
+ }
- /**
- * Converts a char[] to String.
- */
- public static String toString(char[] c) {
- return new String(c);
- }
+ /**
+ * Given a qualified name, extract the last component. If the input is not qualified, the same string is answered.
+ */
+ public static String extractLastName(String qualifiedName) {
+ int i = qualifiedName.lastIndexOf('.');
+ if (i == -1)
+ return qualifiedName;
+ return qualifiedName.substring(i + 1);
+ }
- /**
- * Converts an array of Objects into String.
- */
- public static String toString(Object[] objects) {
- return toString(objects,
- new Displayable(){
- public String displayString(Object o) {
- if (o == null) return "null"; //$NON-NLS-1$
- return o.toString();
- }
- });
- }
+ /**
+ * Extracts the parameter types from a method signature.
+ */
+ public static String[] extractParameterTypes(char[] sig) {
+ int count = getParameterCount(sig);
+ String[] result = new String[count];
+ if (count == 0)
+ return result;
+ int i = CharOperation.indexOf('(', sig) + 1;
+ count = 0;
+ int len = sig.length;
+ int start = i;
+ for (;;) {
+ if (i == len)
+ break;
+ char c = sig[i];
+ if (c == ')')
+ break;
+ if (c == '[') {
+ ++i;
+ } else if (c == 'L') {
+ i = CharOperation.indexOf(';', sig, i + 1) + 1;
+ Assert.isTrue(i != 0);
+ result[count++] = convertTypeSignature(CharOperation.subarray(sig, start, i));
+ start = i;
+ } else {
+ ++i;
+ result[count++] = convertTypeSignature(CharOperation.subarray(sig, start, i));
+ start = i;
+ }
+ }
+ return result;
+ }
- /**
- * Converts an array of Objects into String.
- */
- public static String toString(Object[] objects, Displayable renderer) {
- if (objects == null) return ""; //$NON-NLS-1$
- StringBuffer buffer = new StringBuffer(10);
- for (int i = 0; i < objects.length; i++){
- if (i > 0) buffer.append(", "); //$NON-NLS-1$
- buffer.append(renderer.displayString(objects[i]));
- }
- return buffer.toString();
- }
-
- /**
- * Asserts that the given method signature is valid.
- */
- public static void validateMethodSignature(String sig) {
- Assert.isTrue(isValidMethodSignature(sig));
- }
+ /**
+ * Extracts the return type from a method signature.
+ */
+ public static String extractReturnType(String sig) {
+ int i = sig.lastIndexOf(')');
+ Assert.isTrue(i != -1);
+ return sig.substring(i + 1);
+ }
- /**
- * Asserts that the given type signature is valid.
- */
- public static void validateTypeSignature(String sig, boolean allowVoid) {
- Assert.isTrue(isValidTypeSignature(sig, allowVoid));
- }
- public static void verbose(String log) {
- verbose(log, System.out);
- }
- public static synchronized void verbose(String log, PrintStream printStream) {
- int start = 0;
- do {
- int end = log.indexOf('\n', start);
- printStream.print(Thread.currentThread());
- printStream.print(" "); //$NON-NLS-1$
- printStream.print(log.substring(start, end == -1 ? log.length() : end+1));
- start = end+1;
- } while (start != 0);
- printStream.println();
- }
- /**
- * Creates a NLS catalog for the given locale.
- */
- public static void relocalize() {
- try {
- bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault());
- } catch(MissingResourceException e) {
- System.out.println("Missing resource : " + bundleName.replace('.', '/') + ".properties for locale " + Locale.getDefault()); //$NON-NLS-1$//$NON-NLS-2$
- throw e;
- }
- }
-
- /**
- * Put all the arguments in one String.
- */
- public static String getProblemArgumentsForMarker(String[] arguments){
- StringBuffer args = new StringBuffer(10);
-
- args.append(arguments.length);
- args.append(':');
-
-
- for (int j = 0; j < arguments.length; j++) {
- if(j != 0)
- args.append(ARGUMENTS_DELIMITER);
-
- if(arguments[j].length() == 0) {
- args.append(EMPTY_ARGUMENT);
- } else {
- args.append(arguments[j]);
- }
- }
-
- return args.toString();
- }
-
- /**
- * Separate all the arguments of a String made by getProblemArgumentsForMarker
- */
- public static String[] getProblemArgumentsFromMarker(String argumentsString){
- if (argumentsString == null) return null;
- int index = argumentsString.indexOf(':');
- if(index == -1)
- return null;
-
- int length = argumentsString.length();
- int numberOfArg;
- try{
- numberOfArg = Integer.parseInt(argumentsString.substring(0 , index));
- } catch (NumberFormatException e) {
- return null;
- }
- argumentsString = argumentsString.substring(index + 1, length);
-
- String[] args = new String[length];
- int count = 0;
-
- StringTokenizer tokenizer = new StringTokenizer(argumentsString, ARGUMENTS_DELIMITER);
- while(tokenizer.hasMoreTokens()) {
- String argument = tokenizer.nextToken();
- if(argument.equals(EMPTY_ARGUMENT))
- argument = ""; //$NON-NLS-1$
- args[count++] = argument;
+ private static IFile findFirstClassFile(IFolder folder) {
+ try {
+ IResource[] members = folder.members();
+ for (int i = 0, max = members.length; i < max; i++) {
+ IResource member = members[i];
+ if (member.getType() == IResource.FOLDER) {
+ return findFirstClassFile((IFolder) member);
+ } else if (net.sourceforge.phpdt.internal.compiler.util.Util.isClassFileName(member.getName())) {
+ return (IFile) member;
+ }
+ }
+ } catch (CoreException e) {
+ // ignore
+ }
+ return null;
+ }
+
+ /**
+ * Finds the first line separator used by the given text.
+ *
+ * @return "\n" or "\r" or "\r\n", or null
if none found
+ */
+ public static String findLineSeparator(char[] text) {
+ // find the first line separator
+ int length = text.length;
+ if (length > 0) {
+ char nextChar = text[0];
+ for (int i = 0; i < length; i++) {
+ char currentChar = nextChar;
+ nextChar = i < length - 1 ? text[i + 1] : ' ';
+ switch (currentChar) {
+ case '\n':
+ return "\n"; //$NON-NLS-1$
+ case '\r':
+ return nextChar == '\n' ? "\r\n" : "\r"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
+ // not found
+ return null;
+ }
+
+ // public static IClassFileAttribute getAttribute(IClassFileReader classFileReader, char[] attributeName) {
+ // IClassFileAttribute[] attributes = classFileReader.getAttributes();
+ // for (int i = 0, max = attributes.length; i < max; i++) {
+ // if (CharOperation.equals(attributes[i].getAttributeName(), attributeName)) {
+ // return attributes[i];
+ // }
+ // }
+ // return null;
+ // }
+ //
+ // public static IClassFileAttribute getAttribute(ICodeAttribute codeAttribute, char[] attributeName) {
+ // IClassFileAttribute[] attributes = codeAttribute.getAttributes();
+ // for (int i = 0, max = attributes.length; i < max; i++) {
+ // if (CharOperation.equals(attributes[i].getAttributeName(), attributeName)) {
+ // return attributes[i];
+ // }
+ // }
+ // return null;
+ // }
+
+ // public static IClassFileAttribute getAttribute(IFieldInfo fieldInfo, char[] attributeName) {
+ // IClassFileAttribute[] attributes = fieldInfo.getAttributes();
+ // for (int i = 0, max = attributes.length; i < max; i++) {
+ // if (CharOperation.equals(attributes[i].getAttributeName(), attributeName)) {
+ // return attributes[i];
+ // }
+ // }
+ // return null;
+ // }
+ //
+ // public static IClassFileAttribute getAttribute(IMethodInfo methodInfo, char[] attributeName) {
+ // IClassFileAttribute[] attributes = methodInfo.getAttributes();
+ // for (int i = 0, max = attributes.length; i < max; i++) {
+ // if (CharOperation.equals(attributes[i].getAttributeName(), attributeName)) {
+ // return attributes[i];
+ // }
+ // }
+ // return null;
+ // }
+ /**
+ * Get the jdk level of this root. The value can be:
+ * 0 if the root is a source package fragment root or if a Java model exception occured
".class"
suffix
+ * IStatus.OK
if the given name is valid as a .class file name, otherwise a
+ * status object indicating what is wrong with the name
+ */
+ // public static boolean isValidClassFileName(String name) {
+ // return JavaConventions.validateClassFileName(name).getSeverity() != IStatus.ERROR;
+ // }
+ /**
+ * Validate the given compilation unit name. A compilation unit name must obey the following rules:
+ * ".java"
suffix
+ * 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 boolean isValidCompilationUnitName(String name) {
+ return PHPFileUtil.isPHPFileName(name);
+ // return JavaConventions.validateCompilationUnitName(name).getSeverity() != IStatus.ERROR;
+ }
+
+ /**
+ * Returns true if the given folder name is valid for a package, false if it is not.
+ */
+ public static boolean isValidFolderNameForPackage(String folderName) {
+ // return JavaConventions.validateIdentifier(folderName).getSeverity() != IStatus.ERROR;
+ return true;
+ }
+ /**
+ * Returns true if the given method signature is valid, false if it is not.
+ */
+ public static boolean isValidMethodSignature(String sig) {
+ int len = sig.length();
+ if (len == 0)
+ return false;
+ int i = 0;
+ char c = sig.charAt(i++);
+ if (c != '(')
+ return false;
+ if (i >= len)
+ return false;
+ while (sig.charAt(i) != ')') {
+ // Void is not allowed as a parameter type.
+ i = checkTypeSignature(sig, i, len, false);
+ if (i == -1)
+ return false;
+ if (i >= len)
+ return false;
+ }
+ ++i;
+ i = checkTypeSignature(sig, i, len, true);
+ return i == len;
+ }
+
+ /**
+ * Returns true if the given type signature is valid, false if it is not.
+ */
+ public static boolean isValidTypeSignature(String sig, boolean allowVoid) {
+ int len = sig.length();
+ return checkTypeSignature(sig, 0, len, allowVoid) == len;
+ }
+
+ /*
+ * Add a log entry
+ */
+ public static void log(Throwable e, String message) {
+ Throwable nestedException;
+ if (e instanceof JavaModelException && (nestedException = ((JavaModelException) e).getException()) != null) {
+ e = nestedException;
+ }
+ IStatus status = new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, IStatus.ERROR, message, e);
+ JavaCore.getPlugin().getLog().log(status);
+ }
+
+ /**
+ * Normalizes the cariage returns in the given text. They are all changed to use the given buffer's line separator.
+ */
+ public static char[] normalizeCRs(char[] text, char[] buffer) {
+ CharArrayBuffer result = new CharArrayBuffer();
+ int lineStart = 0;
+ int length = text.length;
+ if (length == 0)
+ return text;
+ String lineSeparator = getLineSeparator(text, buffer);
+ char nextChar = text[0];
+ for (int i = 0; i < length; i++) {
+ char currentChar = nextChar;
+ nextChar = i < length - 1 ? text[i + 1] : ' ';
+ switch (currentChar) {
+ case '\n':
+ int lineLength = i - lineStart;
+ char[] line = new char[lineLength];
+ System.arraycopy(text, lineStart, line, 0, lineLength);
+ result.append(line);
+ result.append(lineSeparator);
+ lineStart = i + 1;
+ break;
+ case '\r':
+ lineLength = i - lineStart;
+ if (lineLength >= 0) {
+ line = new char[lineLength];
+ System.arraycopy(text, lineStart, line, 0, lineLength);
+ result.append(line);
+ result.append(lineSeparator);
+ if (nextChar == '\n') {
+ nextChar = ' ';
+ lineStart = i + 2;
+ } else {
+ // when line separator are mixed in the same file
+ // \r might not be followed by a \n. If not, we should increment
+ // lineStart by one and not by two.
+ lineStart = i + 1;
+ }
+ } else {
+ // when line separator are mixed in the same file
+ // we need to prevent NegativeArraySizeException
+ lineStart = i + 1;
+ }
+ break;
+ }
+ }
+ char[] lastLine;
+ if (lineStart > 0) {
+ int lastLineLength = length - lineStart;
+ if (lastLineLength > 0) {
+ lastLine = new char[lastLineLength];
+ System.arraycopy(text, lineStart, lastLine, 0, lastLineLength);
+ result.append(lastLine);
+ }
+ return result.getContents();
+ }
+ return text;
+ }
+
+ /**
+ * Normalizes the cariage returns in the given text. They are all changed to use given buffer's line sepatator.
+ */
+ public static String normalizeCRs(String text, String buffer) {
+ return new String(normalizeCRs(text.toCharArray(), buffer.toCharArray()));
+ }
+
+ /**
+ * Converts the given relative path into a package name. Returns null if the path is not a valid package name.
+ */
+ public static String packageName(IPath pkgPath) {
+ StringBuffer pkgName = new StringBuffer(IPackageFragment.DEFAULT_PACKAGE_NAME);
+ for (int j = 0, max = pkgPath.segmentCount(); j < max; j++) {
+ String segment = pkgPath.segment(j);
+ // if (!isValidFolderNameForPackage(segment)) {
+ // return null;
+ // }
+ pkgName.append(segment);
+ if (j < pkgPath.segmentCount() - 1) {
+ pkgName.append("."); //$NON-NLS-1$
+ }
+ }
+ return pkgName.toString();
+ }
+
+ /**
+ * Returns the length of the common prefix between s1 and s2.
+ */
+ public static int prefixLength(char[] s1, char[] s2) {
+ int len = 0;
+ int max = Math.min(s1.length, s2.length);
+ for (int i = 0; i < max && s1[i] == s2[i]; ++i)
+ ++len;
+ return len;
+ }
+
+ /**
+ * Returns the length of the common prefix between s1 and s2.
+ */
+ public static int prefixLength(String s1, String s2) {
+ int len = 0;
+ int max = Math.min(s1.length(), s2.length());
+ for (int i = 0; i < max && s1.charAt(i) == s2.charAt(i); ++i)
+ ++len;
+ return len;
+ }
+
+ private static void quickSort(char[][] list, int left, int right) {
+ int original_left = left;
+ int original_right = right;
+ char[] mid = list[(left + right) / 2];
+ do {
+ while (compare(list[left], mid) < 0) {
+ left++;
+ }
+ while (compare(mid, list[right]) < 0) {
+ right--;
+ }
+ if (left <= right) {
+ char[] tmp = list[left];
+ list[left] = list[right];
+ list[right] = tmp;
+ left++;
+ right--;
+ }
+ } while (left <= right);
+ if (original_left < right) {
+ quickSort(list, original_left, right);
+ }
+ if (left < original_right) {
+ quickSort(list, left, original_right);
+ }
+ }
+
+ /**
+ * Sort the comparable objects in the given collection.
+ */
+ private static void quickSort(Comparable[] sortedCollection, int left, int right) {
+ int original_left = left;
+ int original_right = right;
+ Comparable mid = sortedCollection[(left + right) / 2];
+ do {
+ while (sortedCollection[left].compareTo(mid) < 0) {
+ left++;
+ }
+ while (mid.compareTo(sortedCollection[right]) < 0) {
+ right--;
+ }
+ if (left <= right) {
+ Comparable tmp = sortedCollection[left];
+ sortedCollection[left] = sortedCollection[right];
+ sortedCollection[right] = tmp;
+ left++;
+ right--;
+ }
+ } while (left <= right);
+ if (original_left < right) {
+ quickSort(sortedCollection, original_left, right);
+ }
+ if (left < original_right) {
+ quickSort(sortedCollection, left, original_right);
+ }
+ }
+
+ private static void quickSort(int[] list, int left, int right) {
+ int original_left = left;
+ int original_right = right;
+ int mid = list[(left + right) / 2];
+ do {
+ while (list[left] < mid) {
+ left++;
+ }
+ while (mid < list[right]) {
+ right--;
+ }
+ if (left <= right) {
+ int tmp = list[left];
+ list[left] = list[right];
+ list[right] = tmp;
+ left++;
+ right--;
+ }
+ } while (left <= right);
+ if (original_left < right) {
+ quickSort(list, original_left, right);
+ }
+ if (left < original_right) {
+ quickSort(list, left, original_right);
+ }
+ }
+
+ /**
+ * Sort the objects in the given collection using the given comparer.
+ */
+ private static void quickSort(Object[] sortedCollection, int left, int right, Comparer comparer) {
+ int original_left = left;
+ int original_right = right;
+ Object mid = sortedCollection[(left + right) / 2];
+ do {
+ while (comparer.compare(sortedCollection[left], mid) < 0) {
+ left++;
+ }
+ while (comparer.compare(mid, sortedCollection[right]) < 0) {
+ right--;
+ }
+ if (left <= right) {
+ Object tmp = sortedCollection[left];
+ sortedCollection[left] = sortedCollection[right];
+ sortedCollection[right] = tmp;
+ left++;
+ right--;
+ }
+ } while (left <= right);
+ if (original_left < right) {
+ quickSort(sortedCollection, original_left, right, comparer);
+ }
+ if (left < original_right) {
+ quickSort(sortedCollection, left, original_right, comparer);
+ }
+ }
+
+ /**
+ * Sort the objects in the given collection using the given sort order.
+ */
+ private static void quickSort(Object[] sortedCollection, int left, int right, int[] sortOrder) {
+ int original_left = left;
+ int original_right = right;
+ int mid = sortOrder[(left + right) / 2];
+ do {
+ while (sortOrder[left] < mid) {
+ left++;
+ }
+ while (mid < sortOrder[right]) {
+ right--;
+ }
+ if (left <= right) {
+ Object tmp = sortedCollection[left];
+ sortedCollection[left] = sortedCollection[right];
+ sortedCollection[right] = tmp;
+ int tmp2 = sortOrder[left];
+ sortOrder[left] = sortOrder[right];
+ sortOrder[right] = tmp2;
+ left++;
+ right--;
+ }
+ } while (left <= right);
+ if (original_left < right) {
+ quickSort(sortedCollection, original_left, right, sortOrder);
+ }
+ if (left < original_right) {
+ quickSort(sortedCollection, left, original_right, sortOrder);
+ }
+ }
+
+ /**
+ * Sort the strings in the given collection.
+ */
+ private static void quickSort(String[] sortedCollection, int left, int right) {
+ int original_left = left;
+ int original_right = right;
+ String mid = sortedCollection[(left + right) / 2];
+ do {
+ while (sortedCollection[left].compareTo(mid) < 0) {
+ left++;
+ }
+ while (mid.compareTo(sortedCollection[right]) < 0) {
+ right--;
+ }
+ if (left <= right) {
+ String tmp = sortedCollection[left];
+ sortedCollection[left] = sortedCollection[right];
+ sortedCollection[right] = tmp;
+ left++;
+ right--;
+ }
+ } while (left <= right);
+ if (original_left < right) {
+ quickSort(sortedCollection, original_left, right);
+ }
+ if (left < original_right) {
+ quickSort(sortedCollection, left, original_right);
+ }
+ }
+
+ /**
+ * Sort the strings in the given collection in reverse alphabetical order.
+ */
+ private static void quickSortReverse(String[] sortedCollection, int left, int right) {
+ int original_left = left;
+ int original_right = right;
+ String mid = sortedCollection[(left + right) / 2];
+ do {
+ while (sortedCollection[left].compareTo(mid) > 0) {
+ left++;
+ }
+ while (mid.compareTo(sortedCollection[right]) > 0) {
+ right--;
+ }
+ if (left <= right) {
+ String tmp = sortedCollection[left];
+ sortedCollection[left] = sortedCollection[right];
+ sortedCollection[right] = tmp;
+ left++;
+ right--;
+ }
+ } while (left <= right);
+ if (original_left < right) {
+ quickSortReverse(sortedCollection, original_left, right);
+ }
+ if (left < original_right) {
+ quickSortReverse(sortedCollection, left, original_right);
+ }
+ }
+
+ /**
+ * Reads in a string from the specified data input stream. The string has been encoded using a modified UTF-8 format.
+ *
+ * The first two bytes are read as if by readUnsignedShort
. This value gives the number of following bytes that
+ * are in the encoded string, not the length of the resulting string. The following bytes are then interpreted as bytes encoding
+ * characters in the UTF-8 format and are converted into characters.
+ *
+ * This method blocks until all the bytes are read, the end of the stream is detected, or an exception is thrown. + * + * @param in + * a data input stream. + * @return a Unicode string. + * @exception EOFException + * if the input stream reaches the end before all the bytes. + * @exception IOException + * if an I/O error occurs. + * @exception UTFDataFormatException + * if the bytes do not represent a valid UTF-8 encoding of a Unicode string. + * @see java.io.DataInputStream#readUnsignedShort() + */ + public final static char[] readUTF(DataInput in) throws IOException { + int utflen = in.readUnsignedShort(); + char str[] = new char[utflen]; + int count = 0; + int strlen = 0; + while (count < utflen) { + int c = in.readUnsignedByte(); + int char2, char3; + switch (c >> 4) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + // 0xxxxxxx + count++; + str[strlen++] = (char) c; + break; + case 12: + case 13: + // 110x xxxx 10xx xxxx + count += 2; + if (count > utflen) + throw new UTFDataFormatException(); + char2 = in.readUnsignedByte(); + if ((char2 & 0xC0) != 0x80) + throw new UTFDataFormatException(); + str[strlen++] = (char) (((c & 0x1F) << 6) | (char2 & 0x3F)); + break; + case 14: + // 1110 xxxx 10xx xxxx 10xx xxxx + count += 3; + if (count > utflen) + throw new UTFDataFormatException(); + char2 = in.readUnsignedByte(); + char3 = in.readUnsignedByte(); + if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80)) + throw new UTFDataFormatException(); + str[strlen++] = (char) (((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0)); + break; + default: + // 10xx xxxx, 1111 xxxx + throw new UTFDataFormatException(); + } + } + if (strlen < utflen) { + System.arraycopy(str, 0, str = new char[strlen], 0, strlen); + } + return str; + } + + /** + * Creates a NLS catalog for the given locale. + */ + public static void relocalize() { + try { + bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault()); + } catch (MissingResourceException e) { + System.out.println("Missing resource : " + bundleName.replace('.', '/') + ".properties for locale " + Locale.getDefault()); //$NON-NLS-1$//$NON-NLS-2$ + throw e; + } + } + + public static void sort(char[][] list) { + if (list.length > 1) + quickSort(list, 0, list.length - 1); + } + + /** + * Sorts an array of Comparable objects in place. + */ + public static void sort(Comparable[] objects) { + if (objects.length > 1) + quickSort(objects, 0, objects.length - 1); + } + + public static void sort(int[] list) { + if (list.length > 1) + quickSort(list, 0, list.length - 1); + } + + /** + * Sorts an array of objects in place. The given comparer compares pairs of items. + */ + public static void sort(Object[] objects, Comparer comparer) { + if (objects.length > 1) + quickSort(objects, 0, objects.length - 1, comparer); + } + + /** + * Sorts an array of objects in place, using the sort order given for each item. + */ + public static void sort(Object[] objects, int[] sortOrder) { + if (objects.length > 1) + quickSort(objects, 0, objects.length - 1, sortOrder); + } + + /** + * Sorts an array of strings in place using quicksort. + */ + public static void sort(String[] strings) { + if (strings.length > 1) + quickSort(strings, 0, strings.length - 1); + } + + /** + * Sorts an array of Comparable objects, returning a new array with the sorted items. The original array is left untouched. + */ + public static Comparable[] sortCopy(Comparable[] objects) { + int len = objects.length; + Comparable[] copy = new Comparable[len]; + System.arraycopy(objects, 0, copy, 0, len); + sort(copy); + return copy; + } + + /** + * Sorts an array of Strings, returning a new array with the sorted items. The original array is left untouched. + */ + public static Object[] sortCopy(Object[] objects, Comparer comparer) { + int len = objects.length; + Object[] copy = new Object[len]; + System.arraycopy(objects, 0, copy, 0, len); + sort(copy, comparer); + return copy; + } + + /** + * Sorts an array of Strings, returning a new array with the sorted items. The original array is left untouched. + */ + public static String[] sortCopy(String[] objects) { + int len = objects.length; + String[] copy = new String[len]; + System.arraycopy(objects, 0, copy, 0, len); + sort(copy); + return copy; + } + + /** + * Sorts an array of strings in place using quicksort in reverse alphabetical order. + */ + public static void sortReverseOrder(String[] strings) { + if (strings.length > 1) + quickSortReverse(strings, 0, strings.length - 1); + } + + /** + * Converts a String[] to char[][]. + */ + public static char[][] toCharArrays(String[] a) { + int len = a.length; + char[][] result = new char[len][]; + for (int i = 0; i < len; ++i) { + result[i] = toChars(a[i]); + } + return result; + } + + /** + * Converts a String to char[]. + */ + public static char[] toChars(String s) { + int len = s.length(); + char[] chars = new char[len]; + s.getChars(0, len, chars, 0); + return chars; + } + + /** + * Converts a String to char[][], where segments are separate by '.'. + */ + public static char[][] toCompoundChars(String s) { + int len = s.length(); + if (len == 0) { + return CharOperation.NO_CHAR_CHAR; + } + int segCount = 1; + for (int off = s.indexOf('.'); off != -1; off = s.indexOf('.', off + 1)) { + ++segCount; + } + char[][] segs = new char[segCount][]; + int start = 0; + for (int i = 0; i < segCount; ++i) { + int dot = s.indexOf('.', start); + int end = (dot == -1 ? s.length() : dot); + segs[i] = new char[end - start]; + s.getChars(start, end, segs[i], 0); + start = end + 1; + } + return segs; + } + + /** + * Converts a char[] to String. + */ + public static String toString(char[] c) { + return new String(c); + } + + /** + * Converts a char[][] to String, where segments are separated by '.'. + */ + public static String toString(char[][] c) { + StringBuffer sb = new StringBuffer(); + for (int i = 0, max = c.length; i < max; ++i) { + if (i != 0) + sb.append('.'); + sb.append(c[i]); + } + return sb.toString(); + } + + /** + * Converts a char[][] and a char[] to String, where segments are separated by '.'. + */ + public static String toString(char[][] c, char[] d) { + if (c == null) + return new String(d); + StringBuffer sb = new StringBuffer(); + for (int i = 0, max = c.length; i < max; ++i) { + sb.append(c[i]); + sb.append('.'); + } + sb.append(d); + return sb.toString(); + } + + /* + * Returns the unresolved type parameter signatures of the given method e.g. {"QString;", "[int", "[[Qjava.util.Vector;"} + */ + // public static String[] typeParameterSignatures(AbstractMethodDeclaration method) { + // Argument[] args = method.arguments; + // if (args != null) { + // int length = args.length; + // String[] signatures = new String[length]; + // for (int i = 0; i < args.length; i++) { + // Argument arg = args[i]; + // signatures[i] = typeSignature(arg.type); + // } + // return signatures; + // } + // return new String[0]; + // } + /* + * Returns the unresolved type signature of the given type reference, e.g. "QString;", "[int", "[[Qjava.util.Vector;" + */ + // public static String typeSignature(TypeReference type) { + // char[][] compoundName = type.getTypeName(); + // char[] typeName =CharOperation.concatWith(compoundName, '.'); + // String signature = Signature.createTypeSignature(typeName, false/*don't resolve*/); + // int dimensions = type.dimensions(); + // if (dimensions > 0) { + // signature = Signature.createArraySignature(signature, dimensions); + // } + // return signature; + // } + /* + * Returns the unresolved type signature of the given type reference, + * e.g. "QString;", "[int", "[[Qjava.util.Vector;" + */ + public static String typeSignature(TypeReference type) { + char[][] compoundName = type.getTypeName(); + char[] typeName =CharOperation.concatWith(compoundName, '.'); + String signature = Signature.createTypeSignature(typeName, false/*don't resolve*/); + int dimensions = type.dimensions(); + if (dimensions > 0) { + signature = Signature.createArraySignature(signature, dimensions); } - - if(count != numberOfArg) - return null; - - System.arraycopy(args, 0, args = new String[count], 0, count); - return args; - } - -} + return signature; + } + /** + * Asserts that the given method signature is valid. + */ + public static void validateMethodSignature(String sig) { + Assert.isTrue(isValidMethodSignature(sig)); + } + + /** + * Asserts that the given type signature is valid. + */ + public static void validateTypeSignature(String sig, boolean allowVoid) { + Assert.isTrue(isValidTypeSignature(sig, allowVoid)); + } + + public static void verbose(String log) { + verbose(log, System.out); + } + + public static synchronized void verbose(String log, PrintStream printStream) { + int start = 0; + do { + int end = log.indexOf('\n', start); + printStream.print(Thread.currentThread()); + printStream.print(" "); //$NON-NLS-1$ + printStream.print(log.substring(start, end == -1 ? log.length() : end + 1)); + start = end + 1; + } while (start != 0); + printStream.println(); + } + + /** + * Writes a string to the given output stream using UTF-8 encoding in a machine-independent manner. + *
+ * First, two bytes are written to the output stream as if by the writeShort
method giving the number of bytes to
+ * follow. This value is the number of bytes actually written out, not the length of the string. Following the length, each
+ * character of the string is output, in sequence, using the UTF-8 encoding for the character.
+ *
+ * @param str
+ * a string to be written.
+ * @return the number of bytes written to the stream.
+ * @exception IOException
+ * if an I/O error occurs.
+ * @since JDK1.0
+ */
+ public static int writeUTF(OutputStream out, char[] str) throws IOException {
+ int strlen = str.length;
+ int utflen = 0;
+ for (int i = 0; i < strlen; i++) {
+ int c = str[i];
+ if ((c >= 0x0001) && (c <= 0x007F)) {
+ utflen++;
+ } else if (c > 0x07FF) {
+ utflen += 3;
+ } else {
+ utflen += 2;
+ }
+ }
+ if (utflen > 65535)
+ throw new UTFDataFormatException();
+ out.write((utflen >>> 8) & 0xFF);
+ out.write((utflen >>> 0) & 0xFF);
+ if (strlen == utflen) {
+ for (int i = 0; i < strlen; i++)
+ out.write(str[i]);
+ } else {
+ for (int i = 0; i < strlen; i++) {
+ int c = str[i];
+ if ((c >= 0x0001) && (c <= 0x007F)) {
+ out.write(c);
+ } else if (c > 0x07FF) {
+ out.write(0xE0 | ((c >> 12) & 0x0F));
+ out.write(0x80 | ((c >> 6) & 0x3F));
+ out.write(0x80 | ((c >> 0) & 0x3F));
+ } else {
+ out.write(0xC0 | ((c >> 6) & 0x1F));
+ out.write(0x80 | ((c >> 0) & 0x3F));
+ }
+ }
+ }
+ return utflen + 2; // the number of bytes written to the stream
+ }
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/CodeGenerationMessages.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/CodeGenerationMessages.java
new file mode 100644
index 0000000..f1b2e7a
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/CodeGenerationMessages.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.internal.corext.codemanipulation;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class CodeGenerationMessages {
+
+ private static final String RESOURCE_BUNDLE= CodeGenerationMessages.class.getName();
+ private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
+
+ private CodeGenerationMessages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return fgResourceBundle.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+
+ /**
+ * Gets a string from the resource bundle and formats it with the argument
+ *
+ * @param key the string used to get the bundle value, must not be null
+ */
+ public static String getFormattedString(String key, Object arg) {
+ return MessageFormat.format(getString(key), new Object[] { arg });
+ }
+
+
+ /**
+ * Gets a string from the resource bundle and formats it with arguments
+ */
+ public static String getFormattedString(String key, Object[] args) {
+ return MessageFormat.format(getString(key), args);
+ }
+
+
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/CodeGenerationMessages.properties b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/CodeGenerationMessages.properties
new file mode 100644
index 0000000..7c41c12
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/CodeGenerationMessages.properties
@@ -0,0 +1,27 @@
+###############################################################################
+# 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
+###############################################################################
+
+AddGetterSetterOperation.description=Generate Getters and Setters...
+
+AddImportsOperation.description=Adding import...
+
+AddMethodStubOperation.description=Create method...
+
+AddUnimplementedMethodsOperation.description=Evaluating and adding unimplemented methods...
+
+AddCustomConstructorOperation.description=Evaluating and adding new constructor...
+
+OrganizeImportsOperation.description=Organizing imports of {0}...
+
+AddJavaDocStubOperation.description=Create Javadoc stub...
+
+AddDelegateMethodsOperation.monitor.message=Creating {0} methods...
+ImportsStructure.operation.description=Updating imports...
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/GetterSetterUtil.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/GetterSetterUtil.java
new file mode 100644
index 0000000..2866303
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/GetterSetterUtil.java
@@ -0,0 +1,205 @@
+/*******************************************************************************
+ * 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.internal.corext.codemanipulation;
+
+import org.eclipse.core.runtime.CoreException;
+
+import net.sourceforge.phpdt.core.Flags;
+import net.sourceforge.phpdt.core.IField;
+import net.sourceforge.phpdt.core.IJavaProject;
+import net.sourceforge.phpdt.core.IMethod;
+import net.sourceforge.phpdt.core.IType;
+import net.sourceforge.phpdt.core.JavaModelException;
+import net.sourceforge.phpdt.core.NamingConventions;
+import net.sourceforge.phpdt.core.Signature;
+
+import net.sourceforge.phpdt.ui.CodeGeneration;
+import net.sourceforge.phpdt.ui.PreferenceConstants;
+
+import net.sourceforge.phpdt.internal.corext.util.JavaModelUtil;
+import net.sourceforge.phpdt.internal.corext.util.JdtFlags;
+
+public class GetterSetterUtil {
+
+ private static final String[] EMPTY= new String[0];
+
+ //no instances
+ private GetterSetterUtil(){
+ }
+
+ public static String getGetterName(IField field, String[] excludedNames) throws JavaModelException {
+ boolean useIs= PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.CODEGEN_IS_FOR_GETTERS);
+ return getGetterName(field, excludedNames, useIs);
+ }
+
+ private static String getGetterName(IField field, String[] excludedNames, boolean useIsForBoolGetters) throws JavaModelException {
+ if (excludedNames == null) {
+ excludedNames= EMPTY;
+ }
+ return getGetterName(field.getJavaProject(), field.getElementName(), field.getFlags(), useIsForBoolGetters && JavaModelUtil.isBoolean(field), excludedNames);
+ }
+
+ public static String getGetterName(IJavaProject project, String fieldName, int flags, boolean isBoolean, String[] excludedNames){
+ return NamingConventions.suggestGetterName(project, fieldName, flags, isBoolean, excludedNames);
+ }
+
+ public static String getSetterName(IJavaProject project, String fieldName, int flags, boolean isBoolean, String[] excludedNames){
+ return NamingConventions.suggestSetterName(project, fieldName, flags, isBoolean, excludedNames);
+ }
+
+ public static String getSetterName(IField field, String[] excludedNames) throws JavaModelException {
+ if (excludedNames == null) {
+ excludedNames= EMPTY;
+ }
+ return NamingConventions.suggestSetterName(field.getJavaProject(), field.getElementName(), field.getFlags(), JavaModelUtil.isBoolean(field), excludedNames);
+ }
+
+ public static IMethod getGetter(IField field) throws JavaModelException{
+ IMethod primaryCandidate= JavaModelUtil.findMethod(getGetterName(field, EMPTY, true), new String[0], false, field.getDeclaringType());
+ if (! JavaModelUtil.isBoolean(field) || (primaryCandidate != null && primaryCandidate.exists()))
+ return primaryCandidate;
+ //bug 30906 describes why we need to look for other alternatives here
+ String secondCandidateName= getGetterName(field, EMPTY, false);
+ return JavaModelUtil.findMethod(secondCandidateName, new String[0], false, field.getDeclaringType());
+ }
+
+ public static IMethod getSetter(IField field) throws JavaModelException{
+ String[] args= new String[] { field.getTypeSignature() };
+ return JavaModelUtil.findMethod(getSetterName(field, EMPTY), args, false, field.getDeclaringType());
+ }
+
+ /**
+ * Create a stub for a getter of the given field using getter/setter templates. The resulting code
+ * has to be formatted and indented.
+ * @param field The field to create a getter for
+ * @param setterName The chosen name for the setter
+ * @param addComments If true
, comments will be added.
+ * @param flags The flags signaling visibility, if static, synchronized or final
+ * @return Returns the generated stub.
+ * @throws CoreException
+ */
+ public static String getSetterStub(IField field, String setterName, boolean addComments, int flags) throws CoreException {
+
+ String fieldName= field.getElementName();
+ IType parentType= field.getDeclaringType();
+
+ String returnSig= field.getTypeSignature();
+ String typeName= Signature.toString(returnSig);
+
+ IJavaProject project= field.getJavaProject();
+
+ String accessorName = NamingConventions.removePrefixAndSuffixForFieldName(project, fieldName, field.getFlags());
+ String argname= StubUtility.suggestArgumentName(project, accessorName, EMPTY);
+
+ boolean isStatic= Flags.isStatic(flags);
+// boolean isSync= Flags.isSynchronized(flags);
+ boolean isFinal= Flags.isFinal(flags);
+
+ // create the setter stub
+ StringBuffer buf= new StringBuffer();
+ if (addComments) {
+ String comment= CodeGeneration.getSetterComment(field.getCompilationUnit(), parentType.getTypeQualifiedName('.'), setterName, field.getElementName(), typeName, argname, accessorName, String.valueOf('\n'));
+ if (comment != null) {
+ buf.append(comment);
+ buf.append('\n');
+ }
+ }
+ buf.append(JdtFlags.getVisibilityString(flags));
+ buf.append(' ');
+ if (isStatic)
+ buf.append("static "); //$NON-NLS-1$
+// if (isSync)
+// buf.append("synchronized "); //$NON-NLS-1$
+ if (isFinal)
+ buf.append("final "); //$NON-NLS-1$
+
+ buf.append("void "); //$NON-NLS-1$
+ buf.append(setterName);
+ buf.append('(');
+ buf.append(typeName);
+ buf.append(' ');
+ buf.append(argname);
+ buf.append(") {\n"); //$NON-NLS-1$
+
+ boolean useThis= PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.CODEGEN_KEYWORD_THIS);
+ if (argname.equals(fieldName) || (useThis && !isStatic)) {
+ if (isStatic)
+ fieldName= parentType.getElementName() + '.' + fieldName;
+ else
+ fieldName= "this." + fieldName; //$NON-NLS-1$
+ }
+ String body= CodeGeneration.getSetterMethodBodyContent(field.getCompilationUnit(), parentType.getTypeQualifiedName('.'), setterName, fieldName, argname, String.valueOf('\n'));
+ if (body != null) {
+ buf.append(body);
+ }
+ buf.append("}\n"); //$NON-NLS-1$
+ return buf.toString();
+ }
+
+ /**
+ * Create a stub for a getter of the given field using getter/setter templates. The resulting code
+ * has to be formatted and indented.
+ * @param field The field to create a getter for
+ * @param getterName The chosen name for the getter
+ * @param addComments If true
, comments will be added.
+ * @param flags The flags signaling visibility, if static, synchronized or final
+ * @return Returns the generated stub.
+ * @throws CoreException
+ */
+ public static String getGetterStub(IField field, String getterName, boolean addComments, int flags) throws CoreException {
+ String fieldName= field.getElementName();
+ IType parentType= field.getDeclaringType();
+
+ boolean isStatic= Flags.isStatic(flags);
+// boolean isSync= Flags.isSynchronized(flags);
+ boolean isFinal= Flags.isFinal(flags);
+
+ String typeName= Signature.toString(field.getTypeSignature());
+ String accessorName = NamingConventions.removePrefixAndSuffixForFieldName(field.getJavaProject(), fieldName, field.getFlags());
+
+ // create the getter stub
+ StringBuffer buf= new StringBuffer();
+ if (addComments) {
+ String comment= CodeGeneration.getGetterComment(field.getCompilationUnit(), parentType.getTypeQualifiedName('.'), getterName, field.getElementName(), typeName, accessorName, String.valueOf('\n'));
+ if (comment != null) {
+ buf.append(comment);
+ buf.append('\n');
+ }
+ }
+
+ buf.append(JdtFlags.getVisibilityString(flags));
+ buf.append(' ');
+ if (isStatic)
+ buf.append("static "); //$NON-NLS-1$
+// if (isSync)
+// buf.append("synchronized "); //$NON-NLS-1$
+ if (isFinal)
+ buf.append("final "); //$NON-NLS-1$
+
+ buf.append(typeName);
+ buf.append(' ');
+ buf.append(getterName);
+ buf.append("() {\n"); //$NON-NLS-1$
+
+ boolean useThis= PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.CODEGEN_KEYWORD_THIS);
+ if (useThis && !isStatic) {
+ fieldName= "this." + fieldName; //$NON-NLS-1$
+ }
+
+ String body= CodeGeneration.getGetterMethodBodyContent(field.getCompilationUnit(), parentType.getTypeQualifiedName('.'), getterName, fieldName, String.valueOf('\n'));
+ if (body != null) {
+ buf.append(body);
+ }
+ buf.append("}\n"); //$NON-NLS-1$
+ return buf.toString();
+ }
+
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/IRequestQuery.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/IRequestQuery.java
new file mode 100644
index 0000000..3f24fa1
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/IRequestQuery.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.internal.corext.codemanipulation;
+
+import net.sourceforge.phpdt.core.IMember;
+
+
+/**
+ * Query object to let operations callback the actions.
+ * Example is a callback to ask if a existing method should be replaced.
+ */
+public interface IRequestQuery {
+
+ // return codes
+ public static final int CANCEL= 0;
+ public static final int NO= 1;
+ public static final int YES= 2;
+ public static final int YES_ALL= 3;
+
+ /**
+ * Do the callback. Returns YES, NO, YES_ALL or CANCEL
+ */
+ int doQuery(IMember member);
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/StubUtility.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/StubUtility.java
index 8c4c7e0..b0ae2b9 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/StubUtility.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/StubUtility.java
@@ -336,7 +336,7 @@ public class StubUtility {
}
/**
- * @see org.eclipse.jdt.ui.CodeGeneration#getTypeComment(ICompilationUnit, String, String)
+ * @see net.sourceforge.phpdt.ui.CodeGeneration#getTypeComment(ICompilationUnit, String, String)
*/
public static String getCompilationUnitContent(ICompilationUnit cu, String typeComment, String typeContent, String lineDelimiter) throws CoreException {
IPackageFragment pack= (IPackageFragment) cu.getParent();
@@ -358,7 +358,7 @@ public class StubUtility {
}
/*
- * @see org.eclipse.jdt.ui.CodeGeneration#getTypeComment(ICompilationUnit, String, String)
+ * @see net.sourceforge.phpdt.ui.CodeGeneration#getTypeComment(ICompilationUnit, String, String)
*/
public static String getTypeComment(ICompilationUnit cu, String typeQualifiedName, String lineDelim) throws CoreException {
Template template= PHPeclipsePlugin.getDefault().getCodeTemplateStore().findTemplate(CodeTemplateContextType.TYPECOMMENT);
@@ -424,7 +424,7 @@ public class StubUtility {
}
/**
- * @see org.eclipse.jdt.ui.CodeGeneration#getMethodComment(IMethod,IMethod,String)
+ * @see net.sourceforge.phpdt.ui.CodeGeneration#getMethodComment(IMethod,IMethod,String)
*/
public static String getMethodComment(IMethod method, IMethod overridden, String lineDelimiter) throws CoreException {
String retType= method.isConstructor() ? null : method.getReturnType();
@@ -435,7 +435,7 @@ public class StubUtility {
}
/**
- * @see org.eclipse.jdt.ui.CodeGeneration#getMethodComment(ICompilationUnit, String, String, String[], String[], String, IMethod, String)
+ * @see net.sourceforge.phpdt.ui.CodeGeneration#getMethodComment(ICompilationUnit, String, String, String[], String[], String, IMethod, String)
*/
public static String getMethodComment(ICompilationUnit cu, String typeName, String methodName, String[] paramNames, String[] excTypeSig, String retTypeSig, IMethod overridden, String lineDelimiter) throws CoreException {
String templateName= CodeTemplateContextType.METHODCOMMENT;
@@ -512,7 +512,7 @@ public class StubUtility {
/**
- * @see org.eclipse.jdt.ui.CodeGeneration#getSetterComment(ICompilationUnit, String, String, String, String, String, String, String)
+ * @see net.sourceforge.phpdt.ui.CodeGeneration#getSetterComment(ICompilationUnit, String, String, String, String, String, String, String)
*/
public static String getSetterComment(ICompilationUnit cu, String typeName, String methodName, String fieldName, String fieldType, String paramName, String bareFieldName, String lineDelimiter) throws CoreException {
String templateName= CodeTemplateContextType.SETTERCOMMENT;
@@ -534,7 +534,7 @@ public class StubUtility {
}
/**
- * @see org.eclipse.jdt.ui.CodeGeneration#getGetterComment(ICompilationUnit, String, String, String, String, String, String)
+ * @see net.sourceforge.phpdt.ui.CodeGeneration#getGetterComment(ICompilationUnit, String, String, String, String, String, String)
*/
public static String getGetterComment(ICompilationUnit cu, String typeName, String methodName, String fieldName, String fieldType, String bareFieldName, String lineDelimiter) throws CoreException {
String templateName= CodeTemplateContextType.GETTERCOMMENT;
@@ -572,7 +572,7 @@ public class StubUtility {
}
/**
- * @see org.eclipse.jdt.ui.CodeGeneration#getMethodComment(ICompilationUnit, String, MethodDeclaration, IMethodBinding, String)
+ * @see net.sourceforge.phpdt.ui.CodeGeneration#getMethodComment(ICompilationUnit, String, MethodDeclaration, IMethodBinding, String)
*/
// public static String getMethodComment(ICompilationUnit cu, String typeName, IMethodBinding overridden, String lineDelimiter) throws CoreException {
// if (overridden != null) {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/CodeTemplates.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/CodeTemplates.java
index f28361a..5e8a298 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/CodeTemplates.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/CodeTemplates.java
@@ -23,7 +23,7 @@ import org.eclipse.jface.text.templates.Template;
/**
* CodeTemplates
gives access to the available code templates.
* @since 3.0
- * @deprecated use {@link org.eclipse.jdt.internal.ui.JavaPlugin#getCodeTemplateStore()} instead
+ * @deprecated use {@link net.sourceforge.phpdt.internal.ui.JavaPlugin#getCodeTemplateStore()} instead
*/
public class CodeTemplates extends net.sourceforge.phpdt.internal.corext.template.php.TemplateSet {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/HTMLContextType.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/HTMLContextType.java
index eb0f0cf..4205ed6 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/HTMLContextType.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/HTMLContextType.java
@@ -4,7 +4,7 @@
*/
package net.sourceforge.phpdt.internal.corext.template.php;
-//import org.eclipse.jdt.core.ICompilationUnit;
+//import net.sourceforge.phpdt.core.ICompilationUnit;
import net.sourceforge.phpdt.core.ICompilationUnit;
@@ -46,7 +46,7 @@ public class HTMLContextType extends CompilationUnitContextType {
return new HTMLUnitContext(this, document, offset, length, compilationUnit);
}
/* (non-Javadoc)
- * @see org.eclipse.jdt.internal.corext.template.java.CompilationUnitContextType#createContext(org.eclipse.jface.text.IDocument, int, int, org.eclipse.jdt.core.ICompilationUnit)
+ * @see net.sourceforge.phpdt.internal.corext.template.java.CompilationUnitContextType#createContext(org.eclipse.jface.text.IDocument, int, int, net.sourceforge.phpdt.core.ICompilationUnit)
*/
// public CompilationUnitContext createContext(IDocument document, int offset, int length, ICompilationUnit compilationUnit) {
// return new JavaDocContext(this, document, offset, length, compilationUnit);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/HTMLUnitContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/HTMLUnitContext.java
index 0c4dfb3..e83cc10 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/HTMLUnitContext.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/HTMLUnitContext.java
@@ -105,7 +105,7 @@ public class HTMLUnitContext extends CompilationUnitContext {
}
/*
- * @see org.eclipse.jdt.internal.corext.template.DocumentTemplateContext#getEnd()
+ * @see net.sourceforge.phpdt.internal.corext.template.DocumentTemplateContext#getEnd()
*/
public int getEnd() {
@@ -129,7 +129,7 @@ public class HTMLUnitContext extends CompilationUnitContext {
}
/*
- * @see org.eclipse.jdt.internal.corext.template.DocumentTemplateContext#getKey()
+ * @see net.sourceforge.phpdt.internal.corext.template.DocumentTemplateContext#getKey()
*/
public String getKey() {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/JavaDocContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/JavaDocContext.java
index d1eaa07..f31b7af 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/JavaDocContext.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/JavaDocContext.java
@@ -112,7 +112,7 @@ public class JavaDocContext extends CompilationUnitContext {
}
/*
- * @see org.eclipse.jdt.internal.corext.template.DocumentTemplateContext#getEnd()
+ * @see net.sourceforge.phpdt.internal.corext.template.DocumentTemplateContext#getEnd()
*/
public int getEnd() {
@@ -136,7 +136,7 @@ public class JavaDocContext extends CompilationUnitContext {
}
/*
- * @see org.eclipse.jdt.internal.corext.template.DocumentTemplateContext#getKey()
+ * @see net.sourceforge.phpdt.internal.corext.template.DocumentTemplateContext#getKey()
*/
public String getKey() {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/JavaDocContextType.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/JavaDocContextType.java
index c44e026..4882d95 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/JavaDocContextType.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/JavaDocContextType.java
@@ -51,7 +51,7 @@ public class JavaDocContextType extends CompilationUnitContextType {
}
/* (non-Javadoc)
- * @see org.eclipse.jdt.internal.corext.template.java.CompilationUnitContextType#createContext(org.eclipse.jface.text.IDocument, int, int, org.eclipse.jdt.core.ICompilationUnit)
+ * @see net.sourceforge.phpdt.internal.corext.template.java.CompilationUnitContextType#createContext(org.eclipse.jface.text.IDocument, int, int, net.sourceforge.phpdt.core.ICompilationUnit)
*/
public CompilationUnitContext createContext(IDocument document, int offset, int length, ICompilationUnit compilationUnit) {
return new JavaDocContext(this, document, offset, length, compilationUnit);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/MoveTextEdit.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/MoveTextEdit.java
index 77a8db5..de964c9 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/MoveTextEdit.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/MoveTextEdit.java
@@ -7,7 +7,7 @@ package net.sourceforge.phpdt.internal.corext.textmanipulation;
import org.eclipse.core.runtime.CoreException;
-//import org.eclipse.jdt.internal.corext.Assert;
+//import net.sourceforge.phpdt.internal.corext.Assert;
/**
* A text edit that moves text inside a text buffer.
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/SimpleTextEdit.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/SimpleTextEdit.java
index 1000537..9072f2e 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/SimpleTextEdit.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/SimpleTextEdit.java
@@ -6,7 +6,7 @@ package net.sourceforge.phpdt.internal.corext.textmanipulation;
import org.eclipse.core.runtime.CoreException;
-//import org.eclipse.jdt.internal.corext.Assert;
+//import net.sourceforge.phpdt.internal.corext.Assert;
public abstract class SimpleTextEdit extends TextEdit {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/TextBuffer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/TextBuffer.java
index 6559085..8f8a79d 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/TextBuffer.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/TextBuffer.java
@@ -24,8 +24,8 @@ import org.eclipse.jface.text.ILineTracker;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.util.Assert;
-//import org.eclipse.jdt.internal.ui.JavaPlugin;
-//import org.eclipse.jdt.internal.ui.JavaStatusConstants;
+//import net.sourceforge.phpdt.internal.ui.JavaPlugin;
+//import net.sourceforge.phpdt.internal.ui.JavaStatusConstants;
/**
* An implementation of a TextBuffer
that is based on ITextSelection
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/TextBufferEditor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/TextBufferEditor.java
index 192cb3f..d622569 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/TextBufferEditor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/TextBufferEditor.java
@@ -14,10 +14,10 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
-//import org.eclipse.jdt.core.IJavaModelStatusConstants;
-//import org.eclipse.jdt.core.JavaModelException;
+//import net.sourceforge.phpdt.core.IJavaModelStatusConstants;
+//import net.sourceforge.phpdt.core.JavaModelException;
//
-//import org.eclipse.jdt.internal.corext.Assert;
+//import net.sourceforge.phpdt.internal.corext.Assert;
/**
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/TextRange.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/TextRange.java
index d92fba2..9694ddb 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/TextRange.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/TextRange.java
@@ -4,9 +4,9 @@
*/
package net.sourceforge.phpdt.internal.corext.textmanipulation;
-//import org.eclipse.jdt.core.ISourceRange;
+//import net.sourceforge.phpdt.core.ISourceRange;
//
-//import org.eclipse.jdt.internal.corext.Assert;
+//import net.sourceforge.phpdt.internal.corext.Assert;
public final class TextRange {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/CodeFormatterUtil.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/CodeFormatterUtil.java
index 60fc71d..f9c116b 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/CodeFormatterUtil.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/CodeFormatterUtil.java
@@ -12,12 +12,12 @@ package net.sourceforge.phpdt.internal.corext.util;
import java.util.Map;
-import net.sourceforge.phpdt.core.IJavaProject;
import net.sourceforge.phpdt.core.ToolFactory;
-import net.sourceforge.phpdt.core.formatter.CodeFormatter;
+import net.sourceforge.phpdt.core.formatter.DefaultCodeFormatterConstants;
import net.sourceforge.phpdt.internal.corext.Assert;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
import org.eclipse.jface.text.DefaultPositionUpdater;
@@ -42,10 +42,10 @@ public class CodeFormatterUtil {
// axelcl change end
}
-// public static int getTabWidth() {
-// Preferences preferences= JavaCore.getPlugin().getPluginPreferences();
-// return preferences.getInt(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE);
-// }
+ public static int getTabWidth() {
+ Preferences preferences= PHPeclipsePlugin.getDefault().getPluginPreferences();
+ return preferences.getInt(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE);
+ }
// transition code
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/IOCloser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/IOCloser.java
index 6ed53f7..1e16693 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/IOCloser.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/IOCloser.java
@@ -16,7 +16,7 @@ import java.io.Reader;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-//import org.eclipse.jdt.internal.ui.JavaPlugin;
+//import net.sourceforge.phpdt.internal.ui.JavaPlugin;
public class IOCloser {
public static void perform(Reader reader, InputStream stream) {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/JavaModelUtil.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/JavaModelUtil.java
index 6f19917..a098975 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/JavaModelUtil.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/JavaModelUtil.java
@@ -692,7 +692,7 @@ public class JavaModelUtil {
private static final String EMPTY_ARGUMENT = " "; //$NON-NLS-1$
/**
- * Copied from org.eclipse.jdt.internal.core.ProjectPrefUtil;
+ * Copied from net.sourceforge.phpdt.internal.core.ProjectPrefUtil;
*/
public static String[] getProblemArgumentsFromMarker(String argumentsString){
if (argumentsString == null) return null;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/PHPUIMessages.properties b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/PHPUIMessages.properties
index b5a8f8f..bba5607 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/PHPUIMessages.properties
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/PHPUIMessages.properties
@@ -380,7 +380,7 @@ AppearancePreferencePage.description= Appearance of Java elements in viewers:
AppearancePreferencePage.methodreturntype.label= Show &method return types
AppearancePreferencePage.overrideindicator.label= Show &override indicators in outline and hierarchy
AppearancePreferencePage.pkgNamePatternEnable.label= &Compress package name segments (except for the last one)
-AppearancePreferencePage.pkgNamePattern.label= Com&pression pattern (e.g. given package name 'org.eclipse.jdt' pattern '.' will compress it to '..jdt', '0' to 'jdt', '1~.' to 'o~.e~.jdt'):
+AppearancePreferencePage.pkgNamePattern.label= Com&pression pattern (e.g. given package name 'net.sourceforge.phpdt' pattern '.' will compress it to '..jdt', '0' to 'jdt', '1~.' to 'o~.e~.jdt'):
AppearancePreferencePage.showMembersInPackagesView=S&how members in Package Explorer
AppearancePreferencePage.stackViewsVerticallyInTheJavaBrowsingPerspective=&Stack views vertically in the Java Browsing perspective
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/AddBlockCommentAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/AddBlockCommentAction.java
index 68c90df..500644f 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/AddBlockCommentAction.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/AddBlockCommentAction.java
@@ -50,8 +50,8 @@ public class AddBlockCommentAction extends BlockCommentAction {
}
/*
- * @see org.eclipse.jdt.internal.ui.actions.BlockCommentAction#runInternal(org.eclipse.jface.text.ITextSelection,
- * org.eclipse.jface.text.IDocumentExtension3, org.eclipse.jdt.internal.ui.actions.BlockCommentAction.Edit.EditFactory)
+ * @see net.sourceforge.phpdt.internal.ui.actions.BlockCommentAction#runInternal(org.eclipse.jface.text.ITextSelection,
+ * org.eclipse.jface.text.IDocumentExtension3, net.sourceforge.phpdt.internal.ui.actions.BlockCommentAction.Edit.EditFactory)
*/
protected void runInternal(ITextSelection selection, IDocumentExtension3 docExtension, Edit.EditFactory factory)
throws BadLocationException, BadPartitioningException {
@@ -198,7 +198,7 @@ public class AddBlockCommentAction extends BlockCommentAction {
}
/*
- * @see org.eclipse.jdt.internal.ui.actions.BlockCommentAction#validSelection(org.eclipse.jface.text.ITextSelection)
+ * @see net.sourceforge.phpdt.internal.ui.actions.BlockCommentAction#validSelection(org.eclipse.jface.text.ITextSelection)
*/
protected boolean isValidSelection(ITextSelection selection) {
return selection != null && !selection.isEmpty() && selection.getLength() > 0;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/RemoveBlockCommentAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/RemoveBlockCommentAction.java
index ea5e0b2..c58c0ad 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/RemoveBlockCommentAction.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/RemoveBlockCommentAction.java
@@ -45,7 +45,7 @@ public class RemoveBlockCommentAction extends BlockCommentAction {
}
/*
- * @see org.eclipse.jdt.internal.ui.actions.AddBlockCommentAction#runInternal(org.eclipse.jface.text.ITextSelection, org.eclipse.jface.text.IDocumentExtension3, org.eclipse.jdt.internal.ui.actions.AddBlockCommentAction.Edit.EditFactory)
+ * @see net.sourceforge.phpdt.internal.ui.actions.AddBlockCommentAction#runInternal(org.eclipse.jface.text.ITextSelection, org.eclipse.jface.text.IDocumentExtension3, net.sourceforge.phpdt.internal.ui.actions.AddBlockCommentAction.Edit.EditFactory)
*/
protected void runInternal(ITextSelection selection, IDocumentExtension3 docExtension, Edit.EditFactory factory) throws BadPartitioningException, BadLocationException {
List edits= new LinkedList();
@@ -79,7 +79,7 @@ public class RemoveBlockCommentAction extends BlockCommentAction {
}
/*
- * @see org.eclipse.jdt.internal.ui.actions.AddBlockCommentAction#validSelection(org.eclipse.jface.text.ITextSelection)
+ * @see net.sourceforge.phpdt.internal.ui.actions.AddBlockCommentAction#validSelection(org.eclipse.jface.text.ITextSelection)
*/
protected boolean isValidSelection(ITextSelection selection) {
return selection != null && !selection.isEmpty();
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/filters/FilterDescriptor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/filters/FilterDescriptor.java
index 249c97c..2d21450 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/filters/FilterDescriptor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/filters/FilterDescriptor.java
@@ -31,7 +31,7 @@ import org.eclipse.ui.activities.WorkbenchActivityHelper;
/**
* Represents a custom filter which is provided by the
- * "org.eclipse.jdt.ui.javaElementFilters" extension point.
+ * "net.sourceforge.phpdt.ui.javaElementFilters" extension point.
*
* since 2.0
*/
@@ -99,9 +99,9 @@ public class FilterDescriptor implements Comparable, IPluginContribution {
private FilterDescriptor(IConfigurationElement element) {
fElement= element;
// it is either a pattern filter or a custom filter
- Assert.isTrue(isPatternFilter() ^ isCustomFilter(), "An extension for extension-point org.eclipse.jdt.ui.javaElementFilters does not specify a correct filter"); //$NON-NLS-1$
- Assert.isNotNull(getId(), "An extension for extension-point org.eclipse.jdt.ui.javaElementFilters does not provide a valid ID"); //$NON-NLS-1$
- Assert.isNotNull(getName(), "An extension for extension-point org.eclipse.jdt.ui.javaElementFilters does not provide a valid name"); //$NON-NLS-1$
+ Assert.isTrue(isPatternFilter() ^ isCustomFilter(), "An extension for extension-point net.sourceforge.phpdt.ui.javaElementFilters does not specify a correct filter"); //$NON-NLS-1$
+ Assert.isNotNull(getId(), "An extension for extension-point net.sourceforge.phpdt.ui.javaElementFilters does not provide a valid ID"); //$NON-NLS-1$
+ Assert.isNotNull(getName(), "An extension for extension-point net.sourceforge.phpdt.ui.javaElementFilters does not provide a valid name"); //$NON-NLS-1$
}
/**
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/filters/FilterMessages.properties b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/filters/FilterMessages.properties
index 7687a76..5904766 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/filters/FilterMessages.properties
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/filters/FilterMessages.properties
@@ -19,6 +19,6 @@ CustomFiltersDialog.DeselectAllButton.label= &Deselect All
OpenCustomFiltersDialogAction.text= &Filters...
-FilterDescriptor.filterDescriptionCreationError.message= One of the extensions for extension-point org.eclipse.jdt.ui.javaElementFilters is incorrect.
+FilterDescriptor.filterDescriptionCreationError.message= One of the extensions for extension-point net.sourceforge.phpdt.ui.javaElementFilters is incorrect.
FilterDescriptor.filterCreationError.title= Filter Creation Error
-FilterDescriptor.filterCreationError.message= The org.eclipse.jdt.ui.javaElementFilters plug-in extension "{0}" specifies a viewer filter class which does not exist.
+FilterDescriptor.filterCreationError.message= The net.sourceforge.phpdt.ui.javaElementFilters plug-in extension "{0}" specifies a viewer filter class which does not exist.
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/packageview/PackagesMessages.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/packageview/PackagesMessages.java
deleted file mode 100644
index 121b683..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/packageview/PackagesMessages.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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.internal.ui.packageview;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class PackagesMessages {
-
- private static final String RESOURCE_BUNDLE= "net.sourceforge.phpdt.internal.ui.packageview.PackagesMessages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private PackagesMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- /**
- * Gets a string from the resource bundle and formats it with the argument
- *
- * @param key the string used to get the bundle value, must not be null
- */
- public static String getFormattedString(String key, Object arg) {
- String format= null;
- try {
- format= fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- if (arg == null)
- arg= ""; //$NON-NLS-1$
- return MessageFormat.format(format, new Object[] { arg });
- }
-
- /**
- * Gets a string from the resource bundle and formats it with arguments
- */
- public static String getFormattedString(String key, String[] args) {
- return MessageFormat.format(fgResourceBundle.getString(key), args);
- }
-
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/packageview/PackagesMessages.properties b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/packageview/PackagesMessages.properties
deleted file mode 100644
index 01bac3f..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/packageview/PackagesMessages.properties
+++ /dev/null
@@ -1,97 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 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
-###############################################################################
-
-BuildGroup.buildProject=&Build Project
-BuildGroup.rebuildProject=Rebuild Pro&ject
-
-DragAdapter.deleting=Deleting ...
-DragAdapter.problem=Problem while moving or copying files.
-DragAdapter.problemTitle=Drag & Drop
-DragAdapter.refreshing=Refreshing...
-
-DropAdapter.alreadyExists={0} already exists. Would you like to overwrite it?
-DropAdapter.errorMessage=Error while moving or copying files.
-DropAdapter.errorSame=Cannot copy {0}: the destination folder is the same as the source folder.
-DropAdapter.errorSubfolder=Cannot copy {0}: the destination folder is a subfolder of the source folder.
-DropAdapter.errorTitle=Drag & Drop
-DropAdapter.question=Question
-
-FilterSelectionAction.apply.label=Select &filters to apply (matching files will be hidden):
-FilterSelectionAction.apply.toolTip=Apply the defined filters
-FilterSelectionAction.dialog.title=Package Explorer Filters
-
-GotoPackage.action.label=&Package...
-GotoPackage.dialog.message=&Choose a package (? = any character, * = any string):
-GotoPackage.dialog.title=Go to Package
-GotoPackage.action.description=Searches for and selects the package entered.
-
-GotoType.action.label=&Type...
-GotoType.action.description=Searches for and selects the type entered.
-GotoType.dialog.message=&Choose a type (? = any character, * = any string):
-GotoType.dialog.title=Go to Type
-GotoType.error.message=An exception occurred while searching for types
-
-GotoResource.action.label=&Resource...
-GotoResource.dialog.title= Go to Resource
-
-OpenResource.action.description=Open the selected file in an editor.
-OpenResource.action.label=&Open
-OpenResource.error.message=Cannot open Java editor.
-OpenResource.error.messageArgs=Cannot open Java editor on {0}. {1}
-OpenResource.error.messageProblems=Problems Opening Editor.
-OpenResource.error.title=Open Resource
-
-Sorter.expectPackage=expects a PackageFragment or PackageFragmentRoot
-
-ShowLibraries.hideReferencedLibs=Hide referenced libraries
-ShowLibraries.showReferencedLibs=Show referenced libraries
-
-ShowBinaries.hideBinaryProjects=Hide library projects
-ShowBinaries.showBinaryProjects=Show library projects
-
-ShowInNavigator.description=Show the selected object(s) in the navigator
-ShowInNavigator.error=Cannot open navigator
-ShowInNavigator.label=Show in &Navigator
-
-PackageExplorer.filters=&Filters...
-PackageExplorer.gotoTitle=G&o To
-PackageExplorer.openPerspective=Open &Perspective
-PackageExplorer.refactoringTitle=&Refactor
-PackageExplorer.referencedLibs=Show Referenced &Libraries
-PackageExplorer.binaryProjects=Show Library Projects
-PackageExplorer.title=Package Explorer
-PackageExplorer.argTitle={0}: {1}
-PackageExplorer.toolTip= Working Set: {0}
-PackageExplorer.toolTip2= {0} - Working Set: {1}
-PackageExplorer.openWith=Open Wit&h
-
-PackageExplorer.element_not_present=Cannot reveal {0} in Package Explorer. The element may be hidden by a filter or an active working set.
-
-SelectionTransferDropAdapter.error.title=Drag and drop
-SelectionTransferDropAdapter.error.message=Unexpected exception. See log for details
-SelectionTransferDropAdapter.dialog.title=Move
-SelectionTransferDropAdapter.dialog.preview.label=Pre&view
-SelectionTransferDropAdapter.dialog.question=Do you want to update references to the moved element(s)? Click 'Preview' to see the preview of the reference updates.
-
-CollapseAllAction.label=Collapse All
-CollapseAllAction.tooltip=Collapse All
-CollapseAllAction.description=Collapse All
-
-ToggleLinkingAction.label=Lin&k With Editor
-ToggleLinkingAction.tooltip=Link with Editor
-ToggleLinkingAction.description=Link with active editor
-
-LayoutActionGroup.label= &Layout
-LayoutActionGroup.flatLayoutAction.label= &Flat
-LayoutActionGroup.hierarchicalLayoutAction.label= &Hierarchical
-
-ClassPathContainer.error_label=Could not resolve class path entry
-PackageExplorerPart.workspace=Workspace
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/packageview/SelectionTransferDragAdapter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/packageview/SelectionTransferDragAdapter.java
deleted file mode 100644
index c0fca07..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/packageview/SelectionTransferDragAdapter.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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.internal.ui.packageview;
-
-import java.util.Iterator;
-
-import net.sourceforge.phpdt.core.IJavaElement;
-import net.sourceforge.phpdt.core.IPackageFragmentRoot;
-
-import net.sourceforge.phpdt.internal.ui.dnd.BasicSelectionTransferDragAdapter;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-public class SelectionTransferDragAdapter extends BasicSelectionTransferDragAdapter {
-
- public SelectionTransferDragAdapter(ISelectionProvider provider) {
- super(provider);
- }
-
- protected boolean isDragable(ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- for (Iterator iter= ((IStructuredSelection)selection).iterator(); iter.hasNext();) {
- Object element= iter.next();
- if (element instanceof IJavaElement) {
- IPackageFragmentRoot root= (IPackageFragmentRoot)((IJavaElement)element).getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
- if (root != null && root.isArchive())
- return false;
- }
- }
- return true;
- }
- return false;
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/AbstractConfigurationBlockPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/AbstractConfigurationBlockPreferencePage.java
index c263688..e2bf8be 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/AbstractConfigurationBlockPreferencePage.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/AbstractConfigurationBlockPreferencePage.java
@@ -25,7 +25,7 @@ import org.eclipse.ui.help.WorkbenchHelp;
/**
* Abstract preference page which is used to wrap a
- * {@link org.eclipse.jdt.internal.ui.preferences.IPreferenceConfigurationBlock}.
+ * {@link net.sourceforge.phpdt.internal.ui.preferences.IPreferenceConfigurationBlock}.
*
* @since 3.0
*/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeAssistPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeAssistPreferencePage.java
index 019607d..3409f64 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeAssistPreferencePage.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeAssistPreferencePage.java
@@ -27,28 +27,28 @@ import net.sourceforge.phpeclipse.PHPeclipsePlugin;
public class CodeAssistPreferencePage extends AbstractConfigurationBlockPreferencePage {
/*
- * @see org.eclipse.jdt.internal.ui.preferences.AbstractConfigureationBlockPreferencePage#getHelpId()
+ * @see net.sourceforge.phpdt.internal.ui.preferences.AbstractConfigureationBlockPreferencePage#getHelpId()
*/
protected String getHelpId() {
return IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE;
}
/*
- * @see org.eclipse.jdt.internal.ui.preferences.AbstractConfigurationBlockPreferencePage#setDescription()
+ * @see net.sourceforge.phpdt.internal.ui.preferences.AbstractConfigurationBlockPreferencePage#setDescription()
*/
protected void setDescription() {
// This page has no description
}
/*
- * @see org.eclipse.jdt.internal.ui.preferences.AbstractConfigurationBlockPreferencePage#setPreferenceStore()
+ * @see net.sourceforge.phpdt.internal.ui.preferences.AbstractConfigurationBlockPreferencePage#setPreferenceStore()
*/
protected void setPreferenceStore() {
setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
}
/*
- * @see org.eclipse.jdt.internal.ui.preferences.AbstractConfigureationBlockPreferencePage#createConfigurationBlock(org.eclipse.jdt.internal.ui.preferences.OverlayPreferenceStore)
+ * @see net.sourceforge.phpdt.internal.ui.preferences.AbstractConfigureationBlockPreferencePage#createConfigurationBlock(net.sourceforge.phpdt.internal.ui.preferences.OverlayPreferenceStore)
*/
protected IPreferenceConfigurationBlock createConfigurationBlock(OverlayPreferenceStore overlayPreferenceStore) {
return new CodeAssistConfigurationBlock(this, overlayPreferenceStore);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerPreferencePage.java
index 64f687b..16b4c43 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerPreferencePage.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerPreferencePage.java
@@ -83,7 +83,7 @@ public class CompilerPreferencePage extends PreferencePage implements IWorkbench
}
/* (non-Javadoc)
- * @see org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener#statusChanged(org.eclipse.core.runtime.IStatus)
+ * @see net.sourceforge.phpdt.internal.ui.wizards.IStatusChangeListener#statusChanged(org.eclipse.core.runtime.IStatus)
*/
public void statusChanged(IStatus status) {
setValid(!status.matches(IStatus.ERROR));
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerPropertyPage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerPropertyPage.java
index c64b204..40f2f61 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerPropertyPage.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerPropertyPage.java
@@ -138,7 +138,7 @@ public class CompilerPropertyPage extends PropertyPage {
private void doDialogFieldChanged(DialogField field) {
if (field == fChangeWorkspaceSettings) {
- String id= "org.eclipse.jdt.ui.preferences.CompilerPreferencePage"; //$NON-NLS-1$
+ String id= "net.sourceforge.phpdt.ui.preferences.CompilerPreferencePage"; //$NON-NLS-1$
CompilerPreferencePage page= new CompilerPreferencePage();
showPreferencePage(id, page);
} else {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/FoldingConfigurationBlock.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/FoldingConfigurationBlock.java
index b0a223c..a1dfb5d 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/FoldingConfigurationBlock.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/FoldingConfigurationBlock.java
@@ -64,7 +64,7 @@ class FoldingConfigurationBlock {
}
/*
- * @see org.eclipse.jdt.internal.ui.text.folding.IJavaFoldingPreferences#createControl(org.eclipse.swt.widgets.Group)
+ * @see net.sourceforge.phpdt.internal.ui.text.folding.IJavaFoldingPreferences#createControl(org.eclipse.swt.widgets.Group)
*/
public Control createControl(Composite composite) {
Composite inner= new Composite(composite, SWT.NONE);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/IPreferenceConfigurationBlock.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/IPreferenceConfigurationBlock.java
index 423f680..5690e85 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/IPreferenceConfigurationBlock.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/IPreferenceConfigurationBlock.java
@@ -17,7 +17,7 @@ import org.eclipse.swt.widgets.Control;
/**
* Interface for preference configuration blocks which can either be
- * wrapped by a {@link org.eclipse.jdt.internal.ui.preferences.AbstractConfigurationBlockPreferencePage}
+ * wrapped by a {@link net.sourceforge.phpdt.internal.ui.preferences.AbstractConfigurationBlockPreferencePage}
* or be included some preference page.
*
* Clients may implement this interface.
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/JavaPreferencesSettings.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/JavaPreferencesSettings.java
new file mode 100644
index 0000000..3ea2cf3
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/JavaPreferencesSettings.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.internal.ui.preferences;
+
+import java.util.StringTokenizer;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+
+import net.sourceforge.phpdt.ui.PreferenceConstants;
+
+import net.sourceforge.phpdt.internal.corext.codemanipulation.CodeGenerationSettings;
+import net.sourceforge.phpdt.internal.corext.util.CodeFormatterUtil;
+
+public class JavaPreferencesSettings {
+
+ public static CodeGenerationSettings getCodeGenerationSettings() {
+ IPreferenceStore store= PreferenceConstants.getPreferenceStore();
+
+ CodeGenerationSettings res= new CodeGenerationSettings();
+ res.createComments= store.getBoolean(PreferenceConstants.CODEGEN_ADD_COMMENTS);
+ res.useKeywordThis= store.getBoolean(PreferenceConstants.CODEGEN_KEYWORD_THIS);
+ res.importOrder= getImportOrderPreference(store);
+ res.importThreshold= getImportNumberThreshold(store);
+ res.tabWidth= CodeFormatterUtil.getTabWidth();
+ return res;
+ }
+
+ public static int getImportNumberThreshold(IPreferenceStore prefs) {
+ int threshold= prefs.getInt(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD);
+ if (threshold < 0) {
+ threshold= Integer.MAX_VALUE;
+ }
+ return threshold;
+ }
+
+
+ public static String[] getImportOrderPreference(IPreferenceStore prefs) {
+ String str= prefs.getString(PreferenceConstants.ORGIMPORTS_IMPORTORDER);
+ if (str != null) {
+ return unpackList(str, ";"); //$NON-NLS-1$
+ }
+ return new String[0];
+ }
+
+ private static String[] unpackList(String str, String separator) {
+ StringTokenizer tok= new StringTokenizer(str, separator); //$NON-NLS-1$
+ int nTokens= tok.countTokens();
+ String[] res= new String[nTokens];
+ for (int i= 0; i < nTokens; i++) {
+ res[i]= tok.nextToken().trim();
+ }
+ return res;
+ }
+
+
+}
+
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PreferencesMessages.properties b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PreferencesMessages.properties
index 5ba2d19..bd11016 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PreferencesMessages.properties
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PreferencesMessages.properties
@@ -283,7 +283,7 @@ AppearancePreferencePage.description= Appearance of PHP elements in viewers:
AppearancePreferencePage.methodreturntype.label= Show &method return types
AppearancePreferencePage.overrideindicator.label= Show &override indicators in outline and hierarchy
AppearancePreferencePage.pkgNamePatternEnable.label= &Compress all package name segments, except the final segment
-AppearancePreferencePage.pkgNamePattern.label= Com&pression pattern (e.g. given package name 'org.eclipse.jdt' pattern '.' will compress it to '..jdt', '0' to 'jdt', '1~.' to 'o~.e~.jdt'):
+AppearancePreferencePage.pkgNamePattern.label= Com&pression pattern (e.g. given package name 'net.sourceforge.phpdt' pattern '.' will compress it to '..jdt', '0' to 'jdt', '1~.' to 'o~.e~.jdt'):
AppearancePreferencePage.showMembersInPackagesView=S&how members in Package Explorer
AppearancePreferencePage.stackViewsVerticallyInTheJavaBrowsingPerspective=&Stack views vertically in the Java Browsing perspective
AppearancePreferencePage.note=Note:
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/SpellingConfigurationBlock.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/SpellingConfigurationBlock.java
index 169901a..a48fb80 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/SpellingConfigurationBlock.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/SpellingConfigurationBlock.java
@@ -262,7 +262,7 @@ public class SpellingConfigurationBlock extends OptionsConfigurationBlock {
}
/*
- * @see org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock#createContents(org.eclipse.swt.widgets.Composite)
+ * @see net.sourceforge.phpdt.internal.ui.preferences.OptionsConfigurationBlock#createContents(org.eclipse.swt.widgets.Composite)
*/
protected Control createContents(final Composite parent) {
@@ -363,7 +363,7 @@ public class SpellingConfigurationBlock extends OptionsConfigurationBlock {
}
/*
- * @see org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock#getDefaultOptions()
+ * @see net.sourceforge.phpdt.internal.ui.preferences.OptionsConfigurationBlock#getDefaultOptions()
*/
protected Map getDefaultOptions() {
@@ -378,14 +378,14 @@ public class SpellingConfigurationBlock extends OptionsConfigurationBlock {
}
/*
- * @see org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock#getFullBuildDialogStrings(boolean)
+ * @see net.sourceforge.phpdt.internal.ui.preferences.OptionsConfigurationBlock#getFullBuildDialogStrings(boolean)
*/
protected final String[] getFullBuildDialogStrings(final boolean workspace) {
return null;
}
/*
- * @see org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock#getOptions(boolean)
+ * @see net.sourceforge.phpdt.internal.ui.preferences.OptionsConfigurationBlock#getOptions(boolean)
*/
protected Map getOptions(final boolean inherit) {
@@ -415,7 +415,7 @@ public class SpellingConfigurationBlock extends OptionsConfigurationBlock {
}
/*
- * @see org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock#setOptions(java.util.Map)
+ * @see net.sourceforge.phpdt.internal.ui.preferences.OptionsConfigurationBlock#setOptions(java.util.Map)
*/
protected void setOptions(final Map options) {
@@ -427,7 +427,7 @@ public class SpellingConfigurationBlock extends OptionsConfigurationBlock {
}
/*
- * @see org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock#validateSettings(java.lang.String,java.lang.String)
+ * @see net.sourceforge.phpdt.internal.ui.preferences.OptionsConfigurationBlock#validateSettings(java.lang.String,java.lang.String)
*/
protected void validateSettings(final String key, final String value) {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/SpellingPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/SpellingPreferencePage.java
index 3ab69b1..e4e8b8e 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/SpellingPreferencePage.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/SpellingPreferencePage.java
@@ -92,7 +92,7 @@ public class SpellingPreferencePage extends PreferencePage implements IWorkbench
}
/*
- * @see org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener#statusChanged(org.eclipse.core.runtime.IStatus)
+ * @see net.sourceforge.phpdt.internal.ui.wizards.IStatusChangeListener#statusChanged(org.eclipse.core.runtime.IStatus)
*/
public void statusChanged(final IStatus status) {
setValid(!status.matches(IStatus.ERROR));
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskConfigurationBlock.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskConfigurationBlock.java
index 2a0196c..381482d 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskConfigurationBlock.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskConfigurationBlock.java
@@ -217,7 +217,7 @@ public class TodoTaskConfigurationBlock extends OptionsConfigurationBlock {
}
/* (non-Javadoc)
- * @see org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock#performOk(boolean)
+ * @see net.sourceforge.phpdt.internal.ui.preferences.OptionsConfigurationBlock#performOk(boolean)
*/
public boolean performOk(boolean enabled) {
packTodoTasks();
@@ -237,7 +237,7 @@ public class TodoTaskConfigurationBlock extends OptionsConfigurationBlock {
}
/* (non-Javadoc)
- * @see org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock#updateControls()
+ * @see net.sourceforge.phpdt.internal.ui.preferences.OptionsConfigurationBlock#updateControls()
*/
protected void updateControls() {
unpackTodoTasks();
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskPreferencePage.java
index 5d7c765..60b3716 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskPreferencePage.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskPreferencePage.java
@@ -29,7 +29,7 @@ import org.eclipse.ui.help.WorkbenchHelp;
*/
public class TodoTaskPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, IStatusChangeListener {
- public static final String ID= "org.eclipse.jdt.ui.preferences.TodoTaskPreferencePage"; //$NON-NLS-1$
+ public static final String ID= "net.sourceforge.phpdt.ui.preferences.TodoTaskPreferencePage"; //$NON-NLS-1$
private TodoTaskConfigurationBlock fConfigurationBlock;
@@ -86,7 +86,7 @@ public class TodoTaskPreferencePage extends PreferencePage implements IWorkbench
}
/* (non-Javadoc)
- * @see org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener#statusChanged(org.eclipse.core.runtime.IStatus)
+ * @see net.sourceforge.phpdt.internal.ui.wizards.IStatusChangeListener#statusChanged(org.eclipse.core.runtime.IStatus)
*/
public void statusChanged(IStatus status) {
setValid(!status.matches(IStatus.ERROR));
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/CustomSourceInformationControl.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/CustomSourceInformationControl.java
index 06e67f9..245aaf3 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/CustomSourceInformationControl.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/CustomSourceInformationControl.java
@@ -34,7 +34,7 @@ import org.eclipse.swt.widgets.Shell;
public class CustomSourceInformationControl extends SourceViewerInformationControl {
/** The font name for the viewer font - the same as the java editor's. */
- private static final String SYMBOLIC_FONT_NAME= "org.eclipse.jdt.ui.editors.textfont"; //$NON-NLS-1$
+ private static final String SYMBOLIC_FONT_NAME= "net.sourceforge.phpdt.ui.editors.textfont"; //$NON-NLS-1$
/** The maximum width of the control, set in setSizeConstraints(int, int)
. */
int fMaxWidth= Integer.MAX_VALUE;
@@ -200,7 +200,7 @@ public class CustomSourceInformationControl extends SourceViewerInformationContr
}
/*
- * @see org.eclipse.jdt.internal.ui.text.java.hover.SourceViewerInformationControl#hasContents()
+ * @see net.sourceforge.phpdt.internal.ui.text.java.hover.SourceViewerInformationControl#hasContents()
*/
public boolean hasContents() {
return super.hasContents() && fMaxWidth > 0;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaBreakIterator.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaBreakIterator.java
index 14a9b0b..eb4067f 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaBreakIterator.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaBreakIterator.java
@@ -13,6 +13,8 @@ package net.sourceforge.phpdt.internal.ui.text;
import java.text.BreakIterator;
import java.text.CharacterIterator;
+import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
+
import org.eclipse.jface.text.Assert;
@@ -84,7 +86,7 @@ public class JavaBreakIterator extends BreakIterator {
private static final char EXIT= '\1';
/*
- * @see org.eclipse.jdt.internal.ui.text.JavaBreakIterator.Run#init()
+ * @see net.sourceforge.phpdt.internal.ui.text.JavaBreakIterator.Run#init()
*/
protected void init() {
super.init();
@@ -92,7 +94,7 @@ public class JavaBreakIterator extends BreakIterator {
}
/*
- * @see org.eclipse.jdt.internal.ui.text.JavaBreakIterator.Run#consume(char)
+ * @see net.sourceforge.phpdt.internal.ui.text.JavaBreakIterator.Run#consume(char)
*/
protected boolean consume(char ch) {
if (!isValid(ch) || fState == EXIT)
@@ -118,10 +120,10 @@ public class JavaBreakIterator extends BreakIterator {
static final class Identifier extends Run {
/*
- * @see org.eclipse.jdt.internal.ui.text.JavaBreakIterator.Run#isValid(char)
+ * @see net.sourceforge.phpdt.internal.ui.text.JavaBreakIterator.Run#isValid(char)
*/
protected boolean isValid(char ch) {
- return Character.isJavaIdentifierPart(ch);
+ return Scanner.isPHPIdentifierPart(ch);
}
}
@@ -151,7 +153,7 @@ public class JavaBreakIterator extends BreakIterator {
};
/*
- * @see org.eclipse.jdt.internal.ui.text.JavaBreakIterator.Run#init()
+ * @see net.sourceforge.phpdt.internal.ui.text.JavaBreakIterator.Run#init()
*/
protected void init() {
super.init();
@@ -159,7 +161,7 @@ public class JavaBreakIterator extends BreakIterator {
}
/*
- * @see org.eclipse.jdt.internal.ui.text.JavaBreakIterator.Run#consumes(char)
+ * @see net.sourceforge.phpdt.internal.ui.text.JavaBreakIterator.Run#consumes(char)
*/
protected boolean consume(char ch) {
int kind= getKind(ch);
@@ -191,25 +193,25 @@ public class JavaBreakIterator extends BreakIterator {
return K_UPPER;
if (Character.isLowerCase(ch))
return K_LOWER;
- if (Character.isJavaIdentifierPart(ch)) // _, digits...
+ if (Scanner.isPHPIdentifierPart(ch)) // _, digits...
return K_OTHER;
return K_INVALID;
}
/*
- * @see org.eclipse.jdt.internal.ui.text.JavaBreakIterator.Run#isValid(char)
+ * @see net.sourceforge.phpdt.internal.ui.text.JavaBreakIterator.Run#isValid(char)
*/
protected boolean isValid(char ch) {
- return Character.isJavaIdentifierPart(ch);
+ return Scanner.isPHPIdentifierPart(ch);
}
}
static final class Other extends Run {
/*
- * @see org.eclipse.jdt.internal.ui.text.JavaBreakIterator.Run#isValid(char)
+ * @see net.sourceforge.phpdt.internal.ui.text.JavaBreakIterator.Run#isValid(char)
*/
protected boolean isValid(char ch) {
- return !Character.isWhitespace(ch) && !Character.isJavaIdentifierPart(ch);
+ return !Character.isWhitespace(ch) && !Scanner.isPHPIdentifierPart(ch);
}
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaHeuristicScanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaHeuristicScanner.java
index ebeef70..d7ef909 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaHeuristicScanner.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaHeuristicScanner.java
@@ -12,6 +12,8 @@ package net.sourceforge.phpdt.internal.ui.text;
import java.util.Arrays;
+import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
+
import org.eclipse.jface.text.Assert;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
@@ -75,7 +77,7 @@ public class JavaHeuristicScanner implements Symbols {
*/
private static class NonWhitespace implements StopCondition {
/*
- * @see org.eclipse.jdt.internal.ui.text.JavaHeuristicScanner.StopCondition#stop(char)
+ * @see net.sourceforge.phpdt.internal.ui.text.JavaHeuristicScanner.StopCondition#stop(char)
*/
public boolean stop(char ch, int position, boolean forward) {
return !Character.isWhitespace(ch);
@@ -89,7 +91,7 @@ public class JavaHeuristicScanner implements Symbols {
*/
private class NonWhitespaceDefaultPartition extends NonWhitespace {
/*
- * @see org.eclipse.jdt.internal.ui.text.JavaHeuristicScanner.StopCondition#stop(char)
+ * @see net.sourceforge.phpdt.internal.ui.text.JavaHeuristicScanner.StopCondition#stop(char)
*/
public boolean stop(char ch, int position, boolean forward) {
return super.stop(ch, position, true) && isDefaultPartition(position);
@@ -97,14 +99,14 @@ public class JavaHeuristicScanner implements Symbols {
}
/**
- * Stops upon a non-java identifier (as defined by {@link Character#isJavaIdentifierPart(char)}) character.
+ * Stops upon a non-java identifier (as defined by {@link Scanner#isPHPIdentifierPart(char)}) character.
*/
private static class NonJavaIdentifierPart implements StopCondition {
/*
- * @see org.eclipse.jdt.internal.ui.text.JavaHeuristicScanner.StopCondition#stop(char)
+ * @see net.sourceforge.phpdt.internal.ui.text.JavaHeuristicScanner.StopCondition#stop(char)
*/
public boolean stop(char ch, int position, boolean forward) {
- return !Character.isJavaIdentifierPart(ch);
+ return !Scanner.isPHPIdentifierPart(ch);
}
}
@@ -115,7 +117,7 @@ public class JavaHeuristicScanner implements Symbols {
*/
private class NonJavaIdentifierPartDefaultPartition extends NonJavaIdentifierPart {
/*
- * @see org.eclipse.jdt.internal.ui.text.JavaHeuristicScanner.StopCondition#stop(char)
+ * @see net.sourceforge.phpdt.internal.ui.text.JavaHeuristicScanner.StopCondition#stop(char)
*/
public boolean stop(char ch, int position, boolean forward) {
return super.stop(ch, position, true) || !isDefaultPartition(position);
@@ -148,7 +150,7 @@ public class JavaHeuristicScanner implements Symbols {
}
/*
- * @see org.eclipse.jdt.internal.ui.text.JavaHeuristicScanner.StopCondition#stop(char, int)
+ * @see net.sourceforge.phpdt.internal.ui.text.JavaHeuristicScanner.StopCondition#stop(char, int)
*/
public boolean stop(char ch, int position, boolean forward) {
return Arrays.binarySearch(fChars, ch) >= 0 && isDefaultPartition(position);
@@ -180,7 +182,7 @@ public class JavaHeuristicScanner implements Symbols {
}
/*
- * @see org.eclipse.jdt.internal.ui.text.JavaHeuristicScanner.StopCondition#stop(char, int)
+ * @see net.sourceforge.phpdt.internal.ui.text.JavaHeuristicScanner.StopCondition#stop(char, int)
*/
public boolean stop(char ch, int position, boolean forward) {
@@ -332,7 +334,7 @@ public class JavaHeuristicScanner implements Symbols {
}
// else
- if (Character.isJavaIdentifierPart(fChar)) {
+ if (Scanner.isPHPIdentifierPart(fChar)) {
// assume an ident or keyword
int from= pos, to;
pos= scanForward(pos + 1, bound, fNonIdent);
@@ -400,7 +402,7 @@ public class JavaHeuristicScanner implements Symbols {
}
// else
- if (Character.isJavaIdentifierPart(fChar)) {
+ if (Scanner.isPHPIdentifierPart(fChar)) {
// assume an ident or keyword
int from, to= pos + 1;
pos= scanBackward(pos - 1, bound, fNonIdent);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaReconciler.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaReconciler.java
index a2f5b2c..8dfb26f 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaReconciler.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaReconciler.java
@@ -121,7 +121,7 @@ public class JavaReconciler extends MonoReconciler {
*/
private class ElementChangedListener implements IElementChangedListener {
/*
- * @see org.eclipse.jdt.core.IElementChangedListener#elementChanged(org.eclipse.jdt.core.ElementChangedEvent)
+ * @see net.sourceforge.phpdt.core.IElementChangedListener#elementChanged(net.sourceforge.phpdt.core.ElementChangedEvent)
*/
public void elementChanged(ElementChangedEvent event) {
setJavaModelChanged(true);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/SmartSemicolonAutoEditStrategy.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/SmartSemicolonAutoEditStrategy.java
index edd3013..7b8e3d3 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/SmartSemicolonAutoEditStrategy.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/SmartSemicolonAutoEditStrategy.java
@@ -12,6 +12,7 @@ package net.sourceforge.phpdt.internal.ui.text;
import java.util.Arrays;
+import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
import net.sourceforge.phpdt.internal.core.Assert;
import net.sourceforge.phpdt.internal.ui.text.SmartBackspaceManager.UndoSpec;
import net.sourceforge.phpdt.ui.PreferenceConstants;
@@ -327,7 +328,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy {
return -1;
ch= document.getChar(p);
- if (Character.isJavaIdentifierPart(ch) || ch == ']' || ch == '[')
+ if (Scanner.isPHPIdentifierPart(ch) || ch == ']' || ch == '[')
return offset;
} catch (BadLocationException e) {
@@ -636,10 +637,10 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy {
if (pos < 0)
return false;
- if (pos != 0 && Character.isJavaIdentifierPart(text.charAt(pos - 1)))
+ if (pos != 0 && Scanner.isPHPIdentifierPart(text.charAt(pos - 1)))
return false;
- if (pos + 3 < length && Character.isJavaIdentifierPart(text.charAt(pos + 3)))
+ if (pos + 3 < length && Scanner.isPHPIdentifierPart(text.charAt(pos + 3)))
return false;
return true;
@@ -759,7 +760,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy {
/**
* Checks whether code>document contains the String
like
such
* that its last character is at position
. If like
starts with a
- * identifier part (as determined by {@link Character#isJavaIdentifier(char)}), it is also made
+ * identifier part (as determined by {@link Scanner#isPHPIdentifierPart(char)}), it is also made
* sure that like
is preceded by some non-identifier character or stands at the
* document start.
*
@@ -777,7 +778,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy {
if (!like.equals(document.get(position - length + 1, length)))
return false;
- if (position >= length && Character.isJavaIdentifierPart(like.charAt(0)) && Character.isJavaIdentifierPart(document.getChar(position - length)))
+ if (position >= length && Scanner.isPHPIdentifierPart(like.charAt(0)) && Scanner.isPHPIdentifierPart(document.getChar(position - length)))
return false;
} catch (BadLocationException e) {
@@ -864,7 +865,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy {
while (p >= 0) {
char ch= document.getChar(p);
- if (Character.isJavaIdentifierPart(ch)) {
+ if (Scanner.isPHPIdentifierPart(ch)) {
p--;
continue;
}
@@ -980,7 +981,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy {
/* searching for (^|\s)for(\s|$) */
int forPos= line.indexOf("for"); //$NON-NLS-1$
if (forPos != -1) {
- if ((forPos == 0 || !Character.isJavaIdentifierPart(line.charAt(forPos - 1))) && (line.length() == forPos + 3 || !Character.isJavaIdentifierPart(line.charAt(forPos + 3))))
+ if ((forPos == 0 || !Scanner.isPHPIdentifierPart(line.charAt(forPos - 1))) && (line.length() == forPos + 3 || !Scanner.isPHPIdentifierPart(line.charAt(forPos + 3))))
return true;
}
return false;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/IInvocationContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/IInvocationContext.java
index fc45294..4b637b1 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/IInvocationContext.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/IInvocationContext.java
@@ -41,10 +41,10 @@ public interface IInvocationContext {
/**
* Returns an AST of the compilation unit, possibly only a partial AST focused on the selection
- * offset (see {@link org.eclipse.jdt.core.dom.ASTParser#setFocalPosition(int)}).
+ * offset (see {@link net.sourceforge.phpdt.core.dom.ASTParser#setFocalPosition(int)}).
* The returned AST is shared and therefore protected and cannot be modified.
* The client must check the AST API level and do nothing if they are given an AST
- * they can't handle. (see {@link org.eclipse.jdt.core.dom.AST#apiLevel()}).
+ * they can't handle. (see {@link net.sourceforge.phpdt.core.dom.AST#apiLevel()}).
* @return Returns the root of the AST corresponding to the current compilation unit.
*/
CompilationUnit getASTRoot();
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/JavaExpandHover.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/JavaExpandHover.java
index fc4e006..929f858 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/JavaExpandHover.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/JavaExpandHover.java
@@ -51,7 +51,7 @@ import org.eclipse.ui.texteditor.AnnotationPreferenceLookup;
public class JavaExpandHover extends AnnotationExpandHover {
/** Id of the no breakpoint fake annotation */
- public static final String NO_BREAKPOINT_ANNOTATION= "org.eclipse.jdt.internal.ui.NoBreakpointAnnotation"; //$NON-NLS-1$
+ public static final String NO_BREAKPOINT_ANNOTATION= "net.sourceforge.phpdt.internal.ui.NoBreakpointAnnotation"; //$NON-NLS-1$
private static class NoBreakpointAnnotation extends Annotation implements IAnnotationPresentation {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionUI.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionUI.java
index b47befa..bf483a5 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionUI.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionUI.java
@@ -322,7 +322,7 @@ public class LinkedPositionUI implements ILinkedPositionListener,
}
/*
- * @see org.eclipse.jdt.internal.ui.text.link.ILinkedPositionListener#exit(boolean)
+ * @see net.sourceforge.phpdt.internal.ui.text.link.ILinkedPositionListener#exit(boolean)
*/
public void exit(int flags) {
leave(flags);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/link/ProposalPosition.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/link/ProposalPosition.java
index 46ddd75..13f73c5 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/link/ProposalPosition.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/link/ProposalPosition.java
@@ -12,7 +12,7 @@ package net.sourceforge.phpdt.internal.ui.text.link;
import java.util.Arrays;
-//import org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal;
+//import net.sourceforge.phpdt.internal.ui.text.java.JavaCompletionProposal;
import org.eclipse.jface.text.TypedPosition;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/AddWordProposal.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/AddWordProposal.java
index 3619060..c0140c1 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/AddWordProposal.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/AddWordProposal.java
@@ -93,7 +93,7 @@ public class AddWordProposal implements IPHPCompletionProposal {
}
/*
- * @see org.eclipse.jdt.ui.text.java.IJavaCompletionProposal#getRelevance()
+ * @see net.sourceforge.phpdt.ui.text.java.IJavaCompletionProposal#getRelevance()
*/
public int getRelevance() {
return Integer.MIN_VALUE;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/HtmlTagDictionary.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/HtmlTagDictionary.java
index 5e8907f..2b2ba07 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/HtmlTagDictionary.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/HtmlTagDictionary.java
@@ -25,14 +25,14 @@ import net.sourceforge.phpdt.internal.ui.text.spelling.engine.AbstractSpellDicti
public class HtmlTagDictionary extends AbstractSpellDictionary implements IHtmlTagConstants {
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.AbstractSpellDictionary#getName()
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.AbstractSpellDictionary#getName()
*/
protected final URL getURL() {
return null;
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellDictionary#isCorrect(java.lang.String)
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellDictionary#isCorrect(java.lang.String)
*/
public boolean isCorrect(final String word) {
@@ -43,7 +43,7 @@ public class HtmlTagDictionary extends AbstractSpellDictionary implements IHtmlT
}
/*
- * @see org.eclipse.jdt.ui.text.spelling.engine.AbstractSpellDictionary#load(java.net.URL)
+ * @see net.sourceforge.phpdt.ui.text.spelling.engine.AbstractSpellDictionary#load(java.net.URL)
*/
protected boolean load(final URL url) {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/JavaDocTagDictionary.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/JavaDocTagDictionary.java
index 891d87b..b2f05b7 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/JavaDocTagDictionary.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/JavaDocTagDictionary.java
@@ -25,14 +25,14 @@ import net.sourceforge.phpdt.internal.ui.text.spelling.engine.AbstractSpellDicti
public class JavaDocTagDictionary extends AbstractSpellDictionary implements IJavaDocTagConstants {
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.AbstractSpellDictionary#getName()
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.AbstractSpellDictionary#getName()
*/
protected final URL getURL() {
return null;
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellDictionary#isCorrect(java.lang.String)
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellDictionary#isCorrect(java.lang.String)
*/
public boolean isCorrect(final String word) {
@@ -43,7 +43,7 @@ public class JavaDocTagDictionary extends AbstractSpellDictionary implements IJa
}
/*
- * @see org.eclipse.jdt.ui.text.spelling.engine.AbstractSpellDictionary#load(java.net.URL)
+ * @see net.sourceforge.phpdt.ui.text.spelling.engine.AbstractSpellDictionary#load(java.net.URL)
*/
protected boolean load(final URL url) {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/SpellCheckEngine.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/SpellCheckEngine.java
index 4215576..568f1d7 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/SpellCheckEngine.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/SpellCheckEngine.java
@@ -176,7 +176,7 @@ public class SpellCheckEngine implements ISpellCheckEngine, IPropertyChangeListe
}
/*
- * @see org.eclipse.jdt.ui.text.spelling.engine.ISpellCheckEngine#createSpellChecker(java.util.Locale,org.eclipse.jface.preference.IPreferenceStore)
+ * @see net.sourceforge.phpdt.ui.text.spelling.engine.ISpellCheckEngine#createSpellChecker(java.util.Locale,org.eclipse.jface.preference.IPreferenceStore)
*/
public final synchronized ISpellChecker createSpellChecker(final Locale locale, final IPreferenceStore store) {
@@ -232,7 +232,7 @@ public class SpellCheckEngine implements ISpellCheckEngine, IPropertyChangeListe
}
/*
- * @see org.eclipse.jdt.ui.text.spelling.engine.ISpellCheckEngine#getLocale()
+ * @see net.sourceforge.phpdt.ui.text.spelling.engine.ISpellCheckEngine#getLocale()
*/
public final Locale getLocale() {
return fLocale;
@@ -276,7 +276,7 @@ public class SpellCheckEngine implements ISpellCheckEngine, IPropertyChangeListe
}
/*
- * @see org.eclipse.jdt.ui.text.spelling.engine.ISpellCheckEngine#registerDictionary(org.eclipse.jdt.ui.text.spelling.engine.ISpellDictionary)
+ * @see net.sourceforge.phpdt.ui.text.spelling.engine.ISpellCheckEngine#registerDictionary(net.sourceforge.phpdt.ui.text.spelling.engine.ISpellDictionary)
*/
public synchronized final void registerDictionary(final ISpellDictionary dictionary) {
@@ -287,7 +287,7 @@ public class SpellCheckEngine implements ISpellCheckEngine, IPropertyChangeListe
}
/*
- * @see org.eclipse.jdt.ui.text.spelling.engine.ISpellCheckEngine#registerDictionary(java.util.Locale,org.eclipse.jdt.ui.text.spelling.engine.ISpellDictionary)
+ * @see net.sourceforge.phpdt.ui.text.spelling.engine.ISpellCheckEngine#registerDictionary(java.util.Locale,net.sourceforge.phpdt.ui.text.spelling.engine.ISpellDictionary)
*/
public synchronized final void registerDictionary(final Locale locale, final ISpellDictionary dictionary) {
@@ -298,7 +298,7 @@ public class SpellCheckEngine implements ISpellCheckEngine, IPropertyChangeListe
}
/*
- * @see org.eclipse.jdt.ui.text.spelling.engine.ISpellCheckEngine#unload()
+ * @see net.sourceforge.phpdt.ui.text.spelling.engine.ISpellCheckEngine#unload()
*/
public synchronized final void unload() {
@@ -323,7 +323,7 @@ public class SpellCheckEngine implements ISpellCheckEngine, IPropertyChangeListe
}
/*
- * @see org.eclipse.jdt.ui.text.spelling.engine.ISpellCheckEngine#unregisterDictionary(org.eclipse.jdt.ui.text.spelling.engine.ISpellDictionary)
+ * @see net.sourceforge.phpdt.ui.text.spelling.engine.ISpellCheckEngine#unregisterDictionary(net.sourceforge.phpdt.ui.text.spelling.engine.ISpellDictionary)
*/
public synchronized final void unregisterDictionary(final ISpellDictionary dictionary) {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/SpellReconcileDictionary.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/SpellReconcileDictionary.java
index b19b0c4..d9edc82 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/SpellReconcileDictionary.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/SpellReconcileDictionary.java
@@ -39,7 +39,7 @@ public class SpellReconcileDictionary extends LocaleSensitiveSpellDictionary imp
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellDictionary#isCorrect(java.lang.String)
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellDictionary#isCorrect(java.lang.String)
*/
public boolean isCorrect(final String word) {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/SpellReconcileStrategy.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/SpellReconcileStrategy.java
index 84d5f35..81d4b19 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/SpellReconcileStrategy.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/SpellReconcileStrategy.java
@@ -82,7 +82,7 @@ public class SpellReconcileStrategy implements IReconcilingStrategy, IReconcilin
}
/*
- * @see org.eclipse.jdt.core.compiler.IProblem#getArguments()
+ * @see net.sourceforge.phpdt.core.compiler.IProblem#getArguments()
*/
public String[] getArguments() {
@@ -103,14 +103,14 @@ public class SpellReconcileStrategy implements IReconcilingStrategy, IReconcilin
}
/*
- * @see org.eclipse.jdt.core.compiler.IProblem#getID()
+ * @see net.sourceforge.phpdt.core.compiler.IProblem#getID()
*/
public int getID() {
return Spelling;
}
/*
- * @see org.eclipse.jdt.core.compiler.IProblem#getMessage()
+ * @see net.sourceforge.phpdt.core.compiler.IProblem#getMessage()
*/
public String getMessage() {
@@ -121,28 +121,28 @@ public class SpellReconcileStrategy implements IReconcilingStrategy, IReconcilin
}
/*
- * @see org.eclipse.jdt.core.compiler.IProblem#getOriginatingFileName()
+ * @see net.sourceforge.phpdt.core.compiler.IProblem#getOriginatingFileName()
*/
public char[] getOriginatingFileName() {
return fEditor.getEditorInput().getName().toCharArray();
}
/*
- * @see org.eclipse.jdt.core.compiler.IProblem#getSourceEnd()
+ * @see net.sourceforge.phpdt.core.compiler.IProblem#getSourceEnd()
*/
public final int getSourceEnd() {
return fEnd;
}
/*
- * @see org.eclipse.jdt.core.compiler.IProblem#getSourceLineNumber()
+ * @see net.sourceforge.phpdt.core.compiler.IProblem#getSourceLineNumber()
*/
public final int getSourceLineNumber() {
return fLine;
}
/*
- * @see org.eclipse.jdt.core.compiler.IProblem#getSourceStart()
+ * @see net.sourceforge.phpdt.core.compiler.IProblem#getSourceStart()
*/
public final int getSourceStart() {
return fStart;
@@ -159,7 +159,7 @@ public class SpellReconcileStrategy implements IReconcilingStrategy, IReconcilin
}
/*
- * @see org.eclipse.jdt.core.compiler.IProblem#isError()
+ * @see net.sourceforge.phpdt.core.compiler.IProblem#isError()
*/
public final boolean isError() {
return false;
@@ -176,7 +176,7 @@ public class SpellReconcileStrategy implements IReconcilingStrategy, IReconcilin
}
/*
- * @see org.eclipse.jdt.core.compiler.IProblem#isWarning()
+ * @see net.sourceforge.phpdt.core.compiler.IProblem#isWarning()
*/
public final boolean isWarning() {
return true;
@@ -205,21 +205,21 @@ public class SpellReconcileStrategy implements IReconcilingStrategy, IReconcilin
}
/*
- * @see org.eclipse.jdt.core.compiler.IProblem#setSourceEnd(int)
+ * @see net.sourceforge.phpdt.core.compiler.IProblem#setSourceEnd(int)
*/
public final void setSourceEnd(final int end) {
fEnd= end;
}
/*
- * @see org.eclipse.jdt.core.compiler.IProblem#setSourceLineNumber(int)
+ * @see net.sourceforge.phpdt.core.compiler.IProblem#setSourceLineNumber(int)
*/
public final void setSourceLineNumber(final int line) {
fLine= line;
}
/*
- * @see org.eclipse.jdt.core.compiler.IProblem#setSourceStart(int)
+ * @see net.sourceforge.phpdt.core.compiler.IProblem#setSourceStart(int)
*/
public final void setSourceStart(final int start) {
fStart= start;
@@ -280,7 +280,7 @@ public class SpellReconcileStrategy implements IReconcilingStrategy, IReconcilin
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellEventListener#handle(org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellEvent)
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellEventListener#handle(net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellEvent)
*/
public void handle(final ISpellEvent event) {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/TaskTagDictionary.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/TaskTagDictionary.java
index 92b1ef5..ea03a5d 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/TaskTagDictionary.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/TaskTagDictionary.java
@@ -29,14 +29,14 @@ import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
public class TaskTagDictionary extends AbstractSpellDictionary implements IPropertyChangeListener {
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.AbstractSpellDictionary#getName()
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.AbstractSpellDictionary#getName()
*/
protected final URL getURL() {
return null;
}
/*
- * @see org.eclipse.jdt.ui.text.spelling.engine.AbstractSpellDictionary#load(java.net.URL)
+ * @see net.sourceforge.phpdt.ui.text.spelling.engine.AbstractSpellDictionary#load(java.net.URL)
*/
protected boolean load(final URL url) {
@@ -59,7 +59,7 @@ public class TaskTagDictionary extends AbstractSpellDictionary implements IPrope
}
/*
- * @see org.eclipse.jdt.ui.text.spelling.engine.ISpellDictionary#unload()
+ * @see net.sourceforge.phpdt.ui.text.spelling.engine.ISpellDictionary#unload()
*/
public void unload() {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/WordCorrectionProposal.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/WordCorrectionProposal.java
index 6d0d4ad..64ac2fe 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/WordCorrectionProposal.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/WordCorrectionProposal.java
@@ -154,7 +154,7 @@ public class WordCorrectionProposal implements IPHPCompletionProposal, IHtmlTagC
}
/*
- * @see org.eclipse.jdt.ui.text.java.IJavaCompletionProposal#getRelevance()
+ * @see net.sourceforge.phpdt.ui.text.java.IJavaCompletionProposal#getRelevance()
*/
public final int getRelevance() {
return fRelevance;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/WordIgnoreProposal.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/WordIgnoreProposal.java
index a8cfbf0..d2e076b 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/WordIgnoreProposal.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/WordIgnoreProposal.java
@@ -92,7 +92,7 @@ public class WordIgnoreProposal implements IPHPCompletionProposal {
return PHPUiImages.get(PHPUiImages.IMG_OBJS_NLS_NEVER_TRANSLATE);
}
/*
- * @see org.eclipse.jdt.ui.text.java.IJavaCompletionProposal#getRelevance()
+ * @see net.sourceforge.phpdt.ui.text.java.IJavaCompletionProposal#getRelevance()
*/
public final int getRelevance() {
return Integer.MIN_VALUE + 1;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/AbstractSpellDictionary.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/AbstractSpellDictionary.java
index d15172a..e268c0b 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/AbstractSpellDictionary.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/AbstractSpellDictionary.java
@@ -191,7 +191,7 @@ public abstract class AbstractSpellDictionary implements ISpellDictionary {
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellDictionary#getProposals(java.lang.String,boolean)
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellDictionary#getProposals(java.lang.String,boolean)
*/
public Set getProposals(final String word, final boolean sentence) {
@@ -328,7 +328,7 @@ public abstract class AbstractSpellDictionary implements ISpellDictionary {
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellDictionary#isCorrect(java.lang.String)
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellDictionary#isCorrect(java.lang.String)
*/
public boolean isCorrect(final String word) {
@@ -350,7 +350,7 @@ public abstract class AbstractSpellDictionary implements ISpellDictionary {
}
/*
- * @see org.eclipse.jdt.ui.text.spelling.engine.ISpellDictionary#isLoaded()
+ * @see net.sourceforge.phpdt.ui.text.spelling.engine.ISpellDictionary#isLoaded()
*/
public final synchronized boolean isLoaded() {
return fLoaded || fHashBuckets.size() > 0;
@@ -409,7 +409,7 @@ public abstract class AbstractSpellDictionary implements ISpellDictionary {
}
/*
- * @see org.eclipse.jdt.ui.text.spelling.engine.ISpellDictionary#unload()
+ * @see net.sourceforge.phpdt.ui.text.spelling.engine.ISpellDictionary#unload()
*/
public synchronized void unload() {
@@ -418,14 +418,14 @@ public abstract class AbstractSpellDictionary implements ISpellDictionary {
}
/*
- * @see org.eclipse.jdt.ui.text.spelling.engine.ISpellDictionary#acceptsWords()
+ * @see net.sourceforge.phpdt.ui.text.spelling.engine.ISpellDictionary#acceptsWords()
*/
public boolean acceptsWords() {
return false;
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellDictionary#addWord(java.lang.String)
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellDictionary#addWord(java.lang.String)
*/
public void addWord(final String word) {
// Do nothing
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/DefaultSpellChecker.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/DefaultSpellChecker.java
index 4ca16c5..3453691 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/DefaultSpellChecker.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/DefaultSpellChecker.java
@@ -167,7 +167,7 @@ public class DefaultSpellChecker implements ISpellChecker {
}
/*
- * @see org.eclipse.jdt.ui.text.spelling.engine.ISpellChecker#acceptsWords()
+ * @see net.sourceforge.phpdt.ui.text.spelling.engine.ISpellChecker#acceptsWords()
*/
public boolean acceptsWords() {
// synchronizing might not be needed here since acceptWords is
@@ -189,7 +189,7 @@ public class DefaultSpellChecker implements ISpellChecker {
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellChecker#addWord(java.lang.String)
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellChecker#addWord(java.lang.String)
*/
public void addWord(final String word) {
// synchronizing is necessary as this is a write access
@@ -210,7 +210,7 @@ public class DefaultSpellChecker implements ISpellChecker {
}
/*
- * @see org.eclipse.jdt.ui.text.spelling.engine.ISpellChecker#checkWord(java.lang.String)
+ * @see net.sourceforge.phpdt.ui.text.spelling.engine.ISpellChecker#checkWord(java.lang.String)
*/
public final void checkWord(final String word) {
// synchronizing is necessary as this is a write access
@@ -302,7 +302,7 @@ public class DefaultSpellChecker implements ISpellChecker {
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellChecker#ignoreWord(java.lang.String)
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellChecker#ignoreWord(java.lang.String)
*/
public final void ignoreWord(final String word) {
// synchronizing is necessary as this is a write access
@@ -310,7 +310,7 @@ public class DefaultSpellChecker implements ISpellChecker {
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellChecker#isCorrect(java.lang.String)
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellChecker#isCorrect(java.lang.String)
*/
public final boolean isCorrect(final String word) {
// synchronizing is necessary as this is called from execute
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/LocaleSensitiveSpellDictionary.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/LocaleSensitiveSpellDictionary.java
index 8553ab5..15b88f2 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/LocaleSensitiveSpellDictionary.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/LocaleSensitiveSpellDictionary.java
@@ -53,7 +53,7 @@ public class LocaleSensitiveSpellDictionary extends AbstractSpellDictionary {
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.AbstractSpellDictionary#getURL()
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.AbstractSpellDictionary#getURL()
*/
protected final URL getURL() throws MalformedURLException {
return new URL(fLocation, fLocale.toString().toLowerCase() + "." + PHPUIMessages.getString("Spelling.dictionary.file.extension")); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/PersistentSpellDictionary.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/PersistentSpellDictionary.java
index fe555f3..be610d8 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/PersistentSpellDictionary.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/PersistentSpellDictionary.java
@@ -36,14 +36,14 @@ public class PersistentSpellDictionary extends AbstractSpellDictionary {
}
/*
- * @see org.eclipse.jdt.ui.text.spelling.engine.AbstractSpellDictionary#acceptsWords()
+ * @see net.sourceforge.phpdt.ui.text.spelling.engine.AbstractSpellDictionary#acceptsWords()
*/
public boolean acceptsWords() {
return true;
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellDictionary#addWord(java.lang.String)
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellDictionary#addWord(java.lang.String)
*/
public void addWord(final String word) {
@@ -64,7 +64,7 @@ public class PersistentSpellDictionary extends AbstractSpellDictionary {
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.AbstractSpellDictionary#getURL()
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.AbstractSpellDictionary#getURL()
*/
protected final URL getURL() {
return fLocation;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/SpellEvent.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/SpellEvent.java
index 9d3eff5..627ea52 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/SpellEvent.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/engine/SpellEvent.java
@@ -66,42 +66,42 @@ public class SpellEvent implements ISpellEvent {
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellEvent#getBegin()
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellEvent#getBegin()
*/
public final int getBegin() {
return fBegin;
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellEvent#getEnd()
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellEvent#getEnd()
*/
public final int getEnd() {
return fEnd;
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellEvent#getProposals()
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellEvent#getProposals()
*/
public final Set getProposals() {
return fChecker.getProposals(fWord, fSentence);
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellEvent#getWord()
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellEvent#getWord()
*/
public final String getWord() {
return fWord;
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellEvent#isMatch()
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellEvent#isMatch()
*/
public final boolean isMatch() {
return fMatch;
}
/*
- * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellEvent#isStart()
+ * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellEvent#isStart()
*/
public final boolean isStart() {
return fSentence;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/AbstractProposal.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/AbstractProposal.java
index 1954ea4..f26f6a8 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/AbstractProposal.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/AbstractProposal.java
@@ -16,9 +16,9 @@ import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;
-//import org.eclipse.jdt.internal.ui.text.link.LinkedPositionManager;
-//import org.eclipse.jdt.internal.ui.text.link.LinkedPositionUI;
-//import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
+//import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionManager;
+//import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionUI;
+//import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler;
/**
* A PHP identifier proposal.
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/BuiltInEngine.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/BuiltInEngine.java
index c6e0c51..8aac30a 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/BuiltInEngine.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/BuiltInEngine.java
@@ -21,7 +21,7 @@ import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Region;
import org.eclipse.swt.graphics.Point;
-//import org.eclipse.jdt.internal.ui.text.link.LinkedPositionManager;
+//import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionManager;
public class BuiltInEngine {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/BuiltInProposal.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/BuiltInProposal.java
index 1a8504c..7c9570c 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/BuiltInProposal.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/BuiltInProposal.java
@@ -18,9 +18,9 @@ import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.templates.TemplateContext;
import org.eclipse.swt.graphics.Image;
-//import org.eclipse.jdt.internal.ui.text.link.LinkedPositionManager;
-//import org.eclipse.jdt.internal.ui.text.link.LinkedPositionUI;
-//import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
+//import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionManager;
+//import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionUI;
+//import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler;
/**
* A PHP identifier proposal.
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/DeclarationEngine.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/DeclarationEngine.java
index 56274cd..835b5d4 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/DeclarationEngine.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/DeclarationEngine.java
@@ -25,7 +25,7 @@ import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Region;
import org.eclipse.swt.graphics.Point;
-//import org.eclipse.jdt.internal.ui.text.link.LinkedPositionManager;
+//import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionManager;
public class DeclarationEngine {
@@ -37,8 +37,8 @@ public class DeclarationEngine {
private int fLastSignificantToken;
private IProject fProject;
- private IFile fFile;
-// private String fFileName;
+// private IFile fFile;
+ private String fFileName;
/**
* Creates the template engine for a particular context type.
@@ -50,12 +50,12 @@ public class DeclarationEngine {
fContextType = contextType;
fLastSignificantToken = lastSignificantToken;
- fFile = file;
-// if (fFile != null) {
-// fFileName = fFile.getFullPath().toString();
-// } else {
-// fFileName = "";
-// }
+// fFile = file;
+ if (file != null) {
+ fFileName = file.getProjectRelativePath().toString();
+ } else {
+ fFileName = "";
+ }
}
/**
@@ -78,6 +78,98 @@ public class DeclarationEngine {
/**
* Inspects the context of the compilation unit around completionPosition
* and feeds the collector with proposals.
+ *
+ * @param viewer the text viewer
+ * @param completionPosition the context position in the document of the text viewer
+ * @param compilationUnit the compilation unit (may be null
)
+ */
+ public void completeObject(ITextViewer viewer, int completionPosition, SortedMap map, ICompilationUnit compilationUnit) {
+ IDocument document = viewer.getDocument();
+
+ if (!(fContextType instanceof CompilationUnitContextType))
+ return;
+
+ Point selection = viewer.getSelectedRange();
+
+ // remember selected text
+ String selectedText = null;
+
+ if (selection.y != 0) {
+ try {
+ selectedText = document.get(selection.x, selection.y);
+ } catch (BadLocationException e) {
+ }
+ }
+
+ JavaContext context = (JavaContext) fContextType.createContext(document, completionPosition,selection.y,compilationUnit);
+ context.setVariable("selection", selectedText); //$NON-NLS-1$
+
+ int start = context.getStart();
+ int end = context.getEnd();
+ String prefix = context.getKey();
+ IRegion region = new Region(start, end - start);
+
+ String identifier = null;
+
+ SortedMap subMap = map.subMap(prefix, prefix + '\255');
+ Iterator iter = subMap.keySet().iterator();
+ PHPIdentifierLocation location;
+ ArrayList list;
+ int maxProposals = PHPeclipsePlugin.MAX_PROPOSALS;
+ while (iter.hasNext()) {
+ identifier = (String) iter.next();
+ if (context.canEvaluate(identifier)) {
+ list = (ArrayList) subMap.get(identifier);
+ for (int i = 0; i < list.size(); i++) {
+ location = (PHPIdentifierLocation) list.get(i);
+ int type = location.getType();
+ switch (fLastSignificantToken) {
+ case ITerminalSymbols.TokenNameMINUS_GREATER :
+ if (type != PHPIdentifierLocation.METHOD && type != PHPIdentifierLocation.VARIABLE) {
+ continue; // for loop
+ }
+ break;
+ case ITerminalSymbols.TokenNameVariable :
+ if (type != PHPIdentifierLocation.METHOD && type != PHPIdentifierLocation.VARIABLE) {
+ continue; // for loop
+ }
+// check all filenames of the subclasses
+// if (fFileName.equals(location.getFilename())) {
+// continue; // for loop
+// }
+ break;
+ case ITerminalSymbols.TokenNamethis_PHP_COMPLETION:
+ if (type != PHPIdentifierLocation.METHOD && type != PHPIdentifierLocation.VARIABLE) {
+ continue; // for loop
+ }
+ // check all filenames of the subclasses
+// if (!fFileName.equals(location.getFilename())) {
+// continue; // for loop
+// }
+ break;
+ case ITerminalSymbols.TokenNamenew :
+ if (type != PHPIdentifierLocation.CLASS && type != PHPIdentifierLocation.CONSTRUCTOR) {
+ continue; // for loop
+ }
+ break;
+ default :
+ if (type == PHPIdentifierLocation.METHOD || type == PHPIdentifierLocation.CONSTRUCTOR || type == PHPIdentifierLocation.VARIABLE) {
+ continue; // for loop
+ }
+ }
+ if (maxProposals-- < 0) {
+ return;
+ }
+ fProposals.add( new DeclarationProposal(fProject, identifier, location, context, region, viewer));
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Inspects the context of the compilation unit around completionPosition
+ * and feeds the collector with proposals.
* @param viewer the text viewer
* @param completionPosition the context position in the document of the text viewer
* @param compilationUnit the compilation unit (may be null
)
@@ -135,15 +227,19 @@ public class DeclarationEngine {
if (type != PHPIdentifierLocation.METHOD && type != PHPIdentifierLocation.VARIABLE) {
continue; // for loop
}
+// check all filenames of the subclasses
+ if (fFileName.equals(location.getFilename())) {
+ continue; // for loop
+ }
break;
case ITerminalSymbols.TokenNamethis_PHP_COMPLETION:
if (type != PHPIdentifierLocation.METHOD && type != PHPIdentifierLocation.VARIABLE) {
continue; // for loop
}
// check all filenames of the subclasses
-// if (!fFileName.equals(location.getFilename())) {
-// continue; // for loop
-// }
+ if (!fFileName.equals(location.getFilename())) {
+ continue; // for loop
+ }
break;
case ITerminalSymbols.TokenNamenew :
if (type != PHPIdentifierLocation.CLASS && type != PHPIdentifierLocation.CONSTRUCTOR) {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/DeclarationProposal.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/DeclarationProposal.java
index f14a31c..9723320 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/DeclarationProposal.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/DeclarationProposal.java
@@ -21,9 +21,9 @@ import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.templates.TemplateContext;
import org.eclipse.swt.graphics.Image;
-//import org.eclipse.jdt.internal.ui.text.link.LinkedPositionManager;
-//import org.eclipse.jdt.internal.ui.text.link.LinkedPositionUI;
-//import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
+//import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionManager;
+//import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionUI;
+//import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler;
/**
* A PHP identifier proposal.
@@ -201,7 +201,7 @@ public class DeclarationProposal extends AbstractProposal { //implements IPHPCom
return PHPUiImages.get(PHPUiImages.IMG_VAR);
}
return PHPUiImages.get(PHPUiImages.IMG_FUN);
- }
+ }
/*
* @see IJavaCompletionProposal#getRelevance()
@@ -216,15 +216,15 @@ public class DeclarationProposal extends AbstractProposal { //implements IPHPCom
case '\r' :
case '\n' :
case '\t' :
- return 90;
+ return 80;
case '>' : // ->
case ':' : // ::
- return 95;
+ return 85;
default :
return 0;
}
} else {
- return 90;
+ return 80;
}
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/IdentifierEngine.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/IdentifierEngine.java
index 78df545..f9f0d99 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/IdentifierEngine.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/IdentifierEngine.java
@@ -20,7 +20,7 @@ import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Region;
import org.eclipse.swt.graphics.Point;
-//import org.eclipse.jdt.internal.ui.text.link.LinkedPositionManager;
+//import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionManager;
public class IdentifierEngine {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/IdentifierProposal.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/IdentifierProposal.java
index 92d05eb..ec4eef6 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/IdentifierProposal.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/IdentifierProposal.java
@@ -16,9 +16,9 @@ import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.templates.TemplateContext;
import org.eclipse.swt.graphics.Image;
-//import org.eclipse.jdt.internal.ui.text.link.LinkedPositionManager;
-//import org.eclipse.jdt.internal.ui.text.link.LinkedPositionUI;
-//import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
+//import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionManager;
+//import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionUI;
+//import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler;
/**
* A PHP identifier proposal.
*/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/LocalVariableProposal.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/LocalVariableProposal.java
index 2e79bb8..d74f323 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/LocalVariableProposal.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/LocalVariableProposal.java
@@ -18,21 +18,28 @@ import org.eclipse.swt.graphics.Image;
public class LocalVariableProposal extends AbstractProposal {
private final String fIdentifierName;
+
private final IRegion fRegion;
- private int fRelevance;
+
+ private final int fRelevance;
/**
* Creates a template proposal with a template and its context.
+ *
* @param template
* the template
* @param image
* the icon of the proposal.
*/
public LocalVariableProposal(String identifierName, IRegion region, ITextViewer viewer) {
+ this(identifierName, region, viewer, 99);
+ }
+
+ public LocalVariableProposal(String identifierName, IRegion region, ITextViewer viewer, int relevance) {
super(viewer);
fIdentifierName = identifierName;
fRegion = region;
- fRelevance = 99;
+ fRelevance = relevance;
}
/*
@@ -84,15 +91,11 @@ public class LocalVariableProposal extends AbstractProposal {
*/
public String getAdditionalProposalInfo() {
StringBuffer hoverInfoBuffer = new StringBuffer();
- // String workspaceLocation = PHPeclipsePlugin.getWorkspace().getRoot().getLocation().toString();
-// String workspaceLocation;
-// if (fProject != null) {
-// workspaceLocation = fProject.getLocation().toString() + '/';
-// } else {
-// // should never happen?
-// workspaceLocation = PHPeclipsePlugin.getWorkspace().getRoot().getLocation().toString();
-// }
- hoverInfoBuffer.append("local variable -");
+ if (fRelevance>95) {
+ hoverInfoBuffer.append("function source variable -");
+ } else {
+ hoverInfoBuffer.append("editor source variable -");
+ }
hoverInfoBuffer.append(fIdentifierName);
return hoverInfoBuffer.toString();
}
@@ -133,10 +136,5 @@ public class LocalVariableProposal extends AbstractProposal {
public int hashCode() {
return fIdentifierName.hashCode();
}
- /**
- * @param relevance The relevance to set.
- */
- public void setRelevance(int relevance) {
- fRelevance = relevance;
- }
+
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/viewsupport/FilterUpdater.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/viewsupport/FilterUpdater.java
new file mode 100644
index 0000000..0a95480
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/viewsupport/FilterUpdater.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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.internal.ui.viewsupport;
+
+import org.eclipse.swt.widgets.Control;
+
+import org.eclipse.jface.util.Assert;
+import org.eclipse.jface.viewers.StructuredViewer;
+
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+
+
+public class FilterUpdater implements IResourceChangeListener {
+
+ private StructuredViewer fViewer;
+
+ public FilterUpdater(StructuredViewer viewer) {
+ Assert.isNotNull(viewer);
+ fViewer= viewer;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
+ */
+ public void resourceChanged(IResourceChangeEvent event) {
+ IResourceDelta delta= event.getDelta();
+ if (delta == null)
+ return;
+
+ IResourceDelta[] projDeltas = delta.getAffectedChildren(IResourceDelta.CHANGED);
+ for (int i= 0; i < projDeltas.length; i++) {
+ IResourceDelta pDelta= projDeltas[i];
+ if ((pDelta.getFlags() & IResourceDelta.DESCRIPTION) != 0) {
+ final Control ctrl= fViewer.getControl();
+ if (ctrl != null && !ctrl.isDisposed()) {
+ // async is needed due to bug 33783
+ ctrl.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (!ctrl.isDisposed())
+ fViewer.refresh(false);
+ }
+ });
+ }
+ }
+ }
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/viewsupport/JavaElementLabels.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/viewsupport/JavaElementLabels.java
index 4e71612..325d623 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/viewsupport/JavaElementLabels.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/viewsupport/JavaElementLabels.java
@@ -216,7 +216,7 @@ public class JavaElementLabels {
/**
* Post qualify referenced package fragement roots. For example
- * jdt.jar - org.eclipse.jdt.ui
if the jar is referenced
+ * jdt.jar - net.sourceforge.phpdt.ui
if the jar is referenced
* from another project.
*/
public final static int REFERENCED_ROOT_POST_QUALIFIED = 1 << 30;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/wizards/NewClassCreationWizard.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/wizards/NewClassCreationWizard.java
index 23bf845..efb355c 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/wizards/NewClassCreationWizard.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/wizards/NewClassCreationWizard.java
@@ -45,7 +45,7 @@ public class NewClassCreationWizard extends NewElementWizard {
/* (non-Javadoc)
- * @see org.eclipse.jdt.internal.ui.wizards.NewElementWizard#finishPage(org.eclipse.core.runtime.IProgressMonitor)
+ * @see net.sourceforge.phpdt.internal.ui.wizards.NewElementWizard#finishPage(org.eclipse.core.runtime.IProgressMonitor)
*/
protected void finishPage(IProgressMonitor monitor) throws InterruptedException, CoreException {
fPage.createType(monitor); // use the full progress monitor
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/IContextMenuConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/IContextMenuConstants.java
index 6bb3fd6..9b9164f 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/IContextMenuConstants.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/IContextMenuConstants.java
@@ -23,7 +23,7 @@ public interface IContextMenuConstants {
/**
* Type hierarchy view part: pop-up menu target ID for type hierarchy viewer
- * (value "org.eclipse.jdt.ui.TypeHierarchy.typehierarchy"
).
+ * (value "net.sourceforge.phpdt.ui.TypeHierarchy.typehierarchy"
).
*
* @since 2.0
*/
@@ -31,7 +31,7 @@ public interface IContextMenuConstants {
/**
* Type hierarchy view part: pop-up menu target ID for supertype hierarchy viewer
- * (value "org.eclipse.jdt.ui.TypeHierarchy.supertypes"
).
+ * (value "net.sourceforge.phpdt.ui.TypeHierarchy.supertypes"
).
*
* @since 2.0
*/
@@ -39,7 +39,7 @@ public interface IContextMenuConstants {
/**
* Type hierarchy view part: Pop-up menu target ID for the subtype hierarchy viewer
- * (value "org.eclipse.jdt.ui.TypeHierarchy.subtypes"
).
+ * (value "net.sourceforge.phpdt.ui.TypeHierarchy.subtypes"
).
*
* @since 2.0
*/
@@ -47,7 +47,7 @@ public interface IContextMenuConstants {
/**
* Type hierarchy view part: pop-up menu target ID for the meber viewer
- * (value "org.eclipse.jdt.ui.TypeHierarchy.members"
).
+ * (value "net.sourceforge.phpdt.ui.TypeHierarchy.members"
).
*
* @since 2.0
*/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/IJavaElementSearchConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/IJavaElementSearchConstants.java
new file mode 100644
index 0000000..705fe7c
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/IJavaElementSearchConstants.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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.ui;
+
+/**
+ * Search scope constants for Java selection dialogs.
+ *
+ * This interface declares constants only; it is not intended to be implemented. + *
+ * + * @see JavaUI + */ +public interface IJavaElementSearchConstants { + + /** + * Search scope constant (bit mask) indicating that classes should be considered. + * Used when opening certain kinds of selection dialogs. + */ + public static final int CONSIDER_CLASSES= 1 << 1; + + /** + * Search scope constant (bit mask) indicating that interfaces should be considered. + * Used when opening certain kinds of selection dialogs. + */ + public static final int CONSIDER_INTERFACES= 1 << 2; + + /** + * Search scope constant (bit mask) indicating that both classes and interfaces + * should be considered. Equivalent to + *CONSIDER_CLASSES | CONSIDER_INTERFACES
.
+ */
+ public static final int CONSIDER_TYPES= CONSIDER_CLASSES | CONSIDER_INTERFACES;
+
+ /**
+ * Search scope constant (bit mask) indicating that binaries should be considered.
+ * Used when opening certain kinds of selection dialogs.
+ */
+ public static final int CONSIDER_BINARIES= 1 << 3;
+
+ /**
+ * Search scope constant (bit mask) indicating that external JARs should be considered.
+ * Used when opening certain kinds of selection dialogs.
+ */
+ public static final int CONSIDER_EXTERNAL_JARS= 1 << 4;
+
+ /**
+ * Search scope constant (bit mask) indicating that required projects should be considered.
+ * Used when opening certain kinds of selection dialogs.
+ *
+ * @since 2.0
+ */
+ public static final int CONSIDER_REQUIRED_PROJECTS= 1 << 5;
+
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/IPackagesViewPart.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/IPackagesViewPart.java
new file mode 100644
index 0000000..392ea8d
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/IPackagesViewPart.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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.ui;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.IViewPart;
+
+/**
+ * The standard Packages view presents a Java-centric view of the workspace.
+ * Within Java projects, the resource hierarchy is organized into Java packages
+ * as described by the project's classpath. Note that this view shows both Java
+ * elements and ordinary resources.
+ * + * This interface is not intended to be implemented by clients. + *
+ * + * @see JavaUI#ID_PACKAGES + */ +public interface IPackagesViewPart extends IViewPart { + /** + * Selects and reveals the given element in this packages view. + * The tree will be expanded as needed to show the element. + * + * @param element the element to be revealed + */ + void selectAndReveal(Object element); + + /** + * Returns the TreeViewer shown in the Packages view. + * + * @return the tree viewer used in the Packages view + * + * @since 2.0 + */ + TreeViewer getTreeViewer(); +} diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/IWorkingCopyProvider.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/IWorkingCopyProvider.java index 7d588ff..585cfc9 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/IWorkingCopyProvider.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/IWorkingCopyProvider.java @@ -19,8 +19,8 @@ package net.sourceforge.phpdt.ui; * This interface is not intended to be implemented by clients. * * - * @see org.eclipse.jdt.ui.StandardJavaElementContentProvider - * @see org.eclipse.jdt.core.IWorkingCopy + * @see net.sourceforge.phpdt.ui.StandardJavaElementContentProvider + * @see net.sourceforge.phpdt.core.IWorkingCopy * * @since 2.0 */ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/JavaUI.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/JavaUI.java index 6236042..db03eaa 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/JavaUI.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/JavaUI.java @@ -25,7 +25,7 @@ import org.eclipse.ui.internal.SharedImages; import org.eclipse.ui.texteditor.IDocumentProvider; /** - * Central access point for the Java UI plug-in (id"org.eclipse.jdt.ui"
).
+ * Central access point for the Java UI plug-in (id "net.sourceforge.phpdt.ui"
).
* This class provides static methods for:
* "org.eclipse.jdt.ui"
).
+ * The id of the Java plugin (value "net.sourceforge.phpdt.ui"
).
*/
-// public static final String ID_PLUGIN= "org.eclipse.jdt.ui"; //$NON-NLS-1$
+// public static final String ID_PLUGIN= "net.sourceforge.phpdt.ui"; //$NON-NLS-1$
/**
* The id of the Java perspective
- * (value "org.eclipse.jdt.ui.JavaPerspective"
).
+ * (value "net.sourceforge.phpdt.ui.JavaPerspective"
).
*/
- // public static final String ID_PERSPECTIVE= "org.eclipse.jdt.ui.JavaPerspective"; //$NON-NLS-1$
+ // public static final String ID_PERSPECTIVE= "net.sourceforge.phpdt.ui.JavaPerspective"; //$NON-NLS-1$
/**
* The id of the Java hierarchy perspective
- * (value "org.eclipse.jdt.ui.JavaHierarchyPerspective"
).
+ * (value "net.sourceforge.phpdt.ui.JavaHierarchyPerspective"
).
*/
-// public static final String ID_HIERARCHYPERSPECTIVE= "org.eclipse.jdt.ui.JavaHierarchyPerspective"; //$NON-NLS-1$
+// public static final String ID_HIERARCHYPERSPECTIVE= "net.sourceforge.phpdt.ui.JavaHierarchyPerspective"; //$NON-NLS-1$
/**
* The id of the Java action set
- * (value "org.eclipse.jdt.ui.JavaActionSet"
).
+ * (value "net.sourceforge.phpdt.ui.JavaActionSet"
).
*/
-// public static final String ID_ACTION_SET= "org.eclipse.jdt.ui.JavaActionSet"; //$NON-NLS-1$
+// public static final String ID_ACTION_SET= "net.sourceforge.phpdt.ui.JavaActionSet"; //$NON-NLS-1$
/**
* The id of the Java Element Creation action set
- * (value "org.eclipse.jdt.ui.JavaElementCreationActionSet"
).
+ * (value "net.sourceforge.phpdt.ui.JavaElementCreationActionSet"
).
*
* @since 2.0
*/
-// public static final String ID_ELEMENT_CREATION_ACTION_SET= "org.eclipse.jdt.ui.JavaElementCreationActionSet"; //$NON-NLS-1$
+// public static final String ID_ELEMENT_CREATION_ACTION_SET= "net.sourceforge.phpdt.ui.JavaElementCreationActionSet"; //$NON-NLS-1$
/**
* The id of the Java Coding action set
- * (value "org.eclipse.jdt.ui.CodingActionSet"
).
+ * (value "net.sourceforge.phpdt.ui.CodingActionSet"
).
*
* @since 2.0
*/
-// public static final String ID_CODING_ACTION_SET= "org.eclipse.jdt.ui.CodingActionSet"; //$NON-NLS-1$
+// public static final String ID_CODING_ACTION_SET= "net.sourceforge.phpdt.ui.CodingActionSet"; //$NON-NLS-1$
/**
* The id of the Java action set for open actions
- * (value "org.eclipse.jdt.ui.A_OpenActionSet"
).
+ * (value "net.sourceforge.phpdt.ui.A_OpenActionSet"
).
*
* @since 2.0
*/
-// public static final String ID_OPEN_ACTION_SET= "org.eclipse.jdt.ui.A_OpenActionSet"; //$NON-NLS-1$
+// public static final String ID_OPEN_ACTION_SET= "net.sourceforge.phpdt.ui.A_OpenActionSet"; //$NON-NLS-1$
/**
* The id of the Java Search action set
- * (value org.eclipse.jdt.ui.SearchActionSet"
).
+ * (value net.sourceforge.phpdt.ui.SearchActionSet"
).
*
* @since 2.0
*/
-// public static final String ID_SEARCH_ACTION_SET= "org.eclipse.jdt.ui.SearchActionSet"; //$NON-NLS-1$
+// public static final String ID_SEARCH_ACTION_SET= "net.sourceforge.phpdt.ui.SearchActionSet"; //$NON-NLS-1$
/**
* The editor part id of the editor that presents Java compilation units
- * (value "org.eclipse.jdt.ui.CompilationUnitEditor"
).
+ * (value "net.sourceforge.phpdt.ui.CompilationUnitEditor"
).
*/
// public static final String ID_CU_EDITOR= "net.sourceforge.phpdt.ui.PHPUnitEditor"; //$NON-NLS-1$
/**
* The editor part id of the editor that presents Java binary class files
- * (value "org.eclipse.jdt.ui.ClassFileEditor"
).
+ * (value "net.sourceforge.phpdt.ui.ClassFileEditor"
).
*/
-// public static final String ID_CF_EDITOR= "org.eclipse.jdt.ui.ClassFileEditor"; //$NON-NLS-1$
+// public static final String ID_CF_EDITOR= "net.sourceforge.phpdt.ui.ClassFileEditor"; //$NON-NLS-1$
/**
* The editor part id of the code snippet editor
- * (value "org.eclipse.jdt.ui.SnippetEditor"
).
+ * (value "net.sourceforge.phpdt.ui.SnippetEditor"
).
*/
-// public static final String ID_SNIPPET_EDITOR= "org.eclipse.jdt.ui.SnippetEditor"; //$NON-NLS-1$
+// public static final String ID_SNIPPET_EDITOR= "net.sourceforge.phpdt.ui.SnippetEditor"; //$NON-NLS-1$
/**
* The view part id of the Packages view
- * (value "org.eclipse.jdt.ui.PackageExplorer"
).
+ * (value "net.sourceforge.phpdt.ui.PackageExplorer"
).
*
* When this id is used to access
* a view part with IWorkbenchPage.findView
or
@@ -136,7 +136,7 @@ public final class JavaUI {
/**
* The view part id of the type hierarchy part.
- * (value "org.eclipse.jdt.ui.TypeHierarchy"
).
+ * (value "net.sourceforge.phpdt.ui.TypeHierarchy"
).
*
* When this id is used to access
* a view part with IWorkbenchPage.findView
or
@@ -152,43 +152,43 @@ public final class JavaUI {
/**
* The id of the Java Browsing Perspective
- * (value "org.eclipse.jdt.ui.JavaBrowsingPerspective"
).
+ * (value "net.sourceforge.phpdt.ui.JavaBrowsingPerspective"
).
*
* @since 2.0
*/
-// public static String ID_BROWSING_PERSPECTIVE= "org.eclipse.jdt.ui.JavaBrowsingPerspective"; //$NON-NLS-1$
+// public static String ID_BROWSING_PERSPECTIVE= "net.sourceforge.phpdt.ui.JavaBrowsingPerspective"; //$NON-NLS-1$
/**
* The view part id of the Java Browsing Projects view
- * (value "org.eclipse.jdt.ui.ProjectsView"
).
+ * (value "net.sourceforge.phpdt.ui.ProjectsView"
).
*
* @since 2.0
*/
-// public static String ID_PROJECTS_VIEW= "org.eclipse.jdt.ui.ProjectsView"; //$NON-NLS-1$
+// public static String ID_PROJECTS_VIEW= "net.sourceforge.phpdt.ui.ProjectsView"; //$NON-NLS-1$
/**
* The view part id of the Java Browsing Packages view
- * (value "org.eclipse.jdt.ui.PackagesView"
).
+ * (value "net.sourceforge.phpdt.ui.PackagesView"
).
*
* @since 2.0
*/
-// public static String ID_PACKAGES_VIEW= "org.eclipse.jdt.ui.PackagesView"; //$NON-NLS-1$
+// public static String ID_PACKAGES_VIEW= "net.sourceforge.phpdt.ui.PackagesView"; //$NON-NLS-1$
/**
* The view part id of the Java Browsing Types view
- * (value "org.eclipse.jdt.ui.TypesView"
).
+ * (value "net.sourceforge.phpdt.ui.TypesView"
).
*
* @since 2.0
*/
-// public static String ID_TYPES_VIEW= "org.eclipse.jdt.ui.TypesView"; //$NON-NLS-1$
+// public static String ID_TYPES_VIEW= "net.sourceforge.phpdt.ui.TypesView"; //$NON-NLS-1$
/**
* The view part id of the Java Browsing Members view
- * (value "org.eclipse.jdt.ui.MembersView"
).
+ * (value "net.sourceforge.phpdt.ui.MembersView"
).
*
* @since 2.0
*/
-// public static String ID_MEMBERS_VIEW= "org.eclipse.jdt.ui.MembersView"; //$NON-NLS-1$
+// public static String ID_MEMBERS_VIEW= "net.sourceforge.phpdt.ui.MembersView"; //$NON-NLS-1$
/**
* The class org.eclipse.debug.core.model.IProcess allows attaching
@@ -199,7 +199,7 @@ public final class JavaUI {
* was launched with.
* @deprecated
*/
-// public final static String ATTR_CMDLINE= "org.eclipse.jdt.ui.launcher.cmdLine"; //$NON-NLS-1$
+// public final static String ATTR_CMDLINE= "net.sourceforge.phpdt.ui.launcher.cmdLine"; //$NON-NLS-1$
/**
* Returns the shared images for the Java UI.
@@ -551,7 +551,7 @@ public final class JavaUI {
*
* @return the list of shared working copies
*
- * @see org.eclipse.jdt.core.JavaCore#getSharedWorkingCopies(org.eclipse.jdt.core.IBufferFactory)
+ * @see net.sourceforge.phpdt.core.JavaCore#getSharedWorkingCopies(net.sourceforge.phpdt.core.IBufferFactory)
* @since 2.0
*/
public static IWorkingCopy[] getSharedWorkingCopies() {
@@ -588,9 +588,9 @@ public final class JavaUI {
*
* @return the BufferFactory for the Java UI plug-in
*
- * @see org.eclipse.jdt.core.IBufferFactory
+ * @see net.sourceforge.phpdt.core.IBufferFactory
* @since 2.0
- * @deprecated {@link IBufferFactory} has been replaced by {@link org.eclipse.jdt.core.WorkingCopyOwner}.
+ * @deprecated {@link IBufferFactory} has been replaced by {@link net.sourceforge.phpdt.core.WorkingCopyOwner}.
* The Java UI plug-in uses the primary working copy owner that can be accessed with null
in
* API's that require an owner
*/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/PreferenceConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/PreferenceConstants.java
index 8a27f28..15796fe 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/PreferenceConstants.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/PreferenceConstants.java
@@ -58,7 +58,7 @@ public class PreferenceConstants {
/**
* A named preference that defines the pattern used for package name compression.
*
- * Value is of type String
. For example foe the given package name 'org.eclipse.jdt' pattern '.' will compress it
+ * Value is of type String
. For example foe the given package name 'net.sourceforge.phpdt' pattern '.' will compress it
* to '..jdt', '1~' to 'o~.e~.jdt'.
*
+ * Value is of type Boolean
.
+ *
+ * Value is of type Boolean
.
+ *
+ * Value is of type String
.
+ *
@@ -1032,7 +1062,7 @@ public class PreferenceConstants {
public final static String EDITOR_MULTI_LINE_COMMENT_COLOR = IPreferenceConstants.PHP_MULTILINE_COMMENT;
/**
- * The symbolic font name for the Java editor text font (value "org.eclipse.jdt.ui.editors.textfont"
).
+ * The symbolic font name for the Java editor text font (value "net.sourceforge.phpdt.ui.editors.textfont"
).
*
* @since 2.1
*/
@@ -2270,6 +2300,10 @@ public class PreferenceConstants {
store.setDefault(PreferenceConstants.CODEGEN_USE_GETTERSETTER_SUFFIX, false);
store.setDefault(PreferenceConstants.CODEGEN_GETTERSETTER_PREFIX, "fg, f, _$, _, m_"); //$NON-NLS-1$
store.setDefault(PreferenceConstants.CODEGEN_GETTERSETTER_SUFFIX, "_"); //$NON-NLS-1$
+
+ store.setDefault(PreferenceConstants.CODEGEN_KEYWORD_THIS, false);
+ store.setDefault(PreferenceConstants.CODEGEN_IS_FOR_GETTERS, true);
+ store.setDefault(PreferenceConstants.CODEGEN_EXCEPTION_VAR_NAME, "e"); //$NON-NLS-1$
store.setDefault(PreferenceConstants.CODEGEN_ADD_COMMENTS, true);
store.setDefault(PreferenceConstants.CODEGEN__NON_JAVADOC_COMMENTS, false);
store.setDefault(PreferenceConstants.CODEGEN__FILE_COMMENTS, false);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/StandardJavaElementContentProvider.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/StandardJavaElementContentProvider.java
index 7f1d21b..1495209 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/StandardJavaElementContentProvider.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/StandardJavaElementContentProvider.java
@@ -64,8 +64,8 @@ Java model (IJavaModel
)
* compilation units in the Java element hierarchy for which a shared working copy exists
* in JDT core.
*
- * @see org.eclipse.jdt.ui.IWorkingCopyProvider
- * @see JavaCore#getSharedWorkingCopies(org.eclipse.jdt.core.IBufferFactory)
+ * @see net.sourceforge.phpdt.ui.IWorkingCopyProvider
+ * @see JavaCore#getSharedWorkingCopies(net.sourceforge.phpdt.core.IBufferFactory)
*
* @since 2.0
*/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/CustomFiltersActionGroup.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/CustomFiltersActionGroup.java
index 2ca32ae..226f4f1 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/CustomFiltersActionGroup.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/CustomFiltersActionGroup.java
@@ -423,7 +423,7 @@ public class CustomFiltersActionGroup extends ActionGroup {
String id= filterDescs[i].getId();
Boolean isEnabled= new Boolean(filterDescs[i].isEnabled());
if (fEnabledFilterIds.containsKey(id))
- PHPeclipsePlugin.logErrorMessage("WARNING: Duplicate id for extension-point \"org.eclipse.jdt.ui.javaElementFilters\""); //$NON-NLS-1$
+ PHPeclipsePlugin.logErrorMessage("WARNING: Duplicate id for extension-point \"net.sourceforge.phpdt.ui.javaElementFilters\""); //$NON-NLS-1$
fEnabledFilterIds.put(id, isEnabled);
fFilterDescriptorMap.put(id, filterDescs[i]);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/GenerateActionGroup.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/GenerateActionGroup.java
index 40aa451..58bf8da 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/GenerateActionGroup.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/GenerateActionGroup.java
@@ -50,7 +50,7 @@ import org.eclipse.ui.texteditor.IUpdate;
*/
public class GenerateActionGroup extends ActionGroup {
/**
- * Pop-up menu: id of the source sub menu (value org.eclipse.jdt.ui.source.menu
).
+ * Pop-up menu: id of the source sub menu (value net.sourceforge.phpdt.ui.source.menu
).
*
* @since 3.0
*/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/PHPEditorActionDefinitionIds.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/PHPEditorActionDefinitionIds.java
index 324b300..e0065b7 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/PHPEditorActionDefinitionIds.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/PHPEditorActionDefinitionIds.java
@@ -20,19 +20,19 @@ public interface PHPEditorActionDefinitionIds {
public static final String OPEN_EDITOR = "net.sourceforge.phpeclipse.ui.edit.text.java.open.editor"; //$NON-NLS-1$
/**
* Action definition ID of the toggle presentation toolbar button action
- * (value "org.eclipse.jdt.ui.edit.text.java.toggle.presentation"
).
+ * (value "net.sourceforge.phpdt.ui.edit.text.java.toggle.presentation"
).
*/
public static final String TOGGLE_PRESENTATION = "net.sourceforge.phpeclipse.ui.edit.text.java.toggle.presentation"; //$NON-NLS-1$
/**
* Action definition ID of the toggle text hover toolbar button action
- * (value "org.eclipse.jdt.ui.edit.text.java.toggle.text.hover"
).
+ * (value "net.sourceforge.phpdt.ui.edit.text.java.toggle.text.hover"
).
*/
public static final String TOGGLE_TEXT_HOVER = "net.sourceforge.phpeclipse.ui.edit.text.java.toggle.text.hover"; //$NON-NLS-1$
/**
* Action definition ID of the edit -> show Javadoc action
- * (value "org.eclipse.jdt.ui.edit.text.java.show.javadoc"
).
+ * (value "net.sourceforge.phpdt.ui.edit.text.java.show.javadoc"
).
*/
public static final String SHOW_JAVADOC = "net.sourceforge.phpeclipse.ui.edit.text.java.show.javadoc"; //$NON-NLS-1$
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/PHPdtActionConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/PHPdtActionConstants.java
index b9fc4d7..1f6fc5f 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/PHPdtActionConstants.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/PHPdtActionConstants.java
@@ -25,7 +25,7 @@ public class PHPdtActionConstants {
// Edit menu
/**
* Edit menu: name of standard Show Javadoc global action
- * (value "org.eclipse.jdt.ui.actions.ShowJavaDoc"
).
+ * (value "net.sourceforge.phpdt.ui.actions.ShowJavaDoc"
).
*/
public static final String SHOW_JAVA_DOC= "net.sourceforge.phpeclipse.phpeditor.ShowJavaDoc"; //$NON-NLS-1$
@@ -51,14 +51,14 @@ public class PHPdtActionConstants {
/**
* Source menu: name of standard ToggleComment global action
- * (value "org.eclipse.jdt.ui.actions.ToggleComment"
).
+ * (value "net.sourceforge.phpdt.ui.actions.ToggleComment"
).
* @since 3.0
*/
public static final String TOGGLE_COMMENT= "net.sourceforge.phpeclipse.ui.actions.ToggleComment"; //$NON-NLS-1$
/**
* Source menu: name of standard Comment global action
- * (value "org.eclipse.jdt.ui.actions.AddBlockComment"
).
+ * (value "net.sourceforge.phpdt.ui.actions.AddBlockComment"
).
*
* @since 3.0
*/
@@ -66,7 +66,7 @@ public class PHPdtActionConstants {
/**
* Source menu: name of standard Uncomment global action
- * (value "org.eclipse.jdt.ui.actions.RemoveBlockComment"
).
+ * (value "net.sourceforge.phpdt.ui.actions.RemoveBlockComment"
).
*
* @since 3.0
*/
@@ -74,7 +74,7 @@ public class PHPdtActionConstants {
/**
* Source menu: name of standard Indent global action
- * (value "org.eclipse.jdt.ui.actions.Indent"
).
+ * (value "net.sourceforge.phpdt.ui.actions.Indent"
).
*
* @since 3.0
*/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java
index fb386ab..e4710b0 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java
@@ -159,7 +159,7 @@ public class JavaTextTools implements IPHPPartitions {
* @param coreStore
* optional preference store to initialize the text tools. The text tool instance installs a listener on the passed
* preference store to adapt itself to changes in the preference store.
- * @see org.eclipse.jdt.ui.PreferenceConstants#getPreferenceStore()
+ * @see net.sourceforge.phpdt.ui.PreferenceConstants#getPreferenceStore()
* @since 2.1
*/
public JavaTextTools(IPreferenceStore store, Preferences coreStore) {
@@ -180,7 +180,7 @@ public class JavaTextTools implements IPHPPartitions {
* @param autoDisposeOnDisplayDispose
* if true
the color manager automatically disposes all managed colors when the current display gets
* disposed and all calls to {@link org.eclipse.jface.text.source.ISharedTextColors#dispose()}are ignored.
- * @see org.eclipse.jdt.ui.PreferenceConstants#getPreferenceStore()
+ * @see net.sourceforge.phpdt.ui.PreferenceConstants#getPreferenceStore()
* @since 2.1
*/
public JavaTextTools(IPreferenceStore store, Preferences coreStore, boolean autoDisposeOnDisplayDispose) {
@@ -479,7 +479,7 @@ public class JavaTextTools implements IPHPPartitions {
* @return true
if event causes a behavioral change
* @since 2.0
* @deprecated As of 3.0, replaced by
- * {@link org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration#affectsTextPresentation(PropertyChangeEvent)}
+ * {@link net.sourceforge.phpdt.ui.text.JavaSourceViewerConfiguration#affectsTextPresentation(PropertyChangeEvent)}
*/
// public boolean affectsBehavior(PropertyChangeEvent event) {
// return fCodeScanner.affectsBehavior(event)
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/PHPSourceViewerConfiguration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/PHPSourceViewerConfiguration.java
index 7708050..cfd2d31 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/PHPSourceViewerConfiguration.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/PHPSourceViewerConfiguration.java
@@ -503,16 +503,6 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
return null;
}
- // public IReconciler getReconciler(ISourceViewer sourceViewer) {
- // if (getEditor() != null && getEditor().isEditable()) {
- // JavaReconciler reconciler = new JavaReconciler(getEditor(),
- // new JavaReconcilingStrategy(getEditor()), false);
- // reconciler.setProgressMonitor(new NullProgressMonitor());
- // reconciler.setDelay(500);
- // return reconciler;
- // }
- // return null;
- // }
/*
* @see SourceViewerConfiguration#getConfiguredTextHoverStateMasks(ISourceViewer, String)
* @since 2.1
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/folding/package.html b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/folding/package.html
index 99d71c2..3148d97 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/folding/package.html
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/folding/package.html
@@ -11,6 +11,6 @@ Application programming interfaces for interaction
with the Eclipse Java Editor folding.
org.eclipse.jdt.ui.foldingStructureProviders
extension point.
+Interfaces for contributions to the net.sourceforge.phpdt.ui.foldingStructureProviders
extension point.