From: axelcl
Date: Sun, 6 Mar 2005 20:56:55 +0000 (+0000)
Subject: improved PHP parser
X-Git-Url: http://git.phpeclipse.com
improved PHP parser
---
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ClasspathVariableInitializer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ClasspathVariableInitializer.java
index ab9b778..54792db 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ClasspathVariableInitializer.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ClasspathVariableInitializer.java
@@ -14,7 +14,7 @@ package net.sourceforge.phpdt.core;
/**
* Abstract base implementation of all classpath variable initializers.
* Classpath variable initializers are used in conjunction with the
- * "org.eclipse.jdt.core.classpathVariableInitializer" extension point.
+ * "net.sourceforge.phpdt.core.classpathVariableInitializer" extension point.
*
* Clients should subclass this class to implement a specific classpath
* variable initializer. The subclass must have a public 0-argument
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Flags.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Flags.java
index a9ccaae..9182b7f 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Flags.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Flags.java
@@ -24,7 +24,7 @@ import net.sourceforge.phpdt.internal.compiler.env.IConstants;
* Note that the numeric values of these flags match the ones for class files
* as described in the Java Virtual Machine Specification. The AST class
* Modifier provides the same functionality as this class, only in
- * the org.eclipse.jdt.core.dom package.
+ * the net.sourceforge.phpdt.core.dom package.
*
*
* @see IMember#getFlags
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IClasspathEntry.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IClasspathEntry.java
index 83de070..8d6e929 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IClasspathEntry.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IClasspathEntry.java
@@ -65,7 +65,7 @@ import org.eclipse.core.runtime.IPath;
* and gets resolved, to either a project or library entry, using
* JavaCore#getResolvedClasspathVariable.
* It is also possible to register an automatic initializer (ClasspathVariableInitializer),
- * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer".
+ * which will be invoked through the extension point "net.sourceforge.phpdt.core.classpathVariableInitializer".
* After resolution, a classpath variable entry may either correspond to a project or a library entry.
*
*
A named classpath container identified by its container path.
@@ -79,7 +79,7 @@ import org.eclipse.core.runtime.IPath;
* which can be used as additional hints for resolving this container reference. If no container was ever
* recorded for this container path onto this project (using setClasspathContainer,
* then a ClasspathContainerInitializer will be activated if any was registered for this
- * container ID onto the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
+ * container ID onto the extension point "net.sourceforge.phpdt.core.classpathContainerInitializer".
* A classpath container entry can be resolved explicitly using JavaCore#getClasspathContainer
* and the resulting container entries can contain any non-container entry. In particular, it may contain variable
* entries, which in turn needs to be resolved before being directly used.
@@ -257,6 +257,55 @@ public interface IClasspathEntry {
* @since 2.1
*/
IPath[] getExclusionPatterns();
+ /**
+ * Returns the set of patterns used to explicitly define resources to be
+ * included with this source entry.
+ *
+ * When no inclusion patterns are specified, the source entry includes all
+ * relevent files in the resource tree rooted at this source entry's path.
+ * Specifying one or more inclusion patterns means that only the specified
+ * portions of the resource tree are to be included. Each path specified
+ * must be a relative path, and will be interpreted relative to this source
+ * entry's path. File patterns are case-sensitive. A file matched by one or
+ * more of these patterns is included in the corresponding package fragment
+ * root unless it is excluded by one or more of this entrie's exclusion
+ * patterns. Exclusion patterns have higher precedence than inclusion
+ * patterns; in other words, exclusion patterns can remove files for the
+ * ones that are to be included, not the other way around.
+ *
+ *
+ * See {@link #getExclusionPatterns()} for a discussion of the syntax and
+ * semantics of path patterns. The absence of any inclusion patterns is
+ * semantically equivalent to the explicit inclusion pattern
+ * **.
+ *
+ *
+ * Examples:
+ *
+ *
+ * The inclusion pattern src/** by itself includes all
+ * files under a root folder named src.
+ *
+ *
+ * The inclusion patterns src/** and
+ * tests/** includes all files under the root folders
+ * named src and tests.
+ *
+ *
+ * The inclusion pattern src/** together with the
+ * exclusion pattern src/**/Foo.java includes all
+ * files under a root folder named src except for ones
+ * named Foo.java.
+ *
+ *
+ *
+ *
+ * @return the possibly empty list of resource inclusion patterns
+ * associated with this source entry, and null for other
+ * kinds of classpath entries
+ * @since 3.0
+ */
+ IPath[] getInclusionPatterns();
/**
* Returns the full path to the specific location where the builder writes
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompilationUnit.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompilationUnit.java
index c25a7cc..dd57c8f 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompilationUnit.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompilationUnit.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package net.sourceforge.phpdt.core;
+import java.util.HashMap;
+
import net.sourceforge.phpdt.internal.core.ImportContainer;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -234,7 +236,18 @@ IJavaElement getElementAt(int position) throws JavaModelException;
* or "java.awt.*")
* @return a handle onto the corresponding import declaration. The import declaration may or may not exist.
*/
-//IImportDeclaration getImport(String name) ;
+IImportDeclaration getImport(String name) ;
+/**
+ * Returns the import declarations in this compilation unit
+ * in the order in which they appear in the source. This is
+ * a convenience method - import declarations can also be
+ * accessed from a compilation unit's import container.
+ *
+ * @return the import declarations in this compilation unit
+ * @throws JavaModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource
+ */
+IImportDeclaration[] getImports() throws JavaModelException;
/**
* Returns the import container for this compilation unit.
* This is a handle-only method. The import container may or
@@ -243,7 +256,7 @@ IJavaElement getElementAt(int position) throws JavaModelException;
* @return a handle onto the corresponding import container. The
* import contain may or may not exist.
*/
-ImportContainer getImportContainer();
+IImportContainer getImportContainer();
/**
* Returns the import declarations in this compilation unit
* in the order in which they appear in the source. This is
@@ -272,7 +285,7 @@ IPackageDeclaration getPackageDeclaration(String name);
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource
*/
-//IPackageDeclaration[] getPackageDeclarations() throws JavaModelException;
+IPackageDeclaration[] getPackageDeclarations() throws JavaModelException;
/**
* Returns the primary compilation unit (whose owner is the primary owner)
* this working copy was created from, or this compilation unit if this a primary
@@ -295,7 +308,7 @@ ICompilationUnit getPrimary();
* @return a handle onto the corresponding type. The type may or may not exist.
* @see JavaConventions#validateCompilationUnitName(String name)
*/
-IType getType(String name);
+IType getType(String name);
/**
* Returns the top-level types declared in this compilation unit
* in the order in which they appear in the source.
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IImportDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IImportDeclaration.java
index c8587e9..812bc64 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IImportDeclaration.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IImportDeclaration.java
@@ -11,6 +11,7 @@
*******************************************************************************/
package net.sourceforge.phpdt.core;
+
/**
* Represents an import declaration in Java compilation unit.
*
@@ -47,4 +48,5 @@ int getFlags() throws JavaModelException;
* @return true if the import is on-demand, false otherwise
*/
boolean isOnDemand();
+
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElement.java
index 07f17f3..cea7b63 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElement.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElement.java
@@ -112,6 +112,12 @@ public interface IJavaElement extends IAdaptable {
int IMPORT_DECLARATION = 13;
/**
+ * Constant representing a local variable declaration.
+ * A Java element with this type can be safely cast to ILocalVariable.
+ * @since 3.0
+ */
+ int LOCAL_VARIABLE = 14;
+ /**
* Returns whether this Java element exists in the model.
*
* Java elements are handle objects that may or may not be backed by an
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElementDelta.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElementDelta.java
index 9fe7eb5..61f2ce9 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElementDelta.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElementDelta.java
@@ -245,6 +245,22 @@ public interface IJavaElementDelta {
* @since 3.0
*/
public int F_PRIMARY_WORKING_COPY = 0x10000;
+
+ /**
+ * Change flag indicating that the raw classpath (or the output folder) of a project has changed.
+ * This flag is only valid if the element is an IJavaProject.
+ *
+ * @since 3.0
+ */
+ public int F_CLASSPATH_CHANGED = 0x20000;
+
+ /**
+ * Change flag indicating that the resource of a primary compilation unit has changed.
+ * This flag is only valid if the element is a primary ICompilationUnit.
+ *
+ * @since 3.0
+ */
+ public int F_PRIMARY_RESOURCE = 0x40000;
/**
* Returns deltas for the children that have been added.
* @return deltas for the children that have been added
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelMarker.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelMarker.java
index e31c253..9c5dd12 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelMarker.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelMarker.java
@@ -21,7 +21,7 @@ package net.sourceforge.phpdt.core;
public interface IJavaModelMarker {
/**
- * Java model problem marker type (value "org.eclipse.jdt.core.problem").
+ * Java model problem marker type (value "net.sourceforge.phpdt.core.problem").
* This can be used to recognize those markers in the workspace that flag problems
* detected by the Java tooling during compilation.
*/
@@ -29,7 +29,7 @@ public interface IJavaModelMarker {
/**
- * Java model transient problem marker type (value "org.eclipse.jdt.core.transient_problem").
+ * Java model transient problem marker type (value "net.sourceforge.phpdt.core.transient_problem").
* This can be used to recognize those markers in the workspace that flag transient
* problems detected by the Java tooling (such as a problem
* detected by the outliner, or a problem detected during a code completion)
@@ -37,11 +37,11 @@ public interface IJavaModelMarker {
public static final String TRANSIENT_PROBLEM = JavaCore.PLUGIN_ID + ".transient_problem"; //$NON-NLS-1$
/**
- * Java model task marker type (value "org.eclipse.jdt.core.task").
+ * Java model task marker type (value "net.sourceforge.phpdt.core.task").
* This can be used to recognize task markers in the workspace that correspond to tasks
* specified in Java source comments and detected during compilation (for example, 'TO-DO: ...').
* Tasks are identified by a task tag, which can be customized through PHPCore
- * option "org.eclipse.jdt.core.compiler.taskTag".
+ * option "net.sourceforge.phpdt.core.compiler.taskTag".
* @since 2.1
*/
public static final String TASK_MARKER = JavaCore.PLUGIN_ID + ".task"; //$NON-NLS-1$
@@ -76,7 +76,7 @@ public interface IJavaModelMarker {
public static final String CYCLE_DETECTED = "cycleDetected"; //$NON-NLS-1$
/**
- * Build path problem marker type (value "org.eclipse.jdt.core.buildpath_problem").
+ * Build path problem marker type (value "net.sourceforge.phpdt.core.buildpath_problem").
* This can be used to recognize those markers in the workspace that flag problems
* detected by the Java tooling during classpath setting.
*/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatus.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatus.java
index 98c8565..6f55b0c 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatus.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatus.java
@@ -19,7 +19,7 @@ import org.eclipse.core.runtime.IStatus;
* wrong.
*
* Java model status object are distinguished by their plug-in id:
- * getPlugin returns "org.eclipse.jdt.core".
+ * getPlugin returns "net.sourceforge.phpdt.core".
* getCode returns one of the status codes declared in
* IJavaModelStatusConstants.
*
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatusConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatusConstants.java
index b089522..f31517d 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatusConstants.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatusConstants.java
@@ -267,7 +267,7 @@ public interface IJavaModelStatusConstants {
* Status constant indicating that an exclusion pattern got specified
* on a classpath source entry, though it was explicitely disabled
* according to its project preference settings.
- * @see org.eclipse.jdt.core.IJavaProject#getOptions(boolean)
+ * @see net.sourceforge.phpdt.core.IJavaProject#getOptions(boolean)
* @since 2.1
*/
public static final int DISABLED_CP_EXCLUSION_PATTERNS = 1002;
@@ -276,7 +276,7 @@ public interface IJavaModelStatusConstants {
* Status constant indicating that a specific output location got associated
* with a source entry, though it was explicitely disabled according to its project
* preference settings.
- * @see org.eclipse.jdt.core.IJavaProject#getOptions(boolean)
+ * @see net.sourceforge.phpdt.core.IJavaProject#getOptions(boolean)
* @since 2.1
*/
public static final int DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS = 1003;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ILocalVariable.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ILocalVariable.java
new file mode 100644
index 0000000..1c9f549
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ILocalVariable.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.core;
+
+/**
+ * Represents a local variable declared in a method or an initializer.
+ * ILocalVariable are pseudo-elements created as the result of a ICodeAssist.codeSelect(...)
+ * operation. They are not part of the Java model (exists() returns whether the parent exists rather than
+ * whether the local variable exists in the parent) and they are not included in the children of an IMethod
+ * or an IInitializer.
+ *
+ * In particular such a pseudo-element should not be used as a handle. For example its name range won't be updated
+ * if the underlying source changes.
+ *
+ * This interface is not intended to be implemented by clients.
+ *
+ * @since 3.0
+ */
+public interface ILocalVariable extends IJavaElement, ISourceReference {
+
+ /**
+ * Returns the name of this local variable.
+ *
+ * @return the name of this local variable.
+ */
+ String getElementName();
+
+ /**
+ * Returns the source range of this local variable's name.
+ *
+ * @return the source range of this local variable's name
+ */
+ ISourceRange getNameRange();
+
+ /**
+ * Returns the type signature of this local variable.
+ *
+ * The type signature may be either unresolved (for source types)
+ * or resolved (for binary types), and either basic (for basic types)
+ * or rich (for parameterized types). See {@link Signature} for details.
+ *
+ *
+ * @return the type signature of this local variable.
+ * @see Signature
+ */
+ String getTypeSignature();
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IMember.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IMember.java
index 68446bd..8365ab6 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IMember.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IMember.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package net.sourceforge.phpdt.core;
+import net.sourceforge.phpdt.core.IType;
+
/**
* Common protocol for Java elements that can be members of types.
* This set consists of IType, IMethod,
@@ -18,7 +20,7 @@ package net.sourceforge.phpdt.core;
* This interface is not intended to be implemented by clients.
*
*/
-public interface IMember extends IJavaElement , ISourceReference, ISourceManipulation {
+public interface IMember extends IJavaElement , ISourceReference, ISourceManipulation, IParent {
/**
* Returns the class file in which this member is declared, or null
* if this member is not declared in a class file (for example, a source type).
@@ -75,6 +77,20 @@ int getFlags() throws JavaModelException;
*/
ISourceRange getNameRange() throws JavaModelException;
/**
+ * Returns the local or anonymous type declared in this source member with the given simple name and/or
+ * with the specified position relative to the order they are defined in the source.
+ * The name is empty if it is an anonymous type.
+ * Numbering starts at 1 (thus the first occurrence is occurrence 1, not occurrence 0).
+ * This is a handle-only method. The type may or may not exist.
+ * Throws a RuntimeException if this member is not a source member.
+ *
+ * @param name the given simple name
+ * @param occurrenceCount the specified position
+ * @return the type with the given name and/or with the specified position relative to the order they are defined in the source
+ * @since 3.0
+ */
+IType getType(String name, int occurrenceCount);
+/**
* Returns whether this member is from a class file.
* This is a handle-only method.
*
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageFragment.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageFragment.java
index 2d832d5..117ee26 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageFragment.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageFragment.java
@@ -133,7 +133,7 @@ public interface IPackageFragment extends IParent, IJavaElement, IOpenable {
* exception occurs while accessing its corresponding resource.
* @return this package fragment's root kind encoded as an integer
*/
-// int getKind() throws JavaModelException;
+ int getKind() throws JavaModelException;
/**
* Returns an array of non-Java resources contained in this package fragment.
*
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IType.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IType.java
index 5feecce..264c13c 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IType.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IType.java
@@ -10,6 +10,11 @@
*******************************************************************************/
package net.sourceforge.phpdt.core;
+import org.eclipse.core.runtime.IProgressMonitor;
+import net.sourceforge.phpdt.core.ITypeHierarchy;
+import net.sourceforge.phpdt.core.JavaModelException;
+import net.sourceforge.phpdt.core.WorkingCopyOwner;
+
/**
* Represents either a source type in a compilation unit (either a top-level
@@ -553,6 +558,26 @@ public interface IType extends IMember, IParent {
* @since 2.0
*/
// ITypeHierarchy newTypeHierarchy(IWorkingCopy[] workingCopies, IProgressMonitor monitor) throws JavaModelException;
+ /**
+ * Creates and returns a type hierarchy for this type containing
+ * this type, all of its supertypes, and all its subtypes in the workspace,
+ * considering types in the working copies with the given owner.
+ * In other words, the owner's working copies will take
+ * precedence over their original compilation units in the workspace.
+ *
+ * Note that if a working copy is empty, it will be as if the original compilation
+ * unit had been deleted.
+ *
+ *
+ * @param owner the owner of working copies that take precedence over their original compilation units
+ * @param monitor the given progress monitor
+ * @return a type hierarchy for this type containing
+ * this type, all of its supertypes, and all its subtypes in the workspace
+ * @exception JavaModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @since 3.0
+ */
+// ITypeHierarchy newTypeHierarchy(WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException;
/**
* Creates and returns a type hierarchy for this type containing
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaConventions.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaConventions.java
new file mode 100644
index 0000000..d82a30c
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaConventions.java
@@ -0,0 +1,444 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.core;
+
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import net.sourceforge.phpdt.core.compiler.*;
+import net.sourceforge.phpdt.core.compiler.InvalidInputException;
+import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
+import net.sourceforge.phpdt.internal.compiler.util.SuffixConstants;
+import net.sourceforge.phpdt.internal.core.*;
+import net.sourceforge.phpdt.internal.core.JavaModelStatus;
+import net.sourceforge.phpdt.internal.core.util.Util;
+
+/**
+ * Provides methods for checking Java-specific conventions such as name syntax.
+ *
+ * This class provides static methods and constants only; it is not intended to be
+ * instantiated or subclassed by clients.
+ *
+ */
+public final class JavaConventions {
+
+ private final static char DOT= '.';
+ private final static Scanner SCANNER = new Scanner();
+
+ private JavaConventions() {
+ // Not instantiable
+ }
+
+ /**
+ * Returns whether the given package fragment root paths are considered
+ * to overlap.
+ *
+ * Two root paths overlap if one is a prefix of the other, or they point to
+ * the same location. However, a JAR is allowed to be nested in a root.
+ *
+ * @param rootPath1 the first root path
+ * @param rootPath2 the second root path
+ * @return true if the given package fragment root paths are considered to overlap, false otherwise
+ * @deprecated Overlapping roots are allowed in 2.1
+ */
+ public static boolean isOverlappingRoots(IPath rootPath1, IPath rootPath2) {
+ if (rootPath1 == null || rootPath2 == null) {
+ return false;
+ }
+// String extension1 = rootPath1.getFileExtension();
+// String extension2 = rootPath2.getFileExtension();
+// if (extension1 != null && (extension1.equalsIgnoreCase(SuffixConstants.EXTENSION_JAR) || extension1.equalsIgnoreCase(SuffixConstants.EXTENSION_ZIP))) {
+// return false;
+// }
+// if (extension2 != null && (extension2.equalsIgnoreCase(SuffixConstants.EXTENSION_JAR) || extension2.equalsIgnoreCase(SuffixConstants.EXTENSION_ZIP))) {
+// return false;
+// }
+ return rootPath1.isPrefixOf(rootPath2) || rootPath2.isPrefixOf(rootPath1);
+ }
+
+ /*
+ * Returns the current identifier extracted by the scanner (without unicode
+ * escapes) from the given id.
+ * Returns null if the id was not valid
+ */
+ private static synchronized char[] scannedIdentifier(String id) {
+ if (id == null) {
+ return null;
+ }
+ String trimmed = id.trim();
+ if (!trimmed.equals(id)) {
+ return null;
+ }
+ try {
+ SCANNER.setSource(id.toCharArray());
+ int token = SCANNER.getNextToken();
+ char[] currentIdentifier;
+ try {
+ currentIdentifier = SCANNER.getCurrentIdentifierSource();
+ } catch (ArrayIndexOutOfBoundsException e) {
+ return null;
+ }
+ int nextToken= SCANNER.getNextToken();
+ if (token == ITerminalSymbols.TokenNameIdentifier
+ && nextToken == ITerminalSymbols.TokenNameEOF
+ && SCANNER.startPosition == SCANNER.source.length) { // to handle case where we had an ArrayIndexOutOfBoundsException
+ // while reading the last token
+ return currentIdentifier;
+ } else {
+ return null;
+ }
+ }
+ catch (InvalidInputException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Validate the given compilation unit name.
+ * A compilation unit name must obey the following rules:
+ *
+ *
it must not be null
+ *
it must include the ".java" suffix
+ *
its prefix must be a valid identifier
+ *
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 compilation unit
+ * @return a status object with code IStatus.OK if
+ * the given name is valid as a compilation unit name, otherwise a status
+ * object indicating what is wrong with the name
+ */
+ public static IStatus validateCompilationUnitName(String name) {
+ if (name == null) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.unit.nullName"), null); //$NON-NLS-1$
+ }
+ if (!net.sourceforge.phpdt.internal.compiler.util.Util.isJavaFileName(name)) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.unit.notJavaName"), null); //$NON-NLS-1$
+ }
+ String identifier;
+ int index;
+ index = name.lastIndexOf('.');
+ if (index == -1) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.unit.notJavaName"), null); //$NON-NLS-1$
+ }
+ identifier = name.substring(0, index);
+ // JSR-175 metadata strongly recommends "package-info.java" as the
+ // file in which to store package annotations and
+ // the package-level spec (replaces package.html)
+ if (!identifier.equals("package-info")) { //$NON-NLS-1$
+ IStatus status = validateIdentifier(identifier);
+ if (!status.isOK()) {
+ return status;
+ }
+ }
+ IStatus status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE);
+ if (!status.isOK()) {
+ return status;
+ }
+ return JavaModelStatus.VERIFIED_OK;
+ }
+
+ /**
+ * Validate the given .class file name.
+ * A .class file name must obey the following rules:
+ *
+ *
it must not be null
+ *
it must include the ".class" suffix
+ *
its prefix must be a valid identifier
+ *
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 .class file
+ * @return a status object with code IStatus.OK if
+ * the given name is valid as a .class file name, otherwise a status
+ * object indicating what is wrong with the name
+ * @since 2.0
+ */
+ public static IStatus validateClassFileName(String name) {
+ if (name == null) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.classFile.nullName"), null); //$NON-NLS-1$
+ }
+ if (!net.sourceforge.phpdt.internal.compiler.util.Util.isClassFileName(name)) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.classFile.notClassFileName"), null); //$NON-NLS-1$
+ }
+ String identifier;
+ int index;
+ index = name.lastIndexOf('.');
+ if (index == -1) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.classFile.notClassFileName"), null); //$NON-NLS-1$
+ }
+ identifier = name.substring(0, index);
+ IStatus status = validateIdentifier(identifier);
+ if (!status.isOK()) {
+ return status;
+ }
+ status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE);
+ if (!status.isOK()) {
+ return status;
+ }
+ return JavaModelStatus.VERIFIED_OK;
+ }
+
+ /**
+ * Validate the given field name.
+ *
+ * Syntax of a field name corresponds to VariableDeclaratorId (JLS2 8.3).
+ * For example, "x".
+ *
+ * @param name the name of a field
+ * @return a status object with code IStatus.OK if
+ * the given name is valid as a field name, otherwise a status
+ * object indicating what is wrong with the name
+ */
+ public static IStatus validateFieldName(String name) {
+ return validateIdentifier(name);
+ }
+
+ /**
+ * Validate the given Java identifier.
+ * The identifier must not have the same spelling as a Java keyword,
+ * boolean literal ("true", "false"), or null literal ("null").
+ * See section 3.8 of the Java Language Specification, Second Edition (JLS2).
+ * A valid identifier can act as a simple type name, method name or field name.
+ *
+ * @param id the Java identifier
+ * @return a status object with code IStatus.OK if
+ * the given identifier is a valid Java identifier, otherwise a status
+ * object indicating what is wrong with the identifier
+ */
+ public static IStatus validateIdentifier(String id) {
+ if (scannedIdentifier(id) != null) {
+ return JavaModelStatus.VERIFIED_OK;
+ } else {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.illegalIdentifier", id), null); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Validate the given import declaration name.
+ *
+ * The name of an import corresponds to a fully qualified type name
+ * or an on-demand package name as defined by ImportDeclaration (JLS2 7.5).
+ * For example, "java.util.*" or "java.util.Hashtable".
+ *
+ * @param name the import declaration
+ * @return a status object with code IStatus.OK if
+ * the given name is valid as an import declaration, otherwise a status
+ * object indicating what is wrong with the name
+ */
+ public static IStatus validateImportDeclaration(String name) {
+ if (name == null || name.length() == 0) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.import.nullImport"), null); //$NON-NLS-1$
+ }
+ if (name.charAt(name.length() - 1) == '*') {
+ if (name.charAt(name.length() - 2) == '.') {
+ return validatePackageName(name.substring(0, name.length() - 2));
+ } else {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.import.unqualifiedImport"), null); //$NON-NLS-1$
+ }
+ }
+ return validatePackageName(name);
+ }
+
+ /**
+ * Validate the given Java type name, either simple or qualified.
+ * For example, "java.lang.Object", or "Object".
+ *
+ *
+ * @param name the name of a type
+ * @return a status object with code IStatus.OK if
+ * the given name is valid as a Java type name,
+ * a status with code IStatus.WARNING
+ * indicating why the given name is discouraged,
+ * otherwise a status object indicating what is wrong with
+ * the name
+ */
+ public static IStatus validateJavaTypeName(String name) {
+ if (name == null) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.nullName"), null); //$NON-NLS-1$
+ }
+ String trimmed = name.trim();
+ if (!name.equals(trimmed)) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.nameWithBlanks"), null); //$NON-NLS-1$
+ }
+ int index = name.lastIndexOf('.');
+ char[] scannedID;
+ if (index == -1) {
+ // simple name
+ scannedID = scannedIdentifier(name);
+ } else {
+ // qualified name
+ String pkg = name.substring(0, index).trim();
+ IStatus status = validatePackageName(pkg);
+ if (!status.isOK()) {
+ return status;
+ }
+ String type = name.substring(index + 1).trim();
+ scannedID = scannedIdentifier(type);
+ }
+
+ if (scannedID != null) {
+ IStatus status = ResourcesPlugin.getWorkspace().validateName(new String(scannedID), IResource.FILE);
+ if (!status.isOK()) {
+ return status;
+ }
+ if (CharOperation.contains('$', scannedID)) {
+ return new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.dollarName"), null); //$NON-NLS-1$
+ }
+ if ((scannedID.length > 0 && Character.isLowerCase(scannedID[0]))) {
+ return new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.lowercaseName"), null); //$NON-NLS-1$
+ }
+ return JavaModelStatus.VERIFIED_OK;
+ } else {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.invalidName", name), null); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Validate the given method name.
+ * The special names "<init>" and "<clinit>" are not valid.
+ *
+ * The syntax for a method name is defined by Identifier
+ * of MethodDeclarator (JLS2 8.4). For example "println".
+ *
+ * @param name the name of a method
+ * @return a status object with code IStatus.OK if
+ * the given name is valid as a method name, otherwise a status
+ * object indicating what is wrong with the name
+ */
+ public static IStatus validateMethodName(String name) {
+
+ return validateIdentifier(name);
+ }
+
+ /**
+ * Validate the given package name.
+ *
+ * The syntax of a package name corresponds to PackageName as
+ * defined by PackageDeclaration (JLS2 7.4). For example, "java.lang".
+ *
+ * Note that the given name must be a non-empty package name (that is, attempting to
+ * validate the default package will return an error status.)
+ * Also it must not contain any characters or substrings that are not valid
+ * on the file system on which workspace root is located.
+ *
+ * @param name the name of a package
+ * @return a status object with code IStatus.OK if
+ * the given name is valid as a package name, otherwise a status
+ * object indicating what is wrong with the name
+ */
+ public static IStatus validatePackageName(String name) {
+
+ if (name == null) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.nullName"), null); //$NON-NLS-1$
+ }
+ int length;
+ if ((length = name.length()) == 0) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.emptyName"), null); //$NON-NLS-1$
+ }
+ if (name.charAt(0) == DOT || name.charAt(length-1) == DOT) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.dotName"), null); //$NON-NLS-1$
+ }
+ if (CharOperation.isWhitespace(name.charAt(0)) || CharOperation.isWhitespace(name.charAt(name.length() - 1))) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.nameWithBlanks"), null); //$NON-NLS-1$
+ }
+ int dot = 0;
+ while (dot != -1 && dot < length-1) {
+ if ((dot = name.indexOf(DOT, dot+1)) != -1 && dot < length-1 && name.charAt(dot+1) == DOT) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.consecutiveDotsName"), null); //$NON-NLS-1$
+ }
+ }
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ StringTokenizer st = new StringTokenizer(name, new String(new char[] {DOT}));
+ boolean firstToken = true;
+ IStatus warningStatus = null;
+ while (st.hasMoreTokens()) {
+ String typeName = st.nextToken();
+ typeName = typeName.trim(); // grammar allows spaces
+ char[] scannedID = scannedIdentifier(typeName);
+ if (scannedID == null) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.illegalIdentifier", typeName), null); //$NON-NLS-1$
+ }
+ IStatus status = workspace.validateName(new String(scannedID), IResource.FOLDER);
+ if (!status.isOK()) {
+ return status;
+ }
+ if (firstToken && scannedID.length > 0 && Character.isUpperCase(scannedID[0])) {
+ if (warningStatus == null) {
+ warningStatus = new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.uppercaseName"), null); //$NON-NLS-1$
+ }
+ }
+ firstToken = false;
+ }
+ if (warningStatus != null) {
+ return warningStatus;
+ }
+ return JavaModelStatus.VERIFIED_OK;
+ }
+
+ /**
+ * Validate a given classpath and output location for a project, using the following rules:
+ *
+ *
Classpath entries cannot collide with each other; that is, all entry paths must be unique.
+ *
The project output location path cannot be null, must be absolute and located inside the project.
+ *
Specific output locations (specified on source entries) can be null, if not they must be located inside the project,
+ *
A project entry cannot refer to itself directly (that is, a project cannot prerequisite itself).
+ *
Classpath entries or output locations cannot coincidate or be nested in each other, except for the following scenarii listed below:
+ *
A source folder can coincidate with its own output location, in which case this output can then contain library archives.
+ * However, a specific output location cannot coincidate with any library or a distinct source folder than the one referring to it.
+ *
A source/library folder can be nested in any source folder as long as the nested folder is excluded from the enclosing one.
+ *
An output location can be nested in a source folder, if the source folder coincidates with the project itself, or if the output
+ * location is excluded from the source folder.
+ *
+ *
+ *
+ * Note that the classpath entries are not validated automatically. Only bound variables or containers are considered
+ * in the checking process (this allows to perform a consistency check on a classpath which has references to
+ * yet non existing projects, folders, ...).
+ *
+ * This validation is intended to anticipate classpath issues prior to assigning it to a project. In particular, it will automatically
+ * be performed during the classpath setting operation (if validation fails, the classpath setting will not complete).
+ *
+ * @param javaProject the given java project
+ * @param rawClasspath the given classpath
+ * @param projectOutputLocation the given output location
+ * @return a status object with code IStatus.OK if
+ * the given classpath and output location are compatible, otherwise a status
+ * object indicating what is wrong with the classpath or output location
+ * @since 2.0
+ */
+ public static IJavaModelStatus validateClasspath(IJavaProject javaProject, IClasspathEntry[] rawClasspath, IPath projectOutputLocation) {
+
+ return ClasspathEntry.validateClasspath(javaProject, rawClasspath, projectOutputLocation);
+ }
+
+ /**
+ * Returns a Java model status describing the problem related to this classpath entry if any,
+ * a status object with code IStatus.OK if the entry is fine (that is, if the
+ * given classpath entry denotes a valid element to be referenced onto a classpath).
+ *
+ * @param project the given java project
+ * @param entry the given classpath entry
+ * @param checkSourceAttachment a flag to determine if source attachement should be checked
+ * @return a java model status describing the problem related to this classpath entry if any, a status object with code IStatus.OK if the entry is fine
+ * @since 2.0
+ */
+ public static IJavaModelStatus validateClasspathEntry(IJavaProject project, IClasspathEntry entry, boolean checkSourceAttachment){
+ return ClasspathEntry.validateClasspathEntry(project, entry, checkSourceAttachment, true/*recurse in container*/);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java
index 5dd77a1..b340b76 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java
@@ -15,6 +15,7 @@ import net.sourceforge.phpdt.internal.core.ClasspathEntry;
import net.sourceforge.phpdt.internal.core.JavaModel;
import net.sourceforge.phpdt.internal.core.JavaModelManager;
import net.sourceforge.phpdt.internal.core.Region;
+import net.sourceforge.phpdt.internal.core.util.MementoTokenizer;
import net.sourceforge.phpdt.internal.corext.Assert;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
@@ -1652,6 +1653,29 @@ public class JavaCore {
}
/**
+ * Returns the Java model element corresponding to the given handle identifier
+ * generated by IJavaElement.getHandleIdentifier(), or
+ * null if unable to create the associated element.
+ * If the returned Java element is an ICompilationUnit, its owner
+ * is the given owner if such a working copy exists, otherwise the compilation unit
+ * is a primary compilation unit.
+ *
+ * @param handleIdentifier the given handle identifier
+ * @param owner the owner of the returned compilation unit, ignored if the returned
+ * element is not a compilation unit
+ * @return the Java element corresponding to the handle identifier
+ * @since 3.0
+ */
+ public static IJavaElement create(String handleIdentifier, WorkingCopyOwner owner) {
+ if (handleIdentifier == null) {
+ return null;
+ }
+ MementoTokenizer memento = new MementoTokenizer(handleIdentifier);
+ JavaModel model = JavaModelManager.getJavaModelManager().getJavaModel();
+ return model.getHandleFromMemento(memento, owner);
+ }
+
+ /**
* Returns the Java element corresponding to the given file, or
* null if unable to associate the given file with a Java
* element.
@@ -1827,7 +1851,7 @@ public class JavaCore {
* (using setClasspathContainer, then a
* ClasspathContainerInitializer will be activated if any was
* registered for this container ID onto the extension point
- * "org.eclipse.jdt.core.classpathContainerInitializer".
+ * "net.sourceforge.phpdt.core.classpathContainerInitializer".
*
* There is no assumption that the returned container must answer the exact
* same containerPath when requested
@@ -1838,7 +1862,7 @@ public class JavaCore {
* are not preserved from a session to another. It is thus highly
* recommended to register a ClasspathContainerInitializer
* for each referenced container (through the extension point
- * "org.eclipse.jdt.core.ClasspathContainerInitializer").
+ * "net.sourceforge.phpdt.core.ClasspathContainerInitializer").
*
*
* @param containerPath
@@ -1938,7 +1962,7 @@ public class JavaCore {
* Helper method finding the classpath container initializer registered for
* a given classpath container ID or null if none was found
* while iterating over the contributions to extension point to the
- * extension point "org.eclipse.jdt.core.classpathContainerInitializer".
+ * extension point "net.sourceforge.phpdt.core.classpathContainerInitializer".
*
* A containerID is the first segment of any container path, used to
* identify the registered container initializer.
@@ -1995,7 +2019,7 @@ public class JavaCore {
*
* Note that classpath variables can be contributed registered initializers
* for, using the extension point
- * "org.eclipse.jdt.core.classpathVariableInitializer". If an initializer is
+ * "net.sourceforge.phpdt.core.classpathVariableInitializer". If an initializer is
* registered for a variable, its persisted value will be ignored: its
* initializer will thus get the opportunity to rebind the variable
* differently on each session.
@@ -2072,7 +2096,7 @@ public class JavaCore {
* Helper method finding the classpath variable initializer registered for a
* given classpath variable name or null if none was found
* while iterating over the contributions to extension point to the
- * extension point "org.eclipse.jdt.core.classpathVariableInitializer".
+ * extension point "net.sourceforge.phpdt.core.classpathVariableInitializer".
*
*
* @param the
@@ -2150,49 +2174,49 @@ public class JavaCore {
* When generated, this attribute will enable local variable names
* to be displayed in debugger, only in place where variables are
* definitely assigned (.class file is then bigger)
- * - option id: "org.eclipse.jdt.core.compiler.debug.localVariable"
+ * - option id: "net.sourceforge.phpdt.core.compiler.debug.localVariable"
* - possible values: { "generate", "do not generate" }
* - default: "generate"
*
* COMPILER / Generating Line Number Debug Attribute
* When generated, this attribute will enable source code highlighting in debugger
* (.class file is then bigger).
- * - option id: "org.eclipse.jdt.core.compiler.debug.lineNumber"
+ * - option id: "net.sourceforge.phpdt.core.compiler.debug.lineNumber"
* - possible values: { "generate", "do not generate" }
* - default: "generate"
*
* COMPILER / Generating Source Debug Attribute
* When generated, this attribute will enable the debugger to present the
* corresponding source code.
- * - option id: "org.eclipse.jdt.core.compiler.debug.sourceFile"
+ * - option id: "net.sourceforge.phpdt.core.compiler.debug.sourceFile"
* - possible values: { "generate", "do not generate" }
* - default: "generate"
*
* COMPILER / Preserving Unused Local Variables
* Unless requested to preserve unused local variables (that is, never read), the
* compiler will optimize them out, potentially altering debugging
- * - option id: "org.eclipse.jdt.core.compiler.codegen.unusedLocal"
+ * - option id: "net.sourceforge.phpdt.core.compiler.codegen.unusedLocal"
* - possible values: { "preserve", "optimize out" }
* - default: "preserve"
*
* COMPILER / Defining Target Java Platform
* For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
* Note that "1.4" target require to toggle compliance mode to "1.4" too.
- * - option id: "org.eclipse.jdt.core.compiler.codegen.targetPlatform"
+ * - option id: "net.sourceforge.phpdt.core.compiler.codegen.targetPlatform"
* - possible values: { "1.1", "1.2", "1.3", "1.4" }
* - default: "1.1"
*
* COMPILER / Reporting Unreachable Code
* Unreachable code can optionally be reported as an error, warning or simply
* ignored. The bytecode generation will always optimized it out.
- * - option id: "org.eclipse.jdt.core.compiler.problem.unreachableCode"
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.unreachableCode"
* - possible values: { "error", "warning", "ignore" }
* - default: "error"
*
* COMPILER / Reporting Invalid Import
* An import statement that cannot be resolved might optionally be reported
* as an error, as a warning or ignored.
- * - option id: "org.eclipse.jdt.core.compiler.problem.invalidImport"
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.invalidImport"
* - possible values: { "error", "warning", "ignore" }
* - default: "error"
*
@@ -2200,7 +2224,7 @@ public class JavaCore {
* A package default method is not visible in a different package, and thus
* cannot be overridden. When enabling this option, the compiler will signal
* such scenarii either as an error or a warning.
- * - option id: "org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod"
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.overridingPackageDefaultMethod"
* - possible values: { "error", "warning", "ignore" }
* - default: "warning"
*
@@ -2208,21 +2232,21 @@ public class JavaCore {
* Naming a method with a constructor name is generally considered poor
* style programming. When enabling this option, the compiler will signal such
* scenarii either as an error or a warning.
- * - option id: "org.eclipse.jdt.core.compiler.problem.methodWithConstructorName"
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.methodWithConstructorName"
* - possible values: { "error", "warning", "ignore" }
* - default: "warning"
*
* COMPILER / Reporting Deprecation
* When enabled, the compiler will signal use of deprecated API either as an
* error or a warning.
- * - option id: "org.eclipse.jdt.core.compiler.problem.deprecation"
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.deprecation"
* - possible values: { "error", "warning", "ignore" }
* - default: "warning"
*
* COMPILER / Reporting Deprecation Inside Deprecated Code
* When enabled, the compiler will signal use of deprecated API inside deprecated code.
- * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.deprecation".
- * - option id: "org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode"
+ * The severity of the problem is controlled with option "net.sourceforge.phpdt.core.compiler.problem.deprecation".
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.deprecationInDeprecatedCode"
* - possible values: { "enabled", "disabled" }
* - default: "disabled"
*
@@ -2233,49 +2257,49 @@ public class JavaCore {
* } catch (java.io.IOException e) {}.
* When enabling this option, the compiler will issue an error or a warning for hidden
* catch blocks corresponding to checked exceptions
- * - option id: "org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock"
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.hiddenCatchBlock"
* - possible values: { "error", "warning", "ignore" }
* - default: "warning"
*
* COMPILER / Reporting Unused Local
* When enabled, the compiler will issue an error or a warning for unused local
* variables (that is, variables never read from)
- * - option id: "org.eclipse.jdt.core.compiler.problem.unusedLocal"
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedLocal"
* - possible values: { "error", "warning", "ignore" }
* - default: "ignore"
*
* COMPILER / Reporting Unused Parameter
* When enabled, the compiler will issue an error or a warning for unused method
* parameters (that is, parameters never read from)
- * - option id: "org.eclipse.jdt.core.compiler.problem.unusedParameter"
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedParameter"
* - possible values: { "error", "warning", "ignore" }
* - default: "ignore"
*
* COMPILER / Reporting Unused Parameter if Implementing Abstract Method
* When enabled, the compiler will signal unused parameters in abstract method implementations.
- * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
- * - option id: "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract"
+ * The severity of the problem is controlled with option "net.sourceforge.phpdt.core.compiler.problem.unusedParameter".
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedParameterWhenImplementingAbstract"
* - possible values: { "enabled", "disabled" }
* - default: "disabled"
*
* COMPILER / Reporting Unused Parameter if Overriding Concrete Method
* When enabled, the compiler will signal unused parameters in methods overriding concrete ones.
- * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
- * - option id: "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete"
+ * The severity of the problem is controlled with option "net.sourceforge.phpdt.core.compiler.problem.unusedParameter".
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedParameterWhenOverridingConcrete"
* - possible values: { "enabled", "disabled" }
* - default: "disabled"
*
* COMPILER / Reporting Unused Import
* When enabled, the compiler will issue an error or a warning for unused import
* reference
- * - option id: "org.eclipse.jdt.core.compiler.problem.unusedImport"
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedImport"
* - possible values: { "error", "warning", "ignore" }
* - default: "warning"
*
* COMPILER / Reporting Unused Private Members
* When enabled, the compiler will issue an error or a warning whenever a private
* method or field is declared but never used within the same unit.
- * - option id: "org.eclipse.jdt.core.compiler.problem.unusedPrivateMember"
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedPrivateMember"
* - possible values: { "error", "warning", "ignore" }
* - default: "ignore"
*
@@ -2283,21 +2307,21 @@ public class JavaCore {
* When enabled, the compiler will issue an error or a warning whenever it emulates
* access to a non-accessible member of an enclosing type. Such access can have
* performance implications.
- * - option id: "org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation"
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.syntheticAccessEmulation"
* - possible values: { "error", "warning", "ignore" }
* - default: "ignore"
*
* COMPILER / Reporting Non-Externalized String Literal
* When enabled, the compiler will issue an error or a warning for non externalized
* String literal (that is, not tagged with //$NON-NLS-<n>$).
- * - option id: "org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral"
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.nonExternalizedStringLiteral"
* - possible values: { "error", "warning", "ignore" }
* - default: "ignore"
*
* COMPILER / Reporting Usage of 'assert' Identifier
* When enabled, the compiler will issue an error or a warning whenever 'assert' is
* used as an identifier (reserved keyword in 1.4)
- * - option id: "org.eclipse.jdt.core.compiler.problem.assertIdentifier"
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.assertIdentifier"
* - possible values: { "error", "warning", "ignore" }
* - default: "ignore"
*
@@ -2305,14 +2329,14 @@ public class JavaCore {
* When enabled, the compiler will issue an error or a warning whenever a static field
* or method is accessed with an expression receiver. A reference to a static member should
* be qualified with a type name.
- * - option id: "org.eclipse.jdt.core.compiler.problem.staticAccessReceiver"
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.staticAccessReceiver"
* - possible values: { "error", "warning", "ignore" }
* - default: "warning"
*
* COMPILER / Reporting Assignment with no Effect
* When enabled, the compiler will issue an error or a warning whenever an assignment
* has no effect (e.g 'x = x').
- * - option id: "org.eclipse.jdt.core.compiler.problem.noEffectAssignment"
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.noEffectAssignment"
* - possible values: { "error", "warning", "ignore" }
* - default: "warning"
*
@@ -2323,14 +2347,14 @@ public class JavaCore {
* interface I {
* int clone();
* }
- * - option id: "org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod"
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod"
* - possible values: { "error", "warning", "ignore" }
* - default: "warning"
*
* COMPILER / Reporting Usage of char[] Expressions in String Concatenations
* When enabled, the compiler will issue an error or a warning whenever a char[] expression
* is used in String concatenations (for example, "hello" + new char[]{'w','o','r','l','d'}).
- * - option id: "org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion"
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.noImplicitStringConversion"
* - possible values: { "error", "warning", "ignore" }
* - default: "warning"
*
@@ -2338,20 +2362,20 @@ public class JavaCore {
* Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
* reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
* level should be set to "1.4" and the compliance mode should be "1.4".
- * - option id: "org.eclipse.jdt.core.compiler.source"
+ * - option id: "net.sourceforge.phpdt.core.compiler.source"
* - possible values: { "1.3", "1.4" }
* - default: "1.3"
*
* COMPILER / Setting Compliance Level
* Select the compliance level for the compiler. In "1.3" mode, source and target settings
* should not go beyond "1.3" level.
- * - option id: "org.eclipse.jdt.core.compiler.compliance"
+ * - option id: "net.sourceforge.phpdt.core.compiler.compliance"
* - possible values: { "1.3", "1.4" }
* - default: "1.3"
*
* COMPILER / Maximum number of problems reported per compilation unit
* Specify the maximum number of problems reported on each compilation unit.
- * - option id: "org.eclipse.jdt.core.compiler.maxProblemPerUnit"
+ * - option id: "net.sourceforge.phpdt.core.compiler.maxProblemPerUnit"
* - possible values: "<n>" where <n> is zero or a positive integer (if zero then all problems are reported).
* - default: "100"
*
@@ -2360,7 +2384,7 @@ public class JavaCore {
* one of the corresponding tag inside any comment in Java source code.
* Generated task messages will include the tag, and range until the next line separator or comment ending.
* Note that tasks messages are trimmed.
- * - option id: "org.eclipse.jdt.core.compiler.taskTags"
+ * - option id: "net.sourceforge.phpdt.core.compiler.taskTags"
* - possible values: { "<tag>[,<tag>]*" } where <tag> is a String without any wild-card or leading/trailing spaces
* - default: ""
*
@@ -2368,34 +2392,34 @@ public class JavaCore {
* In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
* of the task markers issued by the compiler.
* If the default is specified, the priority of each task marker is "NORMAL".
- * - option id: "org.eclipse.jdt.core.compiler.taskPriorities"
+ * - option id: "net.sourceforge.phpdt.core.compiler.taskPriorities"
* - possible values: { "<priority>[,<priority>]*" } where <priority> is one of "HIGH", "NORMAL" or "LOW"
* - default: ""
*
* BUILDER / Specifying Filters for Resource Copying Control
* Allow to specify some filters to control the resource copy process.
- * - option id: "org.eclipse.jdt.core.builder.resourceCopyExclusionFilter"
+ * - option id: "net.sourceforge.phpdt.core.builder.resourceCopyExclusionFilter"
* - possible values: { "<name>[,<name>]* } where <name> is a file name pattern (* and ? wild-cards allowed)
* or the name of a folder which ends with '/'
* - default: ""
*
* BUILDER / Abort if Invalid Classpath
* Allow to toggle the builder to abort if the classpath is invalid
- * - option id: "org.eclipse.jdt.core.builder.invalidClasspath"
+ * - option id: "net.sourceforge.phpdt.core.builder.invalidClasspath"
* - possible values: { "abort", "ignore" }
* - default: "abort"
*
* BUILDER / Cleaning Output Folder(s)
* Indicate whether the JavaBuilder is allowed to clean the output folders
* when performing full build operations.
- * - option id: "org.eclipse.jdt.core.builder.cleanOutputFolder"
+ * - option id: "net.sourceforge.phpdt.core.builder.cleanOutputFolder"
* - possible values: { "clean", "ignore" }
* - default: "clean"
*
* BUILDER / Reporting Duplicate Resources
* Indicate the severity of the problem reported when more than one occurrence
* of a resource is to be copied into the output location.
- * - option id: "org.eclipse.jdt.core.builder.duplicateResourceTask"
+ * - option id: "net.sourceforge.phpdt.core.builder.duplicateResourceTask"
* - possible values: { "error", "warning" }
* - default: "warning"
*
@@ -2403,61 +2427,61 @@ public class JavaCore {
* Indicate whether JavaCore should enforce the project build order to be based on
* the classpath prerequisite chain. When requesting to compute, this takes over
* the platform default order (based on project references).
- * - option id: "org.eclipse.jdt.core.computeJavaBuildOrder"
+ * - option id: "net.sourceforge.phpdt.core.computeJavaBuildOrder"
* - possible values: { "compute", "ignore" }
* - default: "ignore"
*
* JAVACORE / Specify Default Source Encoding Format
* Get the encoding format for compiled sources. This setting is read-only, it is equivalent
* to 'ResourcesPlugin.getEncoding()'.
- * - option id: "org.eclipse.jdt.core.encoding"
+ * - option id: "net.sourceforge.phpdt.core.encoding"
* - possible values: { any of the supported encoding name}.
* - default: <platform default>
*
* JAVACORE / Reporting Incomplete Classpath
* Indicate the severity of the problem reported when an entry on the classpath does not exist,
* is not legite or is not visible (for example, a referenced project is closed).
- * - option id: "org.eclipse.jdt.core.incompleteClasspath"
+ * - option id: "net.sourceforge.phpdt.core.incompleteClasspath"
* - possible values: { "error", "warning"}
* - default: "error"
*
* JAVACORE / Reporting Classpath Cycle
* Indicate the severity of the problem reported when a project is involved in a cycle.
- * - option id: "org.eclipse.jdt.core.circularClasspath"
+ * - option id: "net.sourceforge.phpdt.core.circularClasspath"
* - possible values: { "error", "warning" }
* - default: "error"
*
* JAVACORE / Enabling Usage of Classpath Exclusion Patterns
* When disabled, no entry on a project classpath can be associated with
* an exclusion pattern.
- * - option id: "org.eclipse.jdt.core.classpath.exclusionPatterns"
+ * - option id: "net.sourceforge.phpdt.core.classpath.exclusionPatterns"
* - possible values: { "enabled", "disabled" }
* - default: "enabled"
*
* JAVACORE / Enabling Usage of Classpath Multiple Output Locations
* When disabled, no entry on a project classpath can be associated with
* a specific output location, preventing thus usage of multiple output locations.
- * - option id: "org.eclipse.jdt.core.classpath.multipleOutputLocations"
+ * - option id: "net.sourceforge.phpdt.core.classpath.multipleOutputLocations"
* - possible values: { "enabled", "disabled" }
* - default: "enabled"
*
* FORMATTER / Inserting New Line Before Opening Brace
* When Insert, a new line is inserted before an opening brace, otherwise nothing
* is inserted
- * - option id: "org.eclipse.jdt.core.formatter.newline.openingBrace"
+ * - option id: "net.sourceforge.phpdt.core.formatter.newline.openingBrace"
* - possible values: { "insert", "do not insert" }
* - default: "do not insert"
*
* FORMATTER / Inserting New Line Inside Control Statement
* When Insert, a new line is inserted between } and following else, catch, finally
- * - option id: "org.eclipse.jdt.core.formatter.newline.controlStatement"
+ * - option id: "net.sourceforge.phpdt.core.formatter.newline.controlStatement"
* - possible values: { "insert", "do not insert" }
* - default: "do not insert"
*
* FORMATTER / Clearing Blank Lines
* When Clear all, all blank lines are removed. When Preserve one, only one is kept
* and all others removed.
- * - option id: "org.eclipse.jdt.core.formatter.newline.clearAll"
+ * - option id: "net.sourceforge.phpdt.core.formatter.newline.clearAll"
* - possible values: { "clear all", "preserve one" }
* - default: "preserve one"
*
@@ -2465,117 +2489,117 @@ public class JavaCore {
* When Insert, a blank line is inserted between an else and an if when they are
* contiguous. When choosing to not insert, else-if will be kept on the same
* line when possible.
- * - option id: "org.eclipse.jdt.core.formatter.newline.elseIf"
+ * - option id: "net.sourceforge.phpdt.core.formatter.newline.elseIf"
* - possible values: { "insert", "do not insert" }
* - default: "do not insert"
*
* FORMATTER / Inserting New Line In Empty Block
* When insert, a line break is inserted between contiguous { and }, if } is not followed
* by a keyword.
- * - option id: "org.eclipse.jdt.core.formatter.newline.emptyBlock"
+ * - option id: "net.sourceforge.phpdt.core.formatter.newline.emptyBlock"
* - possible values: { "insert", "do not insert" }
* - default: "insert"
*
* FORMATTER / Splitting Lines Exceeding Length
* Enable splitting of long lines (exceeding the configurable length). Length of 0 will
* disable line splitting
- * - option id: "org.eclipse.jdt.core.formatter.lineSplit"
+ * - option id: "net.sourceforge.phpdt.core.formatter.lineSplit"
* - possible values: "<n>", where n is zero or a positive integer
* - default: "80"
*
* FORMATTER / Compacting Assignment
* Assignments can be formatted asymmetrically, for example 'int x= 2;', when Normal, a space
* is inserted before the assignment operator
- * - option id: "org.eclipse.jdt.core.formatter.style.assignment"
+ * - option id: "net.sourceforge.phpdt.core.formatter.style.assignment"
* - possible values: { "compact", "normal" }
* - default: "normal"
*
* FORMATTER / Defining Indentation Character
* Either choose to indent with tab characters or spaces
- * - option id: "org.eclipse.jdt.core.formatter.tabulation.char"
+ * - option id: "net.sourceforge.phpdt.core.formatter.tabulation.char"
* - possible values: { "tab", "space" }
* - default: "tab"
*
* FORMATTER / Defining Space Indentation Length
* When using spaces, set the amount of space characters to use for each
* indentation mark.
- * - option id: "org.eclipse.jdt.core.formatter.tabulation.size"
+ * - option id: "net.sourceforge.phpdt.core.formatter.tabulation.size"
* - possible values: "<n>", where n is a positive integer
* - default: "4"
*
* FORMATTER / Inserting space in cast expression
* When Insert, a space is added between the type and the expression in a cast expression.
- * - option id: "org.eclipse.jdt.core.formatter.space.castexpression"
+ * - option id: "net.sourceforge.phpdt.core.formatter.space.castexpression"
* - possible values: { "insert", "do not insert" }
* - default: "insert"
*
* CODEASSIST / Activate Visibility Sensitive Completion
* When active, completion doesn't show that you can not see
* (for example, you can not see private methods of a super class).
- * - option id: "org.eclipse.jdt.core.codeComplete.visibilityCheck"
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.visibilityCheck"
* - possible values: { "enabled", "disabled" }
* - default: "disabled"
*
* CODEASSIST / Automatic Qualification of Implicit Members
* When active, completion automatically qualifies completion on implicit
* field references and message expressions.
- * - option id: "org.eclipse.jdt.core.codeComplete.forceImplicitQualification"
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.forceImplicitQualification"
* - possible values: { "enabled", "disabled" }
* - default: "disabled"
*
* CODEASSIST / Define the Prefixes for Field Name
* When the prefixes is non empty, completion for field name will begin with
* one of the proposed prefixes.
- * - option id: "org.eclipse.jdt.core.codeComplete.fieldPrefixes"
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.fieldPrefixes"
* - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
* - default: ""
*
* CODEASSIST / Define the Prefixes for Static Field Name
* When the prefixes is non empty, completion for static field name will begin with
* one of the proposed prefixes.
- * - option id: "org.eclipse.jdt.core.codeComplete.staticFieldPrefixes"
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.staticFieldPrefixes"
* - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
* - default: ""
*
* CODEASSIST / Define the Prefixes for Local Variable Name
* When the prefixes is non empty, completion for local variable name will begin with
* one of the proposed prefixes.
- * - option id: "org.eclipse.jdt.core.codeComplete.localPrefixes"
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.localPrefixes"
* - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
* - default: ""
*
* CODEASSIST / Define the Prefixes for Argument Name
* When the prefixes is non empty, completion for argument name will begin with
* one of the proposed prefixes.
- * - option id: "org.eclipse.jdt.core.codeComplete.argumentPrefixes"
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.argumentPrefixes"
* - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
* - default: ""
*
* CODEASSIST / Define the Suffixes for Field Name
* When the suffixes is non empty, completion for field name will end with
* one of the proposed suffixes.
- * - option id: "org.eclipse.jdt.core.codeComplete.fieldSuffixes"
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.fieldSuffixes"
* - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card
* - default: ""
*
* CODEASSIST / Define the Suffixes for Static Field Name
* When the suffixes is non empty, completion for static field name will end with
* one of the proposed suffixes.
- * - option id: "org.eclipse.jdt.core.codeComplete.staticFieldSuffixes"
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.staticFieldSuffixes"
* - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card
* - default: ""
*
* CODEASSIST / Define the Suffixes for Local Variable Name
* When the suffixes is non empty, completion for local variable name will end with
* one of the proposed suffixes.
- * - option id: "org.eclipse.jdt.core.codeComplete.localSuffixes"
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.localSuffixes"
* - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card
* - default: ""
*
* CODEASSIST / Define the Suffixes for Argument Name
* When the suffixes is non empty, completion for argument name will end with
* one of the proposed suffixes.
- * - option id: "org.eclipse.jdt.core.codeComplete.argumentSuffixes"
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.argumentSuffixes"
* - possible values: { "<suffix>[,<suffix>]*" } where <prefix> is a String without any wild-card
* - default: ""
* </pre>
@@ -3221,13 +3245,13 @@ public class JavaCore {
*
* A container is exclusively resolved by a
* ClasspathContainerInitializer registered onto the
- * extension point "org.eclipse.jdt.core.classpathContainerInitializer".
+ * extension point "net.sourceforge.phpdt.core.classpathContainerInitializer".
*
* A container path must be formed of at least one segment, where:
*
*
the first segment is a unique ID identifying the target container,
* there must be a container initializer registered onto this ID through the
- * extension point "org.eclipse.jdt.core.classpathContainerInitializer".
+ * extension point "net.sourceforge.phpdt.core.classpathContainerInitializer".
*
*
the remaining segments will be passed onto the initializer, and can
* be used as additional hints during the initialization phase.
* 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:
*
*
the first segment is a unique ID identifying the target container,
* there must be a container initializer registered onto this ID through the
- * extension point "org.eclipse.jdt.core.classpathContainerInitializer".
+ * extension point "net.sourceforge.phpdt.core.classpathContainerInitializer".
*
*
the remaining segments will be passed onto the initializer, and can
* be used as additional hints during the initialization phase.
@@ -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.
- *
- *
- * @param path
- * the absolute workspace-relative path of a source folder
- * @return a new source classpath entry with not exclusion patterns
- *
- * @see #newSourceEntry(org.eclipse.core.runtime.IPath,org.eclipse.core.runtime.IPath[])
- */
- public static IClasspathEntry newSourceEntry(IPath path) {
+ * Creates and returns a new classpath entry of kind 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.
- *
- * If the empty list of exclusion patterns is specified, the source folder
- * will automatically include all resources located inside the source
- * folder. In that case, the result is entirely equivalent to using the
- * factory method 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.
- *
- *
- * @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 with the given exclusion patterns
- * @see #newSourceEntry(org.eclipse.core.runtime.IPath)
- * @see IClasspathEntry#getExclusionPatterns
- *
- * @since 2.1
- */
- public static IClasspathEntry newSourceEntry(IPath path,
- IPath[] exclusionPatterns) {
+ return newSourceEntry(path, ClasspathEntry.INCLUDE_ALL, exclusionPatterns, null /*output location*/);
+ }
- return newSourceEntry(path, exclusionPatterns, 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, 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.
- *
- * If the empty list of exclusion patterns is specified, the source folder
- * will automatically include all resources located inside the source
- * folder. In that case, the result is entirely equivalent to using the
- * factory method 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.
- *
- *
- * @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 outputLocation
- * the specific output location for this source entry (
- * 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.
+ *
+ *
+ * @param path the absolute workspace-relative path of a source folder
+ * @param inclusionPatterns the possibly empty list of inclusion patterns
+ * represented as relative paths
+ * @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 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 :
+ *
+ *
CODEASSIST_FIELD_PREFIXES : Define the Prefixes for Field Name.
+ *
CODEASSIST_STATIC_FIELD_PREFIXES : Define the Prefixes for Static Field Name.
+ *
CODEASSIST_LOCAL_PREFIXES : Define the Prefixes for Local Variable Name.
+ *
CODEASSIST_ARGUMENT_PREFIXES : Define the Prefixes for Argument Name.
+ *
CODEASSIST_FIELD_SUFFIXES : Define the Suffixes for Field Name.
+ *
CODEASSIST_STATIC_FIELD_SUFFIXES : Define the Suffixes for Static Field Name.
+ *
CODEASSIST_LOCAL_SUFFIXES : Define the Suffixes for Local Variable Name.
+ *
CODEASSIST_ARGUMENT_SUFFIXES : Define the Suffixes for Argument Name.
+ *
+ *
+ *
+ * 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.
+ *
+ * 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().
+ *
+ *
+ * @param javaProject project which contains the argument.
+ * @param argumentName argument's name.
+ * @return char[] the name without prefix and suffix.
+ * @see JavaCore#setOptions(java.util.Hashtable)
+ * @see JavaCore#getDefaultOptions()
+ */
+ public static char[] removePrefixAndSuffixForArgumentName(IJavaProject javaProject, char[] argumentName) {
+ AssistOptions assistOptions = new AssistOptions(javaProject.getOptions(true));
+ return removePrefixAndSuffix(
+ argumentName,
+ assistOptions.argumentPrefixes,
+ assistOptions.argumentSuffixes);
+ }
+
+ /**
+ * 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().
+ *
+ *
+ * @param javaProject project which contains the argument.
+ * @param argumentName argument's name.
+ * @return char[] the name without prefix and suffix.
+ * @see JavaCore#setOptions(java.util.Hashtable)
+ * @see JavaCore#getDefaultOptions()
+ */
+ public static String removePrefixAndSuffixForArgumentName(IJavaProject javaProject, String argumentName) {
+ return String.valueOf(removePrefixAndSuffixForArgumentName(javaProject, argumentName.toCharArray()));
+ }
+
+ /**
+ * 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().
+ *
+ *
+ * @param javaProject project which contains the field.
+ * @param fieldName field's name.
+ * @param modifiers field's modifiers as defined by the class
+ * 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().
+ *
+ *
+ * @param javaProject project which contains the field.
+ * @param fieldName field's name.
+ * @param modifiers field's modifiers as defined by the class
+ * 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().
+ *
+ *
+ * @param javaProject project which contains the variable.
+ * @param localName variable's name.
+ * @return char[] the name without prefix and suffix.
+ * @see JavaCore#setOptions(java.util.Hashtable)
+ * @see JavaCore#getDefaultOptions()
+ */
+ public static char[] removePrefixAndSuffixForLocalVariableName(IJavaProject javaProject, char[] localName) {
+ AssistOptions assistOptions = new AssistOptions(javaProject.getOptions(true));
+ return removePrefixAndSuffix(
+ localName,
+ assistOptions.argumentPrefixes,
+ assistOptions.argumentSuffixes);
+ }
+
+ /**
+ * 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().
+ *
+ *
+ * @param javaProject project which contains the variable.
+ * @param localName variable's name.
+ * @return char[] the name without prefix and suffix.
+ * @see JavaCore#setOptions(java.util.Hashtable)
+ * @see JavaCore#getDefaultOptions()
+ */
+ public static String removePrefixAndSuffixForLocalVariableName(IJavaProject javaProject, String localName) {
+ return String.valueOf(removePrefixAndSuffixForLocalVariableName(javaProject, localName.toCharArray()));
+ }
+
+ /**
+ * 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().
+ *
+ *
+ * @param javaProject project which contains the argument.
+ * @param packageName package of the argument's type.
+ * @param qualifiedTypeName argument's type.
+ * @param dim argument's dimension (0 if the argument is not an array).
+ * @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 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().
+ *
+ *
+ * @param javaProject project which contains the argument.
+ * @param packageName package of the argument's type.
+ * @param qualifiedTypeName argument's type.
+ * @param dim argument's dimension (0 if the argument is not an array).
+ * @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 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().
+ *
+ *
+ * @param javaProject project which contains the field.
+ * @param packageName package of the field's type.
+ * @param qualifiedTypeName field's type.
+ * @param dim field's dimension (0 if the field is not an array).
+ * @param modifiers field's modifiers as defined by the class
+ * 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().
+ *
+ *
+ * @param javaProject project which contains the field.
+ * @param packageName package of the field's type.
+ * @param qualifiedTypeName field's type.
+ * @param dim field's dimension (0 if the field is not an array).
+ * @param modifiers field's modifiers as defined by the class
+ * 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().
+ *
+ *
+ * @param javaProject project which contains the variable.
+ * @param packageName package of the variable's type.
+ * @param qualifiedTypeName variable's type.
+ * @param dim variable's dimension (0 if the variable is not an array).
+ * @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 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().
+ *
+ *
+ * @param javaProject project which contains the variable.
+ * @param packageName package of the variable's type.
+ * @param qualifiedTypeName variable's type.
+ * @param dim variable's dimension (0 if the variable is not an array).
+ * @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 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().
+ *
+ *
+ * @param project project which contains the field.
+ * @param fieldName field's name's.
+ * @param modifiers field's modifiers as defined by the class
+ * 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().
+ *
+ *
+ * @param project project which contains the field.
+ * @param fieldName field's name's.
+ * @param modifiers field's modifiers as defined by the class
+ * 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().
+ *
+ *
+ * @param project project which contains the field.
+ * @param fieldName field's name's.
+ * @param modifiers field's modifiers as defined by the class
+ * 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().
+ *
+ *
+ * @param project project which contains the field.
+ * @param fieldName field's name's.
+ * @param modifiers field's modifiers as defined by the class
+ * 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 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:
- * @param name the name of a .class file
- * @return a status object with code IStatus.OK if
- * the given name is valid as a .class file name, otherwise a status
- * object indicating what is wrong with the name
- */
-// 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:
+ *
+ *
major < <16 + minor : see predefined constants on ClassFileConstants
+ *
0 if the root is a source package fragment root or if a Java model exception occured
+ *
+ * Returns the jdk level
+ */
+ // public static long getJdkLevel(Object targetLibrary) {
+ // try {
+ // ClassFileReader reader = null;
+ // if (targetLibrary instanceof IFolder) {
+ // IFile classFile = findFirstClassFile((IFolder) targetLibrary); // only internal classfolders are allowed
+ // if (classFile != null) {
+ // byte[] bytes = Util.getResourceContentsAsByteArray(classFile);
+ // IPath location = classFile.getLocation();
+ // reader = new ClassFileReader(bytes, location == null ? null : location.toString().toCharArray());
+ // }
+ // } else {
+ // // root is a jar file or a zip file
+ // ZipFile jar = null;
+ // try {
+ // IPath path = null;
+ // if (targetLibrary instanceof IResource) {
+ // path = ((IResource)targetLibrary).getLocation();
+ // } else if (targetLibrary instanceof File){
+ // File f = (File) targetLibrary;
+ // if (!f.isDirectory()) {
+ // path = new Path(((File)targetLibrary).getPath());
+ // }
+ // }
+ // if (path != null) {
+ // jar = JavaModelManager.getJavaModelManager().getZipFile(path);
+ // for (Enumeration e= jar.entries(); e.hasMoreElements();) {
+ // ZipEntry member= (ZipEntry) e.nextElement();
+ // String entryName= member.getName();
+ // if (net.sourceforge.phpdt.internal.compiler.util.Util.isClassFileName(entryName)) {
+ // reader = ClassFileReader.read(jar, entryName);
+ // break;
+ // }
+ // }
+ // }
+ // } catch (CoreException e) {
+ // // ignore
+ // } finally {
+ // JavaModelManager.getJavaModelManager().closeZipFile(jar);
+ // }
+ // }
+ // if (reader != null) {
+ // return reader.getVersion();
+ // }
+ // } catch(JavaModelException e) {
+ // // ignore
+ // } catch(ClassFormatException e) {
+ // // ignore
+ // } catch(IOException e) {
+ // // ignore
+ // }
+ // return 0;
+ // }
+ /**
+ * 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 net.sourceforge.phpdt.internal.compiler.util.Util.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;
+ }
+
+ /**
+ * 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;
+ }
+
+ if (count != numberOfArg)
+ return null;
+
+ System.arraycopy(args, 0, args = new String[count], 0, count);
+ return args;
+ }
+
+ /**
+ * 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) {
+ // ignore
+ }
+ }
+ }
+
+ /**
+ * Returns the given file's contents as a character array.
+ */
+ public static char[] getResourceContentsAsCharArray(IFile file) throws JavaModelException {
+ // Get encoding from file
+ String encoding = null;
+ try {
+ encoding = file.getCharset();
+ } catch (CoreException ce) {
+ // do not use any encoding
+ }
+ return getResourceContentsAsCharArray(file, encoding);
+ }
+
+ public static char[] getResourceContentsAsCharArray(IFile file, String encoding) throws JavaModelException {
+ // Get resource contents
+ 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) {
+ // ignore
+ }
+ }
+ }
+
+ /**
+ * 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 the index of the most specific argument paths which is strictly enclosing the path to check
+ */
+ public static int indexOfEnclosingPath(IPath checkedPath, IPath[] paths, int pathCount) {
+
+ int bestMatch = -1, bestLength = -1;
+ for (int i = 0; i < pathCount; i++) {
+ if (paths[i].equals(checkedPath))
+ continue;
+ if (paths[i].isPrefixOf(checkedPath)) {
+ int currentLength = paths[i].segmentCount();
+ if (currentLength > bestLength) {
+ bestLength = currentLength;
+ bestMatch = i;
+ }
+ }
+ }
+ return bestMatch;
+ }
+
+ /*
+ * Returns the index of the first argument paths which is equal to the path to check
+ */
+ public static int indexOfMatchingPath(IPath checkedPath, IPath[] paths, int pathCount) {
+
+ for (int i = 0; i < pathCount; i++) {
+ if (paths[i].equals(checkedPath))
+ return i;
+ }
+ return -1;
+ }
+
+ /*
+ * Returns the index of the first argument paths which is strictly nested inside the path to check
+ */
+ public static int indexOfNestedPath(IPath checkedPath, IPath[] paths, int pathCount) {
+
+ for (int i = 0; i < pathCount; i++) {
+ if (checkedPath.equals(paths[i]))
+ continue;
+ if (checkedPath.isPrefixOf(paths[i]))
+ return i;
+ }
+ return -1;
+ }
+
+ /*
+ * Returns whether the given java element is exluded from its root's classpath. It doesn't check whether the root itself is on the
+ * classpath or not
+ */
+ public static final boolean isExcluded(IJavaElement element) {
+ int elementType = element.getElementType();
+ PackageFragmentRoot root = null;
+ IResource resource = null;
+ switch (elementType) {
+ case IJavaElement.JAVA_MODEL:
+ case IJavaElement.JAVA_PROJECT:
+ case IJavaElement.PACKAGE_FRAGMENT_ROOT:
+ return false;
+
+ // case IJavaElement.PACKAGE_FRAGMENT:
+ // PackageFragmentRoot root = (PackageFragmentRoot)element.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
+ // IResource resource = element.getResource();
+ // return resource != null && isExcluded(resource, root.fullInclusionPatternChars(), root.fullExclusionPatternChars());
+
+ case IJavaElement.COMPILATION_UNIT:
+ root = (PackageFragmentRoot) element.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
+ resource = element.getResource();
+ // if (resource != null && isExcluded(resource, root.fullInclusionPatternChars(), 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 inclusion/exclusion patterns. NOTE: should not be asked directly
+ * using pkg root pathes
+ *
+ * @see IClasspathEntry#getInclusionPatterns
+ * @see IClasspathEntry#getExclusionPatterns
+ */
+ public final static boolean isExcluded(IPath resourcePath, char[][] inclusionPatterns, char[][] exclusionPatterns,
+ boolean isFolderPath) {
+ if (inclusionPatterns == null && exclusionPatterns == null)
+ return false;
+ char[] path = resourcePath.toString().toCharArray();
+
+ inclusionCheck: if (inclusionPatterns != null) {
+ for (int i = 0, length = inclusionPatterns.length; i < length; i++) {
+ char[] pattern = inclusionPatterns[i];
+ char[] folderPattern = pattern;
+ if (isFolderPath) {
+ int lastSlash = CharOperation.lastIndexOf('/', pattern);
+ if (lastSlash != -1 && lastSlash != pattern.length - 1) { // trailing slash -> adds '**' for free (see
+ // http://ant.apache.org/manual/dirtasks.html)
+ int star = CharOperation.indexOf('*', pattern, lastSlash);
+ if ((star == -1 || star >= pattern.length - 1 || pattern[star + 1] != '*')) {
+ folderPattern = CharOperation.subarray(pattern, 0, lastSlash);
+ }
+ }
+ }
+ if (CharOperation.pathMatch(folderPattern, path, true, '/')) {
+ break inclusionCheck;
+ }
+ }
+ return true; // never included
+ }
+ if (isFolderPath) {
+ path = CharOperation.concat(path, new char[] { '*' }, '/');
+ }
+ exclusionCheck: if (exclusionPatterns != null) {
+ for (int i = 0, length = exclusionPatterns.length; i < length; i++) {
+ if (CharOperation.pathMatch(exclusionPatterns[i], path, true, '/')) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ 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
+ return isExcluded(path, null, exclusionPatterns, resource.getType() == IResource.FOLDER);
+ }
+
+ /*
+ * Returns whether the given resource matches one of the exclusion patterns. NOTE: should not be asked directly using pkg root
+ * pathes
+ *
+ * @see IClasspathEntry#getExclusionPatterns
+ */
+ public final static boolean isExcluded(IResource resource, char[][] inclusionPatterns, char[][] exclusionPatterns) {
+ IPath path = resource.getFullPath();
+ // ensure that folders are only excluded if all of their children are excluded
+ return isExcluded(path, inclusionPatterns, exclusionPatterns, resource.getType() == IResource.FOLDER);
+ }
+
+ /**
+ * Validate the given .class file name. A .class file name must obey the following rules:
+ *
+ *
it must not be null
+ *
it must include the ".class" suffix
+ *
its prefix must be a valid identifier
+ *
+ *
+ *
+ * @param name
+ * the name of a .class file
+ * @return a status object with code IStatus.OK if the given name is valid as a .class file name, otherwise a
+ * status object indicating what is wrong with the name
+ */
+ // 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:
+ *
+ *
it must not be null
+ *
it must include the ".java" suffix
+ *
its prefix must be a valid identifier
+ *
+ *
+ *
+ * @param name
+ * the name of a compilation unit
+ * @return a status object with code IStatus.OK if the given name is valid as a compilation unit name, otherwise a
+ * status object indicating what is wrong with the name
+ */
+ public static 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/ui/packageview/PackagesMessages.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/CodeGenerationMessages.java
similarity index 60%
rename from net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/packageview/PackagesMessages.java
rename to net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/CodeGenerationMessages.java
index 121b683..f1b2e7a 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/packageview/PackagesMessages.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/codemanipulation/CodeGenerationMessages.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
@@ -8,26 +8,25 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package net.sourceforge.phpdt.internal.ui.packageview;
+package net.sourceforge.phpdt.internal.corext.codemanipulation;
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$
+public class CodeGenerationMessages {
+ private static final String RESOURCE_BUNDLE= CodeGenerationMessages.class.getName();
private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
- private PackagesMessages() {
+ private CodeGenerationMessages() {
}
public static String getString(String key) {
try {
return fgResourceBundle.getString(key);
} catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+ return '!' + key + '!';
}
}
@@ -37,22 +36,16 @@ public class PackagesMessages {
* @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 });
+ 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, String[] args) {
- return MessageFormat.format(fgResourceBundle.getString(key), args);
+ 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.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 Stringlike 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:
*
*
creating various kinds of selection dialogs to present a collection
@@ -46,81 +46,81 @@ public final class JavaUI {
}
/**
- * The id of the Java plugin (value "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'.
*
*/
@@ -168,7 +168,37 @@ public class PreferenceConstants {
* @see #CODEGEN_USE_GETTERSETTER_SUFFIX
*/
public static final String CODEGEN_GETTERSETTER_SUFFIX = "net.sourceforge.phpdt.ui.gettersetter.suffix.list"; //$NON-NLS-1$
-
+ /**
+ * A named preference that controls whether the keyword "this" will be added
+ * automatically to field accesses in generated methods.
+ *
+ * Value is of type Boolean.
+ *
+ * @since 3.0
+ */
+ public static final String CODEGEN_KEYWORD_THIS= "org.eclipse.jdt.ui.keywordthis"; //$NON-NLS-1$
+
+ /**
+ * A named preference that controls whether to use the prefix "is" or the prefix "get" for
+ * automatically created getters which return a boolean field.
+ *
+ * Value is of type Boolean.
+ *
+ * @since 3.0
+ */
+ public static final String CODEGEN_IS_FOR_GETTERS= "org.eclipse.jdt.ui.gettersetter.use.is"; //$NON-NLS-1$
+
+
+ /**
+ * A named preference that defines the preferred variable names for exceptions in
+ * catch clauses.
+ *
+ * Value is of type String.
+ *
+ * @since 3.0
+ */
+ public static final String CODEGEN_EXCEPTION_VAR_NAME= "org.eclipse.jdt.ui.exception.name"; //$NON-NLS-1$
+
/**
* A named preference that controls if comment stubs will be added automatically to newly created types and methods.
*
@@ -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.
Package Specification
-Interfaces for contributions to the org.eclipse.jdt.ui.foldingStructureProviders extension point.
+Interfaces for contributions to the net.sourceforge.phpdt.ui.foldingStructureProviders extension point.