Parser detects wrong include files now
authoraxelcl <axelcl>
Wed, 29 Dec 2004 21:22:26 +0000 (21:22 +0000)
committeraxelcl <axelcl>
Wed, 29 Dec 2004 21:22:26 +0000 (21:22 +0000)
99 files changed:
net.sourceforge.phpeclipse/plugin.xml
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/DOMFactory.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/Compiler.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DocumentElementParser.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/SourceElementParser.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/CompilationUnit.java [deleted file]
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/env/ICompilationUnit.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Outlineable.java [deleted file]
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/OutlineableWithChildren.java [deleted file]
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/RecoveredElement.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/UnitParser.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/DefaultProblem.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/BasicCompilationUnit.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CommitWorkingCopyOperation.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnit.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitProblemFinder.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyElementsOperation.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyResourceElementsOperation.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelOperation.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelStatus.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProjectElementInfo.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/Openable.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragment.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRoot.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRootInfo.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ReconcileWorkingCopyOperation.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SetClasspathOperation.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceRefElement.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceType.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/AbstractImageBuilder.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/BatchImageBuilder.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/ClasspathDirectory.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/IncrementalImageBuilder.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/NameEnvironment.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/PHPBuilder.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/SourceFile.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/State.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/CompilationUnit.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/DOMField.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/SimpleDOMBuilder.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CommentRecorderParser.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/Util.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/JavaModelUtil.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/StreamUtil.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/PHPSourceViewerConfiguration.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPDocumentorAction.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPEclipseShowAction.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPExternalParserAction.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPOpenAllIncludesEditorAction.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPOpenDeclarationEditorAction.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPOpenIncludeEditorAction.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPOpenSQLTableEditorAction.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPRestartApacheAction.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStartApacheAction.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStartMySQLAction.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStopApacheAction.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/CompilationUnitDeclaration.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Expression.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteralDQ.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteralSQ.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/obfuscator/PHPIdentifier.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPAnnotationHover.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPDocumentProvider.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditorMessages.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPParserAction.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPString.java [deleted file]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPTextHover.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PresentationAction.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/HTMLCodeScanner.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/HTMLCompletionProcessor.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/HTMLWordExtractor.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPAutoIndentStrategy.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCodeScanner.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCompletionProcessor.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPDoubleClickSelector.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPEditorMessages.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPWordExtractor.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/SmartyCodeScanner.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/util/HTMLWordDetector.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/util/PHPColorProvider.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/util/PHPWhitespaceDetector.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/util/PHPWordDetector.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/views/PHPConsole.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/HTMLFileWizard.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/HTMLFileWizardPage.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/PHPFileWizard.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/PHPFileWizardPage.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/PHPWizardMessages.java

index cf3c6f1..e72b1bd 100644 (file)
             id="net.sourceforge.phpeclipse.phpeditor.JavaSelectRulerAction">
         </action>
       </editorContribution>
+      <editorContribution
+            id="net.sourceforge.phpdt.editor.actions" 
+            targetID="net.sourceforge.phpeclipse.PHPUnitEditor">
+         <action 
+               definitionId="net.sourceforge.phpeclipse.actions.opendeclaration"
+               label="Open PHP Declaration"
+               class="net.sourceforge.phpeclipse.actions.PHPOpenDeclarationEditorAction"
+               id="net.sourceforge.phpeclipse.actions.PHPOpenDeclarationEditorAction">
+         </action>
+      </editorContribution>
    </extension>
    <extension
          point="org.eclipse.ui.popupMenus">
             command="net.sourceforge.phpeclipse.ui.edit.text.php.goto.matching.bracket"
             configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
       </keyBinding>
+      
+      <command
+            name="Open PHP Declaration" 
+            description="Open PHP Declaration"
+            category="net.sourceforge.phpeclipse.ui.category.source"
+            id="net.sourceforge.phpeclipse.actions.opendeclaration">
+      </command>
+      <keyBinding
+            string="F3"
+            scope="net.sourceforge.phpdt.ui.phpEditorScope"
+            command="net.sourceforge.phpeclipse.actions.opendeclaration"
+            configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
+      </keyBinding>
    </extension>
    <extension
          id="net.sourceforge.phpeclipse.JavaDocumentSetupParticipant"
index 64872e2..e16da97 100644 (file)
@@ -1899,7 +1899,7 @@ public class JavaCore {
        // causing some grief
        //                              Platform.run(new ISafeRunnable() {
        //                                      public void handleException(Throwable exception) {
-       //                                              Util.log(exception, "Exception occurred in classpath container
+       //                                              ProjectPrefUtil.log(exception, "Exception occurred in classpath container
        // initializer: "+initializer); //$NON-NLS-1$
        //                                      }
        //                                      public void run() throws Exception {
@@ -2048,7 +2048,7 @@ public class JavaCore {
                // be causing some grief
                //                      Platform.run(new ISafeRunnable() {
                //                              public void handleException(Throwable exception) {
-               //                                      Util.log(exception, "Exception occurred in classpath variable
+               //                                      ProjectPrefUtil.log(exception, "Exception occurred in classpath variable
                // initializer: "+initializer+" while initializing variable:
                // "+variableName); //$NON-NLS-1$ //$NON-NLS-2$
                //                              }
@@ -2778,7 +2778,7 @@ public class JavaCore {
                                                        .isExported());
 
                                case IResource.FILE:
-                                       //                                      if (Util.isArchiveFileName(resolvedResource.getName())) {
+                                       //                                      if (ProjectPrefUtil.isArchiveFileName(resolvedResource.getName())) {
                                        //                                              // internal binary archive
                                        //                                              return JavaCore.newLibraryEntry(
                                        //                                                              resolvedPath,
@@ -3971,14 +3971,14 @@ public class JavaCore {
   //   if (JavaModelManager.CP_RESOLVE_VERBOSE){
   //           System.out.println("CPContainer SET - setting container:
   // ["+containerPath+"] for projects: {" //$NON-NLS-1$ //$NON-NLS-2$
-  //                   + (Util.toString(affectedProjects,
-  //                                   new Util.Displayable(){
+  //                   + (ProjectPrefUtil.toString(affectedProjects,
+  //                                   new ProjectPrefUtil.Displayable(){
   //                                           public String displayString(Object o) { return ((IJavaProject)
   // o).getElementName(); }
   //                                   }))
   //                   + "} with values: " //$NON-NLS-1$
-  //                   + (Util.toString(respectiveContainers,
-  //                                   new Util.Displayable(){
+  //                   + (ProjectPrefUtil.toString(respectiveContainers,
+  //                                   new ProjectPrefUtil.Displayable(){
   //                                           public String displayString(Object o) { return ((IClasspathContainer)
   // o).getDescription(); }
   //                                   }))
@@ -4331,8 +4331,8 @@ public class JavaCore {
   //           
   //   if (JavaModelManager.CP_RESOLVE_VERBOSE){
   //           System.out.println("CPVariable SET - setting variables: {" +
-  // Util.toString(variableNames) //$NON-NLS-1$
-  //                   + "} with values: " + Util.toString(variablePaths)); //$NON-NLS-1$
+  // ProjectPrefUtil.toString(variableNames) //$NON-NLS-1$
+  //                   + "} with values: " + ProjectPrefUtil.toString(variablePaths)); //$NON-NLS-1$
   //   }
   //
   //   int varLength = variableNames.length;
@@ -4445,7 +4445,7 @@ public class JavaCore {
   //                                                   if (JavaModelManager.CP_RESOLVE_VERBOSE){
   //                                                           System.out.println("CPVariable SET - updating affected project:
   // ["+project.getElementName()+"] due to setting variables: "+
-  // Util.toString(dbgVariableNames)); //$NON-NLS-1$ //$NON-NLS-2$
+  // ProjectPrefUtil.toString(dbgVariableNames)); //$NON-NLS-1$ //$NON-NLS-2$
   //                                                   }
   //                                                           
   //                                                   project
@@ -4465,7 +4465,7 @@ public class JavaCore {
   //           } catch (CoreException e) {
   //                   if (JavaModelManager.CP_RESOLVE_VERBOSE){
   //                           System.out.println("CPVariable SET - FAILED DUE TO EXCEPTION:
-  // "+Util.toString(dbgVariableNames)); //$NON-NLS-1$
+  // "+ProjectPrefUtil.toString(dbgVariableNames)); //$NON-NLS-1$
   //                           e.printStackTrace();
   //                   }
   //                   if (e instanceof JavaModelException) {
@@ -4514,7 +4514,7 @@ public class JavaCore {
   //           // process deltas since last activated in indexer thread so that indexes
   // are up-to-date.
   //           // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=38658
-  //           Job processSavedState = new Job(Util.bind("savedState.jobName")) {
+  //           Job processSavedState = new Job(ProjectPrefUtil.bind("savedState.jobName")) {
   // //$NON-NLS-1$
   //                   protected IStatus run(IProgressMonitor monitor) {
   //                           try {
index 20ef495..a803c26 100644 (file)
@@ -55,7 +55,7 @@ public IDOMCompilationUnit createCompilationUnit(String sourceCode, String name)
  * Method declared on IDOMFactory.
  */
 //public IDOMField createField() {
-//     return createField("Object aField;"+ Util.LINE_SEPARATOR); //$NON-NLS-1$
+//     return createField("Object aField;"+ ProjectPrefUtil.LINE_SEPARATOR); //$NON-NLS-1$
 //}
 ///* (non-Javadoc)
 // * Method declared on IDOMFactory.
@@ -85,7 +85,7 @@ public IDOMCompilationUnit createCompilationUnit(String sourceCode, String name)
  * Method declared on IDOMFactory.
  */
 //public IDOMInitializer createInitializer() {
-//     return createInitializer("static {}"+ Util.LINE_SEPARATOR); //$NON-NLS-1$
+//     return createInitializer("static {}"+ ProjectPrefUtil.LINE_SEPARATOR); //$NON-NLS-1$
 //}
 ///* (non-Javadoc)
 // * Method declared on IDOMFactory.
@@ -100,7 +100,7 @@ public IDOMCompilationUnit createCompilationUnit(String sourceCode, String name)
  * Method declared on IDOMFactory.
  */
 //public IDOMMethod createMethod() {
-//     return createMethod("public void newMethod() {"+ Util.LINE_SEPARATOR+"}"+ Util.LINE_SEPARATOR); //$NON-NLS-2$ //$NON-NLS-1$
+//     return createMethod("public void newMethod() {"+ ProjectPrefUtil.LINE_SEPARATOR+"}"+ ProjectPrefUtil.LINE_SEPARATOR); //$NON-NLS-2$ //$NON-NLS-1$
 //}
 ///* (non-Javadoc)
 // * Method declared on IDOMFactory.
@@ -130,19 +130,19 @@ public IDOMPackage createPackage() {
 // * Method declared on IDOMFactory.
 // */
 //public IDOMType createType() {
-//     return createType("public class AClass {"+ Util.LINE_SEPARATOR +"}"+ Util.LINE_SEPARATOR); //$NON-NLS-2$ //$NON-NLS-1$
+//     return createType("public class AClass {"+ ProjectPrefUtil.LINE_SEPARATOR +"}"+ ProjectPrefUtil.LINE_SEPARATOR); //$NON-NLS-2$ //$NON-NLS-1$
 //}
 /* (non-Javadoc)
  * Method declared on IDOMFactory.
  */
 //public IDOMType createClass() {
-//     return createType("public class AClass {"+ Util.LINE_SEPARATOR +"}"+ Util.LINE_SEPARATOR); //$NON-NLS-2$ //$NON-NLS-1$
+//     return createType("public class AClass {"+ ProjectPrefUtil.LINE_SEPARATOR +"}"+ ProjectPrefUtil.LINE_SEPARATOR); //$NON-NLS-2$ //$NON-NLS-1$
 //}
 ///* (non-Javadoc)
 // * Method declared on IDOMFactory.
 // */
 //public IDOMType createInterface() {
-//     return createType("public interface AnInterface {"+ Util.LINE_SEPARATOR +"}"+ Util.LINE_SEPARATOR); //$NON-NLS-2$ //$NON-NLS-1$
+//     return createType("public interface AnInterface {"+ ProjectPrefUtil.LINE_SEPARATOR +"}"+ ProjectPrefUtil.LINE_SEPARATOR); //$NON-NLS-2$ //$NON-NLS-1$
 //}
 /* (non-Javadoc)
  * Method declared on IDOMFactory.
index 07d33a0..8504d33 100644 (file)
@@ -31,6 +31,8 @@ import net.sourceforge.phpdt.internal.compiler.util.Util;
 import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
 import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
 
+import org.eclipse.core.resources.IResource;
+
 public class Compiler implements ITypeRequestor, ProblemSeverities {
   public UnitParser parser;
   public ICompilerRequestor requestor;
@@ -341,11 +343,11 @@ public class Compiler implements ITypeRequestor, ProblemSeverities {
     //         if (options.verbose) {
     //                 if (totalUnits > 1) {
     //                         System.out.println(
-    //                                 Util.bind("compilation.units" , String.valueOf(totalUnits)));
+    //                                 ProjectPrefUtil.bind("compilation.units" , String.valueOf(totalUnits)));
     // //$NON-NLS-1$
     //                 } else {
     //                         System.out.println(
-    //                                 Util.bind("compilation.unit" , String.valueOf(totalUnits)));
+    //                                 ProjectPrefUtil.bind("compilation.unit" , String.valueOf(totalUnits)));
     // //$NON-NLS-1$
     //                 }
     //         }
index 4bf670f..b2f8ef1 100644 (file)
@@ -1,13 +1,10 @@
-/*******************************************************************************
- * 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
+/***********************************************************************************************************************************
+ * 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
- *******************************************************************************/
+ * Contributors: IBM Corporation - initial API and implementation
+ **********************************************************************************************************************************/
 package net.sourceforge.phpdt.internal.compiler;
 
 import net.sourceforge.phpdt.core.compiler.IProblem;
@@ -18,1298 +15,1290 @@ import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation;
 import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
 import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
 
+import org.eclipse.core.resources.IResource;
 
 /*
- * A document element parser extracts structural information
- * from a piece of source, providing detailed source positions info.
- *
+ * A document element parser extracts structural information from a piece of source, providing detailed source positions info.
+ * 
  * also see @IDocumentElementRequestor
- *
- * The structural investigation includes:
- * - the package statement
- * - import statements
- * - top-level types: package member, member types (member types of member types...)
- * - fields
- * - methods
- *
+ * 
+ * The structural investigation includes: - the package statement - import statements - top-level types: package member, member
+ * types (member types of member types...) - fields - methods
+ * 
  * Any (parsing) problem encountered is also provided.
  */
 public class DocumentElementParser extends UnitParser {
-       IDocumentElementRequestor requestor;
-       private int localIntPtr;
-       private int lastFieldEndPosition;
-       private int lastFieldBodyEndPosition;   
-       private int typeStartPosition;
-       private long selectorSourcePositions;
-       private int typeDims;
-       private int extendsDim;
-       private int declarationSourceStart;
+  IDocumentElementRequestor requestor;
 
-       /* int[] stack for storing javadoc positions */
-       int[][] intArrayStack;
-       int intArrayPtr;
-       
-//     CompilerOptions options;
-       
-public DocumentElementParser(
-       final IDocumentElementRequestor requestor, 
-       IProblemFactory problemFactory,
-       CompilerOptions options) {
-       super(new ProblemReporter(
-               DefaultErrorHandlingPolicies.exitAfterAllProblems(), 
-               options, 
-               problemFactory) {
-               public void record(IProblem problem, CompilationResult unitResult) {
-                       requestor.acceptProblem(problem);
-               }
-       });
-//     false,
-//     options.sourceLevel >= CompilerOptions.JDK1_4);
-       this.requestor = requestor;
-       intArrayStack = new int[30][];
-       this.options = options;
-}
+  private int localIntPtr;
 
-/**
- *
- * INTERNAL USE-ONLY
- */
-//protected void adjustInterfaceModifiers() {
-//     intStack[intPtr - 2] |= AccInterface;
-//}
-/*
- * Will clear the comment stack when looking
- * for a potential JavaDoc which might contain @deprecated.
- *
- * Additionally, before investigating for @deprecated, retrieve the positions
- * of the JavaDoc comments so as to notify requestor with them.
- */
-//public void checkAnnotation() {
-//
-//     /* persisting javadoc positions */
-//     pushOnIntArrayStack(this.getJavaDocPositions());
-//     boolean deprecated = false;
-//     int lastAnnotationIndex = -1;
-//     int commentPtr = scanner.commentPtr;
-//
-//     //since jdk1.2 look only in the last java doc comment...
-//     nextComment : for (lastAnnotationIndex = scanner.commentPtr; lastAnnotationIndex >= 0; lastAnnotationIndex--){
-//             //look for @deprecated into the first javadoc comment preceeding the declaration
-//             int commentSourceStart = scanner.commentStarts[lastAnnotationIndex];
-//             // javadoc only (non javadoc comment have negative end positions.)
-//             if (modifiersSourceStart != -1 && modifiersSourceStart < commentSourceStart) {
-//                     continue nextComment;
-//             }
-//             if (scanner.commentStops[lastAnnotationIndex] < 0) {
-//                     continue nextComment;
-//             }
-//             int commentSourceEnd = scanner.commentStops[lastAnnotationIndex] - 1; //stop is one over
-//             char[] comment = scanner.source;
-//
-//             deprecated =
-//                     checkDeprecation(
-//                             commentSourceStart,
-//                             commentSourceEnd,
-//                             comment);
-//             break nextComment;
-//     }
-//     if (deprecated) {
-//             checkAndSetModifiers(AccDeprecated);
-//     }
-//     // modify the modifier source start to point at the first comment
-//     if (commentPtr >= 0) {
-//             declarationSourceStart = scanner.commentStarts[0];
-//     }
-//}
-/**
- *
- * INTERNAL USE-ONLY
- */
-//protected void consumeClassBodyDeclaration() {
-//     // ClassBodyDeclaration ::= Diet Block
-//     //push an Initializer
-//     //optimize the push/pop
-//
-//     super.consumeClassBodyDeclaration();
-//     Initializer initializer = (Initializer) astStack[astPtr];
-//     requestor.acceptInitializer(
-//             initializer.declarationSourceStart,
-//             initializer.declarationSourceEnd,
-//             intArrayStack[intArrayPtr--], 
-//             0,
-//             modifiersSourceStart, 
-//             initializer.block.sourceStart,
-//             initializer.block.sourceEnd);
-//}
-///**
-// *
-// * INTERNAL USE-ONLY
-// */
-//protected void consumeClassDeclaration() {
-//     super.consumeClassDeclaration();
-//     // we know that we have a TypeDeclaration on the top of the astStack
-//     if (isLocalDeclaration()) {
-//             // we ignore the local variable declarations
-//             return;
-//     }
-//     requestor.exitClass(endStatementPosition, // '}' is the end of the body 
-//      ((TypeDeclaration) astStack[astPtr]).declarationSourceEnd);
-//}
-///**
-// *
-// * INTERNAL USE-ONLY
-// */
-//protected void consumeClassHeader() {
-//     //ClassHeader ::= $empty
-//     super.consumeClassHeader();
-//     if (isLocalDeclaration()) {
-//             // we ignore the local variable declarations
-//             intArrayPtr--;
-//             return;
-//     }
-//     TypeDeclaration typeDecl = (TypeDeclaration) astStack[astPtr];
-//     TypeReference[] superInterfaces = typeDecl.superInterfaces;
-//     char[][] interfaceNames = null;
-//     int[] interfaceNameStarts = null;
-//     int[] interfaceNameEnds = null;
-//     if (superInterfaces != null) {
-//             int superInterfacesLength = superInterfaces.length;
-//             interfaceNames = new char[superInterfacesLength][];
-//             interfaceNameStarts = new int[superInterfacesLength];
-//             interfaceNameEnds = new int[superInterfacesLength];
-//             for (int i = 0; i < superInterfacesLength; i++) {
-//                     TypeReference superInterface = superInterfaces[i];
-//                     interfaceNames[i] = CharOperation.concatWith(superInterface.getTypeName(), '.'); 
-//                     interfaceNameStarts[i] = superInterface.sourceStart;
-//                     interfaceNameEnds[i] = superInterface.sourceEnd;
-//             }
-//     }
-//     // flush the comments related to the class header
-//     scanner.commentPtr = -1;
-//     TypeReference superclass = typeDecl.superclass;
-//     if (superclass == null) {
-//             requestor.enterClass(
-//                     typeDecl.declarationSourceStart, 
-//                     intArrayStack[intArrayPtr--], 
-//                     typeDecl.modifiers, 
-//                     typeDecl.modifiersSourceStart, 
-//                     typeStartPosition, 
-//                     typeDecl.name, 
-//                     typeDecl.sourceStart, 
-//                     typeDecl.sourceEnd, 
-//                     null, 
-//                     -1, 
-//                     -1, 
-//                     interfaceNames, 
-//                     interfaceNameStarts, 
-//                     interfaceNameEnds, 
-//                     scanner.currentPosition - 1); 
-//     } else {
-//             requestor.enterClass(
-//                     typeDecl.declarationSourceStart, 
-//                     intArrayStack[intArrayPtr--], 
-//                     typeDecl.modifiers, 
-//                     typeDecl.modifiersSourceStart, 
-//                     typeStartPosition, 
-//                     typeDecl.name, 
-//                     typeDecl.sourceStart, 
-//                     typeDecl.sourceEnd, 
-//                     CharOperation.concatWith(superclass.getTypeName(), '.'), 
-//                     superclass.sourceStart, 
-//                     superclass.sourceEnd, 
-//                     interfaceNames, 
-//                     interfaceNameStarts, 
-//                     interfaceNameEnds, 
-//                     scanner.currentPosition - 1); 
-//
-//     }
-//}
-//protected void consumeClassHeaderName() {
-//     // ClassHeaderName ::= Modifiersopt 'class' 'Identifier'
-//     TypeDeclaration typeDecl;
-//     if (nestedMethod[nestedType] == 0) {
-//             if (nestedType != 0) {
-//                     typeDecl = new MemberTypeDeclaration(this.compilationUnit.compilationResult);
-//             } else {
-//                     typeDecl = new TypeDeclaration(this.compilationUnit.compilationResult);
-//             }
-//     } else {
-//             // Record that the block has a declaration for local types
-//             typeDecl = new LocalTypeDeclaration(this.compilationUnit.compilationResult);
-//             markEnclosingMemberWithLocalType();
-//             blockReal();
-//     }
-//
-//     //highlight the name of the type
-//     long pos = identifierPositionStack[identifierPtr];
-//     typeDecl.sourceEnd = (int) pos;
-//     typeDecl.sourceStart = (int) (pos >>> 32);
-//     typeDecl.name = identifierStack[identifierPtr--];
-//     identifierLengthPtr--;
-//
-//     //compute the declaration source too
-//     // 'class' and 'interface' push an int position
-//     typeStartPosition = typeDecl.declarationSourceStart = intStack[intPtr--];
-//     intPtr--;
-//     int declarationSourceStart = intStack[intPtr--];
-//     typeDecl.modifiersSourceStart = intStack[intPtr--];
-//     typeDecl.modifiers = intStack[intPtr--];
-//     if (typeDecl.declarationSourceStart > declarationSourceStart) {
-//             typeDecl.declarationSourceStart = declarationSourceStart;
-//     }
-//     typeDecl.bodyStart = typeDecl.sourceEnd + 1;
-//     pushOnAstStack(typeDecl);
-//}
-///**
-// *
-// * INTERNAL USE-ONLY
-// */
-//protected void consumeCompilationUnit() {
-//     // CompilationUnit ::= EnterCompilationUnit PackageDeclarationopt ImportDeclarationsopt
-//     requestor.exitCompilationUnit(scanner.source.length - 1);
-//}
-/**
- *
- * INTERNAL USE-ONLY
- */
-//protected void consumeConstructorDeclaration() {
-//     // ConstructorDeclaration ::= ConstructorHeader ConstructorBody
-//     super.consumeConstructorDeclaration();
-//     if (isLocalDeclaration()) {
-//             // we ignore the local variable declarations
-//             return;
-//     }
-//     ConstructorDeclaration cd = (ConstructorDeclaration) astStack[astPtr];
-//     requestor.exitConstructor(endStatementPosition, cd.declarationSourceEnd);
-//}
-///**
-// *
-// * INTERNAL USE-ONLY
-// */
-//protected void consumeConstructorHeader() {
-//     // ConstructorHeader ::= ConstructorHeaderName MethodHeaderParameters MethodHeaderThrowsClauseopt
-//     super.consumeConstructorHeader();
-//     if (isLocalDeclaration()) {
-//             // we ignore the local variable declarations
-//             intArrayPtr--;
-//             return;
-//     }
-//     ConstructorDeclaration cd = (ConstructorDeclaration) astStack[astPtr];
-//     Argument[] arguments = cd.arguments;
-//     char[][] argumentTypes = null;
-//     char[][] argumentNames = null;
-//     int[] argumentTypeStarts = null;
-//     int[] argumentTypeEnds = null;
-//     int[] argumentNameStarts = null;
-//     int[] argumentNameEnds = null;
-//     if (arguments != null) {
-//             int argumentLength = arguments.length;
-//             argumentTypes = new char[argumentLength][];
-//             argumentNames = new char[argumentLength][];
-//             argumentNameStarts = new int[argumentLength];
-//             argumentNameEnds = new int[argumentLength];
-//             argumentTypeStarts = new int[argumentLength];
-//             argumentTypeEnds = new int[argumentLength];
-//             for (int i = 0; i < argumentLength; i++) {
-//                     Argument argument = arguments[i];
-//                     TypeReference argumentType = argument.type;
-//                     argumentTypes[i] = returnTypeName(argumentType);
-//                     argumentNames[i] = argument.name;
-//                     argumentNameStarts[i] = argument.sourceStart;
-//                     argumentNameEnds[i] = argument.sourceEnd;
-//                     argumentTypeStarts[i] = argumentType.sourceStart;
-//                     argumentTypeEnds[i] = argumentType.sourceEnd;
-//             }
-//     }
-//     TypeReference[] thrownExceptions = cd.thrownExceptions;
-//     char[][] exceptionTypes = null;
-//     int[] exceptionTypeStarts = null;
-//     int[] exceptionTypeEnds = null;
-//     if (thrownExceptions != null) {
-//             int thrownExceptionLength = thrownExceptions.length;
-//             exceptionTypes = new char[thrownExceptionLength][];
-//             exceptionTypeStarts = new int[thrownExceptionLength];
-//             exceptionTypeEnds = new int[thrownExceptionLength];
-//             for (int i = 0; i < thrownExceptionLength; i++) {
-//                     TypeReference exception = thrownExceptions[i];
-//                     exceptionTypes[i] = CharOperation.concatWith(exception.getTypeName(), '.');
-//                     exceptionTypeStarts[i] = exception.sourceStart;
-//                     exceptionTypeEnds[i] = exception.sourceEnd;
-//             }
-//     }
-//     requestor
-//             .enterConstructor(
-//                     cd.declarationSourceStart, 
-//                     intArrayStack[intArrayPtr--], 
-//                     cd.modifiers,
-//                     cd.modifiersSourceStart, 
-//                     cd.selector, 
-//                     cd.sourceStart, 
-//                     (int) (selectorSourcePositions & 0xFFFFFFFFL), 
-//                     // retrieve the source end of the name
-//                     argumentTypes, 
-//                     argumentTypeStarts, 
-//                     argumentTypeEnds, 
-//                     argumentNames, 
-//                     argumentNameStarts, 
-//                     argumentNameEnds, 
-//                     rParenPos, 
-//                     // right parenthesis
-//                     exceptionTypes, 
-//                     exceptionTypeStarts, 
-//                     exceptionTypeEnds, 
-//                     scanner.currentPosition - 1); 
-//}
-//protected void consumeConstructorHeaderName() {
-//     // ConstructorHeaderName ::=  Modifiersopt 'Identifier' '('
-//     ConstructorDeclaration cd = new ConstructorDeclaration(this.compilationUnit.compilationResult);
-//
-//     //name -- this is not really revelant but we do .....
-//     cd.selector = identifierStack[identifierPtr];
-//     selectorSourcePositions = identifierPositionStack[identifierPtr--];
-//     identifierLengthPtr--;
-//
-//     //modifiers
-//     cd.declarationSourceStart = intStack[intPtr--];
-//     cd.modifiersSourceStart = intStack[intPtr--];
-//     cd.modifiers = intStack[intPtr--];
-//
-//     //highlight starts at the selector starts
-//     cd.sourceStart = (int) (selectorSourcePositions >>> 32);
-//     pushOnAstStack(cd);
-//
-//     cd.sourceEnd = lParenPos;
-//     cd.bodyStart = lParenPos + 1;
-//}
-//protected void consumeDefaultModifiers() {
-//     checkAnnotation(); // might update modifiers with AccDeprecated
-//     pushOnIntStack(modifiers); // modifiers
-//     pushOnIntStack(-1);
-//     pushOnIntStack(
-//             declarationSourceStart >= 0 ? declarationSourceStart : scanner.startPosition); 
-//     resetModifiers();
-//}
-//protected void consumeDiet() {
-//     // Diet ::= $empty
-//     super.consumeDiet();
-//     /* persisting javadoc positions
-//      * Will be consume in consumeClassBodyDeclaration
-//      */
-//     pushOnIntArrayStack(this.getJavaDocPositions());        
-//}
-///**
-// *
-// * INTERNAL USE-ONLY
-// */
-//protected void consumeEnterCompilationUnit() {
-//     // EnterCompilationUnit ::= $empty
-//     requestor.enterCompilationUnit();
-//}
-///**
-// *
-// * INTERNAL USE-ONLY
-// */
-//protected void consumeEnterVariable() {
-//     // EnterVariable ::= $empty
-//     boolean isLocalDeclaration = isLocalDeclaration();
-//     if (!isLocalDeclaration && (variablesCounter[nestedType] != 0)) {
-//             requestor.exitField(lastFieldBodyEndPosition, lastFieldEndPosition);
-//     }
-//     char[] name = identifierStack[identifierPtr];
-//     long namePosition = identifierPositionStack[identifierPtr--];
-//     int extendedTypeDimension = intStack[intPtr--];
-//
-//     AbstractVariableDeclaration declaration;
-//     if (nestedMethod[nestedType] != 0) {
-//             // create the local variable declarations
-//             declaration = 
-//                     new LocalDeclaration(null, name, (int) (namePosition >>> 32), (int) namePosition); 
-//     } else {
-//             // create the field declaration
-//             declaration = 
-//                     new FieldDeclaration(null, name, (int) (namePosition >>> 32), (int) namePosition); 
-//     }
-//     identifierLengthPtr--;
-//     TypeReference type;
-//     int variableIndex = variablesCounter[nestedType];
-//     int typeDim = 0;
-//     if (variableIndex == 0) {
-//             // first variable of the declaration (FieldDeclaration or LocalDeclaration)
-//             if (nestedMethod[nestedType] != 0) {
-//                     // local declaration
-//                     declaration.declarationSourceStart = intStack[intPtr--];
-//                     declaration.modifiersSourceStart = intStack[intPtr--];
-//                     declaration.modifiers = intStack[intPtr--];
-//                     type = getTypeReference(typeDim = intStack[intPtr--]); // type dimension
-//                     pushOnAstStack(type);
-//             } else {
-//                     // field declaration
-//                     type = getTypeReference(typeDim = intStack[intPtr--]); // type dimension
-//                     pushOnAstStack(type);
-//                     declaration.declarationSourceStart = intStack[intPtr--];
-//                     declaration.modifiersSourceStart = intStack[intPtr--];
-//                     declaration.modifiers = intStack[intPtr--];
-//             }
-//     } else {
-//             type = (TypeReference) astStack[astPtr - variableIndex];
-//             typeDim = type.dimensions();
-//             AbstractVariableDeclaration previousVariable = 
-//                     (AbstractVariableDeclaration) astStack[astPtr]; 
-//             declaration.declarationSourceStart = previousVariable.declarationSourceStart;
-//             declaration.modifiers = previousVariable.modifiers;
-//             declaration.modifiersSourceStart = previousVariable.modifiersSourceStart;
-//     }
-//
-//     localIntPtr = intPtr;
-//
-//     if (extendedTypeDimension == 0) {
-//             declaration.type = type;
-//     } else {
-//             int dimension = typeDim + extendedTypeDimension;
-//             //on the identifierLengthStack there is the information about the type....
-//             int baseType;
-//             if ((baseType = identifierLengthStack[identifierLengthPtr + 1]) < 0) {
-//                     //it was a baseType
-//                     declaration.type = TypeReference.baseTypeReference(-baseType, dimension);
-//                     declaration.type.sourceStart = type.sourceStart;
-//                     declaration.type.sourceEnd = type.sourceEnd;
-//             } else {
-//                     declaration.type = this.copyDims(type, dimension);
-//             }
-//     }
-//     variablesCounter[nestedType]++;
-//     nestedMethod[nestedType]++;
-//     pushOnAstStack(declaration);
-//
-//     int[] javadocPositions = intArrayStack[intArrayPtr];
-//     if (!isLocalDeclaration) {
-//             requestor
-//                     .enterField(
-//                             declaration.declarationSourceStart, 
-//                             javadocPositions, 
-//                             declaration.modifiers, 
-//                             declaration.modifiersSourceStart, 
-//                             returnTypeName(declaration.type), 
-//                             type.sourceStart, 
-//                             type.sourceEnd, 
-//                             typeDims, 
-//                             name, 
-//                             (int) (namePosition >>> 32), 
-//                             (int) namePosition, 
-//                             extendedTypeDimension, 
-//                             extendedTypeDimension == 0 ? -1 : endPosition); 
-//     }
-//}
-///**
-// *
-// * INTERNAL USE-ONLY
-// */
-//protected void consumeExitVariableWithInitialization() {
-//     // ExitVariableWithInitialization ::= $empty
-//     // the scanner is located after the comma or the semi-colon.
-//     // we want to include the comma or the semi-colon
-//     super.consumeExitVariableWithInitialization();
-//     nestedMethod[nestedType]--;     
-//     lastFieldEndPosition = scanner.currentPosition - 1;
-//     lastFieldBodyEndPosition =      ((AbstractVariableDeclaration) astStack[astPtr]).initialization.sourceEnd;
-//}
-//protected void consumeExitVariableWithoutInitialization() {
-//     // ExitVariableWithoutInitialization ::= $empty
-//     // do nothing by default
-//     super.consumeExitVariableWithoutInitialization();
-//     nestedMethod[nestedType]--;     
-//     lastFieldEndPosition = scanner.currentPosition - 1;
-//     lastFieldBodyEndPosition = scanner.startPosition - 1;
-//}
-///**
-// *
-// * INTERNAL USE-ONLY
-// */
-//protected void consumeFieldDeclaration() {
-//     // See consumeLocalVariableDeclarationDefaultModifier() in case of change: duplicated code
-//     // FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';'
-//     // the super.consumeFieldDeclaration will reinitialize the variableCounter[nestedType]  
-//     int variableIndex = variablesCounter[nestedType];
-//     super.consumeFieldDeclaration();
-//     intArrayPtr--;
-//     if (isLocalDeclaration())
-//             return;
-//     if (variableIndex != 0) {
-//             requestor.exitField(lastFieldBodyEndPosition, lastFieldEndPosition);
-//     }
-//}
-//protected void consumeFormalParameter() {
-//     // FormalParameter ::= Type VariableDeclaratorId ==> false
-//     // FormalParameter ::= Modifiers Type VariableDeclaratorId ==> true
-//     /*
-//     astStack : 
-//     identifierStack : type identifier
-//     intStack : dim dim
-//      ==>
-//     astStack : Argument
-//     identifierStack :  
-//     intStack :  
-//     */
-//
-//     identifierLengthPtr--;
-//     char[] name = identifierStack[identifierPtr];
-//     long namePositions = identifierPositionStack[identifierPtr--];
-//     TypeReference type = getTypeReference(intStack[intPtr--] + intStack[intPtr--]);
-//     intPtr -= 3;
-//     Argument arg = 
-//             new Argument(
-//                     name, 
-//                     namePositions, 
-//                     type, 
-//                     intStack[intPtr + 1]); // modifiers
-//     pushOnAstStack(arg);
-//     intArrayPtr--;
-//}
-///**
-// *
-// * INTERNAL USE-ONLY
-// */
-//protected void consumeInterfaceDeclaration() {
-//     super.consumeInterfaceDeclaration();
-//     // we know that we have a TypeDeclaration on the top of the astStack
-//     if (isLocalDeclaration()) {
-//             // we ignore the local variable declarations
-//             return;
-//     }
-//     requestor.exitInterface(endStatementPosition, // the '}' is the end of the body
-//      ((TypeDeclaration) astStack[astPtr]).declarationSourceEnd);
-//}
-///**
-// *
-// * INTERNAL USE-ONLY
-// */
-//protected void consumeInterfaceHeader() {
-//     //InterfaceHeader ::= $empty
-//     super.consumeInterfaceHeader();
-//     if (isLocalDeclaration()) {
-//             // we ignore the local variable declarations
-//             intArrayPtr--;
-//             return;
-//     }
-//     TypeDeclaration typeDecl = (TypeDeclaration) astStack[astPtr];
-//     TypeReference[] superInterfaces = typeDecl.superInterfaces;
-//     char[][] interfaceNames = null;
-//     int[] interfaceNameStarts = null;
-//     int[] interfacenameEnds = null;
-//     int superInterfacesLength = 0;
-//     if (superInterfaces != null) {
-//             superInterfacesLength = superInterfaces.length;
-//             interfaceNames = new char[superInterfacesLength][];
-//             interfaceNameStarts = new int[superInterfacesLength];
-//             interfacenameEnds = new int[superInterfacesLength];
-//     }
-//     if (superInterfaces != null) {
-//             for (int i = 0; i < superInterfacesLength; i++) {
-//                     TypeReference superInterface = superInterfaces[i];
-//                     interfaceNames[i] = CharOperation.concatWith(superInterface.getTypeName(), '.'); 
-//                     interfaceNameStarts[i] = superInterface.sourceStart;
-//                     interfacenameEnds[i] = superInterface.sourceEnd;
-//             }
-//     }
-//     // flush the comments related to the interface header
-//     scanner.commentPtr = -1;
-//     requestor.enterInterface(
-//             typeDecl.declarationSourceStart, 
-//             intArrayStack[intArrayPtr--], 
-//             typeDecl.modifiers, 
-//             typeDecl.modifiersSourceStart, 
-//             typeStartPosition, 
-//             typeDecl.name, 
-//             typeDecl.sourceStart, 
-//             typeDecl.sourceEnd, 
-//             interfaceNames, 
-//             interfaceNameStarts, 
-//             interfacenameEnds, 
-//             scanner.currentPosition - 1); 
-//}
-//protected void consumeInterfaceHeaderName() {
-//     // InterfaceHeaderName ::= Modifiersopt 'interface' 'Identifier'
-//     TypeDeclaration typeDecl;
-//     if (nestedMethod[nestedType] == 0) {
-//             if (nestedType != 0) {
-//                     typeDecl = new MemberTypeDeclaration(this.compilationUnit.compilationResult);
-//             } else {
-//                     typeDecl = new TypeDeclaration(this.compilationUnit.compilationResult);
-//             }
-//     } else {
-//             // Record that the block has a declaration for local types
-//             typeDecl = new LocalTypeDeclaration(this.compilationUnit.compilationResult);
-//             markEnclosingMemberWithLocalType();
-//             blockReal();
-//     }
-//
-//     //highlight the name of the type
-//     long pos = identifierPositionStack[identifierPtr];
-//     typeDecl.sourceEnd = (int) pos;
-//     typeDecl.sourceStart = (int) (pos >>> 32);
-//     typeDecl.name = identifierStack[identifierPtr--];
-//     identifierLengthPtr--;
-//
-//     //compute the declaration source too
-//     // 'class' and 'interface' push an int position
-//     typeStartPosition = typeDecl.declarationSourceStart = intStack[intPtr--];
-//     intPtr--;
-//     int declarationSourceStart = intStack[intPtr--];
-//     typeDecl.modifiersSourceStart = intStack[intPtr--];
-//     typeDecl.modifiers = intStack[intPtr--];
-//     if (typeDecl.declarationSourceStart > declarationSourceStart) {
-//             typeDecl.declarationSourceStart = declarationSourceStart;
-//     }
-//     typeDecl.bodyStart = typeDecl.sourceEnd + 1;
-//     pushOnAstStack(typeDecl);
-//}
-///**
-// *
-// * INTERNAL USE-ONLY
-// */
-//protected void consumeLocalVariableDeclaration() {
-//     // See consumeLocalVariableDeclarationDefaultModifier() in case of change: duplicated code
-//     // FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';'
-//
-//     super.consumeLocalVariableDeclaration();
-//     intArrayPtr--;
-//}
-///**
-// *
-// * INTERNAL USE-ONLY
-// */
-//protected void consumeMethodDeclaration(boolean isNotAbstract) {
-//     // MethodDeclaration ::= MethodHeader MethodBody
-//     // AbstractMethodDeclaration ::= MethodHeader ';'
-//     super.consumeMethodDeclaration(isNotAbstract);
-//     if (isLocalDeclaration()) {
-//             // we ignore the local variable declarations
-//             return;
-//     }
-//     MethodDeclaration md = (MethodDeclaration) astStack[astPtr];
-//     requestor.exitMethod(endStatementPosition, md.declarationSourceEnd);
-//}
-///**
-// *
-// * INTERNAL USE-ONLY
-// */
-//protected void consumeMethodHeader() {
-//     // MethodHeader ::= MethodHeaderName MethodHeaderParameters MethodHeaderExtendedDims ThrowsClauseopt
-//     super.consumeMethodHeader();
-//     if (isLocalDeclaration()) {
-//             // we ignore the local variable declarations
-//             intArrayPtr--;
-//             return;
-//     }
-//     MethodDeclaration md = (MethodDeclaration) astStack[astPtr];
-//
-//     TypeReference returnType = md.returnType;
-//     char[] returnTypeName = returnTypeName(returnType);
-//     Argument[] arguments = md.arguments;
-//     char[][] argumentTypes = null;
-//     char[][] argumentNames = null;
-//     int[] argumentTypeStarts = null;
-//     int[] argumentTypeEnds = null;
-//     int[] argumentNameStarts = null;
-//     int[] argumentNameEnds = null;
-//     if (arguments != null) {
-//             int argumentLength = arguments.length;
-//             argumentTypes = new char[argumentLength][];
-//             argumentNames = new char[argumentLength][];
-//             argumentNameStarts = new int[argumentLength];
-//             argumentNameEnds = new int[argumentLength];
-//             argumentTypeStarts = new int[argumentLength];
-//             argumentTypeEnds = new int[argumentLength];
-//             for (int i = 0; i < argumentLength; i++) {
-//                     Argument argument = arguments[i];
-//                     TypeReference argumentType = argument.type;
-//                     argumentTypes[i] = returnTypeName(argumentType);
-//                     argumentNames[i] = argument.name;
-//                     argumentNameStarts[i] = argument.sourceStart;
-//                     argumentNameEnds[i] = argument.sourceEnd;
-//                     argumentTypeStarts[i] = argumentType.sourceStart;
-//                     argumentTypeEnds[i] = argumentType.sourceEnd;
-//             }
-//     }
-//     TypeReference[] thrownExceptions = md.thrownExceptions;
-//     char[][] exceptionTypes = null;
-//     int[] exceptionTypeStarts = null;
-//     int[] exceptionTypeEnds = null;
-//     if (thrownExceptions != null) {
-//             int thrownExceptionLength = thrownExceptions.length;
-//             exceptionTypeStarts = new int[thrownExceptionLength];
-//             exceptionTypeEnds = new int[thrownExceptionLength];
-//             exceptionTypes = new char[thrownExceptionLength][];
-//             for (int i = 0; i < thrownExceptionLength; i++) {
-//                     TypeReference exception = thrownExceptions[i];
-//                     exceptionTypes[i] = CharOperation.concatWith(exception.getTypeName(), '.');
-//                     exceptionTypeStarts[i] = exception.sourceStart;
-//                     exceptionTypeEnds[i] = exception.sourceEnd;
-//             }
-//     }
-//     requestor
-//             .enterMethod(
-//                     md.declarationSourceStart, 
-//                     intArrayStack[intArrayPtr--], 
-//                     md.modifiers, 
-//                     md.modifiersSourceStart, 
-//                     returnTypeName, 
-//                     returnType.sourceStart, 
-//                     returnType.sourceEnd, 
-//                     typeDims, 
-//                     md.selector, 
-//                     md.sourceStart, 
-//                     (int) (selectorSourcePositions & 0xFFFFFFFFL), 
-//                     argumentTypes, 
-//                     argumentTypeStarts, 
-//                     argumentTypeEnds, 
-//                     argumentNames, 
-//                     argumentNameStarts, 
-//                     argumentNameEnds, 
-//                     rParenPos, 
-//                     extendsDim, 
-//                     extendsDim == 0 ? -1 : endPosition, 
-//                     exceptionTypes, 
-//                     exceptionTypeStarts, 
-//                     exceptionTypeEnds, 
-//                     scanner.currentPosition - 1); 
-//}
-//protected void consumeMethodHeaderExtendedDims() {
-//     // MethodHeaderExtendedDims ::= Dimsopt
-//     // now we update the returnType of the method
-//     MethodDeclaration md = (MethodDeclaration) astStack[astPtr];
-//     int extendedDims = intStack[intPtr--];
-//     extendsDim = extendedDims;
-//     if (extendedDims != 0) {
-//             TypeReference returnType = md.returnType;
-//             md.sourceEnd = endPosition;
-//             int dims = returnType.dimensions() + extendedDims;
-//             int baseType;
-//             if ((baseType = identifierLengthStack[identifierLengthPtr + 1]) < 0) {
-//                     //it was a baseType
-//                     int sourceStart = returnType.sourceStart;
-//                     int sourceEnd = returnType.sourceEnd;
-//                     returnType = TypeReference.baseTypeReference(-baseType, dims);
-//                     returnType.sourceStart = sourceStart;
-//                     returnType.sourceEnd = sourceEnd;
-//                     md.returnType = returnType;
-//             } else {
-//                     md.returnType = this.copyDims(md.returnType, dims);
-//             }
-//             if (currentToken == TokenNameLBRACE) {
-//                     md.bodyStart = endPosition + 1;
-//             }
-//     }
-//}
-//protected void consumeMethodHeaderName() {
-//     // MethodHeaderName ::= Modifiersopt Type 'Identifier' '('
-//     MethodDeclaration md = new MethodDeclaration(this.compilationUnit.compilationResult);
-//
-//     //name
-//     md.selector = identifierStack[identifierPtr];
-//     selectorSourcePositions = identifierPositionStack[identifierPtr--];
-//     identifierLengthPtr--;
-//     //type
-//     md.returnType = getTypeReference(typeDims = intStack[intPtr--]);
-//     //modifiers
-//     md.declarationSourceStart = intStack[intPtr--];
-//     md.modifiersSourceStart = intStack[intPtr--];
-//     md.modifiers = intStack[intPtr--];
-//
-//     //highlight starts at selector start
-//     md.sourceStart = (int) (selectorSourcePositions >>> 32);
-//     pushOnAstStack(md);
-//     md.bodyStart = scanner.currentPosition-1;
-//}
-//protected void consumeModifiers() {
-//     checkAnnotation(); // might update modifiers with AccDeprecated
-//     pushOnIntStack(modifiers); // modifiers
-//     pushOnIntStack(modifiersSourceStart);
-//     pushOnIntStack(
-//             declarationSourceStart >= 0 ? declarationSourceStart : modifiersSourceStart); 
-//     resetModifiers();
-//}
-/**
- *
- * INTERNAL USE-ONLY
- */
-//protected void consumePackageDeclarationName() {
-//     /* persisting javadoc positions */
-//     pushOnIntArrayStack(this.getJavaDocPositions());
-//
-//     super.consumePackageDeclarationName();
-//     ImportReference importReference = compilationUnit.currentPackage;
-//
-//     requestor.acceptPackage(
-//             importReference.declarationSourceStart, 
-//             importReference.declarationSourceEnd, 
-//             intArrayStack[intArrayPtr--], 
-//             CharOperation.concatWith(importReference.getImportName(), '.'),
-//             importReference.sourceStart);
-//}
-//protected void consumePushModifiers() {
-//     checkAnnotation(); // might update modifiers with AccDeprecated
-//     pushOnIntStack(modifiers); // modifiers
-//     if (modifiersSourceStart < 0) {
-//             pushOnIntStack(-1);
-//             pushOnIntStack(
-//                     declarationSourceStart >= 0 ? declarationSourceStart : scanner.startPosition); 
-//     } else {
-//             pushOnIntStack(modifiersSourceStart);
-//             pushOnIntStack(
-//                     declarationSourceStart >= 0 ? declarationSourceStart : modifiersSourceStart); 
-//     }
-//     resetModifiers();
-//}
-///**
-// *
-// * INTERNAL USE-ONLY
-// */
-//protected void consumeSingleTypeImportDeclarationName() {
-//     // SingleTypeImportDeclarationName ::= 'import' Name
-//
-//     /* persisting javadoc positions */
-//     pushOnIntArrayStack(this.getJavaDocPositions());
-//
-//     super.consumeSingleTypeImportDeclarationName();
-//     ImportReference importReference = (ImportReference) astStack[astPtr];
-//     requestor.acceptImport(
-//             importReference.declarationSourceStart, 
-//             importReference.declarationSourceEnd,
-//             intArrayStack[intArrayPtr--],
-//             CharOperation.concatWith(importReference.getImportName(), '.'),
-//             importReference.sourceStart,
-//             false);
-//}
-///**
-// *
-// * INTERNAL USE-ONLY
-// */
-//protected void consumeStaticInitializer() {
-//     // StaticInitializer ::=  StaticOnly Block
-//     //push an Initializer
-//     //optimize the push/pop
-//     super.consumeStaticInitializer();
-//     Initializer initializer = (Initializer) astStack[astPtr];
-//     requestor.acceptInitializer(
-//             initializer.declarationSourceStart,
-//             initializer.declarationSourceEnd,
-//             intArrayStack[intArrayPtr--],
-//             AccStatic, 
-//             intStack[intPtr--], 
-//             initializer.block.sourceStart,
-//             initializer.declarationSourceEnd);
-//}
-//protected void consumeStaticOnly() {
-//     // StaticOnly ::= 'static'
-//     checkAnnotation(); // might update declaration source start
-//     pushOnIntStack(modifiersSourceStart);
-//     pushOnIntStack(
-//             declarationSourceStart >= 0 ? declarationSourceStart : modifiersSourceStart); 
-//     jumpOverMethodBody();
-//     nestedMethod[nestedType]++;
-//     resetModifiers();
-//}
-///**
-// *
-// * INTERNAL USE-ONLY
-// */
-//protected void consumeTypeImportOnDemandDeclarationName() {
-//     // TypeImportOnDemandDeclarationName ::= 'import' Name '.' '*'
-//
-//     /* persisting javadoc positions */
-//     pushOnIntArrayStack(this.getJavaDocPositions());
-//
-//     super.consumeTypeImportOnDemandDeclarationName();
-//     ImportReference importReference = (ImportReference) astStack[astPtr];
-//     requestor.acceptImport(
-//             importReference.declarationSourceStart, 
-//             importReference.declarationSourceEnd,
-//             intArrayStack[intArrayPtr--],
-//             CharOperation.concatWith(importReference.getImportName(), '.'), 
-//             importReference.sourceStart,
-//             true);
-//}
-public CompilationUnitDeclaration endParse(int act) {
-       if (scanner.recordLineSeparator) {
-               requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
-       }
-       return super.endParse(act);
-}
-/*
- * Flush annotations defined prior to a given positions.
- *
- * Note: annotations are stacked in syntactical order
- *
- * Either answer given <position>, or the end position of a comment line 
- * immediately following the <position> (same line)
- *
- * e.g.
- * void foo(){
- * } // end of method foo
- */
-//public int flushAnnotationsDefinedPriorTo(int position) {
-//
-//     return lastFieldEndPosition = super.flushAnnotationsDefinedPriorTo(position);
-//}
-//protected TypeReference getTypeReference(int dim) { /* build a Reference on a variable that may be qualified or not
-//This variable is a type reference and dim will be its dimensions*/
-//
-//     int length;
-//     TypeReference ref;
-//     if ((length = identifierLengthStack[identifierLengthPtr--]) == 1) {
-//             // single variable reference
-//             if (dim == 0) {
-//                     ref = 
-//                             new SingleTypeReference(
-//                                     identifierStack[identifierPtr], 
-//                                     identifierPositionStack[identifierPtr--]); 
-//             } else {
-//                     ref = 
-//                             new ArrayTypeReference(
-//                                     identifierStack[identifierPtr], 
-//                                     dim, 
-//                                     identifierPositionStack[identifierPtr--]); 
-//                     ref.sourceEnd = endPosition;
-//             }
-//     } else {
-//             if (length < 0) { //flag for precompiled type reference on base types
-//                     ref = TypeReference.baseTypeReference(-length, dim);
-//                     ref.sourceStart = intStack[intPtr--];
-//                     if (dim == 0) {
-//                             ref.sourceEnd = intStack[intPtr--];
-//                     } else {
-//                             intPtr--;
-//                             ref.sourceEnd = endPosition;
-//                     }
-//             } else { //Qualified variable reference
-//                     char[][] tokens = new char[length][];
-//                     identifierPtr -= length;
-//                     long[] positions = new long[length];
-//                     System.arraycopy(identifierStack, identifierPtr + 1, tokens, 0, length);
-//                     System.arraycopy(
-//                             identifierPositionStack, 
-//                             identifierPtr + 1, 
-//                             positions, 
-//                             0, 
-//                             length); 
-//                     if (dim == 0) {
-//                             ref = new QualifiedTypeReference(tokens, positions);
-//                     } else {
-//                             ref = new ArrayQualifiedTypeReference(tokens, dim, positions);
-//                             ref.sourceEnd = endPosition;
-//                     }
-//             }
-//     };
-//     return ref;
-//}
-public void initialize() {
-       //positionning the parser for a new compilation unit
-       //avoiding stack reallocation and all that....
-       super.initialize(false);
-       intArrayPtr = -1;
-}
-/**
- *
- * INTERNAL USE-ONLY
- */
-//private boolean isLocalDeclaration() {
-//     int nestedDepth = nestedType;
-//     while (nestedDepth >= 0) {
-//             if (nestedMethod[nestedDepth] != 0) {
-//                     return true;
-//             }
-//             nestedDepth--;
-//     }
-//     return false;
-//}
-/*
- * Investigate one entire unit.
- */
-public void parseCompilationUnit(ICompilationUnit unit) {
-       char[] regionSource = unit.getContents();
-       try {
-               initialize();
-               goForCompilationUnit();
-               referenceContext =
-                       compilationUnit = 
-                               compilationUnit = 
-                                       new CompilationUnitDeclaration(
-                                               problemReporter(), 
-                                               new CompilationResult(unit, 0, 0, 10), //this.options.maxProblemsPerUnit), 
-                                               regionSource.length); 
-               scanner.resetTo(0, regionSource.length);
-               scanner.setSource(regionSource);
-               parse();
-       } catch (AbortCompilation ex) {
-       }
-}
-/*
- * Investigate one constructor declaration.
- */
-//public void parseConstructor(char[] regionSource) {
-//     try {
-//             initialize();
-//             goForClassBodyDeclarations();
-//             referenceContext = 
-//                     compilationUnit = 
-//                             compilationUnit = 
-//                                     new CompilationUnitDeclaration(
-//                                             problemReporter(), 
-//                                             new CompilationResult(regionSource, 0, 0, 10), //this.options.maxProblemsPerUnit), 
-//                                             regionSource.length); 
-//             scanner.resetTo(0, regionSource.length);
-//             scanner.setSource(regionSource);
-//             parse();
-//     } catch (AbortCompilation ex) {
-//     }
-//}
-/*
- * Investigate one field declaration statement (might have multiple declarations in it).
- */
-//public void parseField(char[] regionSource) {
-//     try {
-//             initialize();
-//             goForFieldDeclaration();
-//             referenceContext = 
-//                     compilationUnit = 
-//                             compilationUnit = 
-//                                     new CompilationUnitDeclaration(
-//                                             problemReporter(), 
-//                                             new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit), 
-//                                             regionSource.length); 
-//             scanner.resetTo(0, regionSource.length);
-//             scanner.setSource(regionSource);
-//             parse();
-//     } catch (AbortCompilation ex) {
-//     }
-//
-//}
-///*
-// * Investigate one import statement declaration.
-// */
-//public void parseImport(char[] regionSource) {
-//     try {
-//             initialize();
-//             goForImportDeclaration();
-//             referenceContext = 
-//                     compilationUnit = 
-//                             compilationUnit = 
-//                                     new CompilationUnitDeclaration(
-//                                             problemReporter(), 
-//                                             new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit), 
-//                                             regionSource.length); 
-//             scanner.resetTo(0, regionSource.length);
-//             scanner.setSource(regionSource);
-//             parse();
-//     } catch (AbortCompilation ex) {
-//     }
-//
-//}
-///*
-// * Investigate one initializer declaration.
-// * regionSource need to content exactly an initializer declaration.
-// * e.g: static { i = 4; }
-// * { name = "test"; }
-// */
-//public void parseInitializer(char[] regionSource) {
-//     try {
-//             initialize();
-//             goForInitializer();
-//             referenceContext = 
-//                     compilationUnit = 
-//                             compilationUnit = 
-//                                     new CompilationUnitDeclaration(
-//                                             problemReporter(), 
-//                                             new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit), 
-//                                             regionSource.length); 
-//             scanner.resetTo(0, regionSource.length);
-//             scanner.setSource(regionSource);
-//             parse();
-//     } catch (AbortCompilation ex) {
-//     }
-//
-//}
-///*
-// * Investigate one method declaration.
-// */
-//public void parseMethod(char[] regionSource) {
-//     try {
-//             initialize();
-//             goForGenericMethodDeclaration();
-//             referenceContext = 
-//                     compilationUnit = 
-//                             compilationUnit = 
-//                                     new CompilationUnitDeclaration(
-//                                             problemReporter(), 
-//                                             new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit), 
-//                                             regionSource.length); 
-//             scanner.resetTo(0, regionSource.length);
-//             scanner.setSource(regionSource);
-//             parse();
-//     } catch (AbortCompilation ex) {
-//     }
-//
-//}
-///*
-// * Investigate one package statement declaration.
-// */
-//public void parsePackage(char[] regionSource) {
-//     try {
-//             initialize();
-//             goForPackageDeclaration();
-//             referenceContext = 
-//                     compilationUnit = 
-//                             compilationUnit = 
-//                                     new CompilationUnitDeclaration(
-//                                             problemReporter(), 
-//                                             new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit), 
-//                                             regionSource.length); 
-//             scanner.resetTo(0, regionSource.length);
-//             scanner.setSource(regionSource);
-//             parse();
-//     } catch (AbortCompilation ex) {
-//     }
-//
-//}
-///*
-// * Investigate one type declaration, its fields, methods and member types.
-// */
-//public void parseType(char[] regionSource) {
-//     try {
-//             initialize();
-//             goForTypeDeclaration();
-//             referenceContext = 
-//                     compilationUnit = 
-//                             compilationUnit = 
-//                                     new CompilationUnitDeclaration(
-//                                             problemReporter(), 
-//                                             new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit), 
-//                                             regionSource.length); 
-//             scanner.resetTo(0, regionSource.length);
-//             scanner.setSource(regionSource);
-//             parse();
-//     } catch (AbortCompilation ex) {
-//     }
-//
-//}
-/**
- * Returns this parser's problem reporter initialized with its reference context.
- * Also it is assumed that a problem is going to be reported, so initializes
- * the compilation result's line positions.
- */
-public ProblemReporter problemReporter() {
-       problemReporter.referenceContext = referenceContext;
-       return problemReporter;
-}
-protected void pushOnIntArrayStack(int[] positions) {
+  private int lastFieldEndPosition;
 
-       try {
-               intArrayStack[++intArrayPtr] = positions;
-       } catch (IndexOutOfBoundsException e) {
-               //intPtr is correct 
-               int oldStackLength = intArrayStack.length;
-               int oldStack[][] = intArrayStack;
-               intArrayStack = new int[oldStackLength + StackIncrement][];
-               System.arraycopy(oldStack, 0, intArrayStack, 0, oldStackLength);
-               intArrayStack[intArrayPtr] = positions;
-       }
-}
-//protected void resetModifiers() {
-//     super.resetModifiers();
-//     declarationSourceStart = -1;
-//}
-/*
- * Syntax error was detected. Will attempt to perform some recovery action in order
- * to resume to the regular parse loop.
- */
-protected boolean resumeOnSyntaxError() {
-       return false;
-}
-/*
- * Answer a char array representation of the type name formatted like:
- * - type name + dimensions
- * Example:
- * "A[][]".toCharArray()
- * "java.lang.String".toCharArray()
- */
-//private char[] returnTypeName(TypeReference type) {
-//     int dimension = type.dimensions();
-//     if (dimension != 0) {
-//             char[] dimensionsArray = new char[dimension * 2];
-//             for (int i = 0; i < dimension; i++) {
-//                     dimensionsArray[i*2] = '[';
-//                     dimensionsArray[(i*2) + 1] = ']';
-//             }
-//             return CharOperation.concat(
-//                     CharOperation.concatWith(type.getTypeName(), '.'), 
-//                     dimensionsArray); 
-//     }
-//     return CharOperation.concatWith(type.getTypeName(), '.');
-//}
-//public String toString() {
-//     StringBuffer buffer = new StringBuffer();
-//     buffer.append("intArrayPtr = " + intArrayPtr + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
-//     buffer.append(super.toString());
-//     return buffer.toString();
-//}
-///**
-// * INTERNAL USE ONLY
-// */
-//protected TypeReference typeReference(
-//     int dim,
-//     int localIdentifierPtr, 
-//     int localIdentifierLengthPtr) {
-//     /* build a Reference on a variable that may be qualified or not
-//      * This variable is a type reference and dim will be its dimensions.
-//      * We don't have any side effect on the stacks' pointers.
-//      */
-//
-//     int length;
-//     TypeReference ref;
-//     if ((length = identifierLengthStack[localIdentifierLengthPtr]) == 1) {
-//             // single variable reference
-//             if (dim == 0) {
-//                     ref = 
-//                             new SingleTypeReference(
-//                                     identifierStack[localIdentifierPtr], 
-//                                     identifierPositionStack[localIdentifierPtr--]); 
-//             } else {
-//                     ref = 
-//                             new ArrayTypeReference(
-//                                     identifierStack[localIdentifierPtr], 
-//                                     dim, 
-//                                     identifierPositionStack[localIdentifierPtr--]); 
-//                     ref.sourceEnd = endPosition;                            
-//             }
-//     } else {
-//             if (length < 0) { //flag for precompiled type reference on base types
-//                     ref = TypeReference.baseTypeReference(-length, dim);
-//                     ref.sourceStart = intStack[localIntPtr--];
-//                     if (dim == 0) {
-//                             ref.sourceEnd = intStack[localIntPtr--];
-//                     } else {
-//                             localIntPtr--;
-//                             ref.sourceEnd = endPosition;
-//                     }
-//             } else { //Qualified variable reference
-//                     char[][] tokens = new char[length][];
-//                     localIdentifierPtr -= length;
-//                     long[] positions = new long[length];
-//                     System.arraycopy(identifierStack, localIdentifierPtr + 1, tokens, 0, length);
-//                     System.arraycopy(
-//                             identifierPositionStack, 
-//                             localIdentifierPtr + 1, 
-//                             positions, 
-//                             0, 
-//                             length); 
-//                     if (dim == 0)
-//                             ref = new QualifiedTypeReference(tokens, positions);
-//                     else
-//                             ref = new ArrayQualifiedTypeReference(tokens, dim, positions);
-//             }
-//     };
-//     return ref;
-//}
-}
+  private int lastFieldBodyEndPosition;
+
+  private int typeStartPosition;
+
+  private long selectorSourcePositions;
+
+  private int typeDims;
+
+  private int extendsDim;
+
+  private int declarationSourceStart;
+
+  /* int[] stack for storing javadoc positions */
+  int[][] intArrayStack;
+
+  int intArrayPtr;
+
+  //   CompilerOptions options;
+
+  public DocumentElementParser(final IDocumentElementRequestor requestor, IProblemFactory problemFactory,
+      CompilerOptions options) {
+    super(new ProblemReporter(DefaultErrorHandlingPolicies.exitAfterAllProblems(), options, problemFactory) {
+      public void record(IProblem problem, CompilationResult unitResult) {
+        requestor.acceptProblem(problem);
+      }
+    });
+    // false,
+    // options.sourceLevel >= CompilerOptions.JDK1_4);
+    this.requestor = requestor;
+    intArrayStack = new int[30][];
+    this.options = options;
+  }
+
+  /**
+   * 
+   * INTERNAL USE-ONLY
+   */
+  //protected void adjustInterfaceModifiers() {
+  //   intStack[intPtr - 2] |= AccInterface;
+  //}
+  /*
+   * Will clear the comment stack when looking for a potential JavaDoc which might contain @deprecated.
+   * 
+   * Additionally, before investigating for @deprecated, retrieve the positions of the JavaDoc comments so as to notify requestor
+   * with them.
+   */
+  //public void checkAnnotation() {
+  //
+  //   /* persisting javadoc positions */
+  //   pushOnIntArrayStack(this.getJavaDocPositions());
+  //   boolean deprecated = false;
+  //   int lastAnnotationIndex = -1;
+  //   int commentPtr = scanner.commentPtr;
+  //
+  //   //since jdk1.2 look only in the last java doc comment...
+  //   nextComment : for (lastAnnotationIndex = scanner.commentPtr; lastAnnotationIndex >= 0; lastAnnotationIndex--){
+  //           //look for @deprecated into the first javadoc comment preceeding the declaration
+  //           int commentSourceStart = scanner.commentStarts[lastAnnotationIndex];
+  //           // javadoc only (non javadoc comment have negative end positions.)
+  //           if (modifiersSourceStart != -1 && modifiersSourceStart < commentSourceStart) {
+  //                   continue nextComment;
+  //           }
+  //           if (scanner.commentStops[lastAnnotationIndex] < 0) {
+  //                   continue nextComment;
+  //           }
+  //           int commentSourceEnd = scanner.commentStops[lastAnnotationIndex] - 1; //stop is one over
+  //           char[] comment = scanner.source;
+  //
+  //           deprecated =
+  //                   checkDeprecation(
+  //                           commentSourceStart,
+  //                           commentSourceEnd,
+  //                           comment);
+  //           break nextComment;
+  //   }
+  //   if (deprecated) {
+  //           checkAndSetModifiers(AccDeprecated);
+  //   }
+  //   // modify the modifier source start to point at the first comment
+  //   if (commentPtr >= 0) {
+  //           declarationSourceStart = scanner.commentStarts[0];
+  //   }
+  //}
+  /**
+   * 
+   * INTERNAL USE-ONLY
+   */
+  //protected void consumeClassBodyDeclaration() {
+  //   // ClassBodyDeclaration ::= Diet Block
+  //   //push an Initializer
+  //   //optimize the push/pop
+  //
+  //   super.consumeClassBodyDeclaration();
+  //   Initializer initializer = (Initializer) astStack[astPtr];
+  //   requestor.acceptInitializer(
+  //           initializer.declarationSourceStart,
+  //           initializer.declarationSourceEnd,
+  //           intArrayStack[intArrayPtr--],
+  //           0,
+  //           modifiersSourceStart,
+  //           initializer.block.sourceStart,
+  //           initializer.block.sourceEnd);
+  //}
+  ///**
+  // *
+  // * INTERNAL USE-ONLY
+  // */
+  //protected void consumeClassDeclaration() {
+  //   super.consumeClassDeclaration();
+  //   // we know that we have a TypeDeclaration on the top of the astStack
+  //   if (isLocalDeclaration()) {
+  //           // we ignore the local variable declarations
+  //           return;
+  //   }
+  //   requestor.exitClass(endStatementPosition, // '}' is the end of the body
+  //    ((TypeDeclaration) astStack[astPtr]).declarationSourceEnd);
+  //}
+  ///**
+  // *
+  // * INTERNAL USE-ONLY
+  // */
+  //protected void consumeClassHeader() {
+  //   //ClassHeader ::= $empty
+  //   super.consumeClassHeader();
+  //   if (isLocalDeclaration()) {
+  //           // we ignore the local variable declarations
+  //           intArrayPtr--;
+  //           return;
+  //   }
+  //   TypeDeclaration typeDecl = (TypeDeclaration) astStack[astPtr];
+  //   TypeReference[] superInterfaces = typeDecl.superInterfaces;
+  //   char[][] interfaceNames = null;
+  //   int[] interfaceNameStarts = null;
+  //   int[] interfaceNameEnds = null;
+  //   if (superInterfaces != null) {
+  //           int superInterfacesLength = superInterfaces.length;
+  //           interfaceNames = new char[superInterfacesLength][];
+  //           interfaceNameStarts = new int[superInterfacesLength];
+  //           interfaceNameEnds = new int[superInterfacesLength];
+  //           for (int i = 0; i < superInterfacesLength; i++) {
+  //                   TypeReference superInterface = superInterfaces[i];
+  //                   interfaceNames[i] = CharOperation.concatWith(superInterface.getTypeName(), '.');
+  //                   interfaceNameStarts[i] = superInterface.sourceStart;
+  //                   interfaceNameEnds[i] = superInterface.sourceEnd;
+  //           }
+  //   }
+  //   // flush the comments related to the class header
+  //   scanner.commentPtr = -1;
+  //   TypeReference superclass = typeDecl.superclass;
+  //   if (superclass == null) {
+  //           requestor.enterClass(
+  //                   typeDecl.declarationSourceStart,
+  //                   intArrayStack[intArrayPtr--],
+  //                   typeDecl.modifiers,
+  //                   typeDecl.modifiersSourceStart,
+  //                   typeStartPosition,
+  //                   typeDecl.name,
+  //                   typeDecl.sourceStart,
+  //                   typeDecl.sourceEnd,
+  //                   null,
+  //                   -1,
+  //                   -1,
+  //                   interfaceNames,
+  //                   interfaceNameStarts,
+  //                   interfaceNameEnds,
+  //                   scanner.currentPosition - 1);
+  //   } else {
+  //           requestor.enterClass(
+  //                   typeDecl.declarationSourceStart,
+  //                   intArrayStack[intArrayPtr--],
+  //                   typeDecl.modifiers,
+  //                   typeDecl.modifiersSourceStart,
+  //                   typeStartPosition,
+  //                   typeDecl.name,
+  //                   typeDecl.sourceStart,
+  //                   typeDecl.sourceEnd,
+  //                   CharOperation.concatWith(superclass.getTypeName(), '.'),
+  //                   superclass.sourceStart,
+  //                   superclass.sourceEnd,
+  //                   interfaceNames,
+  //                   interfaceNameStarts,
+  //                   interfaceNameEnds,
+  //                   scanner.currentPosition - 1);
+  //
+  //   }
+  //}
+  //protected void consumeClassHeaderName() {
+  //   // ClassHeaderName ::= Modifiersopt 'class' 'Identifier'
+  //   TypeDeclaration typeDecl;
+  //   if (nestedMethod[nestedType] == 0) {
+  //           if (nestedType != 0) {
+  //                   typeDecl = new MemberTypeDeclaration(this.compilationUnit.compilationResult);
+  //           } else {
+  //                   typeDecl = new TypeDeclaration(this.compilationUnit.compilationResult);
+  //           }
+  //   } else {
+  //           // Record that the block has a declaration for local types
+  //           typeDecl = new LocalTypeDeclaration(this.compilationUnit.compilationResult);
+  //           markEnclosingMemberWithLocalType();
+  //           blockReal();
+  //   }
+  //
+  //   //highlight the name of the type
+  //   long pos = identifierPositionStack[identifierPtr];
+  //   typeDecl.sourceEnd = (int) pos;
+  //   typeDecl.sourceStart = (int) (pos >>> 32);
+  //   typeDecl.name = identifierStack[identifierPtr--];
+  //   identifierLengthPtr--;
+  //
+  //   //compute the declaration source too
+  //   // 'class' and 'interface' push an int position
+  //   typeStartPosition = typeDecl.declarationSourceStart = intStack[intPtr--];
+  //   intPtr--;
+  //   int declarationSourceStart = intStack[intPtr--];
+  //   typeDecl.modifiersSourceStart = intStack[intPtr--];
+  //   typeDecl.modifiers = intStack[intPtr--];
+  //   if (typeDecl.declarationSourceStart > declarationSourceStart) {
+  //           typeDecl.declarationSourceStart = declarationSourceStart;
+  //   }
+  //   typeDecl.bodyStart = typeDecl.sourceEnd + 1;
+  //   pushOnAstStack(typeDecl);
+  //}
+  ///**
+  // *
+  // * INTERNAL USE-ONLY
+  // */
+  //protected void consumeCompilationUnit() {
+  //   // CompilationUnit ::= EnterCompilationUnit PackageDeclarationopt ImportDeclarationsopt
+  //   requestor.exitCompilationUnit(scanner.source.length - 1);
+  //}
+  /**
+   * 
+   * INTERNAL USE-ONLY
+   */
+  //protected void consumeConstructorDeclaration() {
+  //   // ConstructorDeclaration ::= ConstructorHeader ConstructorBody
+  //   super.consumeConstructorDeclaration();
+  //   if (isLocalDeclaration()) {
+  //           // we ignore the local variable declarations
+  //           return;
+  //   }
+  //   ConstructorDeclaration cd = (ConstructorDeclaration) astStack[astPtr];
+  //   requestor.exitConstructor(endStatementPosition, cd.declarationSourceEnd);
+  //}
+  ///**
+  // *
+  // * INTERNAL USE-ONLY
+  // */
+  //protected void consumeConstructorHeader() {
+  //   // ConstructorHeader ::= ConstructorHeaderName MethodHeaderParameters MethodHeaderThrowsClauseopt
+  //   super.consumeConstructorHeader();
+  //   if (isLocalDeclaration()) {
+  //           // we ignore the local variable declarations
+  //           intArrayPtr--;
+  //           return;
+  //   }
+  //   ConstructorDeclaration cd = (ConstructorDeclaration) astStack[astPtr];
+  //   Argument[] arguments = cd.arguments;
+  //   char[][] argumentTypes = null;
+  //   char[][] argumentNames = null;
+  //   int[] argumentTypeStarts = null;
+  //   int[] argumentTypeEnds = null;
+  //   int[] argumentNameStarts = null;
+  //   int[] argumentNameEnds = null;
+  //   if (arguments != null) {
+  //           int argumentLength = arguments.length;
+  //           argumentTypes = new char[argumentLength][];
+  //           argumentNames = new char[argumentLength][];
+  //           argumentNameStarts = new int[argumentLength];
+  //           argumentNameEnds = new int[argumentLength];
+  //           argumentTypeStarts = new int[argumentLength];
+  //           argumentTypeEnds = new int[argumentLength];
+  //           for (int i = 0; i < argumentLength; i++) {
+  //                   Argument argument = arguments[i];
+  //                   TypeReference argumentType = argument.type;
+  //                   argumentTypes[i] = returnTypeName(argumentType);
+  //                   argumentNames[i] = argument.name;
+  //                   argumentNameStarts[i] = argument.sourceStart;
+  //                   argumentNameEnds[i] = argument.sourceEnd;
+  //                   argumentTypeStarts[i] = argumentType.sourceStart;
+  //                   argumentTypeEnds[i] = argumentType.sourceEnd;
+  //           }
+  //   }
+  //   TypeReference[] thrownExceptions = cd.thrownExceptions;
+  //   char[][] exceptionTypes = null;
+  //   int[] exceptionTypeStarts = null;
+  //   int[] exceptionTypeEnds = null;
+  //   if (thrownExceptions != null) {
+  //           int thrownExceptionLength = thrownExceptions.length;
+  //           exceptionTypes = new char[thrownExceptionLength][];
+  //           exceptionTypeStarts = new int[thrownExceptionLength];
+  //           exceptionTypeEnds = new int[thrownExceptionLength];
+  //           for (int i = 0; i < thrownExceptionLength; i++) {
+  //                   TypeReference exception = thrownExceptions[i];
+  //                   exceptionTypes[i] = CharOperation.concatWith(exception.getTypeName(), '.');
+  //                   exceptionTypeStarts[i] = exception.sourceStart;
+  //                   exceptionTypeEnds[i] = exception.sourceEnd;
+  //           }
+  //   }
+  //   requestor
+  //           .enterConstructor(
+  //                   cd.declarationSourceStart,
+  //                   intArrayStack[intArrayPtr--],
+  //                   cd.modifiers,
+  //                   cd.modifiersSourceStart,
+  //                   cd.selector,
+  //                   cd.sourceStart,
+  //                   (int) (selectorSourcePositions & 0xFFFFFFFFL),
+  //                   // retrieve the source end of the name
+  //                   argumentTypes,
+  //                   argumentTypeStarts,
+  //                   argumentTypeEnds,
+  //                   argumentNames,
+  //                   argumentNameStarts,
+  //                   argumentNameEnds,
+  //                   rParenPos,
+  //                   // right parenthesis
+  //                   exceptionTypes,
+  //                   exceptionTypeStarts,
+  //                   exceptionTypeEnds,
+  //                   scanner.currentPosition - 1);
+  //}
+  //protected void consumeConstructorHeaderName() {
+  //   // ConstructorHeaderName ::= Modifiersopt 'Identifier' '('
+  //   ConstructorDeclaration cd = new ConstructorDeclaration(this.compilationUnit.compilationResult);
+  //
+  //   //name -- this is not really revelant but we do .....
+  //   cd.selector = identifierStack[identifierPtr];
+  //   selectorSourcePositions = identifierPositionStack[identifierPtr--];
+  //   identifierLengthPtr--;
+  //
+  //   //modifiers
+  //   cd.declarationSourceStart = intStack[intPtr--];
+  //   cd.modifiersSourceStart = intStack[intPtr--];
+  //   cd.modifiers = intStack[intPtr--];
+  //
+  //   //highlight starts at the selector starts
+  //   cd.sourceStart = (int) (selectorSourcePositions >>> 32);
+  //   pushOnAstStack(cd);
+  //
+  //   cd.sourceEnd = lParenPos;
+  //   cd.bodyStart = lParenPos + 1;
+  //}
+  //protected void consumeDefaultModifiers() {
+  //   checkAnnotation(); // might update modifiers with AccDeprecated
+  //   pushOnIntStack(modifiers); // modifiers
+  //   pushOnIntStack(-1);
+  //   pushOnIntStack(
+  //           declarationSourceStart >= 0 ? declarationSourceStart : scanner.startPosition);
+  //   resetModifiers();
+  //}
+  //protected void consumeDiet() {
+  //   // Diet ::= $empty
+  //   super.consumeDiet();
+  //   /* persisting javadoc positions
+  //    * Will be consume in consumeClassBodyDeclaration
+  //    */
+  //   pushOnIntArrayStack(this.getJavaDocPositions());
+  //}
+  ///**
+  // *
+  // * INTERNAL USE-ONLY
+  // */
+  //protected void consumeEnterCompilationUnit() {
+  //   // EnterCompilationUnit ::= $empty
+  //   requestor.enterCompilationUnit();
+  //}
+  ///**
+  // *
+  // * INTERNAL USE-ONLY
+  // */
+  //protected void consumeEnterVariable() {
+  //   // EnterVariable ::= $empty
+  //   boolean isLocalDeclaration = isLocalDeclaration();
+  //   if (!isLocalDeclaration && (variablesCounter[nestedType] != 0)) {
+  //           requestor.exitField(lastFieldBodyEndPosition, lastFieldEndPosition);
+  //   }
+  //   char[] name = identifierStack[identifierPtr];
+  //   long namePosition = identifierPositionStack[identifierPtr--];
+  //   int extendedTypeDimension = intStack[intPtr--];
+  //
+  //   AbstractVariableDeclaration declaration;
+  //   if (nestedMethod[nestedType] != 0) {
+  //           // create the local variable declarations
+  //           declaration =
+  //                   new LocalDeclaration(null, name, (int) (namePosition >>> 32), (int) namePosition);
+  //   } else {
+  //           // create the field declaration
+  //           declaration =
+  //                   new FieldDeclaration(null, name, (int) (namePosition >>> 32), (int) namePosition);
+  //   }
+  //   identifierLengthPtr--;
+  //   TypeReference type;
+  //   int variableIndex = variablesCounter[nestedType];
+  //   int typeDim = 0;
+  //   if (variableIndex == 0) {
+  //           // first variable of the declaration (FieldDeclaration or LocalDeclaration)
+  //           if (nestedMethod[nestedType] != 0) {
+  //                   // local declaration
+  //                   declaration.declarationSourceStart = intStack[intPtr--];
+  //                   declaration.modifiersSourceStart = intStack[intPtr--];
+  //                   declaration.modifiers = intStack[intPtr--];
+  //                   type = getTypeReference(typeDim = intStack[intPtr--]); // type dimension
+  //                   pushOnAstStack(type);
+  //           } else {
+  //                   // field declaration
+  //                   type = getTypeReference(typeDim = intStack[intPtr--]); // type dimension
+  //                   pushOnAstStack(type);
+  //                   declaration.declarationSourceStart = intStack[intPtr--];
+  //                   declaration.modifiersSourceStart = intStack[intPtr--];
+  //                   declaration.modifiers = intStack[intPtr--];
+  //           }
+  //   } else {
+  //           type = (TypeReference) astStack[astPtr - variableIndex];
+  //           typeDim = type.dimensions();
+  //           AbstractVariableDeclaration previousVariable =
+  //                   (AbstractVariableDeclaration) astStack[astPtr];
+  //           declaration.declarationSourceStart = previousVariable.declarationSourceStart;
+  //           declaration.modifiers = previousVariable.modifiers;
+  //           declaration.modifiersSourceStart = previousVariable.modifiersSourceStart;
+  //   }
+  //
+  //   localIntPtr = intPtr;
+  //
+  //   if (extendedTypeDimension == 0) {
+  //           declaration.type = type;
+  //   } else {
+  //           int dimension = typeDim + extendedTypeDimension;
+  //           //on the identifierLengthStack there is the information about the type....
+  //           int baseType;
+  //           if ((baseType = identifierLengthStack[identifierLengthPtr + 1]) < 0) {
+  //                   //it was a baseType
+  //                   declaration.type = TypeReference.baseTypeReference(-baseType, dimension);
+  //                   declaration.type.sourceStart = type.sourceStart;
+  //                   declaration.type.sourceEnd = type.sourceEnd;
+  //           } else {
+  //                   declaration.type = this.copyDims(type, dimension);
+  //           }
+  //   }
+  //   variablesCounter[nestedType]++;
+  //   nestedMethod[nestedType]++;
+  //   pushOnAstStack(declaration);
+  //
+  //   int[] javadocPositions = intArrayStack[intArrayPtr];
+  //   if (!isLocalDeclaration) {
+  //           requestor
+  //                   .enterField(
+  //                           declaration.declarationSourceStart,
+  //                           javadocPositions,
+  //                           declaration.modifiers,
+  //                           declaration.modifiersSourceStart,
+  //                           returnTypeName(declaration.type),
+  //                           type.sourceStart,
+  //                           type.sourceEnd,
+  //                           typeDims,
+  //                           name,
+  //                           (int) (namePosition >>> 32),
+  //                           (int) namePosition,
+  //                           extendedTypeDimension,
+  //                           extendedTypeDimension == 0 ? -1 : endPosition);
+  //   }
+  //}
+  ///**
+  // *
+  // * INTERNAL USE-ONLY
+  // */
+  //protected void consumeExitVariableWithInitialization() {
+  //   // ExitVariableWithInitialization ::= $empty
+  //   // the scanner is located after the comma or the semi-colon.
+  //   // we want to include the comma or the semi-colon
+  //   super.consumeExitVariableWithInitialization();
+  //   nestedMethod[nestedType]--;
+  //   lastFieldEndPosition = scanner.currentPosition - 1;
+  //   lastFieldBodyEndPosition = ((AbstractVariableDeclaration) astStack[astPtr]).initialization.sourceEnd;
+  //}
+  //protected void consumeExitVariableWithoutInitialization() {
+  //   // ExitVariableWithoutInitialization ::= $empty
+  //   // do nothing by default
+  //   super.consumeExitVariableWithoutInitialization();
+  //   nestedMethod[nestedType]--;
+  //   lastFieldEndPosition = scanner.currentPosition - 1;
+  //   lastFieldBodyEndPosition = scanner.startPosition - 1;
+  //}
+  ///**
+  // *
+  // * INTERNAL USE-ONLY
+  // */
+  //protected void consumeFieldDeclaration() {
+  //   // See consumeLocalVariableDeclarationDefaultModifier() in case of change: duplicated code
+  //   // FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';'
+  //   // the super.consumeFieldDeclaration will reinitialize the variableCounter[nestedType]
+  //   int variableIndex = variablesCounter[nestedType];
+  //   super.consumeFieldDeclaration();
+  //   intArrayPtr--;
+  //   if (isLocalDeclaration())
+  //           return;
+  //   if (variableIndex != 0) {
+  //           requestor.exitField(lastFieldBodyEndPosition, lastFieldEndPosition);
+  //   }
+  //}
+  //protected void consumeFormalParameter() {
+  //   // FormalParameter ::= Type VariableDeclaratorId ==> false
+  //   // FormalParameter ::= Modifiers Type VariableDeclaratorId ==> true
+  //   /*
+  //   astStack :
+  //   identifierStack : type identifier
+  //   intStack : dim dim
+  //    ==>
+  //   astStack : Argument
+  //   identifierStack :
+  //   intStack :
+  //   */
+  //
+  //   identifierLengthPtr--;
+  //   char[] name = identifierStack[identifierPtr];
+  //   long namePositions = identifierPositionStack[identifierPtr--];
+  //   TypeReference type = getTypeReference(intStack[intPtr--] + intStack[intPtr--]);
+  //   intPtr -= 3;
+  //   Argument arg =
+  //           new Argument(
+  //                   name,
+  //                   namePositions,
+  //                   type,
+  //                   intStack[intPtr + 1]); // modifiers
+  //   pushOnAstStack(arg);
+  //   intArrayPtr--;
+  //}
+  ///**
+  // *
+  // * INTERNAL USE-ONLY
+  // */
+  //protected void consumeInterfaceDeclaration() {
+  //   super.consumeInterfaceDeclaration();
+  //   // we know that we have a TypeDeclaration on the top of the astStack
+  //   if (isLocalDeclaration()) {
+  //           // we ignore the local variable declarations
+  //           return;
+  //   }
+  //   requestor.exitInterface(endStatementPosition, // the '}' is the end of the body
+  //    ((TypeDeclaration) astStack[astPtr]).declarationSourceEnd);
+  //}
+  ///**
+  // *
+  // * INTERNAL USE-ONLY
+  // */
+  //protected void consumeInterfaceHeader() {
+  //   //InterfaceHeader ::= $empty
+  //   super.consumeInterfaceHeader();
+  //   if (isLocalDeclaration()) {
+  //           // we ignore the local variable declarations
+  //           intArrayPtr--;
+  //           return;
+  //   }
+  //   TypeDeclaration typeDecl = (TypeDeclaration) astStack[astPtr];
+  //   TypeReference[] superInterfaces = typeDecl.superInterfaces;
+  //   char[][] interfaceNames = null;
+  //   int[] interfaceNameStarts = null;
+  //   int[] interfacenameEnds = null;
+  //   int superInterfacesLength = 0;
+  //   if (superInterfaces != null) {
+  //           superInterfacesLength = superInterfaces.length;
+  //           interfaceNames = new char[superInterfacesLength][];
+  //           interfaceNameStarts = new int[superInterfacesLength];
+  //           interfacenameEnds = new int[superInterfacesLength];
+  //   }
+  //   if (superInterfaces != null) {
+  //           for (int i = 0; i < superInterfacesLength; i++) {
+  //                   TypeReference superInterface = superInterfaces[i];
+  //                   interfaceNames[i] = CharOperation.concatWith(superInterface.getTypeName(), '.');
+  //                   interfaceNameStarts[i] = superInterface.sourceStart;
+  //                   interfacenameEnds[i] = superInterface.sourceEnd;
+  //           }
+  //   }
+  //   // flush the comments related to the interface header
+  //   scanner.commentPtr = -1;
+  //   requestor.enterInterface(
+  //           typeDecl.declarationSourceStart,
+  //           intArrayStack[intArrayPtr--],
+  //           typeDecl.modifiers,
+  //           typeDecl.modifiersSourceStart,
+  //           typeStartPosition,
+  //           typeDecl.name,
+  //           typeDecl.sourceStart,
+  //           typeDecl.sourceEnd,
+  //           interfaceNames,
+  //           interfaceNameStarts,
+  //           interfacenameEnds,
+  //           scanner.currentPosition - 1);
+  //}
+  //protected void consumeInterfaceHeaderName() {
+  //   // InterfaceHeaderName ::= Modifiersopt 'interface' 'Identifier'
+  //   TypeDeclaration typeDecl;
+  //   if (nestedMethod[nestedType] == 0) {
+  //           if (nestedType != 0) {
+  //                   typeDecl = new MemberTypeDeclaration(this.compilationUnit.compilationResult);
+  //           } else {
+  //                   typeDecl = new TypeDeclaration(this.compilationUnit.compilationResult);
+  //           }
+  //   } else {
+  //           // Record that the block has a declaration for local types
+  //           typeDecl = new LocalTypeDeclaration(this.compilationUnit.compilationResult);
+  //           markEnclosingMemberWithLocalType();
+  //           blockReal();
+  //   }
+  //
+  //   //highlight the name of the type
+  //   long pos = identifierPositionStack[identifierPtr];
+  //   typeDecl.sourceEnd = (int) pos;
+  //   typeDecl.sourceStart = (int) (pos >>> 32);
+  //   typeDecl.name = identifierStack[identifierPtr--];
+  //   identifierLengthPtr--;
+  //
+  //   //compute the declaration source too
+  //   // 'class' and 'interface' push an int position
+  //   typeStartPosition = typeDecl.declarationSourceStart = intStack[intPtr--];
+  //   intPtr--;
+  //   int declarationSourceStart = intStack[intPtr--];
+  //   typeDecl.modifiersSourceStart = intStack[intPtr--];
+  //   typeDecl.modifiers = intStack[intPtr--];
+  //   if (typeDecl.declarationSourceStart > declarationSourceStart) {
+  //           typeDecl.declarationSourceStart = declarationSourceStart;
+  //   }
+  //   typeDecl.bodyStart = typeDecl.sourceEnd + 1;
+  //   pushOnAstStack(typeDecl);
+  //}
+  ///**
+  // *
+  // * INTERNAL USE-ONLY
+  // */
+  //protected void consumeLocalVariableDeclaration() {
+  //   // See consumeLocalVariableDeclarationDefaultModifier() in case of change: duplicated code
+  //   // FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';'
+  //
+  //   super.consumeLocalVariableDeclaration();
+  //   intArrayPtr--;
+  //}
+  ///**
+  // *
+  // * INTERNAL USE-ONLY
+  // */
+  //protected void consumeMethodDeclaration(boolean isNotAbstract) {
+  //   // MethodDeclaration ::= MethodHeader MethodBody
+  //   // AbstractMethodDeclaration ::= MethodHeader ';'
+  //   super.consumeMethodDeclaration(isNotAbstract);
+  //   if (isLocalDeclaration()) {
+  //           // we ignore the local variable declarations
+  //           return;
+  //   }
+  //   MethodDeclaration md = (MethodDeclaration) astStack[astPtr];
+  //   requestor.exitMethod(endStatementPosition, md.declarationSourceEnd);
+  //}
+  ///**
+  // *
+  // * INTERNAL USE-ONLY
+  // */
+  //protected void consumeMethodHeader() {
+  //   // MethodHeader ::= MethodHeaderName MethodHeaderParameters MethodHeaderExtendedDims ThrowsClauseopt
+  //   super.consumeMethodHeader();
+  //   if (isLocalDeclaration()) {
+  //           // we ignore the local variable declarations
+  //           intArrayPtr--;
+  //           return;
+  //   }
+  //   MethodDeclaration md = (MethodDeclaration) astStack[astPtr];
+  //
+  //   TypeReference returnType = md.returnType;
+  //   char[] returnTypeName = returnTypeName(returnType);
+  //   Argument[] arguments = md.arguments;
+  //   char[][] argumentTypes = null;
+  //   char[][] argumentNames = null;
+  //   int[] argumentTypeStarts = null;
+  //   int[] argumentTypeEnds = null;
+  //   int[] argumentNameStarts = null;
+  //   int[] argumentNameEnds = null;
+  //   if (arguments != null) {
+  //           int argumentLength = arguments.length;
+  //           argumentTypes = new char[argumentLength][];
+  //           argumentNames = new char[argumentLength][];
+  //           argumentNameStarts = new int[argumentLength];
+  //           argumentNameEnds = new int[argumentLength];
+  //           argumentTypeStarts = new int[argumentLength];
+  //           argumentTypeEnds = new int[argumentLength];
+  //           for (int i = 0; i < argumentLength; i++) {
+  //                   Argument argument = arguments[i];
+  //                   TypeReference argumentType = argument.type;
+  //                   argumentTypes[i] = returnTypeName(argumentType);
+  //                   argumentNames[i] = argument.name;
+  //                   argumentNameStarts[i] = argument.sourceStart;
+  //                   argumentNameEnds[i] = argument.sourceEnd;
+  //                   argumentTypeStarts[i] = argumentType.sourceStart;
+  //                   argumentTypeEnds[i] = argumentType.sourceEnd;
+  //           }
+  //   }
+  //   TypeReference[] thrownExceptions = md.thrownExceptions;
+  //   char[][] exceptionTypes = null;
+  //   int[] exceptionTypeStarts = null;
+  //   int[] exceptionTypeEnds = null;
+  //   if (thrownExceptions != null) {
+  //           int thrownExceptionLength = thrownExceptions.length;
+  //           exceptionTypeStarts = new int[thrownExceptionLength];
+  //           exceptionTypeEnds = new int[thrownExceptionLength];
+  //           exceptionTypes = new char[thrownExceptionLength][];
+  //           for (int i = 0; i < thrownExceptionLength; i++) {
+  //                   TypeReference exception = thrownExceptions[i];
+  //                   exceptionTypes[i] = CharOperation.concatWith(exception.getTypeName(), '.');
+  //                   exceptionTypeStarts[i] = exception.sourceStart;
+  //                   exceptionTypeEnds[i] = exception.sourceEnd;
+  //           }
+  //   }
+  //   requestor
+  //           .enterMethod(
+  //                   md.declarationSourceStart,
+  //                   intArrayStack[intArrayPtr--],
+  //                   md.modifiers,
+  //                   md.modifiersSourceStart,
+  //                   returnTypeName,
+  //                   returnType.sourceStart,
+  //                   returnType.sourceEnd,
+  //                   typeDims,
+  //                   md.selector,
+  //                   md.sourceStart,
+  //                   (int) (selectorSourcePositions & 0xFFFFFFFFL),
+  //                   argumentTypes,
+  //                   argumentTypeStarts,
+  //                   argumentTypeEnds,
+  //                   argumentNames,
+  //                   argumentNameStarts,
+  //                   argumentNameEnds,
+  //                   rParenPos,
+  //                   extendsDim,
+  //                   extendsDim == 0 ? -1 : endPosition,
+  //                   exceptionTypes,
+  //                   exceptionTypeStarts,
+  //                   exceptionTypeEnds,
+  //                   scanner.currentPosition - 1);
+  //}
+  //protected void consumeMethodHeaderExtendedDims() {
+  //   // MethodHeaderExtendedDims ::= Dimsopt
+  //   // now we update the returnType of the method
+  //   MethodDeclaration md = (MethodDeclaration) astStack[astPtr];
+  //   int extendedDims = intStack[intPtr--];
+  //   extendsDim = extendedDims;
+  //   if (extendedDims != 0) {
+  //           TypeReference returnType = md.returnType;
+  //           md.sourceEnd = endPosition;
+  //           int dims = returnType.dimensions() + extendedDims;
+  //           int baseType;
+  //           if ((baseType = identifierLengthStack[identifierLengthPtr + 1]) < 0) {
+  //                   //it was a baseType
+  //                   int sourceStart = returnType.sourceStart;
+  //                   int sourceEnd = returnType.sourceEnd;
+  //                   returnType = TypeReference.baseTypeReference(-baseType, dims);
+  //                   returnType.sourceStart = sourceStart;
+  //                   returnType.sourceEnd = sourceEnd;
+  //                   md.returnType = returnType;
+  //           } else {
+  //                   md.returnType = this.copyDims(md.returnType, dims);
+  //           }
+  //           if (currentToken == TokenNameLBRACE) {
+  //                   md.bodyStart = endPosition + 1;
+  //           }
+  //   }
+  //}
+  //protected void consumeMethodHeaderName() {
+  //   // MethodHeaderName ::= Modifiersopt Type 'Identifier' '('
+  //   MethodDeclaration md = new MethodDeclaration(this.compilationUnit.compilationResult);
+  //
+  //   //name
+  //   md.selector = identifierStack[identifierPtr];
+  //   selectorSourcePositions = identifierPositionStack[identifierPtr--];
+  //   identifierLengthPtr--;
+  //   //type
+  //   md.returnType = getTypeReference(typeDims = intStack[intPtr--]);
+  //   //modifiers
+  //   md.declarationSourceStart = intStack[intPtr--];
+  //   md.modifiersSourceStart = intStack[intPtr--];
+  //   md.modifiers = intStack[intPtr--];
+  //
+  //   //highlight starts at selector start
+  //   md.sourceStart = (int) (selectorSourcePositions >>> 32);
+  //   pushOnAstStack(md);
+  //   md.bodyStart = scanner.currentPosition-1;
+  //}
+  //protected void consumeModifiers() {
+  //   checkAnnotation(); // might update modifiers with AccDeprecated
+  //   pushOnIntStack(modifiers); // modifiers
+  //   pushOnIntStack(modifiersSourceStart);
+  //   pushOnIntStack(
+  //           declarationSourceStart >= 0 ? declarationSourceStart : modifiersSourceStart);
+  //   resetModifiers();
+  //}
+  /**
+   * 
+   * INTERNAL USE-ONLY
+   */
+  //protected void consumePackageDeclarationName() {
+  //   /* persisting javadoc positions */
+  //   pushOnIntArrayStack(this.getJavaDocPositions());
+  //
+  //   super.consumePackageDeclarationName();
+  //   ImportReference importReference = compilationUnit.currentPackage;
+  //
+  //   requestor.acceptPackage(
+  //           importReference.declarationSourceStart,
+  //           importReference.declarationSourceEnd,
+  //           intArrayStack[intArrayPtr--],
+  //           CharOperation.concatWith(importReference.getImportName(), '.'),
+  //           importReference.sourceStart);
+  //}
+  //protected void consumePushModifiers() {
+  //   checkAnnotation(); // might update modifiers with AccDeprecated
+  //   pushOnIntStack(modifiers); // modifiers
+  //   if (modifiersSourceStart < 0) {
+  //           pushOnIntStack(-1);
+  //           pushOnIntStack(
+  //                   declarationSourceStart >= 0 ? declarationSourceStart : scanner.startPosition);
+  //   } else {
+  //           pushOnIntStack(modifiersSourceStart);
+  //           pushOnIntStack(
+  //                   declarationSourceStart >= 0 ? declarationSourceStart : modifiersSourceStart);
+  //   }
+  //   resetModifiers();
+  //}
+  ///**
+  // *
+  // * INTERNAL USE-ONLY
+  // */
+  //protected void consumeSingleTypeImportDeclarationName() {
+  //   // SingleTypeImportDeclarationName ::= 'import' Name
+  //
+  //   /* persisting javadoc positions */
+  //   pushOnIntArrayStack(this.getJavaDocPositions());
+  //
+  //   super.consumeSingleTypeImportDeclarationName();
+  //   ImportReference importReference = (ImportReference) astStack[astPtr];
+  //   requestor.acceptImport(
+  //           importReference.declarationSourceStart,
+  //           importReference.declarationSourceEnd,
+  //           intArrayStack[intArrayPtr--],
+  //           CharOperation.concatWith(importReference.getImportName(), '.'),
+  //           importReference.sourceStart,
+  //           false);
+  //}
+  ///**
+  // *
+  // * INTERNAL USE-ONLY
+  // */
+  //protected void consumeStaticInitializer() {
+  //   // StaticInitializer ::= StaticOnly Block
+  //   //push an Initializer
+  //   //optimize the push/pop
+  //   super.consumeStaticInitializer();
+  //   Initializer initializer = (Initializer) astStack[astPtr];
+  //   requestor.acceptInitializer(
+  //           initializer.declarationSourceStart,
+  //           initializer.declarationSourceEnd,
+  //           intArrayStack[intArrayPtr--],
+  //           AccStatic,
+  //           intStack[intPtr--],
+  //           initializer.block.sourceStart,
+  //           initializer.declarationSourceEnd);
+  //}
+  //protected void consumeStaticOnly() {
+  //   // StaticOnly ::= 'static'
+  //   checkAnnotation(); // might update declaration source start
+  //   pushOnIntStack(modifiersSourceStart);
+  //   pushOnIntStack(
+  //           declarationSourceStart >= 0 ? declarationSourceStart : modifiersSourceStart);
+  //   jumpOverMethodBody();
+  //   nestedMethod[nestedType]++;
+  //   resetModifiers();
+  //}
+  ///**
+  // *
+  // * INTERNAL USE-ONLY
+  // */
+  //protected void consumeTypeImportOnDemandDeclarationName() {
+  //   // TypeImportOnDemandDeclarationName ::= 'import' Name '.' '*'
+  //
+  //   /* persisting javadoc positions */
+  //   pushOnIntArrayStack(this.getJavaDocPositions());
+  //
+  //   super.consumeTypeImportOnDemandDeclarationName();
+  //   ImportReference importReference = (ImportReference) astStack[astPtr];
+  //   requestor.acceptImport(
+  //           importReference.declarationSourceStart,
+  //           importReference.declarationSourceEnd,
+  //           intArrayStack[intArrayPtr--],
+  //           CharOperation.concatWith(importReference.getImportName(), '.'),
+  //           importReference.sourceStart,
+  //           true);
+  //}
+  public CompilationUnitDeclaration endParse(int act) {
+    if (scanner.recordLineSeparator) {
+      requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
+    }
+    return super.endParse(act);
+  }
+
+  /*
+   * Flush annotations defined prior to a given positions.
+   * 
+   * Note: annotations are stacked in syntactical order
+   * 
+   * Either answer given <position>, or the end position of a comment line immediately following the <position> (same line)
+   * 
+   * e.g. void foo(){ } // end of method foo
+   */
+
+  //public int flushAnnotationsDefinedPriorTo(int position) {
+  //
+  //   return lastFieldEndPosition = super.flushAnnotationsDefinedPriorTo(position);
+  //}
+  //protected TypeReference getTypeReference(int dim) { /* build a Reference on a variable that may be qualified or not
+  //This variable is a type reference and dim will be its dimensions*/
+  //
+  //   int length;
+  //   TypeReference ref;
+  //   if ((length = identifierLengthStack[identifierLengthPtr--]) == 1) {
+  //           // single variable reference
+  //           if (dim == 0) {
+  //                   ref =
+  //                           new SingleTypeReference(
+  //                                   identifierStack[identifierPtr],
+  //                                   identifierPositionStack[identifierPtr--]);
+  //           } else {
+  //                   ref =
+  //                           new ArrayTypeReference(
+  //                                   identifierStack[identifierPtr],
+  //                                   dim,
+  //                                   identifierPositionStack[identifierPtr--]);
+  //                   ref.sourceEnd = endPosition;
+  //           }
+  //   } else {
+  //           if (length < 0) { //flag for precompiled type reference on base types
+  //                   ref = TypeReference.baseTypeReference(-length, dim);
+  //                   ref.sourceStart = intStack[intPtr--];
+  //                   if (dim == 0) {
+  //                           ref.sourceEnd = intStack[intPtr--];
+  //                   } else {
+  //                           intPtr--;
+  //                           ref.sourceEnd = endPosition;
+  //                   }
+  //           } else { //Qualified variable reference
+  //                   char[][] tokens = new char[length][];
+  //                   identifierPtr -= length;
+  //                   long[] positions = new long[length];
+  //                   System.arraycopy(identifierStack, identifierPtr + 1, tokens, 0, length);
+  //                   System.arraycopy(
+  //                           identifierPositionStack,
+  //                           identifierPtr + 1,
+  //                           positions,
+  //                           0,
+  //                           length);
+  //                   if (dim == 0) {
+  //                           ref = new QualifiedTypeReference(tokens, positions);
+  //                   } else {
+  //                           ref = new ArrayQualifiedTypeReference(tokens, dim, positions);
+  //                           ref.sourceEnd = endPosition;
+  //                   }
+  //           }
+  //   };
+  //   return ref;
+  //}
+  public void initialize() {
+    //positionning the parser for a new compilation unit
+    //avoiding stack reallocation and all that....
+    super.initialize(false);
+    intArrayPtr = -1;
+  }
+
+  /**
+   * 
+   * INTERNAL USE-ONLY
+   */
+  //private boolean isLocalDeclaration() {
+  //   int nestedDepth = nestedType;
+  //   while (nestedDepth >= 0) {
+  //           if (nestedMethod[nestedDepth] != 0) {
+  //                   return true;
+  //           }
+  //           nestedDepth--;
+  //   }
+  //   return false;
+  //}
+  /*
+   * Investigate one entire unit.
+   */
+  public void parseCompilationUnit(ICompilationUnit unit) {
+    char[] regionSource = unit.getContents();
+    try {
+      initialize();
+      goForCompilationUnit();
+      referenceContext = compilationUnit = compilationUnit = new CompilationUnitDeclaration(problemReporter(),
+          new CompilationResult(unit, 0, 0, 10), //this.options.maxProblemsPerUnit),
+          regionSource.length);
+      scanner.resetTo(0, regionSource.length);
+      scanner.setSource(regionSource);
+      parse();
+    } catch (AbortCompilation ex) {
+    }
+  }
+
+  /*
+   * Investigate one constructor declaration.
+   */
+  //public void parseConstructor(char[] regionSource) {
+  //   try {
+  //           initialize();
+  //           goForClassBodyDeclarations();
+  //           referenceContext =
+  //                   compilationUnit =
+  //                           compilationUnit =
+  //                                   new CompilationUnitDeclaration(
+  //                                           problemReporter(),
+  //                                           new CompilationResult(regionSource, 0, 0, 10), //this.options.maxProblemsPerUnit),
+  //                                           regionSource.length);
+  //           scanner.resetTo(0, regionSource.length);
+  //           scanner.setSource(regionSource);
+  //           parse();
+  //   } catch (AbortCompilation ex) {
+  //   }
+  //}
+  /*
+   * Investigate one field declaration statement (might have multiple declarations in it).
+   */
+  //public void parseField(char[] regionSource) {
+  //   try {
+  //           initialize();
+  //           goForFieldDeclaration();
+  //           referenceContext =
+  //                   compilationUnit =
+  //                           compilationUnit =
+  //                                   new CompilationUnitDeclaration(
+  //                                           problemReporter(),
+  //                                           new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit),
+  //                                           regionSource.length);
+  //           scanner.resetTo(0, regionSource.length);
+  //           scanner.setSource(regionSource);
+  //           parse();
+  //   } catch (AbortCompilation ex) {
+  //   }
+  //
+  //}
+  ///*
+  // * Investigate one import statement declaration.
+  // */
+  //public void parseImport(char[] regionSource) {
+  //   try {
+  //           initialize();
+  //           goForImportDeclaration();
+  //           referenceContext =
+  //                   compilationUnit =
+  //                           compilationUnit =
+  //                                   new CompilationUnitDeclaration(
+  //                                           problemReporter(),
+  //                                           new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit),
+  //                                           regionSource.length);
+  //           scanner.resetTo(0, regionSource.length);
+  //           scanner.setSource(regionSource);
+  //           parse();
+  //   } catch (AbortCompilation ex) {
+  //   }
+  //
+  //}
+  ///*
+  // * Investigate one initializer declaration.
+  // * regionSource need to content exactly an initializer declaration.
+  // * e.g: static { i = 4; }
+  // * { name = "test"; }
+  // */
+  //public void parseInitializer(char[] regionSource) {
+  //   try {
+  //           initialize();
+  //           goForInitializer();
+  //           referenceContext =
+  //                   compilationUnit =
+  //                           compilationUnit =
+  //                                   new CompilationUnitDeclaration(
+  //                                           problemReporter(),
+  //                                           new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit),
+  //                                           regionSource.length);
+  //           scanner.resetTo(0, regionSource.length);
+  //           scanner.setSource(regionSource);
+  //           parse();
+  //   } catch (AbortCompilation ex) {
+  //   }
+  //
+  //}
+  ///*
+  // * Investigate one method declaration.
+  // */
+  //public void parseMethod(char[] regionSource) {
+  //   try {
+  //           initialize();
+  //           goForGenericMethodDeclaration();
+  //           referenceContext =
+  //                   compilationUnit =
+  //                           compilationUnit =
+  //                                   new CompilationUnitDeclaration(
+  //                                           problemReporter(),
+  //                                           new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit),
+  //                                           regionSource.length);
+  //           scanner.resetTo(0, regionSource.length);
+  //           scanner.setSource(regionSource);
+  //           parse();
+  //   } catch (AbortCompilation ex) {
+  //   }
+  //
+  //}
+  ///*
+  // * Investigate one package statement declaration.
+  // */
+  //public void parsePackage(char[] regionSource) {
+  //   try {
+  //           initialize();
+  //           goForPackageDeclaration();
+  //           referenceContext =
+  //                   compilationUnit =
+  //                           compilationUnit =
+  //                                   new CompilationUnitDeclaration(
+  //                                           problemReporter(),
+  //                                           new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit),
+  //                                           regionSource.length);
+  //           scanner.resetTo(0, regionSource.length);
+  //           scanner.setSource(regionSource);
+  //           parse();
+  //   } catch (AbortCompilation ex) {
+  //   }
+  //
+  //}
+  ///*
+  // * Investigate one type declaration, its fields, methods and member types.
+  // */
+  //public void parseType(char[] regionSource) {
+  //   try {
+  //           initialize();
+  //           goForTypeDeclaration();
+  //           referenceContext =
+  //                   compilationUnit =
+  //                           compilationUnit =
+  //                                   new CompilationUnitDeclaration(
+  //                                           problemReporter(),
+  //                                           new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit),
+  //                                           regionSource.length);
+  //           scanner.resetTo(0, regionSource.length);
+  //           scanner.setSource(regionSource);
+  //           parse();
+  //   } catch (AbortCompilation ex) {
+  //   }
+  //
+  //}
+  /**
+   * Returns this parser's problem reporter initialized with its reference context. Also it is assumed that a problem is going to be
+   * reported, so initializes the compilation result's line positions.
+   */
+  public ProblemReporter problemReporter() {
+    problemReporter.referenceContext = referenceContext;
+    return problemReporter;
+  }
+
+  protected void pushOnIntArrayStack(int[] positions) {
+
+    try {
+      intArrayStack[++intArrayPtr] = positions;
+    } catch (IndexOutOfBoundsException e) {
+      //intPtr is correct
+      int oldStackLength = intArrayStack.length;
+      int oldStack[][] = intArrayStack;
+      intArrayStack = new int[oldStackLength + StackIncrement][];
+      System.arraycopy(oldStack, 0, intArrayStack, 0, oldStackLength);
+      intArrayStack[intArrayPtr] = positions;
+    }
+  }
+
+  //protected void resetModifiers() {
+  //   super.resetModifiers();
+  //   declarationSourceStart = -1;
+  //}
+  /*
+   * Syntax error was detected. Will attempt to perform some recovery action in order to resume to the regular parse loop.
+   */
+  protected boolean resumeOnSyntaxError() {
+    return false;
+  }
+  /*
+   * Answer a char array representation of the type name formatted like: - type name + dimensions Example: "A[][]".toCharArray()
+   * "java.lang.String".toCharArray()
+   */
+  //private char[] returnTypeName(TypeReference type) {
+  //   int dimension = type.dimensions();
+  //   if (dimension != 0) {
+  //           char[] dimensionsArray = new char[dimension * 2];
+  //           for (int i = 0; i < dimension; i++) {
+  //                   dimensionsArray[i*2] = '[';
+  //                   dimensionsArray[(i*2) + 1] = ']';
+  //           }
+  //           return CharOperation.concat(
+  //                   CharOperation.concatWith(type.getTypeName(), '.'),
+  //                   dimensionsArray);
+  //   }
+  //   return CharOperation.concatWith(type.getTypeName(), '.');
+  //}
+  //public String toString() {
+  //   StringBuffer buffer = new StringBuffer();
+  //   buffer.append("intArrayPtr = " + intArrayPtr + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+  //   buffer.append(super.toString());
+  //   return buffer.toString();
+  //}
+  ///**
+  // * INTERNAL USE ONLY
+  // */
+  //protected TypeReference typeReference(
+  //   int dim,
+  //   int localIdentifierPtr,
+  //   int localIdentifierLengthPtr) {
+  //   /* build a Reference on a variable that may be qualified or not
+  //    * This variable is a type reference and dim will be its dimensions.
+  //    * We don't have any side effect on the stacks' pointers.
+  //    */
+  //
+  //   int length;
+  //   TypeReference ref;
+  //   if ((length = identifierLengthStack[localIdentifierLengthPtr]) == 1) {
+  //           // single variable reference
+  //           if (dim == 0) {
+  //                   ref =
+  //                           new SingleTypeReference(
+  //                                   identifierStack[localIdentifierPtr],
+  //                                   identifierPositionStack[localIdentifierPtr--]);
+  //           } else {
+  //                   ref =
+  //                           new ArrayTypeReference(
+  //                                   identifierStack[localIdentifierPtr],
+  //                                   dim,
+  //                                   identifierPositionStack[localIdentifierPtr--]);
+  //                   ref.sourceEnd = endPosition;
+  //           }
+  //   } else {
+  //           if (length < 0) { //flag for precompiled type reference on base types
+  //                   ref = TypeReference.baseTypeReference(-length, dim);
+  //                   ref.sourceStart = intStack[localIntPtr--];
+  //                   if (dim == 0) {
+  //                           ref.sourceEnd = intStack[localIntPtr--];
+  //                   } else {
+  //                           localIntPtr--;
+  //                           ref.sourceEnd = endPosition;
+  //                   }
+  //           } else { //Qualified variable reference
+  //                   char[][] tokens = new char[length][];
+  //                   localIdentifierPtr -= length;
+  //                   long[] positions = new long[length];
+  //                   System.arraycopy(identifierStack, localIdentifierPtr + 1, tokens, 0, length);
+  //                   System.arraycopy(
+  //                           identifierPositionStack,
+  //                           localIdentifierPtr + 1,
+  //                           positions,
+  //                           0,
+  //                           length);
+  //                   if (dim == 0)
+  //                           ref = new QualifiedTypeReference(tokens, positions);
+  //                   else
+  //                           ref = new ArrayQualifiedTypeReference(tokens, dim, positions);
+  //           }
+  //   };
+  //   return ref;
+  //}
+}
\ No newline at end of file
index dab8298..7dc0c65 100644 (file)
@@ -23,10 +23,10 @@ import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
 import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation;
 import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
 import net.sourceforge.phpdt.internal.core.util.CommentRecorderParser;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
 import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
 import net.sourceforge.phpeclipse.internal.compiler.ast.AnonymousLocalTypeDeclaration;
 import net.sourceforge.phpeclipse.internal.compiler.ast.Argument;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
 import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
 import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
 import net.sourceforge.phpeclipse.internal.compiler.ast.ExplicitConstructorCall;
@@ -40,6 +40,8 @@ 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.
@@ -105,7 +107,7 @@ public class SourceElementParser extends CommentRecorderParser {//extends
   public SourceElementParser(final ISourceElementRequestor requestor, IProblemFactory problemFactory, CompilerOptions options) {
     // we want to notify all syntax error with the acceptProblem API
     // To do so, we define the record method of the ProblemReporter
-    super(new ProblemReporter(DefaultErrorHandlingPolicies.exitAfterAllProblems(), options, problemFactory) {
+    super( new ProblemReporter(DefaultErrorHandlingPolicies.exitAfterAllProblems(), options, problemFactory) {
       public void record(IProblem problem, CompilationResult unitResult, ReferenceContext referenceContext) {
         unitResult.record(problem, referenceContext);
         if (requestor!=null) {
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
deleted file mode 100644 (file)
index 0971b28..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * 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;
-
-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$
-}
-}
index 811f518..7e14fc5 100644 (file)
@@ -10,6 +10,8 @@
  *******************************************************************************/
 package net.sourceforge.phpdt.internal.compiler.env;
 
+import org.eclipse.core.resources.IResource;
+
 /**
  * This interface denotes a compilation unit, providing its name and content.
  */
@@ -33,4 +35,7 @@ char[] getMainTypeName();
  * For example, {java, lang}.
  */
 char[][] getPackageName();
+
+IResource getResource();
+
 }
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Outlineable.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Outlineable.java
deleted file mode 100644 (file)
index 90a5527..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-package net.sourceforge.phpdt.internal.compiler.parser;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.Position;
-
-/**
- * Here is an interface that object that can be in the outline view must implement.
- * @author Matthieu Casanova
- */
-public interface Outlineable {
-
-  /**
-   * This will return the image for the outline of the object.
-   * @return an image
-   */
-  ImageDescriptor getImage();
-
-  Object getParent();
-
-  Position getPosition();
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/OutlineableWithChildren.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/OutlineableWithChildren.java
deleted file mode 100644 (file)
index c7bfd79..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-package net.sourceforge.phpdt.internal.compiler.parser;
-
-import java.util.List;
-
-/**
- * The interface that will describe an object that can have children.
- * @author Matthieu Casanova
- */
-public interface OutlineableWithChildren extends Outlineable {
-  boolean add(Outlineable o);
-
-  Outlineable get(int index);
-
-  int size();
-
-  List getList();
-}
index eccc174..73d504e 100644 (file)
@@ -1,9 +1,9 @@
 /***********************************************************************************************************************************
- * Copyright (c) 2002 Klaus Hartlage - www.eclipseproject.de All rights reserved. This program and the accompanying material are
+ * Copyright (c) 2002 www.phpeclipse.de All rights reserved. This program and the accompanying material 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: Klaus Hartlage - www.eclipseproject.de
+ * Contributors: www.phpeclipse.de
  **********************************************************************************************************************************/
 package net.sourceforge.phpdt.internal.compiler.parser;
 
@@ -19,20 +19,31 @@ import net.sourceforge.phpdt.internal.compiler.lookup.TypeConstants;
 import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
 import net.sourceforge.phpdt.internal.compiler.problem.ProblemSeverities;
 import net.sourceforge.phpdt.internal.compiler.util.Util;
+import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil;
 import net.sourceforge.phpeclipse.builder.IdentifierIndexManager;
+import net.sourceforge.phpeclipse.internal.compiler.ast.AND_AND_Expression;
 import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
 import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
+import net.sourceforge.phpeclipse.internal.compiler.ast.BinaryExpression;
 import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ConditionalExpression;
+import net.sourceforge.phpeclipse.internal.compiler.ast.EqualExpression;
 import net.sourceforge.phpeclipse.internal.compiler.ast.Expression;
 import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
 import net.sourceforge.phpeclipse.internal.compiler.ast.IfStatement;
 import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference;
 import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration;
+import net.sourceforge.phpeclipse.internal.compiler.ast.OR_OR_Expression;
 import net.sourceforge.phpeclipse.internal.compiler.ast.SingleTypeReference;
 import net.sourceforge.phpeclipse.internal.compiler.ast.Statement;
+import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteral;
+import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteralDQ;
+import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteralSQ;
 import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
 
 import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
 
 public class Parser //extends PHPParserSuperclass
     implements ITerminalSymbols, CompilerModifiers, ParserBasicInformation {
@@ -207,23 +218,6 @@ public class Parser //extends PHPParserSuperclass
   }
 
   /**
-   * Method Declaration.
-   * 
-   * @see
-   */
-  //  private void getChar() {
-  //    if (str.length() > chIndx) {
-  //      ch = str.charAt(chIndx++);
-  //
-  //      return;
-  //    }
-  //
-  //    chIndx = str.length() + 1;
-  //    ch = ' ';
-  //    // token = TokenNameEOF;
-  //    phpEnd = true;
-  //  }
-  /**
    * gets the next token from input
    */
   private void getNextToken() {
@@ -587,8 +581,8 @@ public class Parser //extends PHPParserSuperclass
       statement(TokenNameEOF);
       if ((token == TokenNameRBRACE) || (token == TokenNamecase) || (token == TokenNamedefault) || (token == TokenNameelse)
           || (token == TokenNameelseif) || (token == TokenNameendif) || (token == TokenNameendfor)
-          || (token == TokenNameendforeach) || (token == TokenNameendwhile) || (token == TokenNameendswitch) || (token == TokenNameenddeclare)
-          || (token == TokenNameEOF) || (token == TokenNameERROR)) {
+          || (token == TokenNameendforeach) || (token == TokenNameendwhile) || (token == TokenNameendswitch)
+          || (token == TokenNameenddeclare) || (token == TokenNameEOF) || (token == TokenNameERROR)) {
         return;
       }
     } while (true);
@@ -1978,10 +1972,12 @@ public class Parser //extends PHPParserSuperclass
   }
 
   private Expression expr_without_variable(boolean only_variable) {
+    int exprSourceStart = scanner.getCurrentTokenStartPosition();
+    int exprSourceEnd = scanner.getCurrentTokenEndPosition();
     Expression expression = new Expression();
-    expression.sourceStart = scanner.getCurrentTokenStartPosition();
+    expression.sourceStart = exprSourceStart;
     // default, may be overwritten
-    expression.sourceEnd = scanner.getCurrentTokenEndPosition();
+    expression.sourceEnd = exprSourceEnd;
     //         internal_functions_in_yacc
     // | T_CLONE expr
     // | T_PRINT expr
@@ -2135,11 +2131,17 @@ public class Parser //extends PHPParserSuperclass
       scanner.encapsedStringStack.push(new Character('\''));
       getNextToken();
       try {
+        exprSourceStart = scanner.getCurrentTokenStartPosition();
         if (token == TokenNameEncapsedString1) {
+          expression = new StringLiteralSQ(scanner.getCurrentStringLiteralSource(exprSourceStart), exprSourceStart, scanner
+              .getCurrentTokenEndPosition());
         } else {
           encaps_list();
           if (token != TokenNameEncapsedString1) {
             throwSyntaxError("\'\'\' expected at end of string" + "(Found token: " + scanner.toStringAction(token) + " )");
+          } else {
+            expression = new StringLiteralSQ(scanner.getCurrentStringLiteralSource(exprSourceStart), exprSourceStart, scanner
+                .getCurrentTokenEndPosition());
           }
         }
       } finally {
@@ -2152,11 +2154,17 @@ public class Parser //extends PHPParserSuperclass
       scanner.encapsedStringStack.push(new Character('"'));
       getNextToken();
       try {
+        exprSourceStart = scanner.getCurrentTokenStartPosition();
         if (token == TokenNameEncapsedString2) {
+          expression = new StringLiteralDQ(scanner.getCurrentStringLiteralSource(exprSourceStart), exprSourceStart, scanner
+              .getCurrentTokenEndPosition());
         } else {
           encaps_list();
           if (token != TokenNameEncapsedString2) {
             throwSyntaxError("'\"' expected at end of string" + "(Found token: " + scanner.toStringAction(token) + " )");
+          } else {
+            expression = new StringLiteralDQ(scanner.getCurrentStringLiteralSource(exprSourceStart), exprSourceStart, scanner
+                .getCurrentTokenEndPosition());
           }
         }
       } finally {
@@ -2164,10 +2172,18 @@ public class Parser //extends PHPParserSuperclass
         getNextToken();
       }
       break;
-    case TokenNameIntegerLiteral:
-    case TokenNameDoubleLiteral:
     case TokenNameStringDoubleQuote:
+      expression = new StringLiteralDQ(scanner.getCurrentStringLiteralSource(), scanner.getCurrentTokenStartPosition(), scanner
+          .getCurrentTokenEndPosition());
+      common_scalar();
+      break;
     case TokenNameStringSingleQuote:
+      expression = new StringLiteralSQ(scanner.getCurrentStringLiteralSource(), scanner.getCurrentTokenStartPosition(), scanner
+          .getCurrentTokenEndPosition());
+      common_scalar();
+      break;
+    case TokenNameIntegerLiteral:
+    case TokenNameDoubleLiteral:
     case TokenNameStringInterpolated:
     case TokenNameFILE:
     case TokenNameLINE:
@@ -2332,7 +2348,17 @@ public class Parser //extends PHPParserSuperclass
     while (true) {
       switch (token) {
       case TokenNameOR_OR:
+        getNextToken();
+        expression = new OR_OR_Expression(expression, expr(), token);
+        break;
       case TokenNameAND_AND:
+        getNextToken();
+        expression = new AND_AND_Expression(expression, expr(), token);
+        break;
+      case TokenNameEQUAL_EQUAL:
+        getNextToken();
+        expression = new EqualExpression(expression, expr(), token);
+        break;
       case TokenNameand:
       case TokenNameor:
       case TokenNamexor:
@@ -2349,28 +2375,34 @@ public class Parser //extends PHPParserSuperclass
       case TokenNameRIGHT_SHIFT:
       case TokenNameEQUAL_EQUAL_EQUAL:
       case TokenNameNOT_EQUAL_EQUAL:
-      case TokenNameEQUAL_EQUAL:
       case TokenNameNOT_EQUAL:
       case TokenNameLESS:
       case TokenNameLESS_EQUAL:
       case TokenNameGREATER:
       case TokenNameGREATER_EQUAL:
         getNextToken();
-        expr();
+        expression = new BinaryExpression(expression, expr(), token);
         break;
       //  | expr T_INSTANCEOF class_name_reference
       //       | expr '?' expr ':' expr
       case TokenNameinstanceof:
         getNextToken();
         class_name_reference();
+        // TODO use InstanceofExpression
+        expression = new Expression();
+        expression.sourceStart = exprSourceStart;
+        expression.sourceEnd = scanner.getCurrentTokenEndPosition();
         break;
       case TokenNameQUESTION:
         getNextToken();
-        expr();
-        if (token == TokenNameCOLON) {
-          getNextToken();
-          expr();
+        Expression valueIfTrue = expr();
+        if (token != TokenNameCOLON) {
+          throwSyntaxError("':' expected in conditional expression.");
         }
+        getNextToken();
+        Expression valueIfFalse = expr();
+
+        expression = new ConditionalExpression(expression, valueIfTrue, valueIfFalse);
         break;
       default:
         return expression;
@@ -3251,7 +3283,7 @@ public class Parser //extends PHPParserSuperclass
   }
 
   private void internal_functions_in_yacc() {
-    int start = 0;
+    //    int start = 0;
     ImportReference impt = null;
     switch (token) {
     case TokenNameisset:
@@ -3282,28 +3314,11 @@ public class Parser //extends PHPParserSuperclass
       break;
     case TokenNameinclude:
       //T_INCLUDE expr
-      start = scanner.getCurrentTokenStartPosition();
-      getNextToken();
-      expr();
-
-      impt = new ImportReference(scanner.getCurrentTokenSource(start), start, scanner.getCurrentTokenEndPosition(), false);
-      impt.declarationSourceEnd = impt.sourceEnd;
-      impt.declarationEnd = impt.declarationSourceEnd;
-      //endPosition is just before the ;
-      impt.declarationSourceStart = start;
-      includesList.add(impt);
+      checkFileName(token, impt);
       break;
     case TokenNameinclude_once:
       //       T_INCLUDE_ONCE expr
-      start = scanner.getCurrentTokenStartPosition();
-      getNextToken();
-      expr();
-      impt = new ImportReference(scanner.getCurrentTokenSource(start), start, scanner.getCurrentTokenEndPosition(), false);
-      impt.declarationSourceEnd = impt.sourceEnd;
-      impt.declarationEnd = impt.declarationSourceEnd;
-      //endPosition is just before the ;
-      impt.declarationSourceStart = start;
-      includesList.add(impt);
+      checkFileName(token, impt);
       break;
     case TokenNameeval:
       //       T_EVAL '(' expr ')'
@@ -3320,31 +3335,78 @@ public class Parser //extends PHPParserSuperclass
       break;
     case TokenNamerequire:
       //T_REQUIRE expr
-      start = scanner.getCurrentTokenStartPosition();
-      getNextToken();
-      expr();
-      impt = new ImportReference(scanner.getCurrentTokenSource(start), start, scanner.getCurrentTokenEndPosition(), false);
-      impt.declarationSourceEnd = impt.sourceEnd;
-      impt.declarationEnd = impt.declarationSourceEnd;
-      //endPosition is just before the ;
-      impt.declarationSourceStart = start;
-      includesList.add(impt);
+      checkFileName(token, impt);
       break;
     case TokenNamerequire_once:
       //       T_REQUIRE_ONCE expr
-      start = scanner.getCurrentTokenStartPosition();
-      getNextToken();
-      expr();
-      impt = new ImportReference(scanner.getCurrentTokenSource(start), start, scanner.getCurrentTokenEndPosition(), false);
-      impt.declarationSourceEnd = impt.sourceEnd;
-      impt.declarationEnd = impt.declarationSourceEnd;
-      //endPosition is just before the ;
-      impt.declarationSourceStart = start;
-      includesList.add(impt);
+      checkFileName(token, impt);
       break;
     }
   }
 
+  private void checkFileName(int includeToken, ImportReference impt) {
+    //<include-token> expr
+    int start = scanner.getCurrentTokenStartPosition();
+    boolean hasLPAREN = false;
+    getNextToken();
+    if (token == TokenNameLPAREN) {
+      hasLPAREN = true;
+      getNextToken();
+    }
+    Expression expression = expr();
+    if (hasLPAREN) {
+      if (token == TokenNameRPAREN) {
+        getNextToken();
+      } else {
+        throwSyntaxError("')' expected for keyword '" + scanner.toStringAction(includeToken) + "'");
+      }
+    }
+    impt = new ImportReference(scanner.getCurrentTokenSource(start), start, scanner.getCurrentTokenEndPosition(), false);
+    impt.declarationSourceEnd = impt.sourceEnd;
+    impt.declarationEnd = impt.declarationSourceEnd;
+    //endPosition is just before the ;
+    impt.declarationSourceStart = start;
+    includesList.add(impt);
+
+    if (expression instanceof StringLiteral) {
+      StringLiteral literal = (StringLiteral) expression;
+      char[] includeName = literal.source();
+      if (includeName.length == 0) {
+        reportSyntaxError("Empty filename after keyword '" + scanner.toStringAction(includeToken) + "'", literal.sourceStart,
+            literal.sourceStart + 1);
+      }
+      String includeNameString = new String(includeName);
+      if (literal instanceof StringLiteralDQ) {
+        if (includeNameString.indexOf('$') >= 0) {
+          // assuming that the filename contains a variable => no filename check
+          return;
+        }
+      }
+      if (includeNameString.startsWith("http://")) {
+        // assuming external include location
+        return;
+      }
+      if (scanner.compilationUnit != null) {
+        IResource resource = scanner.compilationUnit.getResource();
+        //        java.io.File f = new java.io.File(new String(compilationUnit.getFileName()));
+        //        System.out.println(expression.toStringExpression());
+        //      }
+        if (resource != null && resource instanceof IFile) {
+          // check the filename:
+          //      System.out.println(new String(compilationUnit.getFileName())+" - "+ expression.toStringExpression());
+          IProject project = resource.getProject();
+          if (project != null) {
+            if (PHPFileUtil.determineFilePath(includeNameString, resource, project) == null) {
+              reportSyntaxError("File: " + expression.toStringExpression() + " doesn't exist in project: "
+                  + project.getLocation().toString(), literal.sourceStart, literal.sourceEnd);
+              //              System.out.println(path.toString() + " - " + expression.toStringExpression());
+            }
+          }
+        }
+      }
+    }
+  }
+
   private void isset_variables() {
     // variable
     // | isset_variables ','
index c13f9f6..4a3cac8 100644 (file)
@@ -17,7 +17,6 @@ import net.sourceforge.phpeclipse.internal.compiler.ast.Statement;
 /**
  * Internal structure for parsing recovery 
  */
-
 public class RecoveredElement {
 
        public RecoveredElement parent;
index 9146cc7..7d96e62 100644 (file)
@@ -16,6 +16,7 @@ import net.sourceforge.phpdt.core.compiler.CharOperation;
 import net.sourceforge.phpdt.core.compiler.IScanner;
 import net.sourceforge.phpdt.core.compiler.ITerminalSymbols;
 import net.sourceforge.phpdt.core.compiler.InvalidInputException;
+import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit;
 import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteral;
 
 public class Scanner implements IScanner, ITerminalSymbols {
@@ -196,6 +197,7 @@ public class Scanner implements IScanner, ITerminalSymbols {
 
   public static final boolean TRACE = false;
 
+  public ICompilationUnit compilationUnit = null;
   /**
    * Determines if the specified character is permissible as the first character in a PHP identifier
    */
@@ -311,6 +313,9 @@ public class Scanner implements IScanner, ITerminalSymbols {
 
   public final char[] getCurrentStringLiteralSource() {
     // Return the token REAL source (aka unicodes are precomputed)
+    if (startPosition + 1 >= currentPosition) {
+      return new char[0];
+    }
     char[] result;
     int length;
     System.arraycopy(source, startPosition + 1, result = new char[length = currentPosition - startPosition - 2], 0, length);
@@ -318,6 +323,14 @@ public class Scanner implements IScanner, ITerminalSymbols {
     return result;
   }
 
+  public final char[] getCurrentStringLiteralSource(int startPos) {
+    // Return the token REAL source (aka unicodes are precomputed)
+    char[] result;
+    int length;
+    System.arraycopy(source, startPos + 1, result = new char[length = currentPosition - startPos - 2], 0, length);
+    //    }
+    return result;
+  }
   /*
    * Search the source position corresponding to the end of a given line number
    * 
@@ -3626,7 +3639,12 @@ public class Scanner implements IScanner, ITerminalSymbols {
   }
 
   public final void setSource(char[] source) {
+    setSource(null, source);
+  }
+  
+  public final void setSource(ICompilationUnit compilationUnit, char[] source) {
     //the source-buffer is set to sourceString
+    this.compilationUnit = compilationUnit;
     if (source == null) {
       this.source = new char[0];
     } else {
index 744a7ab..f9981b9 100644 (file)
@@ -140,7 +140,7 @@ public class UnitParser extends Parser {
       goForCompilationUnit();
 
       /* scanner initialization */
-      scanner.setSource(sourceUnit.getContents());
+      scanner.setSource(sourceUnit, sourceUnit.getContents());
 
       /* unit creation */
       referenceContext =
@@ -405,7 +405,7 @@ public class UnitParser extends Parser {
       goForCompilationUnit();
 
       /* scanner initialization */
-      scanner.setSource(sourceUnit.getContents());
+      scanner.setSource(sourceUnit, sourceUnit.getContents());
       scanner.resetTo(start, end);
       /* unit creation */
       referenceContext =
index 78548c7..83d80cf 100644 (file)
@@ -91,7 +91,7 @@ public class DefaultProblem implements ProblemSeverities, IProblem {
        //              //sanity .....
        //              if ((startPosition > endPosition)
        //                      || ((startPosition <= 0) && (endPosition <= 0)))
-       //                      return Util.bind("problem.noSourceInformation"); //$NON-NLS-1$
+       //                      return ProjectPrefUtil.bind("problem.noSourceInformation"); //$NON-NLS-1$
        //
        //              final char SPACE = '\u0020';
        //              final char MARK = '^';
@@ -160,7 +160,7 @@ public class DefaultProblem implements ProblemSeverities, IProblem {
        //              //resize underneathto remove 'null' chars
        //              System.arraycopy(underneath, 0, underneath = new char[pos], 0, pos);
        //
-       //              return " " + Util.bind("problem.atLine", String.valueOf(line))
+       //              return " " + ProjectPrefUtil.bind("problem.atLine", String.valueOf(line))
        // //$NON-NLS-2$ //$NON-NLS-1$
        //                      + "\n\t" + new String(extract) + "\n\t" + new String(underneath);
        // //$NON-NLS-2$ //$NON-NLS-1$
index c6c0f0f..cf5d8d5 100644 (file)
@@ -21,94 +21,107 @@ import net.sourceforge.phpdt.internal.compiler.util.Util;
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 
 /**
- * A basic implementation of <code>ICompilationUnit</code>
- * for use in the <code>SourceMapper</code>.
+ * A basic implementation of <code>ICompilationUnit</code> for use in the <code>SourceMapper</code>.
+ * 
  * @see ICompilationUnit
  */
 public class BasicCompilationUnit implements ICompilationUnit {
   protected char[] contents;
+
   protected char[] fileName;
+
   protected char[][] packageName;
+
   protected char[] mainTypeName;
+
   protected String encoding;
 
-//  public BasicCompilationUnit(char[] contents, char[][] packageName, String fileName, String encoding) {
-//    this.contents = contents;
-//    this.fileName = fileName.toCharArray();
-//    this.packageName = packageName;
-//
-//    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;
-//  }
+  protected IResource resource;
+
+  //  public BasicCompilationUnit(char[] contents, char[][] packageName, String fileName, String encoding) {
+  //    this.contents = contents;
+  //    this.fileName = fileName.toCharArray();
+  //    this.packageName = packageName;
+  //
+  //    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 BasicCompilationUnit(char[] contents, char[][] packageName, String fileName) {
-       this.contents = contents;
-       this.fileName = fileName.toCharArray();
-       this.packageName = packageName;
+    this.contents = contents;
+    this.fileName = fileName.toCharArray();
+    this.packageName = packageName;
+
+    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 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();
 
-       int end = fileName.lastIndexOf("."); //$NON-NLS-1$
-       if (end == -1)
-               end = fileName.length();
+    this.mainTypeName = fileName.substring(start, end).toCharArray();
+    this.encoding = null;
+    this.resource = null;
+  }
 
-       this.mainTypeName = fileName.substring(start, end).toCharArray();
-       this.encoding = null;
-}
   public BasicCompilationUnit(char[] contents, char[][] packageName, String fileName, String encoding) {
-       this(contents, packageName, fileName);
-       this.encoding = encoding;
+    this(contents, packageName, fileName);
+    this.encoding = encoding;
+    this.resource = null;
   }
+
   public BasicCompilationUnit(char[] contents, char[][] packageName, String fileName, IJavaElement javaElement) {
-       this(contents, packageName, fileName);
-       initEncoding(javaElement);
+    this(contents, packageName, fileName);
+    initEncoding(javaElement);
   }
+
   /*
-   * Initialize compilation unit encoding.
-   * If we have a project, then get file name corresponding IFile and retrieve its encoding using
-   * new API for encoding.
-   * In case of a class file, then go through project in order to let the possibility to retrieve
-   * a corresponding source file resource.
-   * If we have a compilation unit, then get encoding from its resource directly...
+   * Initialize compilation unit encoding. If we have a project, then get file name corresponding IFile and retrieve its encoding
+   * using new API for encoding. In case of a class file, then go through project in order to let the possibility to retrieve a
+   * corresponding source file resource. If we have a compilation unit, then get encoding from its resource directly...
    */
   private void initEncoding(IJavaElement javaElement) {
-       if (javaElement != null) {
-               try {
-                       IJavaProject javaProject = javaElement.getJavaProject();
-                       switch (javaElement.getElementType()) {
-                               case IJavaElement.COMPILATION_UNIT:
-                                       IFile file = (IFile) javaElement.getResource();
-                                       if (file != null) {
-                                               this.encoding = file.getCharset();
-                                               break;
-                                       }
-                                       // if no file, then get project encoding
-                               default:
-                                       IProject project = (IProject) javaProject.getResource();
-                                       if (project != null) {
-                                               this.encoding = project.getDefaultCharset();
-                                       }
-                                       break;
-                       }
-               } catch (CoreException e1) {
-                       this.encoding = null;
-               }
-       } else  {
-               this.encoding = null;
-       }
+    if (javaElement != null) {
+      try {
+        IJavaProject javaProject = javaElement.getJavaProject();
+        switch (javaElement.getElementType()) {
+        case IJavaElement.COMPILATION_UNIT:
+          IFile file = (IFile) javaElement.getResource();
+
+          if (file != null) {
+            resource = file;
+            this.encoding = file.getCharset();
+            break;
+          }
+        // if no file, then get project encoding
+        default:
+          IProject project = (IProject) javaProject.getResource();
+          if (project != null) {
+            resource = project;
+            this.encoding = project.getDefaultCharset();
+          }
+          break;
+        }
+      } catch (CoreException e1) {
+        this.encoding = null;
+      }
+    } else {
+      this.encoding = null;
+    }
   }
+
   public char[] getContents() {
     if (this.contents != null)
       return this.contents; // answer the cached source
@@ -120,18 +133,27 @@ public class BasicCompilationUnit implements ICompilationUnit {
     }
     return CharOperation.NO_CHAR;
   }
+
   public char[] getFileName() {
     return this.fileName;
   }
+
   public char[] getMainTypeName() {
     return this.mainTypeName;
   }
+
   public char[][] getPackageName() {
     return this.packageName;
   }
+
   public String toString() {
     return "CompilationUnit: " + new String(fileName); //$NON-NLS-1$
   }
-  
 
-}
+  /* (non-Javadoc)
+   * @see net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit#getResource()
+   */
+  public IResource getResource() {
+    return resource;
+  }
+}
\ No newline at end of file
index 839b8cd..b03a1c5 100644 (file)
@@ -71,7 +71,7 @@ public class CommitWorkingCopyOperation extends JavaModelOperation {
       //                       PackageFragmentRoot root = (PackageFragmentRoot)workingCopy.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
       boolean isIncluded = !Util.isExcluded(workingCopy);
       //                       if (isPrimary || (root.isOnClasspath() && isIncluded && resource.isAccessible() &&
-      // Util.isValidCompilationUnitName(workingCopy.getElementName()))) {
+      // ProjectPrefUtil.isValidCompilationUnitName(workingCopy.getElementName()))) {
       if (isPrimary || (isIncluded && resource.isAccessible() && Util.isValidCompilationUnitName(workingCopy.getElementName()))) {
 
         // force opening so that the delta builder can get the old info
index feeabcc..2fb069d 100644 (file)
@@ -53,1169 +53,1278 @@ import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.Path;
 
-/**  
+/**
  * @see ICompilationUnit
  */
 
-public class CompilationUnit extends Openable implements ICompilationUnit, net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit {
-       public WorkingCopyOwner owner;
+public class CompilationUnit extends Openable implements ICompilationUnit,
+    net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit {
+  public WorkingCopyOwner owner;
 
-/**
- * Constructs a handle to a compilation unit with the given name in the
- * specified package for the specified owner
- *
- * @exception IllegalArgumentException if the name of the compilation unit
- * does not end with ".java"
- */
-protected CompilationUnit(PackageFragment parent, String name, WorkingCopyOwner owner) {
-       super(parent, name);
-       this.owner = owner;
-}
-/**
- * Accepts the given visitor onto the parsed tree of this compilation unit, after
- * having runned the name resolution.
- * The visitor's corresponding <code>visit</code> method is called with the
- * corresponding parse tree. If the visitor returns <code>true</code>, this method
- * visits this parse node's members.
- *
- * @param visitor the visitor
- * @exception JavaModelException if this method fails. Reasons include:
- * <ul>
- * <li> This element does not exist.</li>
- * <li> The visitor failed with this exception.</li>
- * </ul>
- */
-//public void accept(IAbstractSyntaxTreeVisitor visitor) throws JavaModelException {
-//     CompilationUnitVisitor.visit(this, visitor);
-//} 
-/*
- * @see ICompilationUnit#becomeWorkingCopy(IProblemRequestor, IProgressMonitor)
- */
-public void becomeWorkingCopy(IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException {
-       JavaModelManager manager = JavaModelManager.getJavaModelManager();
-       JavaModelManager.PerWorkingCopyInfo perWorkingCopyInfo = manager.getPerWorkingCopyInfo(this, false/*don't create*/, true /*record usage*/, null/*no problem requestor needed*/);
-       if (perWorkingCopyInfo == null) {
-               // close cu and its children
-               close();
-
-               BecomeWorkingCopyOperation operation = new BecomeWorkingCopyOperation(this, problemRequestor);
-               operation.runOperation(monitor);
-       }
-}
-//protected void buildStructure(OpenableElementInfo info, IProgressMonitor monitor) throws JavaModelException {
-//
-//     if (monitor != null && monitor.isCanceled()) return;
-//
-//     // remove existing (old) infos
-//     removeInfo();
-//
-//     HashMap newElements = new HashMap(11);
-//     info.setIsStructureKnown(generateInfos(info, monitor, newElements, getResource()));
-//     JavaModelManager.getJavaModelManager().getElementsOutOfSynchWithBuffers().remove(this);
-//     for (Iterator iter = newElements.keySet().iterator(); iter.hasNext();) {
-//             IJavaElement key = (IJavaElement) iter.next();
-//             Object value = newElements.get(key);
-//             JavaModelManager.getJavaModelManager().putInfo(key, value);
-//     }
-//     // add the info for this at the end, to ensure that a getInfo cannot reply null in case the LRU cache needs
-//     // to be flushed. Might lead to performance issues.
-//     // see PR 1G2K5S7: ITPJCORE:ALL - NPE when accessing source for a binary type
-//     JavaModelManager.getJavaModelManager().putInfo(this, info);     
-//}
-protected boolean buildStructure(OpenableElementInfo info, final IProgressMonitor pm, Map newElements, IResource underlyingResource) throws JavaModelException {
-
-       // check if this compilation unit can be opened
-       if (!isWorkingCopy()) { // no check is done on root kind or exclusion pattern for working copies
-               if ( // ((IPackageFragment)getParent()).getKind() == IPackageFragmentRoot.K_BINARY|| 
-                               !isValidCompilationUnit()
-                               || !underlyingResource.isAccessible()) {
-                       throw newNotPresentException();
-               }
-       }
-       
-       // prevents reopening of non-primary working copies (they are closed when they are discarded and should not be reopened)
-       if (!isPrimary() && getPerWorkingCopyInfo() == null) {
-               throw newNotPresentException();
-       }
-
-       CompilationUnitElementInfo unitInfo = (CompilationUnitElementInfo) info;
-
-       // get buffer contents
-       IBuffer buffer = getBufferManager().getBuffer(CompilationUnit.this);
-       if (buffer == null) {
-               buffer = openBuffer(pm, unitInfo); // open buffer independently from the info, since we are building the info
-       }
-       final char[] contents = buffer == null ? null : buffer.getCharacters();
-
-       // generate structure and compute syntax problems if needed
-       CompilationUnitStructureRequestor requestor = new CompilationUnitStructureRequestor(this, unitInfo, newElements);
-       JavaModelManager.PerWorkingCopyInfo perWorkingCopyInfo = getPerWorkingCopyInfo();
-       IJavaProject project = getJavaProject();
-       boolean computeProblems = JavaProject.hasJavaNature(project.getProject()) && perWorkingCopyInfo != null && perWorkingCopyInfo.isActive();
-       IProblemFactory problemFactory = new DefaultProblemFactory();
-       Map options = project.getOptions(true);
-       SourceElementParser parser = new SourceElementParser(
-               requestor, 
-               problemFactory, 
-               new CompilerOptions(options));
-               //, true/*report local declarations*/);
-       requestor.parser = parser;
-       CompilationUnitDeclaration unit = parser.parseCompilationUnit(new net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit() {
-                       public char[] getContents() {
-                               return contents;
-                       }
-                       public char[] getMainTypeName() {
-                               return CompilationUnit.this.getMainTypeName();
-                       }
-                       public char[][] getPackageName() {
-                               return CompilationUnit.this.getPackageName();
-                       }
-                       public char[] getFileName() {
-                               return CompilationUnit.this.getFileName();
-                       }
-               }, true /*full parse to find local elements*/);
-       
-       // update timestamp (might be IResource.NULL_STAMP if original does not exist)
-       if (underlyingResource == null) {
-               underlyingResource = getResource();
-       }
-       unitInfo.timestamp = ((IFile)underlyingResource).getModificationStamp();
-       
-       // compute other problems if needed
-       CompilationUnitDeclaration compilationUnitDeclaration = null;
-       try {
-               if (computeProblems){
-                       perWorkingCopyInfo.beginReporting();
-                       compilationUnitDeclaration = CompilationUnitProblemFinder.process(unit, this, contents, parser, this.owner, perWorkingCopyInfo, problemFactory, false/*don't cleanup cu*/, pm);
-                       perWorkingCopyInfo.endReporting();
-               }
-               
-//             if (info instanceof ASTHolderCUInfo) {
-//                     int astLevel = ((ASTHolderCUInfo) info).astLevel;
-//                     org.eclipse.jdt.core.dom.CompilationUnit cu = AST.convertCompilationUnit(astLevel, unit, contents, options, pm);
-//                     ((ASTHolderCUInfo) info).ast = cu;
-//             }
-       } finally {
-           if (compilationUnitDeclaration != null) {
-               compilationUnitDeclaration.cleanUp();
-           }
-       }
-       
-       return unitInfo.isStructureKnown();
-}
-///**
-// * @see ICodeAssist#codeComplete(int, ICompletionRequestor)
-// */
-//public void codeComplete(int offset, ICompletionRequestor requestor) throws JavaModelException {
-//     codeComplete(this, isWorkingCopy() ? (org.eclipse.jdt.internal.compiler.env.ICompilationUnit) getOriginalElement() : this, offset, requestor);
-//}
-/**
- * @see ICodeAssist#codeSelect(int, int)
- */
-//public IJavaElement[] codeSelect(int offset, int length) throws JavaModelException {
-//     return super.codeSelect(this, offset, length);
-//}
-/**
- * @see IWorkingCopy#commit(boolean, IProgressMonitor)
- */
-public void commit(boolean force, IProgressMonitor monitor) throws JavaModelException {
-  commitWorkingCopy(force, monitor);
-//     throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_ELEMENT_TYPES, this));
-}
-/**
- * @see ICompilationUnit#commitWorkingCopy(boolean, IProgressMonitor)
- */
-public void commitWorkingCopy(boolean force, IProgressMonitor monitor) throws JavaModelException {
-       CommitWorkingCopyOperation op= new CommitWorkingCopyOperation(this, force);
-       op.runOperation(monitor);
-}
-/**
- * @see ISourceManipulation#copy(IJavaElement, IJavaElement, String, boolean, IProgressMonitor)
- */
-public void copy(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor) throws JavaModelException {
-       if (container == null) {
-               throw new IllegalArgumentException(Util.bind("operation.nullContainer")); //$NON-NLS-1$
-       }
-       IJavaElement[] elements = new IJavaElement[] {this};
-       IJavaElement[] containers = new IJavaElement[] {container};
-       String[] renamings = null;
-       if (rename != null) {
-               renamings = new String[] {rename};
-       }
-       getJavaModel().copy(elements, containers, null, renamings, force, monitor);
-}
+  /**
+   * Constructs a handle to a compilation unit with the given name in the specified package for the specified owner
+   * 
+   * @exception IllegalArgumentException
+   *              if the name of the compilation unit does not end with ".java"
+   */
+  protected CompilationUnit(PackageFragment parent, String name, WorkingCopyOwner owner) {
+    super(parent, name);
+    this.owner = owner;
+  }
 
-/**
- * Returns a new element info for this element.
- */
-protected Object createElementInfo() {
-       return new CompilationUnitElementInfo();
-}
-///**
-// * @see ICompilationUnit#createImport(String, IJavaElement, IProgressMonitor)
-// */
-//public IImportDeclaration createImport(String name, IJavaElement sibling, IProgressMonitor monitor) throws JavaModelException {
-//     CreateImportOperation op = new CreateImportOperation(name, this);
-//     if (sibling != null) {
-//             op.createBefore(sibling);
-//     }
-//     runOperation(op, monitor);
-//     return getImport(name);
-//}
-/**
- * @see ICompilationUnit#createPackageDeclaration(String, IProgressMonitor)
- */
-public IPackageDeclaration createPackageDeclaration(String name, IProgressMonitor monitor) throws JavaModelException {
-       
-       CreatePackageDeclarationOperation op= new CreatePackageDeclarationOperation(name, this);
-       runOperation(op, monitor);
-       return getPackageDeclaration(name);
-}
-///**
-// * @see ICompilationUnit#createType(String, IJavaElement, boolean, IProgressMonitor)
-// */
-//public IType createType(String content, IJavaElement sibling, boolean force, IProgressMonitor monitor) throws JavaModelException {
-//     if (!exists()) {
-//             //autogenerate this compilation unit
-//             IPackageFragment pkg = (IPackageFragment) getParent();
-//             String source = ""; //$NON-NLS-1$
-//             if (pkg.getElementName().length() > 0) {
-//                     //not the default package...add the package declaration
-//                     source = "package " + pkg.getElementName() + ";"  + org.eclipse.jdt.internal.compiler.util.Util.LINE_SEPARATOR + org.eclipse.jdt.internal.compiler.util.Util.LINE_SEPARATOR; //$NON-NLS-1$ //$NON-NLS-2$
-//             }
-//             CreateCompilationUnitOperation op = new CreateCompilationUnitOperation(pkg, fName, source, force);
-//             runOperation(op, monitor);
-//     }
-//     CreateTypeOperation op = new CreateTypeOperation(this, content, force);
-//     if (sibling != null) {
-//             op.createBefore(sibling);
-//     }
-//     runOperation(op, monitor);
-//     return (IType) op.getResultElements()[0];
-//}
-/**
- * @see ISourceManipulation#delete(boolean, IProgressMonitor)
- */
-public void delete(boolean force, IProgressMonitor monitor) throws JavaModelException {
-       IJavaElement[] elements= new IJavaElement[] {this};
-       getJavaModel().delete(elements, force, monitor);
-}
-/**
- * @see IWorkingCopy#destroy()
- * @deprecated
- */
-public void destroy() {
-       try {
-               discardWorkingCopy();
-       } catch (JavaModelException e) {
-               e.printStackTrace();
-       }
-}
-/*
- * @see ICompilationUnit#discardWorkingCopy
- */
-public void discardWorkingCopy() throws JavaModelException {
-       // discard working copy and its children
-       DiscardWorkingCopyOperation op = new DiscardWorkingCopyOperation(this);
-       op.runOperation(null);
-}
+  /**
+   * Accepts the given visitor onto the parsed tree of this compilation unit, after having runned the name resolution. The visitor's
+   * corresponding <code>visit</code> method is called with the corresponding parse tree. If the visitor returns <code>true</code>,
+   * this method visits this parse node's members.
+   * 
+   * @param visitor
+   *          the visitor
+   * @exception JavaModelException
+   *              if this method fails. Reasons include:
+   *              <ul>
+   *              <li>This element does not exist.</li>
+   *              <li>The visitor failed with this exception.</li>
+   *              </ul>
+   */
+  //public void accept(IAbstractSyntaxTreeVisitor visitor) throws JavaModelException {
+  //   CompilationUnitVisitor.visit(this, visitor);
+  //}
+  /*
+   * @see ICompilationUnit#becomeWorkingCopy(IProblemRequestor, IProgressMonitor)
+   */
+  public void becomeWorkingCopy(IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException {
+    JavaModelManager manager = JavaModelManager.getJavaModelManager();
+    JavaModelManager.PerWorkingCopyInfo perWorkingCopyInfo = manager.getPerWorkingCopyInfo(this, false/* don't create */,
+        true /* record usage */, null/* no problem requestor needed */);
+    if (perWorkingCopyInfo == null) {
+      // close cu and its children
+      close();
 
-/**
- * Returns true if this handle represents the same Java element
- * as the given handle.
- *
- * @see Object#equals(java.lang.Object)
- */
-public boolean equals(Object obj) {
-       if (!(obj instanceof CompilationUnit)) return false;
-       CompilationUnit other = (CompilationUnit)obj;
-       return this.owner.equals(other.owner) && super.equals(obj);
-}
-/**
- * @see JavaElement#equalsDOMNode(IDOMNode)
- */
-protected boolean equalsDOMNode(IDOMNode node) throws JavaModelException {
-       String name = getElementName();
-       if (node.getNodeType() == IDOMNode.COMPILATION_UNIT && name != null ) {
-               String nodeName = node.getName();
-               if (nodeName == null) return false;             
-               if (name.equals(nodeName)) {
-                       return true;
-               } else {
-                       // iterate through all the types inside the receiver and see if one of them can fit
-                       IType[] types = getTypes();
-                       String typeNodeName = nodeName.substring(0, nodeName.indexOf(".java")); //$NON-NLS-1$
-                       for (int i = 0, max = types.length; i < max; i++) {
-                               if (types[i].getElementName().equals(typeNodeName)) {
-                                       return true;
-                               }
-                       }
-               }
-       }
-       return false;
-}
-/**
- * @see IWorkingCopy#findElements(IJavaElement)
- */
-public IJavaElement[] findElements(IJavaElement element) {
-       ArrayList children = new ArrayList();
-       while (element != null && element.getElementType() != IJavaElement.COMPILATION_UNIT) {
-               children.add(element);
-               element = element.getParent();
-       }
-       if (element == null) return null;
-       IJavaElement currentElement = this;
-       for (int i = children.size()-1; i >= 0; i--) {
-               IJavaElement child = (IJavaElement)children.get(i);
-               switch (child.getElementType()) {
-//                     case IJavaElement.PACKAGE_DECLARATION:
-//                             currentElement = ((ICompilationUnit)currentElement).getPackageDeclaration(child.getElementName());
-//                             break;
-//                     case IJavaElement.IMPORT_CONTAINER:
-//                             currentElement = ((ICompilationUnit)currentElement).getImportContainer();
-//                             break;
-//                     case IJavaElement.IMPORT_DECLARATION:
-//                             currentElement = ((IImportContainer)currentElement).getImport(child.getElementName());
-//                             break;
-                       case IJavaElement.TYPE:
-                               if (currentElement.getElementType() == IJavaElement.COMPILATION_UNIT) {
-                                       currentElement = ((ICompilationUnit)currentElement).getType(child.getElementName());
-                               } else {
-                                       currentElement = ((IType)currentElement).getType(child.getElementName());
-                               }
-                               break;
-//                     case IJavaElement.INITIALIZER:
-//                             currentElement = ((IType)currentElement).getInitializer(((JavaElement)child).getOccurrenceCount());
-//                             break;
-                       case IJavaElement.FIELD:
-                               currentElement = ((IType)currentElement).getField(child.getElementName());
-                               break;
-                       case IJavaElement.METHOD:
-                               return ((IType)currentElement).findMethods((IMethod)child);
-               }
-               
-       }
-       if (currentElement != null && currentElement.exists()) {
-               return new IJavaElement[] {currentElement};
-       } else {
-               return null;
-       }
-}
-/**
- * @see IWorkingCopy#findPrimaryType()
- */
-public IType findPrimaryType() {
-       String typeName = Signature.getQualifier(this.getElementName());
-       IType primaryType= this.getType(typeName);
-       if (primaryType.exists()) {
-               return primaryType;
-       }
-       return null;
-}
-/**
- * @see IWorkingCopy#findSharedWorkingCopy(IBufferFactory)
- * @deprecated
- */
-public IJavaElement findSharedWorkingCopy(IBufferFactory factory) {
+      BecomeWorkingCopyOperation operation = new BecomeWorkingCopyOperation(this, problemRequestor);
+      operation.runOperation(monitor);
+    }
+  }
 
-       // if factory is null, default factory must be used
-       if (factory == null) factory = this.getBufferManager().getDefaultBufferFactory();
-       
-       return findWorkingCopy(BufferFactoryWrapper.create(factory));
-}
+  //protected void buildStructure(OpenableElementInfo info, IProgressMonitor monitor) throws JavaModelException {
+  //
+  //   if (monitor != null && monitor.isCanceled()) return;
+  //
+  //   // remove existing (old) infos
+  //   removeInfo();
+  //
+  //   HashMap newElements = new HashMap(11);
+  //   info.setIsStructureKnown(generateInfos(info, monitor, newElements, getResource()));
+  //   JavaModelManager.getJavaModelManager().getElementsOutOfSynchWithBuffers().remove(this);
+  //   for (Iterator iter = newElements.keySet().iterator(); iter.hasNext();) {
+  //           IJavaElement key = (IJavaElement) iter.next();
+  //           Object value = newElements.get(key);
+  //           JavaModelManager.getJavaModelManager().putInfo(key, value);
+  //   }
+  //   // add the info for this at the end, to ensure that a getInfo cannot reply null in case the LRU cache needs
+  //   // to be flushed. Might lead to performance issues.
+  //   // see PR 1G2K5S7: ITPJCORE:ALL - NPE when accessing source for a binary type
+  //   JavaModelManager.getJavaModelManager().putInfo(this, info);
+  //}
+  protected boolean buildStructure(OpenableElementInfo info, final IProgressMonitor pm, Map newElements,
+      IResource underlyingResource) throws JavaModelException {
 
-/**
- * @see ICompilationUnit#findWorkingCopy(WorkingCopyOwner)
- */
-public ICompilationUnit findWorkingCopy(WorkingCopyOwner workingCopyOwner) {
-       CompilationUnit cu = new CompilationUnit((PackageFragment)this.parent, getElementName(), workingCopyOwner);
-       if (workingCopyOwner == DefaultWorkingCopyOwner.PRIMARY) {
-               return cu;
-       } else {
-               // must be a working copy
-               JavaModelManager.PerWorkingCopyInfo perWorkingCopyInfo = cu.getPerWorkingCopyInfo();
-               if (perWorkingCopyInfo != null) {
-                       return perWorkingCopyInfo.getWorkingCopy();
-               } else {
-                       return null;
-               }
-       }
-}
-//protected boolean generateInfos(OpenableElementInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource) throws JavaModelException {
-//
-////   if (getParent() instanceof JarPackageFragment) {
-////           // ignore .java files in jar
-////           throw newNotPresentException();
-////   } else {
-//             // put the info now, because getting the contents requires it
-//             JavaModelManager.getJavaModelManager().putInfo(this, info);
-//             CompilationUnitElementInfo unitInfo = (CompilationUnitElementInfo) info;
-//
-//             // generate structure
-//             CompilationUnitStructureRequestor requestor = new CompilationUnitStructureRequestor(this, unitInfo, newElements);
-//             IProblemFactory factory = new DefaultProblemFactory();
-//             SourceElementParser parser = new SourceElementParser(requestor, factory, new CompilerOptions(getJavaProject().getOptions(true)));
-////     SourceElementParser parser = new SourceElementParser(requestor, factory);
-//             requestor.parser = parser;
-//             parser.parseCompilationUnit(this, false);
-//             if (isWorkingCopy()) {
-//                     CompilationUnit original = (CompilationUnit) getOriginalElement();
-//                     // might be IResource.NULL_STAMP if original does not exist
-//                     unitInfo.timestamp = ((IFile) original.getResource()).getModificationStamp();
-//             }
-//             return unitInfo.isStructureKnown();
-////   }
-//}
-/**
- * @see ICompilationUnit#getAllTypes()
- */
-public IType[] getAllTypes() throws JavaModelException {
-       IJavaElement[] types = getTypes();
-       int i;
-       ArrayList allTypes = new ArrayList(types.length);
-       ArrayList typesToTraverse = new ArrayList(types.length);
-       for (i = 0; i < types.length; i++) {
-               typesToTraverse.add(types[i]);
-       }
-       while (!typesToTraverse.isEmpty()) {
-               IType type = (IType) typesToTraverse.get(0);
-               typesToTraverse.remove(type);
-               allTypes.add(type);
-               types = type.getTypes();
-               for (i = 0; i < types.length; i++) {
-                       typesToTraverse.add(types[i]);
-               }
-       } 
-       IType[] arrayOfAllTypes = new IType[allTypes.size()];
-       allTypes.toArray(arrayOfAllTypes);
-       return arrayOfAllTypes;
-}
-/**
- * @see IMember#getCompilationUnit()
- */
-public ICompilationUnit getCompilationUnit() {
-       return this;
-}
-/**
- * @see org.eclipse.jdt.internal.compiler.env.ICompilationUnit#getContents()
- */
-public char[] getContents() {
-       try {
-               IBuffer buffer = this.getBuffer();
-               return buffer == null ? null : buffer.getCharacters();
-       } catch (JavaModelException e) {
-               return CharOperation.NO_CHAR;
-       }
-}
-/**
- * A compilation unit has a corresponding resource unless it is contained
- * in a jar.
- *
- * @see IJavaElement#getCorrespondingResource()
- */
-public IResource getCorrespondingResource() throws JavaModelException {
-       IPackageFragmentRoot root= (IPackageFragmentRoot)getParent().getParent();
-       if (root.isArchive()) {
-               return null;
-       } else {
-               return getUnderlyingResource();
-       }
-}
-/**
- * @see ICompilationUnit#getElementAt(int)
- */
-public IJavaElement getElementAt(int position) throws JavaModelException {
-
-       IJavaElement e= getSourceElementAt(position);
-       if (e == this) {
-               return null;
-       } else {
-               return e;
-       }
-}
-/**
- * @see IJavaElement
- */
-public int getElementType() {
-       return COMPILATION_UNIT;
-}
-public char[] getFileName(){
-       return getElementName().toCharArray();
-}
-/**
- * @see JavaElement#getHandleMementoDelimiter()
- */
-protected char getHandleMementoDelimiter() {
-       return JavaElement.JEM_COMPILATIONUNIT;
-}
-/**
- * @see ICompilationUnit#getImport(String)
- */
-public IImportDeclaration getImport(String importName) {
-       return new ImportDeclaration((ImportContainer)getImportContainer(), importName);
-}
+    // check if this compilation unit can be opened
+    if (!isWorkingCopy()) { // no check is done on root kind or exclusion pattern for working copies
+      if ( // ((IPackageFragment)getParent()).getKind() == IPackageFragmentRoot.K_BINARY||
+      !isValidCompilationUnit() || !underlyingResource.isAccessible()) {
+        throw newNotPresentException();
+      }
+    }
 
-/**
- * @see ICompilationUnit#getImportContainer()
- */
-public ImportContainer getImportContainer() {
-       return new ImportContainer(this);
-}
+    // prevents reopening of non-primary working copies (they are closed when they are discarded and should not be reopened)
+    if (!isPrimary() && getPerWorkingCopyInfo() == null) {
+      throw newNotPresentException();
+    }
 
+    CompilationUnitElementInfo unitInfo = (CompilationUnitElementInfo) info;
 
-/**
- * @see ICompilationUnit#getImports()
- */
-//public IImportDeclaration[] getImports() throws JavaModelException {
-//     IImportContainer container= getImportContainer();
-//     if (container.exists()) {
-//             IJavaElement[] elements= container.getChildren();
-//             IImportDeclaration[] imprts= new IImportDeclaration[elements.length];
-//             System.arraycopy(elements, 0, imprts, 0, elements.length);
-//             return imprts;
-//     } else if (!exists()) {
-//                     throw newNotPresentException();
-//     } else {
-//             return new IImportDeclaration[0];
-//     }
-//
-//}
-/**
- * @see org.eclipse.jdt.internal.compiler.env.ICompilationUnit#getMainTypeName()
- */
-public char[] getMainTypeName(){
-       String name= getElementName();
-       //remove the .java
-       name= name.substring(0, name.length() - 5);
-       return name.toCharArray();
-}
+    // get buffer contents
+    IBuffer buffer = getBufferManager().getBuffer(CompilationUnit.this);
+    if (buffer == null) {
+      buffer = openBuffer(pm, unitInfo); // open buffer independently from the info, since we are building the info
+    }
+    final char[] contents = buffer == null ? null : buffer.getCharacters();
 
-/**
- * @see IWorkingCopy#getOriginal(IJavaElement)
- * @deprecated
- */
-public IJavaElement getOriginal(IJavaElement workingCopyElement) {
-       // backward compatibility
-       if (!isWorkingCopy()) return null;
-       CompilationUnit cu = (CompilationUnit)workingCopyElement.getAncestor(COMPILATION_UNIT);
-       if (cu == null || !this.owner.equals(cu.owner)) {
-               return null;
-       }
-       
-       return workingCopyElement.getPrimaryElement();
-}
-/**
- * @see IWorkingCopy#getOriginalElement()
- * @deprecated
- */
-public IJavaElement getOriginalElement() {
-       // backward compatibility
-       if (!isWorkingCopy()) return null;
-       
-       return getPrimaryElement();
-}
-/*
- * @see ICompilationUnit#getOwner()
- */
-public WorkingCopyOwner getOwner() {
-       return isPrimary() || !isWorkingCopy() ? null : this.owner;
-}
-/**
- * @see ICompilationUnit#getPackageDeclaration(String)
- */
-public IPackageDeclaration getPackageDeclaration(String name) {
-       return new PackageDeclaration(this, name);
-}
-/**
- * @see ICompilationUnit#getPackageDeclarations()
- */
-public IPackageDeclaration[] getPackageDeclarations() throws JavaModelException {
-       ArrayList list = getChildrenOfType(PACKAGE_DECLARATION);
-       IPackageDeclaration[] array= new IPackageDeclaration[list.size()];
-       list.toArray(array);
-       return array;
-}
-/**
- * @see org.eclipse.jdt.internal.compiler.env.ICompilationUnit#getPackageName()
- */
-public char[][] getPackageName() {
-       return null;
-}
-/**
- * @see IJavaElement#getPath()
- */
-public IPath getPath() {
-       PackageFragmentRoot root = this.getPackageFragmentRoot();
-       if (root.isArchive()) {
-               return root.getPath();
-       } else {
-               return this.getParent().getPath().append(this.getElementName());
-       }
-}
-/*
- * Returns the per working copy info for the receiver, or null if none exist.
- * Note: the use count of the per working copy info is NOT incremented.
- */
-public JavaModelManager.PerWorkingCopyInfo getPerWorkingCopyInfo() {
-       return JavaModelManager.getJavaModelManager().getPerWorkingCopyInfo(this, false/*don't create*/, false/*don't record usage*/, null/*no problem requestor needed*/);
-}
-/*
- * @see ICompilationUnit#getPrimary()
- */
-public ICompilationUnit getPrimary() {
-       return (ICompilationUnit)getPrimaryElement(true);
-}
-/* 
- * @see JavaElement#getPrimaryElement(boolean)
- */
-public IJavaElement getPrimaryElement(boolean checkOwner) {
-       if (checkOwner && isPrimary()) return this;
-       return new CompilationUnit((PackageFragment)getParent(), getElementName(), DefaultWorkingCopyOwner.PRIMARY);
-}
+    // generate structure and compute syntax problems if needed
+    CompilationUnitStructureRequestor requestor = new CompilationUnitStructureRequestor(this, unitInfo, newElements);
+    JavaModelManager.PerWorkingCopyInfo perWorkingCopyInfo = getPerWorkingCopyInfo();
+    IJavaProject project = getJavaProject();
+    boolean computeProblems = JavaProject.hasJavaNature(project.getProject()) && perWorkingCopyInfo != null
+        && perWorkingCopyInfo.isActive();
+    IProblemFactory problemFactory = new DefaultProblemFactory();
+    Map options = project.getOptions(true);
 
-/**
- * @see IJavaElement#getResource()
- */
-public IResource getResource() {
-       PackageFragmentRoot root = this.getPackageFragmentRoot();
-       if (root.isArchive()) {
-               return root.getResource();
-       } else {
-               return ((IContainer)this.getParent().getResource()).getFile(new Path(this.getElementName()));
-       }
-}
+    if (underlyingResource == null) {
+      underlyingResource = getResource();
+    }
+    
+    SourceElementParser parser = new SourceElementParser(requestor, problemFactory,
+        new CompilerOptions(options));
+    //, true/*report local declarations*/);
+    requestor.parser = parser;
+    CompilationUnitDeclaration unit = parser.parseCompilationUnit(
+        new net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit() {
+          public char[] getContents() {
+            return contents;
+          }
 
-/**
- * @see ISourceReference#getSource()
- */
-public String getSource() throws JavaModelException {
-       IBuffer buffer = getBuffer();
-       if (buffer == null) return ""; //$NON-NLS-1$
-       return buffer.getContents();
-}
-/**
- * @see ISourceReference#getSourceRange()
- */
-public ISourceRange getSourceRange() throws JavaModelException {
-       return ((CompilationUnitElementInfo) getElementInfo()).getSourceRange();
-}
-/**
- * @see ICompilationUnit#getType(String)
- */
-public IType getType(String name) {
-       return new SourceType(this, name);
-}
-/**
- * @see ICompilationUnit#getTypes()
- */
-public IType[] getTypes() throws JavaModelException {
-       ArrayList list = getChildrenOfType(TYPE);
-       IType[] array= new IType[list.size()];
-       list.toArray(array);
-       return array;
-}
-/**
- * @see IJavaElement
- */
-public IResource getUnderlyingResource() throws JavaModelException {
-       if (isWorkingCopy() && !isPrimary()) return null;
-       return super.getUnderlyingResource();
-}
-///**
-// * @see IWorkingCopy#getSharedWorkingCopy(IProgressMonitor, IBufferFactory, IProblemRequestor)
-// */
-//public IJavaElement getSharedWorkingCopy(IProgressMonitor pm, IBufferFactory factory, IProblemRequestor problemRequestor) throws JavaModelException {
-//     
-//     // if factory is null, default factory must be used
-//     if (factory == null) factory = this.getBufferManager().getDefaultBufferFactory();
-//
-//     JavaModelManager manager = JavaModelManager.getJavaModelManager();
-//     
-//     // In order to be shared, working copies have to denote the same compilation unit 
-//     // AND use the same buffer factory.
-//     // Assuming there is a little set of buffer factories, then use a 2 level Map cache.
-//     Map sharedWorkingCopies = manager.sharedWorkingCopies;
-//     
-//     Map perFactoryWorkingCopies = (Map) sharedWorkingCopies.get(factory);
-//     if (perFactoryWorkingCopies == null){
-//             perFactoryWorkingCopies = new HashMap();
-//             sharedWorkingCopies.put(factory, perFactoryWorkingCopies);
-//     }
-//     WorkingCopy workingCopy = (WorkingCopy)perFactoryWorkingCopies.get(this);
-//     if (workingCopy != null) {
-//             workingCopy.useCount++;
-//
-//             if (SHARED_WC_VERBOSE) {
-//                     System.out.println("Incrementing use count of shared working copy " + workingCopy.toStringWithAncestors()); //$NON-NLS-1$
-//             }
-//
-//             return workingCopy;
-//     } else {
-//             CreateWorkingCopyOperation op = new CreateWorkingCopyOperation(this, perFactoryWorkingCopies, factory, problemRequestor);
-//             runOperation(op, pm);
-//             return op.getResultElements()[0];
-//     }
-//}
-///**
-// * @see IWorkingCopy#getWorkingCopy()
-// */
-//public IJavaElement getWorkingCopy() throws JavaModelException {
-//     return this.getWorkingCopy(null, null, null);
-//}
-//
-///**
-// * @see IWorkingCopy#getWorkingCopy(IProgressMonitor, IBufferFactory, IProblemRequestor)
-// */
-//public IJavaElement getWorkingCopy(IProgressMonitor pm, IBufferFactory factory, IProblemRequestor problemRequestor) throws JavaModelException {
-//     CreateWorkingCopyOperation op = new CreateWorkingCopyOperation(this, null, factory, problemRequestor);
-//     runOperation(op, pm);
-//     return op.getResultElements()[0];
-//}
-/**
- * @see IWorkingCopy#getSharedWorkingCopy(IProgressMonitor, IBufferFactory, IProblemRequestor)
- * @deprecated
- */
-public IJavaElement getSharedWorkingCopy(IProgressMonitor pm, IBufferFactory factory, IProblemRequestor problemRequestor) throws JavaModelException {
-       
-       // if factory is null, default factory must be used
-       if (factory == null) factory = this.getBufferManager().getDefaultBufferFactory();
-       
-       return getWorkingCopy(BufferFactoryWrapper.create(factory), problemRequestor, pm);
-}
-/**
- * @see IWorkingCopy#getWorkingCopy()
- * @deprecated
- */
-public IJavaElement getWorkingCopy() throws JavaModelException {
-       return getWorkingCopy(null);
-}
-/**
- * @see ICompilationUnit#getWorkingCopy(IProgressMonitor)
- */
-public ICompilationUnit getWorkingCopy(IProgressMonitor monitor) throws JavaModelException {
-       return getWorkingCopy(new WorkingCopyOwner() {/*non shared working copy*/}, null/*no problem requestor*/, monitor);
-}
-/**
- * @see IWorkingCopy#getWorkingCopy(IProgressMonitor, IBufferFactory, IProblemRequestor)
- * @deprecated
- */
-public IJavaElement getWorkingCopy(IProgressMonitor monitor, IBufferFactory factory, IProblemRequestor problemRequestor) throws JavaModelException {
-       return getWorkingCopy(BufferFactoryWrapper.create(factory), problemRequestor, monitor);
-}
-/**
- * @see ICompilationUnit#getWorkingCopy(WorkingCopyOwner, IProblemRequestor, IProgressMonitor)
- */
-public ICompilationUnit getWorkingCopy(WorkingCopyOwner workingCopyOwner, IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException {
-       if (!isPrimary()) return this;
-       
-       JavaModelManager manager = JavaModelManager.getJavaModelManager();
-       
-       CompilationUnit workingCopy = new CompilationUnit((PackageFragment)getParent(), getElementName(), workingCopyOwner);
-       JavaModelManager.PerWorkingCopyInfo perWorkingCopyInfo = 
-               manager.getPerWorkingCopyInfo(workingCopy, false/*don't create*/, true/*record usage*/, null/*not used since don't create*/);
-       if (perWorkingCopyInfo != null) {
-               return perWorkingCopyInfo.getWorkingCopy(); // return existing handle instead of the one created above
-       }
-       BecomeWorkingCopyOperation op = new BecomeWorkingCopyOperation(workingCopy, problemRequestor);
-       op.runOperation(monitor);
-       return workingCopy;
-}
+          public char[] getMainTypeName() {
+            return CompilationUnit.this.getMainTypeName();
+          }
 
-/**
- * If I am not open, return true to avoid parsing.
- *
- * @see IParent#hasChildren()
- */
-public boolean hasChildren() throws JavaModelException {
-//     if (isOpen()) {
-//             return getChildren().length > 0;
-//     } else {
-//             return true;
-//     }
-  return false;
-}
-/**
- * @see Openable#hasBuffer()
- */
-protected boolean hasBuffer() {
-       return true;
-}
-/*
- * @see ICompilationUnit#hasResourceChanged()
- */
-public boolean hasResourceChanged() {
-       if (!isWorkingCopy()) return false;
-       
-       // if resource got deleted, then #getModificationStamp() will answer IResource.NULL_STAMP, which is always different from the cached
-       // timestamp
-       Object info = JavaModelManager.getJavaModelManager().getInfo(this);
-       if (info == null) return false;
-       return ((CompilationUnitElementInfo)info).timestamp != getResource().getModificationStamp();
-}
-/**
- * @see IWorkingCopy#isBasedOn(IResource)
- * @deprecated
- */
-public boolean isBasedOn(IResource resource) {
-       if (!isWorkingCopy()) return false;
-       if (!getResource().equals(resource)) return false;
-       return !hasResourceChanged();
-}
-/**
- * @see IOpenable#isConsistent()
- */
-public boolean isConsistent() {
-       return JavaModelManager.getJavaModelManager().getElementsOutOfSynchWithBuffers().get(this) == null;
-}
+          public char[][] getPackageName() {
+            return CompilationUnit.this.getPackageName();
+          }
 
-/**
- * 
- * @see IOpenable
- */
-public boolean isOpen() {
-       Object info = JavaModelManager.getJavaModelManager().getInfo(this);
-       return info != null && ((CompilationUnitElementInfo)info).isOpen();
-}
-public boolean isPrimary() {
-       return this.owner == DefaultWorkingCopyOwner.PRIMARY;
-}
-/**
- * @see Openable#isSourceElement()
- */
-protected boolean isSourceElement() {
-       return true;
-}
-protected boolean isValidCompilationUnit() {
-       IPackageFragmentRoot root = getPackageFragmentRoot();
-       try {
-               if (root.getKind() != IPackageFragmentRoot.K_SOURCE) return false;
-       } catch (JavaModelException e) {
-               return false;
-       }
-//     IResource resource = getResource();
-//     if (resource != null) {
-//             char[][] inclusionPatterns = ((PackageFragmentRoot)root).fullInclusionPatternChars();
-//             char[][] exclusionPatterns = ((PackageFragmentRoot)root).fullExclusionPatternChars();
-//             if (Util.isExcluded(resource, inclusionPatterns, exclusionPatterns)) return false;
-//     }
-       if (!Util.isValidCompilationUnitName(getElementName())) return false;
-       return true;
-}
-/*
- * @see ICompilationUnit#isWorkingCopy()
- */
-public boolean isWorkingCopy() {
-       // For backward compatibility, non primary working copies are always returning true; in removal
-       // delta, clients can still check that element was a working copy before being discarded.
-       return !isPrimary() || getPerWorkingCopyInfo() != null;
-}
-/**
- * @see IOpenable#makeConsistent(IProgressMonitor)
- */
-public void makeConsistent(IProgressMonitor monitor) throws JavaModelException {
-       makeConsistent(false/*don't create AST*/, 0, monitor);
-}
-public Object makeConsistent(boolean createAST, int astLevel, IProgressMonitor monitor) throws JavaModelException {
-       if (isConsistent()) return null;
-               
-       // create a new info and make it the current info
-       // (this will remove the info and its children just before storing the new infos)
-//     if (createAST) {
-//             ASTHolderCUInfo info = new ASTHolderCUInfo();
-//             info.astLevel = astLevel;
-//             openWhenClosed(info, monitor);
-//             org.eclipse.jdt.core.dom.CompilationUnit result = info.ast;
-//             info.ast = null;
-//             return result;
-//     } else {
-               openWhenClosed(createElementInfo(), monitor);
-               return null;
-//     }
-}
-//public net.sourceforge.phpdt.core.dom.CompilationUnit makeConsistent(boolean createAST, int astLevel, IProgressMonitor monitor) throws JavaModelException {
-//     if (isConsistent()) return null;
-//             
-//     // create a new info and make it the current info
-//     // (this will remove the info and its children just before storing the new infos)
-//     if (createAST) {
-//             ASTHolderCUInfo info = new ASTHolderCUInfo();
-//             info.astLevel = astLevel;
-//             openWhenClosed(info, monitor);
-//             net.sourceforge.phpdt.core.dom.CompilationUnit result = info.ast;
-//             info.ast = null;
-//             return result;
-//     } else {
-//             openWhenClosed(createElementInfo(), monitor);
-//             return null;
-//     }
-//}
+          public char[] getFileName() {
+            return CompilationUnit.this.getFileName();
+          }
 
-/**
- * @see ISourceManipulation#move(IJavaElement, IJavaElement, String, boolean, IProgressMonitor)
- */
-public void move(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor) throws JavaModelException {
-       if (container == null) {
-               throw new IllegalArgumentException(Util.bind("operation.nullContainer")); //$NON-NLS-1$
-       }
-       IJavaElement[] elements= new IJavaElement[] {this};
-       IJavaElement[] containers= new IJavaElement[] {container};
-       
-       String[] renamings= null;
-       if (rename != null) {
-               renamings= new String[] {rename};
-       }
-       getJavaModel().move(elements, containers, null, renamings, force, monitor);
-}
-
-///**
-// * @see Openable#openBuffer(IProgressMonitor)
-// */
-//protected IBuffer openBuffer(IProgressMonitor pm) throws JavaModelException {
-//
-//     // create buffer -  compilation units only use default buffer factory
-//     BufferManager bufManager = getBufferManager();
-//     IBuffer buffer = getBufferFactory().createBuffer(this);
-//     if (buffer == null) return null;
-//     
-//     // set the buffer source
-//     if (buffer.getCharacters() == null){
-//             IFile file = (IFile)this.getResource();
-//             if (file == null || !file.exists()) throw newNotPresentException();
-//             buffer.setContents(Util.getResourceContentsAsCharArray(file));
-//     }
-//
-//     // add buffer to buffer cache
-//     bufManager.addBuffer(buffer);
-//                     
-//     // listen to buffer changes
-//     buffer.addBufferChangedListener(this);
-//     
-//     return buffer;
-//}
-/**
- * @see Openable#openBuffer(IProgressMonitor, Object)
- */
-protected IBuffer openBuffer(IProgressMonitor pm, Object info) throws JavaModelException {
-
-       // create buffer
-       boolean isWorkingCopy = isWorkingCopy();
-       IBuffer buffer = 
-               isWorkingCopy 
-                       ? this.owner.createBuffer(this) 
-                       : BufferManager.getDefaultBufferManager().createBuffer(this);
-       if (buffer == null) return null;
-       
-       // set the buffer source
-       if (buffer.getCharacters() == null) {
-               if (isWorkingCopy) {
-                       ICompilationUnit original;
-                       if (!isPrimary() 
-                                       && (original = new CompilationUnit((PackageFragment)getParent(), getElementName(), DefaultWorkingCopyOwner.PRIMARY)).isOpen()) {
-                               buffer.setContents(original.getSource());
-                       } else {
-                               IFile file = (IFile)getResource();
-                               if (file == null || !file.exists()) {
-                                       // initialize buffer with empty contents
-                                       buffer.setContents(CharOperation.NO_CHAR);
-                               } else {
-                                       buffer.setContents(Util.getResourceContentsAsCharArray(file));
-                               }
-                       }
-               } else {
-                       IFile file = (IFile)this.getResource();
-                       if (file == null || !file.exists()) throw newNotPresentException();
-                       buffer.setContents(Util.getResourceContentsAsCharArray(file));
-               }
-       }
-
-       // add buffer to buffer cache
-       BufferManager bufManager = getBufferManager();
-       bufManager.addBuffer(buffer);
-                       
-       // listen to buffer changes
-       buffer.addBufferChangedListener(this);
-       
-       return buffer;
-}
-/*
- * @see Openable#openParent
- */
-protected void openParent(Object childInfo, HashMap newElements, IProgressMonitor pm) throws JavaModelException {
-       try {
-               super.openParent(childInfo, newElements, pm);
-       } catch(JavaModelException e){
-               // allow parent to not exist for working copies defined outside classpath
-               if (!isWorkingCopy() && !e.isDoesNotExist()){ 
-                       throw e;
-               }
-       }
-}
+          public IResource getResource() {
+            return CompilationUnit.this.getResource();
+          }
+        }, true /* full parse to find local elements */);
 
-/**
- * @see ICompilationUnit#reconcile()
- * @deprecated
- */
-public IMarker[] reconcile() throws JavaModelException {
-       reconcile(NO_AST, false/*don't force problem detection*/, null/*use primary owner*/, null/*no progress monitor*/);
-       return null;
-}
-/**
- * @see ICompilationUnit#reconcile(int, boolean, WorkingCopyOwner, IProgressMonitor)
- */
-public void reconcile(boolean forceProblemDetection, IProgressMonitor monitor) throws JavaModelException {
-       reconcile(NO_AST, forceProblemDetection, null/*use primary owner*/, monitor);
-}
+    // update timestamp (might be IResource.NULL_STAMP if original does not exist)
 
-/**
- * @see ICompilationUnit#reconcile(int, boolean, WorkingCopyOwner, IProgressMonitor)
- * @since 3.0
- */
-//public org.eclipse.jdt.core.dom.CompilationUnit reconcile(
-  public Object reconcile(
-       int astLevel,
-       boolean forceProblemDetection,
-       WorkingCopyOwner workingCopyOwner,
-       IProgressMonitor monitor)
-       throws JavaModelException {
-       
-       if (!isWorkingCopy()) return null; // Reconciling is not supported on non working copies
-       if (workingCopyOwner == null) workingCopyOwner = DefaultWorkingCopyOwner.PRIMARY;
-       
-       boolean createAST = false;
-//     if (astLevel == AST.JLS2) {
-//             // client asking for level 2 AST; these are supported
-//             createAST = true;
-//     } else if (astLevel == AST.JLS3) {
-//             // client asking for level 3 ASTs; these are not supported
-//             // TODO (jerome) - these should also be supported in 1.5 stream
-//             createAST = false;
-//     } else {
-//             // client asking for no AST (0) or unknown ast level
-//             // either way, request denied
-//             createAST = false;
-//     }
-       ReconcileWorkingCopyOperation op = new ReconcileWorkingCopyOperation(this, createAST, astLevel, forceProblemDetection, workingCopyOwner);
-       op.runOperation(monitor);
-//     return op.ast;
-       return null;
-}
+    unitInfo.timestamp = ((IFile) underlyingResource).getModificationStamp();
 
-/**
- * @see ISourceManipulation#rename(String, boolean, IProgressMonitor)
- */
-public void rename(String name, boolean force, IProgressMonitor monitor) throws JavaModelException {
-       if (name == null) {
-               throw new IllegalArgumentException(Util.bind("operation.nullName")); //$NON-NLS-1$
-       }
-       IJavaElement[] elements= new IJavaElement[] {this};
-       IJavaElement[] dests= new IJavaElement[] {this.getParent()};
-       String[] renamings= new String[] {name};
-       getJavaModel().rename(elements, dests, renamings, force, monitor);
-}
-
-/*
- * @see ICompilationUnit
- */
-public void restore () throws JavaModelException {
+    // compute other problems if needed
+    CompilationUnitDeclaration compilationUnitDeclaration = null;
+    try {
+      if (computeProblems) {
+        perWorkingCopyInfo.beginReporting();
+        compilationUnitDeclaration = CompilationUnitProblemFinder.process(unit, this, contents, parser, this.owner,
+            perWorkingCopyInfo, problemFactory, false/* don't cleanup cu */, pm);
+        perWorkingCopyInfo.endReporting();
+      }
 
-       if (!isWorkingCopy()) return;
+      //               if (info instanceof ASTHolderCUInfo) {
+      //                       int astLevel = ((ASTHolderCUInfo) info).astLevel;
+      //                       org.eclipse.jdt.core.dom.CompilationUnit cu = AST.convertCompilationUnit(astLevel, unit, contents, options, pm);
+      //                       ((ASTHolderCUInfo) info).ast = cu;
+      //               }
+    } finally {
+      if (compilationUnitDeclaration != null) {
+        compilationUnitDeclaration.cleanUp();
+      }
+    }
 
-       CompilationUnit original = (CompilationUnit) getOriginalElement();
-       IBuffer buffer = this.getBuffer();
-       if (buffer == null) return;
-       buffer.setContents(original.getContents());
-       updateTimeStamp(original);
-       makeConsistent(null);
-}
-/**
- * @see ICodeAssist#codeComplete(int, ICodeCompletionRequestor)
- * @deprecated - use codeComplete(int, ICompletionRequestor)
- */
-//public void codeComplete(int offset, final ICodeCompletionRequestor requestor) throws JavaModelException {
-//     
-//     if (requestor == null){
-//             codeComplete(offset, (ICompletionRequestor)null);
-//             return;
-//     }
-//     codeComplete(
-//             offset,
-//             new ICompletionRequestor(){
-//                     public void acceptAnonymousType(char[] superTypePackageName,char[] superTypeName,char[][] parameterPackageNames,char[][] parameterTypeNames,char[][] parameterNames,char[] completionName,int modifiers,int completionStart,int completionEnd, int relevance){
-//                     }
-//                     public void acceptClass(char[] packageName, char[] className, char[] completionName, int modifiers, int completionStart, int completionEnd, int relevance) {
-//                             requestor.acceptClass(packageName, className, completionName, modifiers, completionStart, completionEnd);
-//                     }
-//                     public void acceptError(IProblem error) {
-//                             if (true) return; // was disabled in 1.0
-//
-//                             try {
-//                                     IMarker marker = ResourcesPlugin.getWorkspace().getRoot().createMarker(IJavaModelMarker.TRANSIENT_PROBLEM);
-//                                     marker.setAttribute(IJavaModelMarker.ID, error.getID());
-//                                     marker.setAttribute(IMarker.CHAR_START, error.getSourceStart());
-//                                     marker.setAttribute(IMarker.CHAR_END, error.getSourceEnd() + 1);
-//                                     marker.setAttribute(IMarker.LINE_NUMBER, error.getSourceLineNumber());
-//                                     marker.setAttribute(IMarker.MESSAGE, error.getMessage());
-//                                     marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
-//                                     requestor.acceptError(marker);
-//                             } catch(CoreException e){
-//                             }
-//                     }
-//                     public void acceptField(char[] declaringTypePackageName, char[] declaringTypeName, char[] name, char[] typePackageName, char[] typeName, char[] completionName, int modifiers, int completionStart, int completionEnd, int relevance) {
-//                             requestor.acceptField(declaringTypePackageName, declaringTypeName, name, typePackageName, typeName, completionName, modifiers, completionStart, completionEnd);
-//                     }
-//                     public void acceptInterface(char[] packageName,char[] interfaceName,char[] completionName,int modifiers,int completionStart,int completionEnd, int relevance) {
-//                             requestor.acceptInterface(packageName, interfaceName, completionName, modifiers, completionStart, completionEnd);
-//                     }
-//                     public void acceptKeyword(char[] keywordName,int completionStart,int completionEnd, int relevance){
-//                             requestor.acceptKeyword(keywordName, completionStart, completionEnd);
-//                     }
-//                     public void acceptLabel(char[] labelName,int completionStart,int completionEnd, int relevance){
-//                             requestor.acceptLabel(labelName, completionStart, completionEnd);
-//                     }
-//                     public void acceptLocalVariable(char[] name,char[] typePackageName,char[] typeName,int modifiers,int completionStart,int completionEnd, int relevance){
-//                             // ignore
-//                     }
-//                     public void acceptMethod(char[] declaringTypePackageName,char[] declaringTypeName,char[] selector,char[][] parameterPackageNames,char[][] parameterTypeNames,char[][] parameterNames,char[] returnTypePackageName,char[] returnTypeName,char[] completionName,int modifiers,int completionStart,int completionEnd, int relevance){
-//                             // skip parameter names
-//                             requestor.acceptMethod(declaringTypePackageName, declaringTypeName, selector, parameterPackageNames, parameterTypeNames, returnTypePackageName, returnTypeName, completionName, modifiers, completionStart, completionEnd);
-//                     }
-//                     public void acceptMethodDeclaration(char[] declaringTypePackageName,char[] declaringTypeName,char[] selector,char[][] parameterPackageNames,char[][] parameterTypeNames,char[][] parameterNames,char[] returnTypePackageName,char[] returnTypeName,char[] completionName,int modifiers,int completionStart,int completionEnd, int relevance){
-//                             // ignore
-//                     }
-//                     public void acceptModifier(char[] modifierName,int completionStart,int completionEnd, int relevance){
-//                             requestor.acceptModifier(modifierName, completionStart, completionEnd);
-//                     }
-//                     public void acceptPackage(char[] packageName,char[] completionName,int completionStart,int completionEnd, int relevance){
-//                             requestor.acceptPackage(packageName, completionName, completionStart, completionEnd);
-//                     }
-//                     public void acceptType(char[] packageName,char[] typeName,char[] completionName,int completionStart,int completionEnd, int relevance){
-//                             requestor.acceptType(packageName, typeName, completionName, completionStart, completionEnd);
-//                     }
-//                     public void acceptVariableName(char[] typePackageName,char[] typeName,char[] name,char[] completionName,int completionStart,int completionEnd, int relevance){
-//                             // ignore
-//                     }
-//             });
-//}
-///**
-// * @see JavaElement#rootedAt(IJavaProject)
-// */
-//public IJavaElement rootedAt(IJavaProject project) {
-//     return
-//             new CompilationUnit(
-//                     (IPackageFragment)((JavaElement)parent).rootedAt(project), 
-//                     name);
-//}
-
-/*
- * Assume that this is a working copy
- */
-protected void updateTimeStamp(CompilationUnit original) throws JavaModelException {
-       long timeStamp =
-               ((IFile) original.getResource()).getModificationStamp();
-       if (timeStamp == IResource.NULL_STAMP) {
-               throw new JavaModelException(
-                       new JavaModelStatus(IJavaModelStatusConstants.INVALID_RESOURCE));
-       }
-       ((CompilationUnitElementInfo) getElementInfo()).timestamp = timeStamp;
-}
-}
+    return unitInfo.isStructureKnown();
+  }
+
+  ///**
+  // * @see ICodeAssist#codeComplete(int, ICompletionRequestor)
+  // */
+  //public void codeComplete(int offset, ICompletionRequestor requestor) throws JavaModelException {
+  //   codeComplete(this, isWorkingCopy() ? (org.eclipse.jdt.internal.compiler.env.ICompilationUnit) getOriginalElement() : this,
+  // offset, requestor);
+  //}
+  /**
+   * @see ICodeAssist#codeSelect(int, int)
+   */
+  //public IJavaElement[] codeSelect(int offset, int length) throws JavaModelException {
+  //   return super.codeSelect(this, offset, length);
+  //}
+  /**
+   * @see IWorkingCopy#commit(boolean, IProgressMonitor)
+   */
+  public void commit(boolean force, IProgressMonitor monitor) throws JavaModelException {
+    commitWorkingCopy(force, monitor);
+    // throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_ELEMENT_TYPES, this));
+  }
+
+  /**
+   * @see ICompilationUnit#commitWorkingCopy(boolean, IProgressMonitor)
+   */
+  public void commitWorkingCopy(boolean force, IProgressMonitor monitor) throws JavaModelException {
+    CommitWorkingCopyOperation op = new CommitWorkingCopyOperation(this, force);
+    op.runOperation(monitor);
+  }
+
+  /**
+   * @see ISourceManipulation#copy(IJavaElement, IJavaElement, String, boolean, IProgressMonitor)
+   */
+  public void copy(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor)
+      throws JavaModelException {
+    if (container == null) {
+      throw new IllegalArgumentException(Util.bind("operation.nullContainer")); //$NON-NLS-1$
+    }
+    IJavaElement[] elements = new IJavaElement[] { this };
+    IJavaElement[] containers = new IJavaElement[] { container };
+    String[] renamings = null;
+    if (rename != null) {
+      renamings = new String[] { rename };
+    }
+    getJavaModel().copy(elements, containers, null, renamings, force, monitor);
+  }
+
+  /**
+   * Returns a new element info for this element.
+   */
+  protected Object createElementInfo() {
+    return new CompilationUnitElementInfo();
+  }
+
+  ///**
+  // * @see ICompilationUnit#createImport(String, IJavaElement, IProgressMonitor)
+  // */
+  //public IImportDeclaration createImport(String name, IJavaElement sibling, IProgressMonitor monitor) throws JavaModelException {
+  //   CreateImportOperation op = new CreateImportOperation(name, this);
+  //   if (sibling != null) {
+  //           op.createBefore(sibling);
+  //   }
+  //   runOperation(op, monitor);
+  //   return getImport(name);
+  //}
+  /**
+   * @see ICompilationUnit#createPackageDeclaration(String, IProgressMonitor)
+   */
+  public IPackageDeclaration createPackageDeclaration(String name, IProgressMonitor monitor) throws JavaModelException {
+
+    CreatePackageDeclarationOperation op = new CreatePackageDeclarationOperation(name, this);
+    runOperation(op, monitor);
+    return getPackageDeclaration(name);
+  }
+
+  ///**
+  // * @see ICompilationUnit#createType(String, IJavaElement, boolean, IProgressMonitor)
+  // */
+  //public IType createType(String content, IJavaElement sibling, boolean force, IProgressMonitor monitor) throws
+  // JavaModelException {
+  //   if (!exists()) {
+  //           //autogenerate this compilation unit
+  //           IPackageFragment pkg = (IPackageFragment) getParent();
+  //           String source = ""; //$NON-NLS-1$
+  //           if (pkg.getElementName().length() > 0) {
+  //                   //not the default package...add the package declaration
+  //                   source = "package " + pkg.getElementName() + ";" + org.eclipse.jdt.internal.compiler.util.ProjectPrefUtil.LINE_SEPARATOR +
+  // org.eclipse.jdt.internal.compiler.util.ProjectPrefUtil.LINE_SEPARATOR; //$NON-NLS-1$ //$NON-NLS-2$
+  //           }
+  //           CreateCompilationUnitOperation op = new CreateCompilationUnitOperation(pkg, fName, source, force);
+  //           runOperation(op, monitor);
+  //   }
+  //   CreateTypeOperation op = new CreateTypeOperation(this, content, force);
+  //   if (sibling != null) {
+  //           op.createBefore(sibling);
+  //   }
+  //   runOperation(op, monitor);
+  //   return (IType) op.getResultElements()[0];
+  //}
+  /**
+   * @see ISourceManipulation#delete(boolean, IProgressMonitor)
+   */
+  public void delete(boolean force, IProgressMonitor monitor) throws JavaModelException {
+    IJavaElement[] elements = new IJavaElement[] { this };
+    getJavaModel().delete(elements, force, monitor);
+  }
+
+  /**
+   * @see IWorkingCopy#destroy()
+   * @deprecated
+   */
+  public void destroy() {
+    try {
+      discardWorkingCopy();
+    } catch (JavaModelException e) {
+      e.printStackTrace();
+    }
+  }
+
+  /*
+   * @see ICompilationUnit#discardWorkingCopy
+   */
+  public void discardWorkingCopy() throws JavaModelException {
+    // discard working copy and its children
+    DiscardWorkingCopyOperation op = new DiscardWorkingCopyOperation(this);
+    op.runOperation(null);
+  }
+
+  /**
+   * Returns true if this handle represents the same Java element as the given handle.
+   * 
+   * @see Object#equals(java.lang.Object)
+   */
+  public boolean equals(Object obj) {
+    if (!(obj instanceof CompilationUnit))
+      return false;
+    CompilationUnit other = (CompilationUnit) obj;
+    return this.owner.equals(other.owner) && super.equals(obj);
+  }
+
+  /**
+   * @see JavaElement#equalsDOMNode(IDOMNode)
+   */
+  protected boolean equalsDOMNode(IDOMNode node) throws JavaModelException {
+    String name = getElementName();
+    if (node.getNodeType() == IDOMNode.COMPILATION_UNIT && name != null) {
+      String nodeName = node.getName();
+      if (nodeName == null)
+        return false;
+      if (name.equals(nodeName)) {
+        return true;
+      } else {
+        // iterate through all the types inside the receiver and see if one of them can fit
+        IType[] types = getTypes();
+        String typeNodeName = nodeName.substring(0, nodeName.indexOf(".java")); //$NON-NLS-1$
+        for (int i = 0, max = types.length; i < max; i++) {
+          if (types[i].getElementName().equals(typeNodeName)) {
+            return true;
+          }
+        }
+      }
+    }
+    return false;
+  }
+
+  /**
+   * @see IWorkingCopy#findElements(IJavaElement)
+   */
+  public IJavaElement[] findElements(IJavaElement element) {
+    ArrayList children = new ArrayList();
+    while (element != null && element.getElementType() != IJavaElement.COMPILATION_UNIT) {
+      children.add(element);
+      element = element.getParent();
+    }
+    if (element == null)
+      return null;
+    IJavaElement currentElement = this;
+    for (int i = children.size() - 1; i >= 0; i--) {
+      IJavaElement child = (IJavaElement) children.get(i);
+      switch (child.getElementType()) {
+      //                       case IJavaElement.PACKAGE_DECLARATION:
+      //                               currentElement = ((ICompilationUnit)currentElement).getPackageDeclaration(child.getElementName());
+      //                               break;
+      //                       case IJavaElement.IMPORT_CONTAINER:
+      //                               currentElement = ((ICompilationUnit)currentElement).getImportContainer();
+      //                               break;
+      //                       case IJavaElement.IMPORT_DECLARATION:
+      //                               currentElement = ((IImportContainer)currentElement).getImport(child.getElementName());
+      //                               break;
+      case IJavaElement.TYPE:
+        if (currentElement.getElementType() == IJavaElement.COMPILATION_UNIT) {
+          currentElement = ((ICompilationUnit) currentElement).getType(child.getElementName());
+        } else {
+          currentElement = ((IType) currentElement).getType(child.getElementName());
+        }
+        break;
+      //                       case IJavaElement.INITIALIZER:
+      //                               currentElement = ((IType)currentElement).getInitializer(((JavaElement)child).getOccurrenceCount());
+      //                               break;
+      case IJavaElement.FIELD:
+        currentElement = ((IType) currentElement).getField(child.getElementName());
+        break;
+      case IJavaElement.METHOD:
+        return ((IType) currentElement).findMethods((IMethod) child);
+      }
+
+    }
+    if (currentElement != null && currentElement.exists()) {
+      return new IJavaElement[] { currentElement };
+    } else {
+      return null;
+    }
+  }
+
+  /**
+   * @see IWorkingCopy#findPrimaryType()
+   */
+  public IType findPrimaryType() {
+    String typeName = Signature.getQualifier(this.getElementName());
+    IType primaryType = this.getType(typeName);
+    if (primaryType.exists()) {
+      return primaryType;
+    }
+    return null;
+  }
+
+  /**
+   * @see IWorkingCopy#findSharedWorkingCopy(IBufferFactory)
+   * @deprecated
+   */
+  public IJavaElement findSharedWorkingCopy(IBufferFactory factory) {
+
+    // if factory is null, default factory must be used
+    if (factory == null)
+      factory = this.getBufferManager().getDefaultBufferFactory();
+
+    return findWorkingCopy(BufferFactoryWrapper.create(factory));
+  }
+
+  /**
+   * @see ICompilationUnit#findWorkingCopy(WorkingCopyOwner)
+   */
+  public ICompilationUnit findWorkingCopy(WorkingCopyOwner workingCopyOwner) {
+    CompilationUnit cu = new CompilationUnit((PackageFragment) this.parent, getElementName(), workingCopyOwner);
+    if (workingCopyOwner == DefaultWorkingCopyOwner.PRIMARY) {
+      return cu;
+    } else {
+      // must be a working copy
+      JavaModelManager.PerWorkingCopyInfo perWorkingCopyInfo = cu.getPerWorkingCopyInfo();
+      if (perWorkingCopyInfo != null) {
+        return perWorkingCopyInfo.getWorkingCopy();
+      } else {
+        return null;
+      }
+    }
+  }
+
+  //protected boolean generateInfos(OpenableElementInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource)
+  // throws JavaModelException {
+  //
+  //// if (getParent() instanceof JarPackageFragment) {
+  //// // ignore .java files in jar
+  //// throw newNotPresentException();
+  //// } else {
+  //           // put the info now, because getting the contents requires it
+  //           JavaModelManager.getJavaModelManager().putInfo(this, info);
+  //           CompilationUnitElementInfo unitInfo = (CompilationUnitElementInfo) info;
+  //
+  //           // generate structure
+  //           CompilationUnitStructureRequestor requestor = new CompilationUnitStructureRequestor(this, unitInfo, newElements);
+  //           IProblemFactory factory = new DefaultProblemFactory();
+  //           SourceElementParser parser = new SourceElementParser(requestor, factory, new
+  // CompilerOptions(getJavaProject().getOptions(true)));
+  //// SourceElementParser parser = new SourceElementParser(requestor, factory);
+  //           requestor.parser = parser;
+  //           parser.parseCompilationUnit(this, false);
+  //           if (isWorkingCopy()) {
+  //                   CompilationUnit original = (CompilationUnit) getOriginalElement();
+  //                   // might be IResource.NULL_STAMP if original does not exist
+  //                   unitInfo.timestamp = ((IFile) original.getResource()).getModificationStamp();
+  //           }
+  //           return unitInfo.isStructureKnown();
+  //// }
+  //}
+  /**
+   * @see ICompilationUnit#getAllTypes()
+   */
+  public IType[] getAllTypes() throws JavaModelException {
+    IJavaElement[] types = getTypes();
+    int i;
+    ArrayList allTypes = new ArrayList(types.length);
+    ArrayList typesToTraverse = new ArrayList(types.length);
+    for (i = 0; i < types.length; i++) {
+      typesToTraverse.add(types[i]);
+    }
+    while (!typesToTraverse.isEmpty()) {
+      IType type = (IType) typesToTraverse.get(0);
+      typesToTraverse.remove(type);
+      allTypes.add(type);
+      types = type.getTypes();
+      for (i = 0; i < types.length; i++) {
+        typesToTraverse.add(types[i]);
+      }
+    }
+    IType[] arrayOfAllTypes = new IType[allTypes.size()];
+    allTypes.toArray(arrayOfAllTypes);
+    return arrayOfAllTypes;
+  }
+
+  /**
+   * @see IMember#getCompilationUnit()
+   */
+  public ICompilationUnit getCompilationUnit() {
+    return this;
+  }
+
+  /**
+   * @see org.eclipse.jdt.internal.compiler.env.ICompilationUnit#getContents()
+   */
+  public char[] getContents() {
+    try {
+      IBuffer buffer = this.getBuffer();
+      return buffer == null ? null : buffer.getCharacters();
+    } catch (JavaModelException e) {
+      return CharOperation.NO_CHAR;
+    }
+  }
+
+  /**
+   * A compilation unit has a corresponding resource unless it is contained in a jar.
+   * 
+   * @see IJavaElement#getCorrespondingResource()
+   */
+  public IResource getCorrespondingResource() throws JavaModelException {
+    IPackageFragmentRoot root = (IPackageFragmentRoot) getParent().getParent();
+    if (root.isArchive()) {
+      return null;
+    } else {
+      return getUnderlyingResource();
+    }
+  }
+
+  /**
+   * @see ICompilationUnit#getElementAt(int)
+   */
+  public IJavaElement getElementAt(int position) throws JavaModelException {
+
+    IJavaElement e = getSourceElementAt(position);
+    if (e == this) {
+      return null;
+    } else {
+      return e;
+    }
+  }
+
+  /**
+   * @see IJavaElement
+   */
+  public int getElementType() {
+    return COMPILATION_UNIT;
+  }
+
+  public char[] getFileName() {
+    return getElementName().toCharArray();
+  }
+
+  /**
+   * @see JavaElement#getHandleMementoDelimiter()
+   */
+  protected char getHandleMementoDelimiter() {
+    return JavaElement.JEM_COMPILATIONUNIT;
+  }
+
+  /**
+   * @see ICompilationUnit#getImport(String)
+   */
+  public IImportDeclaration getImport(String importName) {
+    return new ImportDeclaration((ImportContainer) getImportContainer(), importName);
+  }
+
+  /**
+   * @see ICompilationUnit#getImportContainer()
+   */
+  public ImportContainer getImportContainer() {
+    return new ImportContainer(this);
+  }
+
+  /**
+   * @see ICompilationUnit#getImports()
+   */
+  //public IImportDeclaration[] getImports() throws JavaModelException {
+  //   IImportContainer container= getImportContainer();
+  //   if (container.exists()) {
+  //           IJavaElement[] elements= container.getChildren();
+  //           IImportDeclaration[] imprts= new IImportDeclaration[elements.length];
+  //           System.arraycopy(elements, 0, imprts, 0, elements.length);
+  //           return imprts;
+  //   } else if (!exists()) {
+  //                   throw newNotPresentException();
+  //   } else {
+  //           return new IImportDeclaration[0];
+  //   }
+  //
+  //}
+  /**
+   * @see org.eclipse.jdt.internal.compiler.env.ICompilationUnit#getMainTypeName()
+   */
+  public char[] getMainTypeName() {
+    String name = getElementName();
+    //remove the .java
+    name = name.substring(0, name.length() - 5);
+    return name.toCharArray();
+  }
+
+  /**
+   * @see IWorkingCopy#getOriginal(IJavaElement)
+   * @deprecated
+   */
+  public IJavaElement getOriginal(IJavaElement workingCopyElement) {
+    // backward compatibility
+    if (!isWorkingCopy())
+      return null;
+    CompilationUnit cu = (CompilationUnit) workingCopyElement.getAncestor(COMPILATION_UNIT);
+    if (cu == null || !this.owner.equals(cu.owner)) {
+      return null;
+    }
+
+    return workingCopyElement.getPrimaryElement();
+  }
+
+  /**
+   * @see IWorkingCopy#getOriginalElement()
+   * @deprecated
+   */
+  public IJavaElement getOriginalElement() {
+    // backward compatibility
+    if (!isWorkingCopy())
+      return null;
+
+    return getPrimaryElement();
+  }
+
+  /*
+   * @see ICompilationUnit#getOwner()
+   */
+  public WorkingCopyOwner getOwner() {
+    return isPrimary() || !isWorkingCopy() ? null : this.owner;
+  }
+
+  /**
+   * @see ICompilationUnit#getPackageDeclaration(String)
+   */
+  public IPackageDeclaration getPackageDeclaration(String name) {
+    return new PackageDeclaration(this, name);
+  }
+
+  /**
+   * @see ICompilationUnit#getPackageDeclarations()
+   */
+  public IPackageDeclaration[] getPackageDeclarations() throws JavaModelException {
+    ArrayList list = getChildrenOfType(PACKAGE_DECLARATION);
+    IPackageDeclaration[] array = new IPackageDeclaration[list.size()];
+    list.toArray(array);
+    return array;
+  }
+
+  /**
+   * @see org.eclipse.jdt.internal.compiler.env.ICompilationUnit#getPackageName()
+   */
+  public char[][] getPackageName() {
+    return null;
+  }
+
+  /**
+   * @see IJavaElement#getPath()
+   */
+  public IPath getPath() {
+    PackageFragmentRoot root = this.getPackageFragmentRoot();
+    if (root.isArchive()) {
+      return root.getPath();
+    } else {
+      return this.getParent().getPath().append(this.getElementName());
+    }
+  }
+
+  /*
+   * Returns the per working copy info for the receiver, or null if none exist. Note: the use count of the per working copy info is
+   * NOT incremented.
+   */
+  public JavaModelManager.PerWorkingCopyInfo getPerWorkingCopyInfo() {
+    return JavaModelManager.getJavaModelManager().getPerWorkingCopyInfo(this, false/* don't create */, false/* don't record usage */,
+        null/* no problem requestor needed */);
+  }
+
+  /*
+   * @see ICompilationUnit#getPrimary()
+   */
+  public ICompilationUnit getPrimary() {
+    return (ICompilationUnit) getPrimaryElement(true);
+  }
+
+  /*
+   * @see JavaElement#getPrimaryElement(boolean)
+   */
+  public IJavaElement getPrimaryElement(boolean checkOwner) {
+    if (checkOwner && isPrimary())
+      return this;
+    return new CompilationUnit((PackageFragment) getParent(), getElementName(), DefaultWorkingCopyOwner.PRIMARY);
+  }
+
+  /**
+   * @see IJavaElement#getResource()
+   */
+  public IResource getResource() {
+    PackageFragmentRoot root = this.getPackageFragmentRoot();
+    if (root.isArchive()) {
+      return root.getResource();
+    } else {
+      return ((IContainer) this.getParent().getResource()).getFile(new Path(this.getElementName()));
+    }
+  }
+
+  /**
+   * @see ISourceReference#getSource()
+   */
+  public String getSource() throws JavaModelException {
+    IBuffer buffer = getBuffer();
+    if (buffer == null)
+      return ""; //$NON-NLS-1$
+    return buffer.getContents();
+  }
+
+  /**
+   * @see ISourceReference#getSourceRange()
+   */
+  public ISourceRange getSourceRange() throws JavaModelException {
+    return ((CompilationUnitElementInfo) getElementInfo()).getSourceRange();
+  }
+
+  /**
+   * @see ICompilationUnit#getType(String)
+   */
+  public IType getType(String name) {
+    return new SourceType(this, name);
+  }
+
+  /**
+   * @see ICompilationUnit#getTypes()
+   */
+  public IType[] getTypes() throws JavaModelException {
+    ArrayList list = getChildrenOfType(TYPE);
+    IType[] array = new IType[list.size()];
+    list.toArray(array);
+    return array;
+  }
+
+  /**
+   * @see IJavaElement
+   */
+  public IResource getUnderlyingResource() throws JavaModelException {
+    if (isWorkingCopy() && !isPrimary())
+      return null;
+    return super.getUnderlyingResource();
+  }
+
+  ///**
+  // * @see IWorkingCopy#getSharedWorkingCopy(IProgressMonitor, IBufferFactory, IProblemRequestor)
+  // */
+  //public IJavaElement getSharedWorkingCopy(IProgressMonitor pm, IBufferFactory factory, IProblemRequestor problemRequestor)
+  // throws JavaModelException {
+  //   
+  //   // if factory is null, default factory must be used
+  //   if (factory == null) factory = this.getBufferManager().getDefaultBufferFactory();
+  //
+  //   JavaModelManager manager = JavaModelManager.getJavaModelManager();
+  //   
+  //   // In order to be shared, working copies have to denote the same compilation unit
+  //   // AND use the same buffer factory.
+  //   // Assuming there is a little set of buffer factories, then use a 2 level Map cache.
+  //   Map sharedWorkingCopies = manager.sharedWorkingCopies;
+  //   
+  //   Map perFactoryWorkingCopies = (Map) sharedWorkingCopies.get(factory);
+  //   if (perFactoryWorkingCopies == null){
+  //           perFactoryWorkingCopies = new HashMap();
+  //           sharedWorkingCopies.put(factory, perFactoryWorkingCopies);
+  //   }
+  //   WorkingCopy workingCopy = (WorkingCopy)perFactoryWorkingCopies.get(this);
+  //   if (workingCopy != null) {
+  //           workingCopy.useCount++;
+  //
+  //           if (SHARED_WC_VERBOSE) {
+  //                   System.out.println("Incrementing use count of shared working copy " + workingCopy.toStringWithAncestors()); //$NON-NLS-1$
+  //           }
+  //
+  //           return workingCopy;
+  //   } else {
+  //           CreateWorkingCopyOperation op = new CreateWorkingCopyOperation(this, perFactoryWorkingCopies, factory, problemRequestor);
+  //           runOperation(op, pm);
+  //           return op.getResultElements()[0];
+  //   }
+  //}
+  ///**
+  // * @see IWorkingCopy#getWorkingCopy()
+  // */
+  //public IJavaElement getWorkingCopy() throws JavaModelException {
+  //   return this.getWorkingCopy(null, null, null);
+  //}
+  //
+  ///**
+  // * @see IWorkingCopy#getWorkingCopy(IProgressMonitor, IBufferFactory, IProblemRequestor)
+  // */
+  //public IJavaElement getWorkingCopy(IProgressMonitor pm, IBufferFactory factory, IProblemRequestor problemRequestor) throws
+  // JavaModelException {
+  //   CreateWorkingCopyOperation op = new CreateWorkingCopyOperation(this, null, factory, problemRequestor);
+  //   runOperation(op, pm);
+  //   return op.getResultElements()[0];
+  //}
+  /**
+   * @see IWorkingCopy#getSharedWorkingCopy(IProgressMonitor, IBufferFactory, IProblemRequestor)
+   * @deprecated
+   */
+  public IJavaElement getSharedWorkingCopy(IProgressMonitor pm, IBufferFactory factory, IProblemRequestor problemRequestor)
+      throws JavaModelException {
+
+    // if factory is null, default factory must be used
+    if (factory == null)
+      factory = this.getBufferManager().getDefaultBufferFactory();
+
+    return getWorkingCopy(BufferFactoryWrapper.create(factory), problemRequestor, pm);
+  }
+
+  /**
+   * @see IWorkingCopy#getWorkingCopy()
+   * @deprecated
+   */
+  public IJavaElement getWorkingCopy() throws JavaModelException {
+    return getWorkingCopy(null);
+  }
+
+  /**
+   * @see ICompilationUnit#getWorkingCopy(IProgressMonitor)
+   */
+  public ICompilationUnit getWorkingCopy(IProgressMonitor monitor) throws JavaModelException {
+    return getWorkingCopy(new WorkingCopyOwner() {/* non shared working copy */
+    }, null/* no problem requestor */, monitor);
+  }
+
+  /**
+   * @see IWorkingCopy#getWorkingCopy(IProgressMonitor, IBufferFactory, IProblemRequestor)
+   * @deprecated
+   */
+  public IJavaElement getWorkingCopy(IProgressMonitor monitor, IBufferFactory factory, IProblemRequestor problemRequestor)
+      throws JavaModelException {
+    return getWorkingCopy(BufferFactoryWrapper.create(factory), problemRequestor, monitor);
+  }
+
+  /**
+   * @see ICompilationUnit#getWorkingCopy(WorkingCopyOwner, IProblemRequestor, IProgressMonitor)
+   */
+  public ICompilationUnit getWorkingCopy(WorkingCopyOwner workingCopyOwner, IProblemRequestor problemRequestor,
+      IProgressMonitor monitor) throws JavaModelException {
+    if (!isPrimary())
+      return this;
+
+    JavaModelManager manager = JavaModelManager.getJavaModelManager();
+
+    CompilationUnit workingCopy = new CompilationUnit((PackageFragment) getParent(), getElementName(), workingCopyOwner);
+    JavaModelManager.PerWorkingCopyInfo perWorkingCopyInfo = manager.getPerWorkingCopyInfo(workingCopy, false/* don't create */,
+        true/* record usage */, null/* not used since don't create */);
+    if (perWorkingCopyInfo != null) {
+      return perWorkingCopyInfo.getWorkingCopy(); // return existing handle instead of the one created above
+    }
+    BecomeWorkingCopyOperation op = new BecomeWorkingCopyOperation(workingCopy, problemRequestor);
+    op.runOperation(monitor);
+    return workingCopy;
+  }
+
+  /**
+   * If I am not open, return true to avoid parsing.
+   * 
+   * @see IParent#hasChildren()
+   */
+  public boolean hasChildren() throws JavaModelException {
+    // if (isOpen()) {
+    //         return getChildren().length > 0;
+    // } else {
+    //         return true;
+    // }
+    return false;
+  }
+
+  /**
+   * @see Openable#hasBuffer()
+   */
+  protected boolean hasBuffer() {
+    return true;
+  }
+
+  /*
+   * @see ICompilationUnit#hasResourceChanged()
+   */
+  public boolean hasResourceChanged() {
+    if (!isWorkingCopy())
+      return false;
+
+    // if resource got deleted, then #getModificationStamp() will answer IResource.NULL_STAMP, which is always different from the
+    // cached
+    // timestamp
+    Object info = JavaModelManager.getJavaModelManager().getInfo(this);
+    if (info == null)
+      return false;
+    return ((CompilationUnitElementInfo) info).timestamp != getResource().getModificationStamp();
+  }
+
+  /**
+   * @see IWorkingCopy#isBasedOn(IResource)
+   * @deprecated
+   */
+  public boolean isBasedOn(IResource resource) {
+    if (!isWorkingCopy())
+      return false;
+    if (!getResource().equals(resource))
+      return false;
+    return !hasResourceChanged();
+  }
+
+  /**
+   * @see IOpenable#isConsistent()
+   */
+  public boolean isConsistent() {
+    return JavaModelManager.getJavaModelManager().getElementsOutOfSynchWithBuffers().get(this) == null;
+  }
+
+  /**
+   * 
+   * @see IOpenable
+   */
+  public boolean isOpen() {
+    Object info = JavaModelManager.getJavaModelManager().getInfo(this);
+    return info != null && ((CompilationUnitElementInfo) info).isOpen();
+  }
+
+  public boolean isPrimary() {
+    return this.owner == DefaultWorkingCopyOwner.PRIMARY;
+  }
+
+  /**
+   * @see Openable#isSourceElement()
+   */
+  protected boolean isSourceElement() {
+    return true;
+  }
+
+  protected boolean isValidCompilationUnit() {
+    IPackageFragmentRoot root = getPackageFragmentRoot();
+    try {
+      if (root.getKind() != IPackageFragmentRoot.K_SOURCE)
+        return false;
+    } catch (JavaModelException e) {
+      return false;
+    }
+    // IResource resource = getResource();
+    // if (resource != null) {
+    //         char[][] inclusionPatterns = ((PackageFragmentRoot)root).fullInclusionPatternChars();
+    //         char[][] exclusionPatterns = ((PackageFragmentRoot)root).fullExclusionPatternChars();
+    //         if (ProjectPrefUtil.isExcluded(resource, inclusionPatterns, exclusionPatterns)) return false;
+    // }
+    if (!Util.isValidCompilationUnitName(getElementName()))
+      return false;
+    return true;
+  }
+
+  /*
+   * @see ICompilationUnit#isWorkingCopy()
+   */
+  public boolean isWorkingCopy() {
+    // For backward compatibility, non primary working copies are always returning true; in removal
+    // delta, clients can still check that element was a working copy before being discarded.
+    return !isPrimary() || getPerWorkingCopyInfo() != null;
+  }
+
+  /**
+   * @see IOpenable#makeConsistent(IProgressMonitor)
+   */
+  public void makeConsistent(IProgressMonitor monitor) throws JavaModelException {
+    makeConsistent(false/* don't create AST */, 0, monitor);
+  }
+
+  public Object makeConsistent(boolean createAST, int astLevel, IProgressMonitor monitor) throws JavaModelException {
+    if (isConsistent())
+      return null;
+
+    // create a new info and make it the current info
+    // (this will remove the info and its children just before storing the new infos)
+    // if (createAST) {
+    //         ASTHolderCUInfo info = new ASTHolderCUInfo();
+    //         info.astLevel = astLevel;
+    //         openWhenClosed(info, monitor);
+    //         org.eclipse.jdt.core.dom.CompilationUnit result = info.ast;
+    //         info.ast = null;
+    //         return result;
+    // } else {
+    openWhenClosed(createElementInfo(), monitor);
+    return null;
+    // }
+  }
+
+  //public net.sourceforge.phpdt.core.dom.CompilationUnit makeConsistent(boolean createAST, int astLevel, IProgressMonitor monitor)
+  // throws JavaModelException {
+  //   if (isConsistent()) return null;
+  //           
+  //   // create a new info and make it the current info
+  //   // (this will remove the info and its children just before storing the new infos)
+  //   if (createAST) {
+  //           ASTHolderCUInfo info = new ASTHolderCUInfo();
+  //           info.astLevel = astLevel;
+  //           openWhenClosed(info, monitor);
+  //           net.sourceforge.phpdt.core.dom.CompilationUnit result = info.ast;
+  //           info.ast = null;
+  //           return result;
+  //   } else {
+  //           openWhenClosed(createElementInfo(), monitor);
+  //           return null;
+  //   }
+  //}
+
+  /**
+   * @see ISourceManipulation#move(IJavaElement, IJavaElement, String, boolean, IProgressMonitor)
+   */
+  public void move(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor)
+      throws JavaModelException {
+    if (container == null) {
+      throw new IllegalArgumentException(Util.bind("operation.nullContainer")); //$NON-NLS-1$
+    }
+    IJavaElement[] elements = new IJavaElement[] { this };
+    IJavaElement[] containers = new IJavaElement[] { container };
+
+    String[] renamings = null;
+    if (rename != null) {
+      renamings = new String[] { rename };
+    }
+    getJavaModel().move(elements, containers, null, renamings, force, monitor);
+  }
+
+  ///**
+  // * @see Openable#openBuffer(IProgressMonitor)
+  // */
+  //protected IBuffer openBuffer(IProgressMonitor pm) throws JavaModelException {
+  //
+  //   // create buffer - compilation units only use default buffer factory
+  //   BufferManager bufManager = getBufferManager();
+  //   IBuffer buffer = getBufferFactory().createBuffer(this);
+  //   if (buffer == null) return null;
+  //   
+  //   // set the buffer source
+  //   if (buffer.getCharacters() == null){
+  //           IFile file = (IFile)this.getResource();
+  //           if (file == null || !file.exists()) throw newNotPresentException();
+  //           buffer.setContents(ProjectPrefUtil.getResourceContentsAsCharArray(file));
+  //   }
+  //
+  //   // add buffer to buffer cache
+  //   bufManager.addBuffer(buffer);
+  //                   
+  //   // listen to buffer changes
+  //   buffer.addBufferChangedListener(this);
+  //   
+  //   return buffer;
+  //}
+  /**
+   * @see Openable#openBuffer(IProgressMonitor, Object)
+   */
+  protected IBuffer openBuffer(IProgressMonitor pm, Object info) throws JavaModelException {
+
+    // create buffer
+    boolean isWorkingCopy = isWorkingCopy();
+    IBuffer buffer = isWorkingCopy ? this.owner.createBuffer(this) : BufferManager.getDefaultBufferManager().createBuffer(this);
+    if (buffer == null)
+      return null;
+
+    // set the buffer source
+    if (buffer.getCharacters() == null) {
+      if (isWorkingCopy) {
+        ICompilationUnit original;
+        if (!isPrimary()
+            && (original = new CompilationUnit((PackageFragment) getParent(), getElementName(), DefaultWorkingCopyOwner.PRIMARY))
+                .isOpen()) {
+          buffer.setContents(original.getSource());
+        } else {
+          IFile file = (IFile) getResource();
+          if (file == null || !file.exists()) {
+            // initialize buffer with empty contents
+            buffer.setContents(CharOperation.NO_CHAR);
+          } else {
+            buffer.setContents(Util.getResourceContentsAsCharArray(file));
+          }
+        }
+      } else {
+        IFile file = (IFile) this.getResource();
+        if (file == null || !file.exists())
+          throw newNotPresentException();
+        buffer.setContents(Util.getResourceContentsAsCharArray(file));
+      }
+    }
+
+    // add buffer to buffer cache
+    BufferManager bufManager = getBufferManager();
+    bufManager.addBuffer(buffer);
+
+    // listen to buffer changes
+    buffer.addBufferChangedListener(this);
+
+    return buffer;
+  }
+
+  /*
+   * @see Openable#openParent
+   */
+  protected void openParent(Object childInfo, HashMap newElements, IProgressMonitor pm) throws JavaModelException {
+    try {
+      super.openParent(childInfo, newElements, pm);
+    } catch (JavaModelException e) {
+      // allow parent to not exist for working copies defined outside classpath
+      if (!isWorkingCopy() && !e.isDoesNotExist()) {
+        throw e;
+      }
+    }
+  }
+
+  /**
+   * @see ICompilationUnit#reconcile()
+   * @deprecated
+   */
+  public IMarker[] reconcile() throws JavaModelException {
+    reconcile(NO_AST, false/* don't force problem detection */, null/* use primary owner */, null/* no progress monitor */);
+    return null;
+  }
+
+  /**
+   * @see ICompilationUnit#reconcile(int, boolean, WorkingCopyOwner, IProgressMonitor)
+   */
+  public void reconcile(boolean forceProblemDetection, IProgressMonitor monitor) throws JavaModelException {
+    reconcile(NO_AST, forceProblemDetection, null/* use primary owner */, monitor);
+  }
+
+  /**
+   * @see ICompilationUnit#reconcile(int, boolean, WorkingCopyOwner, IProgressMonitor)
+   * @since 3.0
+   */
+  //public org.eclipse.jdt.core.dom.CompilationUnit reconcile(
+  public Object reconcile(int astLevel, boolean forceProblemDetection, WorkingCopyOwner workingCopyOwner, IProgressMonitor monitor)
+      throws JavaModelException {
+
+    if (!isWorkingCopy())
+      return null; // Reconciling is not supported on non working copies
+    if (workingCopyOwner == null)
+      workingCopyOwner = DefaultWorkingCopyOwner.PRIMARY;
+
+    boolean createAST = false;
+    // if (astLevel == AST.JLS2) {
+    //         // client asking for level 2 AST; these are supported
+    //         createAST = true;
+    // } else if (astLevel == AST.JLS3) {
+    //         // client asking for level 3 ASTs; these are not supported
+    //         // TODO (jerome) - these should also be supported in 1.5 stream
+    //         createAST = false;
+    // } else {
+    //         // client asking for no AST (0) or unknown ast level
+    //         // either way, request denied
+    //         createAST = false;
+    // }
+    ReconcileWorkingCopyOperation op = new ReconcileWorkingCopyOperation(this, createAST, astLevel, forceProblemDetection,
+        workingCopyOwner);
+    op.runOperation(monitor);
+    //         return op.ast;
+    return null;
+  }
+
+  /**
+   * @see ISourceManipulation#rename(String, boolean, IProgressMonitor)
+   */
+  public void rename(String name, boolean force, IProgressMonitor monitor) throws JavaModelException {
+    if (name == null) {
+      throw new IllegalArgumentException(Util.bind("operation.nullName")); //$NON-NLS-1$
+    }
+    IJavaElement[] elements = new IJavaElement[] { this };
+    IJavaElement[] dests = new IJavaElement[] { this.getParent() };
+    String[] renamings = new String[] { name };
+    getJavaModel().rename(elements, dests, renamings, force, monitor);
+  }
+
+  /*
+   * @see ICompilationUnit
+   */
+  public void restore() throws JavaModelException {
+
+    if (!isWorkingCopy())
+      return;
+
+    CompilationUnit original = (CompilationUnit) getOriginalElement();
+    IBuffer buffer = this.getBuffer();
+    if (buffer == null)
+      return;
+    buffer.setContents(original.getContents());
+    updateTimeStamp(original);
+    makeConsistent(null);
+  }
+
+  /**
+   * @see ICodeAssist#codeComplete(int, ICodeCompletionRequestor)
+   * @deprecated - use codeComplete(int, ICompletionRequestor)
+   */
+  //public void codeComplete(int offset, final ICodeCompletionRequestor requestor) throws JavaModelException {
+  //   
+  //   if (requestor == null){
+  //           codeComplete(offset, (ICompletionRequestor)null);
+  //           return;
+  //   }
+  //   codeComplete(
+  //           offset,
+  //           new ICompletionRequestor(){
+  //                   public void acceptAnonymousType(char[] superTypePackageName,char[] superTypeName,char[][] parameterPackageNames,char[][]
+  // parameterTypeNames,char[][] parameterNames,char[] completionName,int modifiers,int completionStart,int completionEnd, int
+  // relevance){
+  //                   }
+  //                   public void acceptClass(char[] packageName, char[] className, char[] completionName, int modifiers, int completionStart, int
+  // completionEnd, int relevance) {
+  //                           requestor.acceptClass(packageName, className, completionName, modifiers, completionStart, completionEnd);
+  //                   }
+  //                   public void acceptError(IProblem error) {
+  //                           if (true) return; // was disabled in 1.0
+  //
+  //                           try {
+  //                                   IMarker marker = ResourcesPlugin.getWorkspace().getRoot().createMarker(IJavaModelMarker.TRANSIENT_PROBLEM);
+  //                                   marker.setAttribute(IJavaModelMarker.ID, error.getID());
+  //                                   marker.setAttribute(IMarker.CHAR_START, error.getSourceStart());
+  //                                   marker.setAttribute(IMarker.CHAR_END, error.getSourceEnd() + 1);
+  //                                   marker.setAttribute(IMarker.LINE_NUMBER, error.getSourceLineNumber());
+  //                                   marker.setAttribute(IMarker.MESSAGE, error.getMessage());
+  //                                   marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
+  //                                   requestor.acceptError(marker);
+  //                           } catch(CoreException e){
+  //                           }
+  //                   }
+  //                   public void acceptField(char[] declaringTypePackageName, char[] declaringTypeName, char[] name, char[] typePackageName, char[]
+  // typeName, char[] completionName, int modifiers, int completionStart, int completionEnd, int relevance) {
+  //                           requestor.acceptField(declaringTypePackageName, declaringTypeName, name, typePackageName, typeName, completionName, modifiers,
+  // completionStart, completionEnd);
+  //                   }
+  //                   public void acceptInterface(char[] packageName,char[] interfaceName,char[] completionName,int modifiers,int completionStart,int
+  // completionEnd, int relevance) {
+  //                           requestor.acceptInterface(packageName, interfaceName, completionName, modifiers, completionStart, completionEnd);
+  //                   }
+  //                   public void acceptKeyword(char[] keywordName,int completionStart,int completionEnd, int relevance){
+  //                           requestor.acceptKeyword(keywordName, completionStart, completionEnd);
+  //                   }
+  //                   public void acceptLabel(char[] labelName,int completionStart,int completionEnd, int relevance){
+  //                           requestor.acceptLabel(labelName, completionStart, completionEnd);
+  //                   }
+  //                   public void acceptLocalVariable(char[] name,char[] typePackageName,char[] typeName,int modifiers,int completionStart,int
+  // completionEnd, int relevance){
+  //                           // ignore
+  //                   }
+  //                   public void acceptMethod(char[] declaringTypePackageName,char[] declaringTypeName,char[] selector,char[][]
+  // parameterPackageNames,char[][] parameterTypeNames,char[][] parameterNames,char[] returnTypePackageName,char[]
+  // returnTypeName,char[] completionName,int modifiers,int completionStart,int completionEnd, int relevance){
+  //                           // skip parameter names
+  //                           requestor.acceptMethod(declaringTypePackageName, declaringTypeName, selector, parameterPackageNames, parameterTypeNames,
+  // returnTypePackageName, returnTypeName, completionName, modifiers, completionStart, completionEnd);
+  //                   }
+  //                   public void acceptMethodDeclaration(char[] declaringTypePackageName,char[] declaringTypeName,char[] selector,char[][]
+  // parameterPackageNames,char[][] parameterTypeNames,char[][] parameterNames,char[] returnTypePackageName,char[]
+  // returnTypeName,char[] completionName,int modifiers,int completionStart,int completionEnd, int relevance){
+  //                           // ignore
+  //                   }
+  //                   public void acceptModifier(char[] modifierName,int completionStart,int completionEnd, int relevance){
+  //                           requestor.acceptModifier(modifierName, completionStart, completionEnd);
+  //                   }
+  //                   public void acceptPackage(char[] packageName,char[] completionName,int completionStart,int completionEnd, int relevance){
+  //                           requestor.acceptPackage(packageName, completionName, completionStart, completionEnd);
+  //                   }
+  //                   public void acceptType(char[] packageName,char[] typeName,char[] completionName,int completionStart,int completionEnd, int
+  // relevance){
+  //                           requestor.acceptType(packageName, typeName, completionName, completionStart, completionEnd);
+  //                   }
+  //                   public void acceptVariableName(char[] typePackageName,char[] typeName,char[] name,char[] completionName,int completionStart,int
+  // completionEnd, int relevance){
+  //                           // ignore
+  //                   }
+  //           });
+  //}
+  ///**
+  // * @see JavaElement#rootedAt(IJavaProject)
+  // */
+  //public IJavaElement rootedAt(IJavaProject project) {
+  //   return
+  //           new CompilationUnit(
+  //                   (IPackageFragment)((JavaElement)parent).rootedAt(project),
+  //                   name);
+  //}
+  /*
+   * Assume that this is a working copy
+   */
+  protected void updateTimeStamp(CompilationUnit original) throws JavaModelException {
+    long timeStamp = ((IFile) original.getResource()).getModificationStamp();
+    if (timeStamp == IResource.NULL_STAMP) {
+      throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_RESOURCE));
+    }
+    ((CompilationUnitElementInfo) getElementInfo()).timestamp = timeStamp;
+  }
+}
\ No newline at end of file
index cd10093..24255af 100644 (file)
@@ -40,6 +40,7 @@ import net.sourceforge.phpdt.internal.compiler.problem.DefaultProblemFactory;
 import net.sourceforge.phpdt.internal.core.util.Util;
 import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
 
+import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.IProgressMonitor;
 
 /**
index 08268b2..aa9b7a2 100644 (file)
@@ -101,14 +101,14 @@ protected JavaModelOperation getNestedOperation(IJavaElement element) {
 //                             if (isRenamingMainType(element, dest)) {
 //                                     return new RenameResourceElementsOperation(new IJavaElement[] {dest}, new IJavaElement[] {dest.getParent()}, new String[]{getNewNameFor(element) + ".php"}, fForce); //$NON-NLS-1$
 //                             } else {
-//                                     return new CreateTypeOperation(dest, getSourceFor(element) + Util.LINE_SEPARATOR, fForce);
+//                                     return new CreateTypeOperation(dest, getSourceFor(element) + ProjectPrefUtil.LINE_SEPARATOR, fForce);
 //                             }
 //                     case IJavaElement.METHOD :
-//                             return new CreateMethodOperation((IType) dest, getSourceFor(element) + Util.LINE_SEPARATOR, fForce);
+//                             return new CreateMethodOperation((IType) dest, getSourceFor(element) + ProjectPrefUtil.LINE_SEPARATOR, fForce);
 //                     case IJavaElement.FIELD :
-//                             return new CreateFieldOperation((IType) dest, getSourceFor(element) + Util.LINE_SEPARATOR, fForce);
+//                             return new CreateFieldOperation((IType) dest, getSourceFor(element) + ProjectPrefUtil.LINE_SEPARATOR, fForce);
 //                     case IJavaElement.INITIALIZER :
-//                             return new CreateInitializerOperation((IType) dest, getSourceFor(element) + Util.LINE_SEPARATOR);
+//                             return new CreateInitializerOperation((IType) dest, getSourceFor(element) + ProjectPrefUtil.LINE_SEPARATOR);
 //                     default :
 //                             return null;
 //             }
index 19b0fe4..7f8d1c4 100644 (file)
@@ -564,7 +564,7 @@ public class CopyResourceElementsOperation extends MultiOperation {
                if (!seenPackageNode && !defaultPackage) {
                        //the cu was in a default package...no package declaration
                        //create the new package declaration as the first child of the cu
-//                     IDOMPackage pkg = fFactory.createPackage("package " + pkgName + ";" + net.sourceforge.phpdt.internal.compiler.util.Util.LINE_SEPARATOR); //$NON-NLS-1$ //$NON-NLS-2$
+//                     IDOMPackage pkg = fFactory.createPackage("package " + pkgName + ";" + net.sourceforge.phpdt.internal.compiler.util.ProjectPrefUtil.LINE_SEPARATOR); //$NON-NLS-1$ //$NON-NLS-2$
 //                     IDOMNode firstChild = domCU.getFirstChild();
 //                     if (firstChild != null) {
 //                             firstChild.insertSibling(pkg);
index 31261a9..a0bf965 100644 (file)
@@ -715,7 +715,7 @@ public class DeltaProcessor implements IResourceChangeListener {
 //                                     } else if (((JavaProject)root.getJavaProject()).contains(resource)) {
 //                                             // create package handle
 //                                             IPath pkgPath = path.removeFirstSegments(root.getPath().segmentCount());
-//                                             String pkg = Util.packageName(pkgPath);
+//                                             String pkg = ProjectPrefUtil.packageName(pkgPath);
 //                                             if (pkg == null) return null;
 //                                             element = root.getPackageFragment(pkg);
 //                                     }
@@ -736,7 +736,7 @@ public class DeltaProcessor implements IResourceChangeListener {
 //                                                     IPackageFragmentRoot root = (IPackageFragmentRoot)this.currentElement;
 //                                                     IPath rootPath = root.getPath();
 //                                                     IPath pkgPath = path.removeLastSegments(1);
-//                                                     String pkgName = Util.packageName(pkgPath.removeFirstSegments(rootPath.segmentCount()));
+//                                                     String pkgName = ProjectPrefUtil.packageName(pkgPath.removeFirstSegments(rootPath.segmentCount()));
 //                                                     if (pkgName != null) {
 //                                                             pkgFragment = root.getPackageFragment(pkgName);
 //                                                     }
@@ -924,7 +924,7 @@ public class DeltaProcessor implements IResourceChangeListener {
 //                                                     IResource resource = child.getResource();
 //                                                     if (resource instanceof IFolder) {
 //                                                             String folderName = resource.getName();
-//                                                             if (Util.isValidFolderNameForPackage(folderName)) {
+//                                                             if (ProjectPrefUtil.isValidFolderNameForPackage(folderName)) {
 //                                                                     String subpkgName = 
 //                                                                             name.length() == 0 ? 
 //                                                                                     folderName : 
@@ -1034,7 +1034,7 @@ public class DeltaProcessor implements IResourceChangeListener {
 //                                             IResource resource = child.getResource();
 //                                             if (resource instanceof IFolder) {
 //                                                     String folderName = resource.getName();
-//                                                     if (Util.isValidFolderNameForPackage(folderName)) {
+//                                                     if (ProjectPrefUtil.isValidFolderNameForPackage(folderName)) {
 //                                                             String subpkgName = 
 //                                                                     name.length() == 0 ? 
 //                                                                             folderName : 
@@ -1074,20 +1074,20 @@ public class DeltaProcessor implements IResourceChangeListener {
 //                             if (rootInfo == null) {
 //                                     rootInfo = this.enclosingRootInfo(res.getFullPath(), kind);
 //                             }
-//                             if (rootInfo == null || Util.isExcluded(res, rootInfo.exclusionPatterns)) {
+//                             if (rootInfo == null || ProjectPrefUtil.isExcluded(res, rootInfo.exclusionPatterns)) {
 //                                     return NON_JAVA_RESOURCE;
 //                             }
 //                             if (res instanceof IFolder) {
-//                                     if (Util.isValidFolderNameForPackage(res.getName())) {
+//                                     if (ProjectPrefUtil.isValidFolderNameForPackage(res.getName())) {
 //                                             return IJavaElement.PACKAGE_FRAGMENT;
 //                                     } else {
 //                                             return NON_JAVA_RESOURCE;
 //                                     }
 //                             } else {
 //                                     String fileName = res.getName();
-//                                     if (Util.isValidCompilationUnitName(fileName)) {
+//                                     if (ProjectPrefUtil.isValidCompilationUnitName(fileName)) {
 //                                             return IJavaElement.COMPILATION_UNIT;
-//                                     } else if (Util.isValidClassFileName(fileName)) {
+//                                     } else if (ProjectPrefUtil.isValidClassFileName(fileName)) {
 //                                             return IJavaElement.CLASS_FILE;
 //                                     } else if (this.rootInfo(res.getFullPath(), kind) != null) {
 //                                             // case of proj=src=bin and resource is a jar file on the classpath
@@ -1414,7 +1414,7 @@ public class DeltaProcessor implements IResourceChangeListener {
 //                                     }
 //                             } catch (JavaModelException e) {
 //                                     if (project.getProject().isAccessible()) {
-//                                             Util.log(e, "Could not save classpath for "+ project.getPath()); //$NON-NLS-1$
+//                                             ProjectPrefUtil.log(e, "Could not save classpath for "+ project.getPath()); //$NON-NLS-1$
 //                                     }
 //                             }
 //                             break;
@@ -1470,7 +1470,7 @@ public class DeltaProcessor implements IResourceChangeListener {
 //                             } catch (RuntimeException e) {
 //                                     // setRawClasspath might fire a delta, and a listener may throw an exception
 //                                     if (project.getProject().isAccessible()) {
-//                                             Util.log(e, "Could not set classpath for "+ project.getPath()); //$NON-NLS-1$
+//                                             ProjectPrefUtil.log(e, "Could not set classpath for "+ project.getPath()); //$NON-NLS-1$
 //                                     }
 //                                     break;
 //                             } catch (JavaModelException e) { // CP failed validation
@@ -1479,11 +1479,11 @@ public class DeltaProcessor implements IResourceChangeListener {
 //                                                     // happens if the .classpath could not be written to disk
 //                                                     project.createClasspathProblemMarker(new JavaModelStatus(
 //                                                                     IJavaModelStatusConstants.INVALID_CLASSPATH_FILE_FORMAT,
-//                                                                     Util.bind("classpath.couldNotWriteClasspathFile", project.getElementName(), e.getMessage()))); //$NON-NLS-1$
+//                                                                     ProjectPrefUtil.bind("classpath.couldNotWriteClasspathFile", project.getElementName(), e.getMessage()))); //$NON-NLS-1$
 //                                             } else {
 //                                                     project.createClasspathProblemMarker(new JavaModelStatus(
 //                                                                     IJavaModelStatusConstants.INVALID_CLASSPATH_FILE_FORMAT,
-//                                                                     Util.bind("classpath.invalidClasspathInClasspathFile", project.getElementName(), e.getMessage()))); //$NON-NLS-1$
+//                                                                     ProjectPrefUtil.bind("classpath.invalidClasspathInClasspathFile", project.getElementName(), e.getMessage()))); //$NON-NLS-1$
 //                                             }                       
 //                                     }
 //                                     break;
@@ -2046,7 +2046,7 @@ public class DeltaProcessor implements IResourceChangeListener {
 //                     // wrap callbacks with Safe runnable for subsequent listeners to be called when some are causing grief
 //                     Platform.run(new ISafeRunnable() {
 //                             public void handleException(Throwable exception) {
-//                                     Util.log(exception, "Exception occurred in listener of Java element change notification"); //$NON-NLS-1$
+//                                     ProjectPrefUtil.log(exception, "Exception occurred in listener of Java element change notification"); //$NON-NLS-1$
 //                             }
 //                             public void run() throws Exception {
 //                                     TypeHierarchy typeHierarchy = (TypeHierarchy)listener;
@@ -2613,10 +2613,10 @@ public class DeltaProcessor implements IResourceChangeListener {
 //                                             IResource resource = child.getResource();
 //                                             if (resource instanceof IFile) {
 //                                                     String name = resource.getName();
-//                                                     if (Util.isJavaFileName(name)) {
+//                                                     if (ProjectPrefUtil.isJavaFileName(name)) {
 //                                                             Openable cu = (Openable)pkg.getCompilationUnit(name);
 //                                                             this.updateIndex(cu, child);
-//                                                     } else if (Util.isClassFileName(name)) {
+//                                                     } else if (ProjectPrefUtil.isClassFileName(name)) {
 //                                                             Openable classFile = (Openable)pkg.getClassFile(name);
 //                                                             this.updateIndex(classFile, child);
 //                                                     }
index 04597a0..01d7c40 100644 (file)
@@ -311,9 +311,9 @@ public class JavaModelManager implements ISaveParticipant {
                        if (PHPFileUtil.isValidPHPUnitName(name))
                        //if (PHPFileUtil.isPHPFile(file))
                                return createCompilationUnitFrom(file, project);
-//                     if (Util.isValidClassFileName(name))
+//                     if (ProjectPrefUtil.isValidClassFileName(name))
 //                             return createClassFileFrom(file, project);
-//                     if (Util.isArchiveFileName(name))
+//                     if (ProjectPrefUtil.isArchiveFileName(name))
 //                             return createJarPackageFragmentRootFrom(file, project);
                }
                return null;
@@ -840,7 +840,7 @@ public class JavaModelManager implements ISaveParticipant {
                        
                // Refresh internal scopes
                if (deltaToNotify != null) {
-//             TODO khartlage temp-del
+//             TODO  temp-del
 //                     Iterator scopes = this.scopes.keySet().iterator();
 //                     while (scopes.hasNext()) {
 //                             AbstractSearchScope scope = (AbstractSearchScope)scopes.next();
@@ -1019,7 +1019,7 @@ public class JavaModelManager implements ISaveParticipant {
                        return proj;
                }
                int rootEnd= memento.indexOf(JavaElement.JEM_PACKAGEFRAGMENT, projectEnd + 1);
-//     TODO khartlage temp-del
+//     TODO  temp-del
 //             if (rootEnd == -1) {
 //                     return model.getHandleFromMementoForRoot(memento, proj, projectEnd, memento.length());
 //             }
@@ -1805,7 +1805,7 @@ public class JavaModelManager implements ISaveParticipant {
        }
 
        public void shutdown () {
-//     TODO khartlage temp-del
+//     TODO  temp-del
 //             if (this.deltaProcessor.indexManager != null){ // no more indexing
 //                     this.deltaProcessor.indexManager.shutdown();
 //             }
index 7a01755..2efde2a 100644 (file)
@@ -383,7 +383,6 @@ public abstract class JavaModelOperation implements IWorkspaceRunnable, IProgres
 //                     // if first time here, computes the root infos before executing the operation
 //                     DeltaProcessor deltaProcessor = JavaModelManager.getJavaModelManager().deltaProcessor;
 //                     if (deltaProcessor.roots == null) {
-////                   TODO khartlage temp-del
 //                       deltaProcessor.initializeRoots();
 //                     }
 //                     executeOperation();
index 90d60e9..c1d7cd7 100644 (file)
@@ -193,7 +193,7 @@ public class JavaModelStatus
           return Util.bind("status.JDOMError"); //$NON-NLS-1$
 
 //                                     case ELEMENT_DOES_NOT_EXIST:
-//                                             return Util.bind("element.doesNotExist",((JavaElement)fElements[0]).toStringWithAncestors()); //$NON-NLS-1$
+//                                             return ProjectPrefUtil.bind("element.doesNotExist",((JavaElement)fElements[0]).toStringWithAncestors()); //$NON-NLS-1$
 
         case EVALUATION_ERROR :
           return Util.bind("status.evaluationError", fString); //$NON-NLS-1$
@@ -205,10 +205,10 @@ public class JavaModelStatus
           return Util.bind("status.invalidContents"); //$NON-NLS-1$
 
           //                           case INVALID_DESTINATION:
-          //                                   return Util.bind("status.invalidDestination", ((JavaElement)fElements[0]).toStringWithAncestors()); //$NON-NLS-1$
+          //                                   return ProjectPrefUtil.bind("status.invalidDestination", ((JavaElement)fElements[0]).toStringWithAncestors()); //$NON-NLS-1$
           //
           //                           case INVALID_ELEMENT_TYPES:
-          //                                   StringBuffer buff= new StringBuffer(Util.bind("operation.notSupported")); //$NON-NLS-1$
+          //                                   StringBuffer buff= new StringBuffer(ProjectPrefUtil.bind("operation.notSupported")); //$NON-NLS-1$
           //                                   for (int i= 0; i < fElements.length; i++) {
           //                                           if (i > 0) {
           //                                                   buff.append(", "); //$NON-NLS-1$
@@ -241,9 +241,9 @@ public class JavaModelStatus
 
           //                           case INVALID_SIBLING:
           //                                   if (fString != null) {
-          //                                           return Util.bind("status.invalidSibling", fString); //$NON-NLS-1$
+          //                                           return ProjectPrefUtil.bind("status.invalidSibling", fString); //$NON-NLS-1$
           //                                   } else {
-          //                                           return Util.bind("status.invalidSibling", ((JavaElement)fElements[0]).toStringWithAncestors()); //$NON-NLS-1$
+          //                                           return ProjectPrefUtil.bind("status.invalidSibling", ((JavaElement)fElements[0]).toStringWithAncestors()); //$NON-NLS-1$
           //                                   }
 
         case IO_EXCEPTION :
@@ -254,13 +254,13 @@ public class JavaModelStatus
           //                                           IJavaElement element = fElements[0];
           //                                           String name = element.getElementName();
           //                                           if (element instanceof IPackageFragment && name.equals(IPackageFragment.DEFAULT_PACKAGE_NAME)) {
-          //                                                   return Util.bind("operation.cannotRenameDefaultPackage"); //$NON-NLS-1$
+          //                                                   return ProjectPrefUtil.bind("operation.cannotRenameDefaultPackage"); //$NON-NLS-1$
           //                                           }
           //                                   }
           //                                   if (fString != null) {
           //                                           return fString;
           //                                   } else {
-          //                                           return Util.bind("status.nameCollision", ""); //$NON-NLS-1$ //$NON-NLS-2$
+          //                                           return ProjectPrefUtil.bind("status.nameCollision", ""); //$NON-NLS-1$ //$NON-NLS-2$
           //                                   }
         case NO_ELEMENTS_TO_PROCESS :
           return Util.bind("operation.needElements"); //$NON-NLS-1$
@@ -275,15 +275,15 @@ public class JavaModelStatus
           return Util.bind("operation.needString"); //$NON-NLS-1$
 
           //                           case PATH_OUTSIDE_PROJECT:
-          //                                   return Util.bind("operation.pathOutsideProject", fString, ((JavaElement)fElements[0]).toStringWithAncestors()); //$NON-NLS-1$
+          //                                   return ProjectPrefUtil.bind("operation.pathOutsideProject", fString, ((JavaElement)fElements[0]).toStringWithAncestors()); //$NON-NLS-1$
           //
           //                           case READ_ONLY:
           //                                   IJavaElement element = fElements[0];
           //                                   String name = element.getElementName();
           //                                   if (element instanceof IPackageFragment && name.equals(IPackageFragment.DEFAULT_PACKAGE_NAME)) {
-          //                                           return Util.bind("status.defaultPackageReadOnly"); //$NON-NLS-1$
+          //                                           return ProjectPrefUtil.bind("status.defaultPackageReadOnly"); //$NON-NLS-1$
           //                                   }
-          //                                   return  Util.bind("status.readOnly", name); //$NON-NLS-1$
+          //                                   return  ProjectPrefUtil.bind("status.readOnly", name); //$NON-NLS-1$
 
         case RELATIVE_PATH :
           return Util.bind("operation.needAbsolutePath", getPath().toString()); //$NON-NLS-1$
@@ -304,7 +304,7 @@ public class JavaModelStatus
           //                                   String description = null;
           //                                   if (initializer != null) description = initializer.getDescription(path, javaProject);
           //                                   if (description == null) description = path.makeRelative().toString();
-          //                                   return Util.bind("classpath.unboundContainerPath", description); //$NON-NLS-1$
+          //                                   return ProjectPrefUtil.bind("classpath.unboundContainerPath", description); //$NON-NLS-1$
           //
           //                           case INVALID_CP_CONTAINER_ENTRY:
           //                                   path = this.fPath;
@@ -322,23 +322,23 @@ public class JavaModelStatus
           //                                           description = container.getDescription();
           //                                   }
           //                                   if (description == null) description = path.makeRelative().toString();
-          //                                   return Util.bind("classpath.invalidContainer", description); //$NON-NLS-1$
+          //                                   return ProjectPrefUtil.bind("classpath.invalidContainer", description); //$NON-NLS-1$
           //
           //                   case CP_VARIABLE_PATH_UNBOUND:
           //                                   path = this.fPath;
-          //                                   return Util.bind("classpath.unboundVariablePath", path.makeRelative().toString()); //$NON-NLS-1$
+          //                                   return ProjectPrefUtil.bind("classpath.unboundVariablePath", path.makeRelative().toString()); //$NON-NLS-1$
           //                                   
           //                   case CLASSPATH_CYCLE: 
           //                                   javaProject = (IJavaProject)fElements[0];
-          //                                   return Util.bind("classpath.cycle", javaProject.getElementName()); //$NON-NLS-1$
+          //                                   return ProjectPrefUtil.bind("classpath.cycle", javaProject.getElementName()); //$NON-NLS-1$
 
           //                   case DISABLED_CP_EXCLUSION_PATTERNS:
           //                                   path = this.fPath;
-          //                                   return Util.bind("classpath.disabledExclusionPatterns", path.makeRelative().toString()); //$NON-NLS-1$
+          //                                   return ProjectPrefUtil.bind("classpath.disabledExclusionPatterns", path.makeRelative().toString()); //$NON-NLS-1$
           //
           //                   case DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS:
           //                                   path = this.fPath;
-          //                                   return Util.bind("classpath.disabledMultipleOutputLocations", path.makeRelative().toString()); //$NON-NLS-1$
+          //                                   return ProjectPrefUtil.bind("classpath.disabledMultipleOutputLocations", path.makeRelative().toString()); //$NON-NLS-1$
       }
       if (fString != null) {
         return fString;
index ff47e67..f803855 100644 (file)
@@ -579,7 +579,7 @@ public class JavaProject
                                                }
                                        } else {
                                                // external target - only JARs allowed
-//                                             if (((java.io.File)target).isFile() && (Util.isArchiveFileName(entryPath.lastSegment()))) {
+//                                             if (((java.io.File)target).isFile() && (ProjectPrefUtil.isArchiveFileName(entryPath.lastSegment()))) {
 //                                                     accumulatedRoots.add(
 //                                                             new JarPackageFragmentRoot(entryPath, this));
 //                                                     rootIDs.add(rootID);
@@ -700,7 +700,7 @@ public class JavaProject
                        switch (innerMostEntry.getEntryKind()) {
                                case IClasspathEntry.CPE_SOURCE:
                                        // .class files are not visible in source folders 
-                                       return true; //!net.sourceforge.phpdt.internal.compiler.util.Util.isClassFileName(fullPath.lastSegment());
+                                       return true; //!net.sourceforge.phpdt.internal.compiler.util.ProjectPrefUtil.isClassFileName(fullPath.lastSegment());
                                case IClasspathEntry.CPE_LIBRARY:
                                        // .java files are not visible in library folders
                                        return !net.sourceforge.phpdt.internal.compiler.util.Util.isJavaFileName(fullPath.lastSegment());
@@ -1492,7 +1492,7 @@ public class JavaProject
                        default:
                                // a path ending with .jar/.zip is still ambiguous and could still resolve to a source/lib folder 
                                // thus will try to guess based on existing resource
-//                             if (Util.isArchiveFileName(path.lastSegment())) {
+//                             if (ProjectPrefUtil.isArchiveFileName(path.lastSegment())) {
 //                                     IResource resource = getProject().getWorkspace().getRoot().findMember(path); 
 //                                     if (resource != null && resource.getType() == IResource.FOLDER){
 //                                             return getPackageFragmentRoot(resource);
@@ -1521,7 +1521,7 @@ public class JavaProject
 
                switch (resource.getType()) {
                        case IResource.FILE:
-//                             if (Util.isArchiveFileName(resource.getName())) {
+//                             if (ProjectPrefUtil.isArchiveFileName(resource.getName())) {
 //                                     return new JarPackageFragmentRoot(resource, this);
 //                             } else {
                                        return null;
@@ -2126,7 +2126,7 @@ public class JavaProject
 //             throws JavaModelException {
 //
 //             if (region == null) {
-//                     throw new IllegalArgumentException(Util.bind("hierarchy.nullRegion"));//$NON-NLS-1$
+//                     throw new IllegalArgumentException(ProjectPrefUtil.bind("hierarchy.nullRegion"));//$NON-NLS-1$
 //             }
 //             CreateTypeHierarchyOperation op =
 //                     new CreateTypeHierarchyOperation(null, region, this, true);
@@ -2144,10 +2144,10 @@ public class JavaProject
 //             throws JavaModelException {
 //
 //             if (type == null) {
-//                     throw new IllegalArgumentException(Util.bind("hierarchy.nullFocusType"));//$NON-NLS-1$
+//                     throw new IllegalArgumentException(ProjectPrefUtil.bind("hierarchy.nullFocusType"));//$NON-NLS-1$
 //             }
 //             if (region == null) {
-//                     throw new IllegalArgumentException(Util.bind("hierarchy.nullRegion"));//$NON-NLS-1$
+//                     throw new IllegalArgumentException(ProjectPrefUtil.bind("hierarchy.nullRegion"));//$NON-NLS-1$
 //             }
 //             CreateTypeHierarchyOperation op =
 //                     new CreateTypeHierarchyOperation(type, region, this, true);
index 54c0ca4..98b96c3 100644 (file)
@@ -96,17 +96,17 @@ class JavaProjectElementInfo extends OpenableElementInfo {
                                                String resName = res.getName();
                                                
                                                // ignore a jar file on the classpath
-//                                             if (Util.isArchiveFileName(resName) && this.isClasspathEntryOrOutputLocation(resFullPath, classpath, projectOutput)) {
+//                                             if (ProjectPrefUtil.isArchiveFileName(resName) && this.isClasspathEntryOrOutputLocation(resFullPath, classpath, projectOutput)) {
 //                                                     break;
 //                                             }
                                                // ignore .java file if src == project
                                                if (srcIsProject 
-//                                                     && Util.isValidCompilationUnitName(resName)
+//                                                     && ProjectPrefUtil.isValidCompilationUnitName(resName)
                                                        && !Util.isExcluded(res, exclusionPatterns)) {
                                                        break;
                                                }
                                                // ignore .class file if bin == project
-//                                             if (binIsProject && Util.isValidClassFileName(resName)) {
+//                                             if (binIsProject && ProjectPrefUtil.isValidClassFileName(resName)) {
 //                                                     break;
 //                                             }
                                                // else add non java resource
index 4fbafee..d73ef9d 100644 (file)
@@ -149,7 +149,7 @@ protected void closing(Object info) {
 // */
 //protected void codeComplete(org.eclipse.jdt.internal.compiler.env.ICompilationUnit cu, org.eclipse.jdt.internal.compiler.env.ICompilationUnit unitToSkip, int position, ICompletionRequestor requestor) throws JavaModelException {
 //     if (requestor == null) {
-//             throw new IllegalArgumentException(Util.bind("codeAssist.nullRequestor")); //$NON-NLS-1$
+//             throw new IllegalArgumentException(ProjectPrefUtil.bind("codeAssist.nullRequestor")); //$NON-NLS-1$
 //     }
 //     IBuffer buffer = getBuffer();
 //     if (buffer == null) {
index 8820a41..405364b 100644 (file)
@@ -77,10 +77,10 @@ public class PackageFragment extends Openable implements IPackageFragment {
                                        if (extension != null) {
                                                if (extension.equalsIgnoreCase(extType)) {
                                                        IJavaElement childElement;
-//                                                     if (kind == IPackageFragmentRoot.K_SOURCE && Util.isValidCompilationUnitName(child.getName())) {
+//                                                     if (kind == IPackageFragmentRoot.K_SOURCE && ProjectPrefUtil.isValidCompilationUnitName(child.getName())) {
 //                                                             childElement = new CompilationUnit(this, child.getName(), DefaultWorkingCopyOwner.PRIMARY);
 //                                                             vChildren.add(childElement);
-//                                                     } else if (Util.isValidClassFileName(child.getName())) {
+//                                                     } else if (ProjectPrefUtil.isValidClassFileName(child.getName())) {
 //                                                             childElement = getClassFile(child.getName());
 //                                                             vChildren.add(childElement);
 //                                                     }
@@ -129,15 +129,15 @@ public class PackageFragment extends Openable implements IPackageFragment {
 //             for (int i = 0, max = members.length; i < max; i++) {
 //                     IResource child = members[i];
 //                     if (child.getType() != IResource.FOLDER
-//                                     && !Util.isExcluded(child, exclusionPatterns)) {
+//                                     && !ProjectPrefUtil.isExcluded(child, exclusionPatterns)) {
 //                             String extension = child.getProjectRelativePath().getFileExtension();
 //                             if (extension != null) {
 //                                     if (extension.equalsIgnoreCase(extType)) {
 //                                             IJavaElement childElement;
-////                                           if (kind == IPackageFragmentRoot.K_SOURCE && Util.isValidCompilationUnitName(child.getName())) {
+////                                           if (kind == IPackageFragmentRoot.K_SOURCE && ProjectPrefUtil.isValidCompilationUnitName(child.getName())) {
 ////                                                   childElement = getCompilationUnit(child.getName());
 ////                                                   vChildren.add(childElement);
-////                                           } else if (Util.isValidClassFileName(child.getName())) {
+////                                           } else if (ProjectPrefUtil.isValidClassFileName(child.getName())) {
 ////                                                   childElement = getClassFile(child.getName());
 ////                                                   vChildren.add(childElement);
 ////                                           }
@@ -165,7 +165,7 @@ public class PackageFragment extends Openable implements IPackageFragment {
  */
 //public void copy(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor) throws JavaModelException {
 //     if (container == null) {
-//             throw new IllegalArgumentException(Util.bind("operation.nullContainer")); //$NON-NLS-1$
+//             throw new IllegalArgumentException(ProjectPrefUtil.bind("operation.nullContainer")); //$NON-NLS-1$
 //     }
 //     IJavaElement[] elements= new IJavaElement[] {this};
 //     IJavaElement[] containers= new IJavaElement[] {container};
@@ -365,7 +365,7 @@ public boolean isDefaultPackage() {
  */
 //public void move(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor) throws JavaModelException {
 //     if (container == null) {
-//             throw new IllegalArgumentException(Util.bind("operation.nullContainer")); //$NON-NLS-1$
+//             throw new IllegalArgumentException(ProjectPrefUtil.bind("operation.nullContainer")); //$NON-NLS-1$
 //     }
 //     IJavaElement[] elements= new IJavaElement[] {this};
 //     IJavaElement[] containers= new IJavaElement[] {container};
@@ -400,7 +400,7 @@ public boolean isDefaultPackage() {
  */
 //public void rename(String name, boolean force, IProgressMonitor monitor) throws JavaModelException {
 //     if (name == null) {
-//             throw new IllegalArgumentException(Util.bind("element.nullName")); //$NON-NLS-1$
+//             throw new IllegalArgumentException(ProjectPrefUtil.bind("element.nullName")); //$NON-NLS-1$
 //     }
 //     IJavaElement[] elements= new IJavaElement[] {this};
 //     IJavaElement[] dests= new IJavaElement[] {this.getParent()};
index 07263dd..c8fb6b0 100644 (file)
@@ -192,7 +192,7 @@ public class PackageFragmentRoot extends Openable implements IPackageFragmentRoo
 //     try {
 //             verifyAttachSource(sourcePath);
 //             if (monitor != null) {
-//                     monitor.beginTask(Util.bind("element.attachingSource"), 2); //$NON-NLS-1$
+//                     monitor.beginTask(ProjectPrefUtil.bind("element.attachingSource"), 2); //$NON-NLS-1$
 //             }
 //             SourceMapper oldMapper= getSourceMapper();
 //             IWorkspace workspace = ResourcesPlugin.getWorkspace();
@@ -355,8 +355,8 @@ public class PackageFragmentRoot extends Openable implements IPackageFragmentRoo
 //                     IResource member = members[i];
 //                     String memberName = member.getName();
 //                     if (member.getType() == IResource.FOLDER 
-//                             && Util.isValidFolderNameForPackage(memberName)
-//                             && !Util.isExcluded(member, exclusionPatterns)) {
+//                             && ProjectPrefUtil.isValidFolderNameForPackage(memberName)
+//                             && !ProjectPrefUtil.isExcluded(member, exclusionPatterns)) {
 //                                     
 //                             // eliminate binary output only if nested inside direct subfolders
 //                             if (javaProject.contains(member)) {
@@ -487,7 +487,7 @@ public boolean equals(Object o) {
 //                             Object target = JavaModel.getTarget(workspaceRoot, entry.getSourceAttachmentPath(), true);
 //                             if (target instanceof IFile){
 //                                     IFile file = (IFile) target;
-//                                     if (Util.isArchiveFileName(file.getName())){
+//                                     if (ProjectPrefUtil.isArchiveFileName(file.getName())){
 //                                             return entry;
 //                                     }
 //                             } else if (target instanceof IFolder) {
@@ -496,7 +496,7 @@ public boolean equals(Object o) {
 //                             if (target instanceof java.io.File){
 //                                     java.io.File file = (java.io.File) target;
 //                                     if (file.isFile()) {
-//                                             if (Util.isArchiveFileName(file.getName())){
+//                                             if (ProjectPrefUtil.isArchiveFileName(file.getName())){
 //                                                     return entry;
 //                                             }
 //                                     } else {
@@ -520,7 +520,7 @@ public boolean equals(Object o) {
 //                                     Object target = JavaModel.getTarget(workspaceRoot, entry.getSourceAttachmentPath(), true);
 //                                     if (target instanceof IFile){
 //                                             IFile file = (IFile) target;
-//                                             if (Util.isArchiveFileName(file.getName())){
+//                                             if (ProjectPrefUtil.isArchiveFileName(file.getName())){
 //                                                     return entry;
 //                                             }
 //                                     } else if (target instanceof IFolder) {
@@ -529,7 +529,7 @@ public boolean equals(Object o) {
 //                                     if (target instanceof java.io.File){
 //                                             java.io.File file = (java.io.File) target;
 //                                             if (file.isFile()) {
-//                                                     if (Util.isArchiveFileName(file.getName())){
+//                                                     if (ProjectPrefUtil.isArchiveFileName(file.getName())){
 //                                                             return entry;
 //                                                     }
 //                                             } else {
index 3365827..0848af2 100644 (file)
@@ -72,17 +72,17 @@ static Object[] computeFolderNonJavaResources(JavaProject project, IContainer fo
                                        if (Util.isValidCompilationUnitName(fileName) && !Util.isExcluded(member, exclusionPatterns)) 
                                                continue nextResource;
                                        // ignore .class files
-//                                     if (Util.isValidClassFileName(fileName)) 
+//                                     if (ProjectPrefUtil.isValidClassFileName(fileName)) 
 //                                             continue nextResource;
 //                                     // ignore .zip or .jar file on classpath
-//                                     if (Util.isArchiveFileName(fileName) && isClasspathEntry(member.getFullPath(), classpath)) 
+//                                     if (ProjectPrefUtil.isArchiveFileName(fileName) && isClasspathEntry(member.getFullPath(), classpath)) 
 //                                             continue nextResource;
                                        break;
 
                                case IResource.FOLDER :
                                        // ignore valid packages or excluded folders that correspond to a nested pkg fragment root
-//                                     if (Util.isValidFolderNameForPackage(member.getName())
-//                                                     && (!Util.isExcluded(member, exclusionPatterns) 
+//                                     if (ProjectPrefUtil.isValidFolderNameForPackage(member.getName())
+//                                                     && (!ProjectPrefUtil.isExcluded(member, exclusionPatterns) 
 //                                                             || isClasspathEntry(member.getFullPath(), classpath)))
 //                                             continue nextResource;
                                        break;
index 126addc..be6bb19 100644 (file)
@@ -48,7 +48,7 @@ public class ReconcileWorkingCopyOperation extends JavaModelOperation {
 //     protected void executeOperation() throws JavaModelException {
 //             if (fMonitor != null){
 //                     if (fMonitor.isCanceled()) return;
-//                     fMonitor.beginTask(Util.bind("element.reconciling"), 10); //$NON-NLS-1$
+//                     fMonitor.beginTask(ProjectPrefUtil.bind("element.reconciling"), 10); //$NON-NLS-1$
 //             }
 //     
 //             WorkingCopy workingCopy = getWorkingCopy();
index b57a644..ac51e61 100644 (file)
@@ -701,7 +701,7 @@ public class SetClasspathOperation extends JavaModelOperation {
 //             while (iter.hasNext()){
 //                     IPackageFragment frag= (IPackageFragment)iter.next();
 //                     ((IPackageFragmentRoot)frag.getParent()).close();
-//                     if (!Util.isExcluded(frag)) {
+//                     if (!ProjectPrefUtil.isExcluded(frag)) {
 //                             delta.added(frag);
 //                             deltaToFire = true;
 //                     }
@@ -713,7 +713,7 @@ public class SetClasspathOperation extends JavaModelOperation {
 //             while (iter.hasNext()){
 //                     IPackageFragment frag= (IPackageFragment)iter.next();
 //                     ((IPackageFragmentRoot)frag.getParent()).close(); 
-//                     if (!Util.isExcluded(frag)) {
+//                     if (!ProjectPrefUtil.isExcluded(frag)) {
 //                             delta.removed(frag);
 //                             deltaToFire = true;
 //                     }
index 9db0a5a..d3dcce0 100644 (file)
@@ -52,7 +52,7 @@ protected Object createElementInfo() {
  */
 //public void copy(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor) throws JavaModelException {
 //     if (container == null) {
-//             throw new IllegalArgumentException(Util.bind("operation.nullContainer")); //$NON-NLS-1$
+//             throw new IllegalArgumentException(ProjectPrefUtil.bind("operation.nullContainer")); //$NON-NLS-1$
 //     }
 //     IJavaElement[] elements= new IJavaElement[] {this};
 //     IJavaElement[] containers= new IJavaElement[] {container};
@@ -170,7 +170,7 @@ public IResource getUnderlyingResource() throws JavaModelException {
  */
 //public void move(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor) throws JavaModelException {
 //     if (container == null) {
-//             throw new IllegalArgumentException(Util.bind("operation.nullContainer")); //$NON-NLS-1$
+//             throw new IllegalArgumentException(ProjectPrefUtil.bind("operation.nullContainer")); //$NON-NLS-1$
 //     }
 //     IJavaElement[] elements= new IJavaElement[] {this};
 //     IJavaElement[] containers= new IJavaElement[] {container};
@@ -189,7 +189,7 @@ public IResource getUnderlyingResource() throws JavaModelException {
  */
 //public void rename(String name, boolean force, IProgressMonitor monitor) throws JavaModelException {
 //     if (name == null) {
-//             throw new IllegalArgumentException(Util.bind("element.nullName")); //$NON-NLS-1$
+//             throw new IllegalArgumentException(ProjectPrefUtil.bind("element.nullName")); //$NON-NLS-1$
 //     }
 //     IJavaElement[] elements= new IJavaElement[] {this};
 //     IJavaElement[] dests= new IJavaElement[] {this.getParent()};
index 4c4e8e8..9af3643 100644 (file)
@@ -49,7 +49,7 @@ public class SourceType extends Member implements IType {
   //public void codeComplete(char[] snippet,int insertion,int position,char[][] localVariableTypeNames,char[][]
   // localVariableNames,int[] localVariableModifiers,boolean isStatic,ICompletionRequestor requestor) throws JavaModelException {
   //   if (requestor == null) {
-  //           throw new IllegalArgumentException(Util.bind("codeAssist.nullRequestor")); //$NON-NLS-1$
+  //           throw new IllegalArgumentException(ProjectPrefUtil.bind("codeAssist.nullRequestor")); //$NON-NLS-1$
   //   }
   //   
   //   JavaProject project = (JavaProject) getJavaProject();
@@ -411,7 +411,7 @@ public class SourceType extends Member implements IType {
    */
   //public ITypeHierarchy newTypeHierarchy(IJavaProject project, IProgressMonitor monitor) throws JavaModelException {
   //   if (project == null) {
-  //           throw new IllegalArgumentException(Util.bind("hierarchy.nullProject")); //$NON-NLS-1$
+  //           throw new IllegalArgumentException(ProjectPrefUtil.bind("hierarchy.nullProject")); //$NON-NLS-1$
   //   }
   //   
   //   CreateTypeHierarchyOperation op= new CreateTypeHierarchyOperation(
index 807d777..22e9a7e 100644 (file)
@@ -109,7 +109,7 @@ public void acceptResult(CompilationResult result) {
 //                                             if (duplicateTypeNames == null)
 //                                                     duplicateTypeNames = new ArrayList();
 //                                             duplicateTypeNames.add(compoundName);
-//                                             createErrorFor(compilationUnit.resource, Util.bind("build.duplicateClassFile", new String(typeName))); //$NON-NLS-1$
+//                                             createErrorFor(compilationUnit.resource, ProjectPrefUtil.bind("build.duplicateClassFile", new String(typeName))); //$NON-NLS-1$
 //                                             continue;
 //                                     }
 //                                     newState.recordLocatorForType(qualifiedTypeName, typeLocator);
index c924195..d29be84 100644 (file)
@@ -131,7 +131,7 @@ protected void cleanOutputFolders() throws CoreException {
                                                                if (Util.isExcluded(resource, exclusionPatterns)) return false;
                                                        }
                                                        if (proxy.getType() == IResource.FILE) {
-//                                                             if (Util.isClassFileName(proxy.getName())) {
+//                                                             if (ProjectPrefUtil.isClassFileName(proxy.getName())) {
 //                                                                     if (resource == null)
 //                                                                             resource = proxy.requestResource();
 //                                                                     resource.delete(IResource.FORCE, null);
@@ -178,7 +178,7 @@ protected void copyExtraResourcesBack(ClasspathMultiDirectory sourceLocation, fi
                                IResource resource = null;
                                switch(proxy.getType()) {
                                        case IResource.FILE :
-                                               if (net.sourceforge.phpdt.internal.compiler.util.Util.isJavaFileName(proxy.getName())) return false;// || Util.isClassFileName(proxy.getName())) return false;
+                                               if (net.sourceforge.phpdt.internal.compiler.util.Util.isJavaFileName(proxy.getName())) return false;// || ProjectPrefUtil.isClassFileName(proxy.getName())) return false;
 
                                                resource = proxy.requestResource();
                                                if (javaBuilder.filterExtraResource(resource)) return false;
index 901bcd3..30a42a8 100644 (file)
@@ -52,7 +52,7 @@ String[] directoryList(String qualifiedPackageName) {
                        int index = 0;
                        for (int i = 0, l = members.length; i < l; i++) {
                                IResource m = members[i];
-//                             if (m.getType() == IResource.FILE && Util.isClassFileName(m.getName()))
+//                             if (m.getType() == IResource.FILE && ProjectPrefUtil.isClassFileName(m.getName()))
 //                                     // add exclusion pattern check here if we want to hide .class files
 //                                     dirList[index++] = m.getName();
                        }
index 3cf8b2f..5765f22 100644 (file)
@@ -187,7 +187,7 @@ public class IncrementalImageBuilder extends AbstractImageBuilder {
 //                  sourceFileFullPath)) {
 //                md = sourceLocations[j];
 //                if (md.exclusionPatterns == null
-//                    || !Util.isExcluded(file, md.exclusionPatterns))
+//                    || !ProjectPrefUtil.isExcluded(file, md.exclusionPatterns))
 //                  break;
 //              }
 //            }
@@ -322,7 +322,7 @@ public class IncrementalImageBuilder extends AbstractImageBuilder {
         }
         return;
       case IResource.FILE :
-    //                 if (Util.isClassFileName(resource.getName())) {
+    //                 if (ProjectPrefUtil.isClassFileName(resource.getName())) {
     //                         IPath typePath =
     // resource.getFullPath().removeFirstSegments(segmentCount).removeFileExtension();
     //                         switch (binaryDelta.getKind()) {
@@ -511,7 +511,7 @@ public class IncrementalImageBuilder extends AbstractImageBuilder {
               sourceFiles.add(new SourceFile((IFile) resource, md, encoding));
           }
           return;
-          //                   } else if (Util.isClassFileName(resourceName)) {
+          //                   } else if (ProjectPrefUtil.isClassFileName(resourceName)) {
           //                           return; // skip class files
         } else if (md.hasIndependentOutputFolder) {
           if (javaBuilder.filterExtraResource(resource))
@@ -697,7 +697,7 @@ public class IncrementalImageBuilder extends AbstractImageBuilder {
   //protected boolean writeClassFileCheck(IFile file, String fileName, byte[]
   // newBytes) throws CoreException {
   //   try {
-  //           byte[] oldBytes = Util.getResourceContentsAsByteArray(file);
+  //           byte[] oldBytes = ProjectPrefUtil.getResourceContentsAsByteArray(file);
   //           if (this.compileLoop > 1) { // only optimize files which were recompiled
   // during the dependent pass, see 33990
   //                   notEqual : if (newBytes.length == oldBytes.length) {
index e023b59..f932e9f 100644 (file)
@@ -170,7 +170,7 @@ public class NameEnvironment implements INameEnvironment {
 //                                     IResource resource = (IResource) target;
 //                                     ClasspathLocation bLocation = null;
 //                                     if (resource instanceof IFile) {
-//                                             if (!(Util.isArchiveFileName(path.lastSegment())))
+//                                             if (!(ProjectPrefUtil.isArchiveFileName(path.lastSegment())))
 //                                                     continue nextEntry;
 //                                             bLocation = ClasspathLocation.forLibrary((IFile) resource);
 //                                     } else if (resource instanceof IContainer) {
@@ -190,7 +190,7 @@ public class NameEnvironment implements INameEnvironment {
 //                                             binaryLocationsPerProject.put(p, existingLocations);
 //                                     }
 //                             } else if (target instanceof File) {
-//                                     if (!(Util.isArchiveFileName(path.lastSegment())))
+//                                     if (!(ProjectPrefUtil.isArchiveFileName(path.lastSegment())))
 //                                             continue nextEntry;
 //                                     bLocations.add(ClasspathLocation.forLibrary(path.toString()));
 //                             }
index 1bd843c..81fd788 100644 (file)
@@ -628,7 +628,7 @@ public class PHPBuilder extends IncrementalProjectBuilder {
     //      IMarker marker =
     // currentProject.createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER);
     //      marker.setAttribute(IMarker.MESSAGE,
-    // Util.bind("build.abortDueToClasspathProblems")); //$NON-NLS-1$
+    // ProjectPrefUtil.bind("build.abortDueToClasspathProblems")); //$NON-NLS-1$
     //      marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
     //      return false;
     //    }
index 455cec3..07aaa8d 100644 (file)
@@ -16,6 +16,7 @@ import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation;
 import net.sourceforge.phpdt.internal.core.util.Util;
 
 import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 
@@ -99,4 +100,9 @@ public String toString() {
        return "SourceFile[" //$NON-NLS-1$
                + resource.getFullPath() + "]";  //$NON-NLS-1$
 }
+
+public IResource getResource() {
+       return resource; 
+}
+
 }
index 279abb0..1e0fe32 100644 (file)
@@ -160,7 +160,7 @@ public class State {
         return;
       case IResource.FILE :
         IPath typeLocatorPath = resource.getProjectRelativePath();
-//        if (Util.isJavaFileName(typeLocatorPath.lastSegment()))
+//        if (ProjectPrefUtil.isJavaFileName(typeLocatorPath.lastSegment()))
 //          removeLocator(typeLocatorPath.toString());
     }
   }
index dcb38a5..4f85502 100644 (file)
  *******************************************************************************/
 package net.sourceforge.phpdt.internal.core.jdom;
 
+import org.eclipse.core.resources.IResource;
+
 import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit;
 
 /**
  * Implements a very simple version of the ICompilationUnit.
- *
- * <p>Please do not use outside of jdom.</p>
+ * 
+ * <p>
+ * Please do not use outside of jdom.
+ * </p>
  */
 public class CompilationUnit implements ICompilationUnit {
-       protected char[] fContents;
-       protected char[] fFileName;
-       protected char[] fMainTypeName;
-public CompilationUnit(char[] contents, char[] filename) {
-       fContents = contents;
-       fFileName = filename;
-
-       String file = new String(filename);
-       int start = file.lastIndexOf("/") + 1; //$NON-NLS-1$
-       if (start == 0 || start < file.lastIndexOf("\\")) //$NON-NLS-1$
-               start = file.lastIndexOf("\\") + 1; //$NON-NLS-1$
-
-       int end = file.lastIndexOf("."); //$NON-NLS-1$
-       if (end == -1)
-               end = file.length();
-
-       fMainTypeName = file.substring(start, end).toCharArray();
-}
-public char[] getContents() {
-       return fContents;
-}
-public char[] getFileName() {
-       return fFileName;
-}
-public char[] getMainTypeName() {
-       return fMainTypeName;
-}
-public char[][] getPackageName() {
-       return null;
-}
-public String toString() {
-       return "CompilationUnit[" + new String(fFileName) + "]";  //$NON-NLS-2$ //$NON-NLS-1$
-}
-}
+  protected char[] fContents;
+
+  protected char[] fFileName;
+
+  protected char[] fMainTypeName;
+
+  public CompilationUnit(char[] contents, char[] filename) {
+    fContents = contents;
+    fFileName = filename;
+
+    String file = new String(filename);
+    int start = file.lastIndexOf("/") + 1; //$NON-NLS-1$
+    if (start == 0 || start < file.lastIndexOf("\\")) //$NON-NLS-1$
+      start = file.lastIndexOf("\\") + 1; //$NON-NLS-1$
+
+    int end = file.lastIndexOf("."); //$NON-NLS-1$
+    if (end == -1)
+      end = file.length();
+
+    fMainTypeName = file.substring(start, end).toCharArray();
+  }
+
+  public char[] getContents() {
+    return fContents;
+  }
+
+  public char[] getFileName() {
+    return fFileName;
+  }
+
+  public char[] getMainTypeName() {
+    return fMainTypeName;
+  }
+
+  public char[][] getPackageName() {
+    return null;
+  }
+
+  public String toString() {
+    return "CompilationUnit[" + new String(fFileName) + "]"; //$NON-NLS-2$ //$NON-NLS-1$
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit#getResource()
+   */
+  public IResource getResource() {
+    return null;
+  }
+}
\ No newline at end of file
index 6c115e4..a0e5300 100644 (file)
@@ -235,7 +235,7 @@ protected void appendSimpleContents(CharArrayBuffer buffer) {
 //                     DOMBuilder builder = new DOMBuilder();
 //                     IDOMField[] details= builder.createFields(source.toCharArray());
 //                     if (details.length == 0) {
-//                             throw new DOMException(Util.bind("dom.cannotDetail")); //$NON-NLS-1$
+//                             throw new DOMException(ProjectPrefUtil.bind("dom.cannotDetail")); //$NON-NLS-1$
 //                     } else {
 //                             node= this;
 //                             for (int i= 0; i < details.length; i++) {
index aa36b78..a308317 100644 (file)
@@ -27,194 +27,218 @@ import net.sourceforge.phpdt.internal.core.util.CharArrayOps;
  */
 public class SimpleDOMBuilder extends AbstractDOMBuilder implements ISourceElementRequestor {
 
-public void acceptImport(int declarationStart, int declarationEnd, char[] name, boolean onDemand) {
-       int[] sourceRange = {declarationStart, declarationEnd};
-       String importName = new String(name);
-       /** name is set to contain the '*' */
-       if (onDemand) {
-               importName+=".*"; //$NON-NLS-1$
-       }
-       fNode= new DOMImport(fDocument, sourceRange, importName, onDemand);
-       addChild(fNode);        
-}
-public void acceptPackage(int declarationStart, int declarationEnd, char[] name) {
-       int[] sourceRange= new int[] {declarationStart, declarationEnd};
-       fNode= new DOMPackage(fDocument, sourceRange, CharArrayOps.charToString(name));
-       addChild(fNode);        
-}
-/**
- * @see IDOMFactory#createCompilationUnit(String, String)
- */
-public IDOMCompilationUnit createCompilationUnit(String sourceCode, String name) {
-       return createCompilationUnit(sourceCode.toCharArray(), name.toCharArray());
-}
-/**
- * @see IDOMFactory#createCompilationUnit(String, String)
- */
-public IDOMCompilationUnit createCompilationUnit(ICompilationUnit compilationUnit) {
-       initializeBuild(compilationUnit.getContents(), true, true);
-       getParser(JavaCore.getOptions()).parseCompilationUnit(compilationUnit, false);
-       return super.createCompilationUnit(compilationUnit);
-}
-/**
- * Creates a new DOMMethod and inizializes.
- *
- * @param declarationStart - a source position corresponding to the first character 
- *             of this constructor declaration
- * @param modifiers - the modifiers for this constructor converted to a flag
- * @param returnType - the name of the return type
- * @param name - the name of this constructor
- * @param nameStart - a source position corresponding to the first character of the name
- * @param nameEnd - a source position corresponding to the last character of the name
- * @param parameterTypes - a list of parameter type names
- * @param parameterNames - a list of the names of the parameters
- * @param exceptionTypes - a list of the exception types
- */
-protected void enterAbstractMethod(int declarationStart, int modifiers,
-       char[] returnType, char[] name, int nameStart, int nameEnd, char[][] parameterTypes,
-       char[][] parameterNames, char[][] exceptionTypes, boolean isConstructor) {
-               
-       int[] sourceRange = {declarationStart, -1}; // will be fixed up on exit
-       int[] nameRange = {nameStart, nameEnd};
-       fNode = new DOMMethod(fDocument, sourceRange, CharArrayOps.charToString(name), nameRange, modifiers, 
-               isConstructor, CharArrayOps.charToString(returnType),
-               CharArrayOps.charcharToString(parameterTypes),
-               CharArrayOps.charcharToString(parameterNames), 
-               CharArrayOps.charcharToString(exceptionTypes));
-       addChild(fNode);
-       fStack.push(fNode);
-}
-/**
- */
-public void enterClass(int declarationStart, int modifiers, char[] name, int nameStart, int nameEnd, char[] superclass, char[][] superinterfaces) {
-       enterType(declarationStart, modifiers, name, nameStart, nameEnd, superclass,
-               superinterfaces, true);
-}
-/**
- */
-public void enterConstructor(int declarationStart, int modifiers, char[] name, int nameStart, int nameEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes) {
-       /* see 1FVIIQZ */
-       String nameString = new String(fDocument, nameStart, nameEnd - nameStart);
-       int openParenPosition = nameString.indexOf('(');
-       if (openParenPosition > -1)
-               nameEnd = nameStart + openParenPosition - 1;
-
-       enterAbstractMethod(declarationStart, modifiers, 
-               null, name, nameStart, nameEnd, parameterTypes,
-               parameterNames, exceptionTypes,true);
-}
-/**
- */
-public void enterField(int declarationStart, int modifiers, char[] type, char[] name, int nameStart, int nameEnd) {
-
-       int[] sourceRange = {declarationStart, -1};
-       int[] nameRange = {nameStart, nameEnd};
-       boolean isSecondary= false;
-       if (fNode instanceof DOMField) {
-               isSecondary = declarationStart == fNode.fSourceRange[0];
-       }
-       fNode = new DOMField(fDocument, sourceRange, CharArrayOps.charToString(name), nameRange, 
-               modifiers, CharArrayOps.charToString(type), isSecondary);
-       addChild(fNode);
-       fStack.push(fNode);
-}
-/**
+  public void acceptImport(int declarationStart, int declarationEnd, char[] name, boolean onDemand) {
+    int[] sourceRange = { declarationStart, declarationEnd };
+    String importName = new String(name);
+    /** name is set to contain the '*' */
+    if (onDemand) {
+      importName += ".*"; //$NON-NLS-1$
+    }
+    fNode = new DOMImport(fDocument, sourceRange, importName, onDemand);
+    addChild(fNode);
+  }
 
- */
-public void enterInitializer(int declarationSourceStart, int modifiers) {
-       int[] sourceRange = {declarationSourceStart, -1};
-       fNode = new DOMInitializer(fDocument, sourceRange, modifiers);
-       addChild(fNode);
-       fStack.push(fNode);
-}
-/**
- */
-public void enterInterface(int declarationStart, int modifiers, char[] name, int nameStart, int nameEnd, char[][] superinterfaces) {
-       enterType(declarationStart, modifiers, name, nameStart, nameEnd, null,
-               superinterfaces, false);
-}
-/**
- */
-public void enterMethod(int declarationStart, int modifiers, char[] returnType, char[] name, int nameStart, int nameEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes) {
-       enterAbstractMethod(declarationStart, modifiers, 
-               returnType, name, nameStart, nameEnd, parameterTypes,
-               parameterNames, exceptionTypes,false);
-}
-/**
- */
-protected void enterType(int declarationStart, int modifiers, char[] name, 
-       int nameStart, int nameEnd, char[] superclass, char[][] superinterfaces, boolean isClass) {
-       if (fBuildingType) {
-               int[] sourceRange = {declarationStart, -1}; // will be fixed in the exit
-               int[] nameRange = new int[] {nameStart, nameEnd};
-               fNode = new DOMType(fDocument, sourceRange, new String(name), nameRange,
-                       modifiers, CharArrayOps.charcharToString(superinterfaces), isClass);
-               addChild(fNode);
-               fStack.push(fNode);
-       }
-}
-/**
- * Finishes the configuration of the class DOM object which
- * was created by a previous enterClass call.
- *
- * @see ISourceElementRequestor#exitClass(int)
- */
-public void exitClass(int declarationEnd) {
-       exitType(declarationEnd);
-}
-/**
- * Finishes the configuration of the method DOM object which
- * was created by a previous enterConstructor call.
- *
- * @see ISourceElementRequestor#exitConstructor(int)
- */
-public void exitConstructor(int declarationEnd) {
-       exitMember(declarationEnd);
-}
-/**
- */
-public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd) {
-       exitMember(declarationEnd);
-}
-/**
- */
-public void exitInitializer(int declarationEnd) {
-       exitMember(declarationEnd);
-}
-/**
- */
-public void exitInterface(int declarationEnd) {
-       exitType(declarationEnd);
-}
-/**
- * Finishes the configuration of the member.
- *
- * @param declarationEnd - a source position corresponding to the end of the method
- *             declaration.  This can include whitespace and comments following the closing bracket.
- */
-protected void exitMember(int declarationEnd) {
-       DOMMember m= (DOMMember) fStack.pop();
-       m.setSourceRangeEnd(declarationEnd);
-       fNode = m;
-}
-/**
- */
-public void exitMethod(int declarationEnd) {
-       exitMember(declarationEnd);
-}
-/**
- * @see AbstractDOMBuilder#exitType
- *
- * @param declarationEnd - a source position corresponding to the end of the class
- *             declaration.  This can include whitespace and comments following the closing bracket.
- */
-protected void exitType(int declarationEnd) {
-       exitType(declarationEnd, declarationEnd);
-}
-/**
- * Creates a new parser.
- */
-protected SourceElementParser getParser(Map settings) {
-       return new SourceElementParser(this, new DefaultProblemFactory(), new CompilerOptions(settings));
-}
-}
+  public void acceptPackage(int declarationStart, int declarationEnd, char[] name) {
+    int[] sourceRange = new int[] { declarationStart, declarationEnd };
+    fNode = new DOMPackage(fDocument, sourceRange, CharArrayOps.charToString(name));
+    addChild(fNode);
+  }
+
+  /**
+   * @see IDOMFactory#createCompilationUnit(String, String)
+   */
+  public IDOMCompilationUnit createCompilationUnit(String sourceCode, String name) {
+    return createCompilationUnit(sourceCode.toCharArray(), name.toCharArray());
+  }
+
+  /**
+   * @see IDOMFactory#createCompilationUnit(String, String)
+   */
+  public IDOMCompilationUnit createCompilationUnit(ICompilationUnit compilationUnit) {
+    initializeBuild(compilationUnit.getContents(), true, true);
+    getParser(JavaCore.getOptions()).parseCompilationUnit(compilationUnit, false);
+    return super.createCompilationUnit(compilationUnit);
+  }
+
+  /**
+   * Creates a new DOMMethod and inizializes.
+   * 
+   * @param declarationStart -
+   *          a source position corresponding to the first character of this constructor declaration
+   * @param modifiers -
+   *          the modifiers for this constructor converted to a flag
+   * @param returnType -
+   *          the name of the return type
+   * @param name -
+   *          the name of this constructor
+   * @param nameStart -
+   *          a source position corresponding to the first character of the name
+   * @param nameEnd -
+   *          a source position corresponding to the last character of the name
+   * @param parameterTypes -
+   *          a list of parameter type names
+   * @param parameterNames -
+   *          a list of the names of the parameters
+   * @param exceptionTypes -
+   *          a list of the exception types
+   */
+  protected void enterAbstractMethod(int declarationStart, int modifiers, char[] returnType, char[] name, int nameStart,
+      int nameEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes, boolean isConstructor) {
+
+    int[] sourceRange = { declarationStart, -1 }; // will be fixed up on exit
+    int[] nameRange = { nameStart, nameEnd };
+    fNode = new DOMMethod(fDocument, sourceRange, CharArrayOps.charToString(name), nameRange, modifiers, isConstructor,
+        CharArrayOps.charToString(returnType), CharArrayOps.charcharToString(parameterTypes), CharArrayOps
+            .charcharToString(parameterNames), CharArrayOps.charcharToString(exceptionTypes));
+    addChild(fNode);
+    fStack.push(fNode);
+  }
+
+  /**
+   */
+  public void enterClass(int declarationStart, int modifiers, char[] name, int nameStart, int nameEnd, char[] superclass,
+      char[][] superinterfaces) {
+    enterType(declarationStart, modifiers, name, nameStart, nameEnd, superclass, superinterfaces, true);
+  }
+
+  /**
+   */
+  public void enterConstructor(int declarationStart, int modifiers, char[] name, int nameStart, int nameEnd,
+      char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes) {
+    /* see 1FVIIQZ */
+    String nameString = new String(fDocument, nameStart, nameEnd - nameStart);
+    int openParenPosition = nameString.indexOf('(');
+    if (openParenPosition > -1)
+      nameEnd = nameStart + openParenPosition - 1;
+
+    enterAbstractMethod(declarationStart, modifiers, null, name, nameStart, nameEnd, parameterTypes, parameterNames,
+        exceptionTypes, true);
+  }
+
+  /**
+   */
+  public void enterField(int declarationStart, int modifiers, char[] type, char[] name, int nameStart, int nameEnd) {
+
+    int[] sourceRange = { declarationStart, -1 };
+    int[] nameRange = { nameStart, nameEnd };
+    boolean isSecondary = false;
+    if (fNode instanceof DOMField) {
+      isSecondary = declarationStart == fNode.fSourceRange[0];
+    }
+    fNode = new DOMField(fDocument, sourceRange, CharArrayOps.charToString(name), nameRange, modifiers, CharArrayOps
+        .charToString(type), isSecondary);
+    addChild(fNode);
+    fStack.push(fNode);
+  }
+
+  /**
+   *  
+   */
+  public void enterInitializer(int declarationSourceStart, int modifiers) {
+    int[] sourceRange = { declarationSourceStart, -1 };
+    fNode = new DOMInitializer(fDocument, sourceRange, modifiers);
+    addChild(fNode);
+    fStack.push(fNode);
+  }
+
+  /**
+   */
+  public void enterInterface(int declarationStart, int modifiers, char[] name, int nameStart, int nameEnd, char[][] superinterfaces) {
+    enterType(declarationStart, modifiers, name, nameStart, nameEnd, null, superinterfaces, false);
+  }
+
+  /**
+   */
+  public void enterMethod(int declarationStart, int modifiers, char[] returnType, char[] name, int nameStart, int nameEnd,
+      char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes) {
+    enterAbstractMethod(declarationStart, modifiers, returnType, name, nameStart, nameEnd, parameterTypes, parameterNames,
+        exceptionTypes, false);
+  }
+
+  /**
+   */
+  protected void enterType(int declarationStart, int modifiers, char[] name, int nameStart, int nameEnd, char[] superclass,
+      char[][] superinterfaces, boolean isClass) {
+    if (fBuildingType) {
+      int[] sourceRange = { declarationStart, -1 }; // will be fixed in the exit
+      int[] nameRange = new int[] { nameStart, nameEnd };
+      fNode = new DOMType(fDocument, sourceRange, new String(name), nameRange, modifiers, CharArrayOps
+          .charcharToString(superinterfaces), isClass);
+      addChild(fNode);
+      fStack.push(fNode);
+    }
+  }
+
+  /**
+   * Finishes the configuration of the class DOM object which was created by a previous enterClass call.
+   * 
+   * @see ISourceElementRequestor#exitClass(int)
+   */
+  public void exitClass(int declarationEnd) {
+    exitType(declarationEnd);
+  }
+
+  /**
+   * Finishes the configuration of the method DOM object which was created by a previous enterConstructor call.
+   * 
+   * @see ISourceElementRequestor#exitConstructor(int)
+   */
+  public void exitConstructor(int declarationEnd) {
+    exitMember(declarationEnd);
+  }
+
+  /**
+   */
+  public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd) {
+    exitMember(declarationEnd);
+  }
+
+  /**
+   */
+  public void exitInitializer(int declarationEnd) {
+    exitMember(declarationEnd);
+  }
+
+  /**
+   */
+  public void exitInterface(int declarationEnd) {
+    exitType(declarationEnd);
+  }
+
+  /**
+   * Finishes the configuration of the member.
+   * 
+   * @param declarationEnd -
+   *          a source position corresponding to the end of the method declaration. This can include whitespace and comments
+   *          following the closing bracket.
+   */
+  protected void exitMember(int declarationEnd) {
+    DOMMember m = (DOMMember) fStack.pop();
+    m.setSourceRangeEnd(declarationEnd);
+    fNode = m;
+  }
+
+  /**
+   */
+  public void exitMethod(int declarationEnd) {
+    exitMember(declarationEnd);
+  }
+
+  /**
+   * @see AbstractDOMBuilder#exitType
+   * 
+   * @param declarationEnd -
+   *          a source position corresponding to the end of the class declaration. This can include whitespace and comments
+   *          following the closing bracket.
+   */
+  protected void exitType(int declarationEnd) {
+    exitType(declarationEnd, declarationEnd);
+  }
+
+  /**
+   * Creates a new parser.
+   */
+  protected SourceElementParser getParser(Map settings) {
+    return new SourceElementParser(this, new DefaultProblemFactory(), new CompilerOptions(settings));
+  }
+}
\ No newline at end of file
index d0cf93d..ae22db0 100644 (file)
@@ -16,6 +16,8 @@ import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
 import net.sourceforge.phpdt.internal.compiler.problem.ProblemSeverities;
 import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
 
+import org.eclipse.core.resources.IResource;
+
 /**
  * Internal parser used for parsing source to create DOM AST nodes.
  * 
index 5ce6748..d78c6ce 100644 (file)
@@ -682,11 +682,11 @@ public class Util {
 //                     case IJavaElement.PACKAGE_FRAGMENT:
 //                             PackageFragmentRoot root = (PackageFragmentRoot)element.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
 //                             IResource resource = element.getResource();
-//                             return resource != null && Util.isExcluded(resource, root.fullExclusionPatternChars());
+//                             return resource != null && ProjectPrefUtil.isExcluded(resource, root.fullExclusionPatternChars());
                        case IJavaElement.COMPILATION_UNIT:
                                root = (PackageFragmentRoot)element.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
                                resource = element.getResource();
-//                             if (resource != null && Util.isExcluded(resource, root.fullExclusionPatternChars()))
+//                             if (resource != null && ProjectPrefUtil.isExcluded(resource, root.fullExclusionPatternChars()))
 //                                     return true;
                                return isExcluded(element.getParent());
                        default:
index a2e6fcc..6f19917 100644 (file)
@@ -692,7 +692,7 @@ public class JavaModelUtil {
        private static final String EMPTY_ARGUMENT = "   "; //$NON-NLS-1$
        
        /**
-        * Copied from org.eclipse.jdt.internal.core.Util;
+        * Copied from org.eclipse.jdt.internal.core.ProjectPrefUtil;
         */
        public static String[] getProblemArgumentsFromMarker(String argumentsString){
                if (argumentsString == null) return null;
index 91e330b..dd1c59c 100644 (file)
@@ -4,36 +4,24 @@
  */
 package net.sourceforge.phpdt.internal.ui.util;
 
+import java.io.File;
 import java.util.ArrayList;
+import java.util.List;
 import java.util.StringTokenizer;
 
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+import net.sourceforge.phpeclipse.ui.overlaypages.ProjectPrefUtil;
 
 import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.jface.preference.IPreferenceStore;
 
-/**
- * @author khartlage
- *  
- */
 public class PHPFileUtil {
   private static String[] PHP_EXTENSIONS = null;
 
-  //  {
-  //      "php",
-  //      "php3",
-  //      "php4",
-  //      "php5",
-  //      "phtml",
-  //      "module", // drupal
-  //      "inc",
-  //      "class"
-  //  };
-  //  public final static String[] HTML_EXTENSIONS = {
-  //      "html",
-  //      "htm",
-  //      "xhtml"
-  //  };
   public final static String[] SMARTY_EXTENSIONS = { "tpl" };
 
   public static boolean isPHPFile(IFile file) {
@@ -70,47 +58,12 @@ public class PHPFileUtil {
     }
     return false;
   }
-
-  /**
-   * Returns true iff str.toLowerCase().endsWith(".html") implementation is not creating extra strings.
-   */
-  //  public final static boolean isHTML_FileName(String name) {
-  //    String extension = getFileExtension(name);
-  //    if (extension==null) {
-  //      return false;
-  //    }
-  //  extension = extension.toLowerCase();
-  //    for (int i=0;i<HTML_EXTENSIONS.length;i++) {
-  //      if (extension.equals(HTML_EXTENSIONS[i])) {
-  //        return true;
-  //      }
-  //    }
-  //    return false;
-  //  }
-  /**
-   * Returns true iff str.toLowerCase().endsWith(".tpl") implementation is not creating extra strings.
-   */
-  //  public final static boolean isTPL_FileName(String name) {
-  //    String extension = getFileExtension(name);
-  //    if (extension==null) {
-  //      return false;
-  //    }
-  //  extension = extension.toLowerCase();
-  //    for (int i=0;i<SMARTY_EXTENSIONS.length;i++) {
-  //      if (extension.equals(SMARTY_EXTENSIONS[i])) {
-  //        return true;
-  //      }
-  //    }
-  //    return false;
-  //  }
+  
   /**
    * Returns true iff the file extension is a valid PHP Unit name implementation is not creating extra strings.
    */
   public final static boolean isValidPHPUnitName(String filename) {
     return PHPFileUtil.isPHPFileName(filename);
-    //         ||
-    //                PHPFileUtil.isHTML_FileName(filename) ||
-    //                    PHPFileUtil.isTPL_FileName(filename);
   }
 
   /**
@@ -149,4 +102,46 @@ public class PHPFileUtil {
   public static void setExtensins(String[] php_extensions) {
     PHP_EXTENSIONS = php_extensions;
   }
+
+  /**
+   * Determine the path of an include name string
+   * @param includeNameString
+   * @param resource
+   * @param project
+   */
+  public static IPath determineFilePath(String includeNameString, IResource resource, IProject project) {
+    IPath documentRootPath = ProjectPrefUtil.getDocumentRoot(project);
+    IPath resourcePath = resource.getProjectRelativePath();
+  
+    File file = null;
+    IPath path = null;
+    path = documentRootPath.append(includeNameString);
+    file = path.toFile();
+    if (file.exists()) {
+      return path;
+    }
+  
+    int index = includeNameString.indexOf('/');
+    if (index < 0) {
+      // includeNameString contains no path separator
+      path = project.getLocation().append(resourcePath.removeLastSegments(1));
+      path = path.append(includeNameString);
+      file = path.toFile();
+      if (file.exists()) {
+        return path;
+      }
+    }
+  
+    List includePaths = ProjectPrefUtil.getIncludePaths(project);
+    if (includePaths.size() > 0) {
+      for (int i = 0; i < includePaths.size(); i++) {
+        path = new Path(includePaths.get(i).toString()).append(includeNameString);
+        file = path.toFile();
+        if (file.exists()) {
+          return path;
+        }
+      }
+    }
+    return null;
+  }
 }
\ No newline at end of file
index f4317a1..55c8865 100644 (file)
@@ -4,9 +4,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
-/**
- * @author khartlage
- * */
 public class StreamUtil {
   public static void transferStreams(InputStream source, OutputStream destination) throws IOException {
     try {
@@ -28,4 +25,4 @@ public class StreamUtil {
       }
     }
   }
-}
+}
\ No newline at end of file
index d5e5073..aa3c70b 100644 (file)
@@ -7,7 +7,7 @@
 
  Contributors:
  IBM Corporation - Initial implementation
- Klaus Hartlage - www.eclipseproject.de
+ www.phpeclipse.de
  **********************************************************************/
 package net.sourceforge.phpdt.ui.text;
 
index 19a2a9d..d19e01e 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse;
 
index ac785cf..814b2e5 100644 (file)
@@ -1175,7 +1175,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon
 
       // process deltas since last activated in indexer thread so that indexes are up-to-date.
       // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=38658
-      //               Job processSavedState = new Job(Util.bind("savedState.jobName")) { //$NON-NLS-1$
+      //               Job processSavedState = new Job(ProjectPrefUtil.bind("savedState.jobName")) { //$NON-NLS-1$
       //                       protected IStatus run(IProgressMonitor monitor) {
       //                               try {
       //                                       // add save participant and process delta atomically
@@ -1270,7 +1270,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon
   //      // JavaModelManager.PluginPreferencesListener());
   //      getPluginPreferences().addPropertyChangeListener(
   //          new JavaModelManager.PluginPreferencesListener());
-  //      // TODO khartlage temp-del
+  //      // TODO temp-del
   //      // manager.loadVariablesAndContainers();
   //      final IWorkspace workspace = ResourcesPlugin.getWorkspace();
   //           workspace.addResourceChangeListener(
index 592c5cd..e29b34d 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.actions;
 
index 6a9430d..e0169ee 100644 (file)
@@ -3,7 +3,8 @@
  * 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 implementation Klaus Hartlage - www.eclipseproject.de
+ * Contributors: IBM Corporation - Initial implementation 
+ *               www.phpeclipse.de
  **********************************************************************************************************************************/
 package net.sourceforge.phpeclipse.actions;
 
@@ -16,7 +17,7 @@ import java.util.Iterator;
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
 import net.sourceforge.phpeclipse.ui.IPreferenceConstants;
 import net.sourceforge.phpeclipse.ui.editor.ShowExternalPreviewAction;
-import net.sourceforge.phpeclipse.ui.overlaypages.Util;
+import net.sourceforge.phpeclipse.ui.overlaypages.ProjectPrefUtil;
 import net.sourceforge.phpeclipse.webbrowser.IWebBrowser;
 import net.sourceforge.phpeclipse.webbrowser.internal.BrowserManager;
 import net.sourceforge.phpeclipse.webbrowser.internal.WebBrowserUtil;
@@ -77,9 +78,9 @@ public class PHPEclipseShowAction implements IObjectActionDelegate {
           // single file:
           IFile previewFile = (IFile) resource;
           String extension = previewFile.getFileExtension().toLowerCase();
-          boolean bringToTopPreview = Util.getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_BRING_TO_TOP_PREVIEW_DEFAULT);
-          boolean showHTMLFilesLocal = Util.getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_SHOW_HTML_FILES_LOCAL);
-          boolean showXMLFilesLocal = Util.getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_SHOW_XML_FILES_LOCAL);
+          boolean bringToTopPreview = ProjectPrefUtil.getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_BRING_TO_TOP_PREVIEW_DEFAULT);
+          boolean showHTMLFilesLocal = ProjectPrefUtil.getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_SHOW_HTML_FILES_LOCAL);
+          boolean showXMLFilesLocal = ProjectPrefUtil.getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_SHOW_XML_FILES_LOCAL);
           boolean isHTMLFileName = "html".equals(extension) || "htm".equals(extension) || "xhtml".equals(extension);
           boolean isXMLFileName = "xml".equals(extension) || "xsd".equals(extension) || "dtd".equals(extension);
 
index 6daa442..fd1cb21 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.actions;
 
index a3cc1bc..d5ad634 100644 (file)
@@ -4,7 +4,7 @@
  * the Common Public License v1.0 which accompanies this distribution, and is
  * available at http://www.eclipse.org/legal/cpl-v10.html
  * 
- * Contributors: Klaus Hartlage - www.eclipseproject.de
+ * Contributors: www.phpeclipse.de
  ******************************************************************************/
 package net.sourceforge.phpeclipse.actions;
 
index 43b848a..313e6de 100644 (file)
@@ -4,7 +4,7 @@
  * the Common Public License v1.0 which accompanies this distribution, and is
  * available at http://www.eclipse.org/legal/cpl-v10.html
  * 
- * Contributors: Klaus Hartlage - www.eclipseproject.de
+ * Contributors: www.phpeclipse.de
  ******************************************************************************/
 package net.sourceforge.phpeclipse.actions;
 
index 542faee..12aa5c6 100644 (file)
@@ -4,7 +4,7 @@
  * the Common Public License v1.0 which accompanies this distribution, and is
  * available at http://www.eclipse.org/legal/cpl-v10.html
  * 
- * Contributors: Klaus Hartlage - www.eclipseproject.de
+ * Contributors: www.phpeclipse.de
  ******************************************************************************/
 package net.sourceforge.phpeclipse.actions;
 
index 5e8ae1c..011993c 100644 (file)
@@ -4,7 +4,7 @@
  * the Common Public License v1.0 which accompanies this distribution, and is
  * available at http://www.eclipse.org/legal/cpl-v10.html
  * 
- * Contributors: Klaus Hartlage - www.eclipseproject.de
+ * Contributors: www.phpeclipse.de
  ******************************************************************************/
 package net.sourceforge.phpeclipse.actions;
 
@@ -17,7 +17,7 @@ import java.util.ArrayList;
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
 import net.sourceforge.phpeclipse.phpeditor.PHPEditor;
 import net.sourceforge.phpeclipse.ui.WebUI;
-import net.sourceforge.phpeclipse.ui.overlaypages.Util;
+import net.sourceforge.phpeclipse.ui.overlaypages.ProjectPrefUtil;
 
 import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
@@ -209,7 +209,7 @@ public class PHPOpenSQLTableEditorAction extends ActionDelegate implements
     // Get The Database bookmark from the Quantum SQL plugin:
     BookmarkCollection sqlBookMarks = BookmarkCollection.getInstance();
     if (sqlBookMarks != null) {
-      String bookmarkString = Util.getMiscProjectsPreferenceValue(project,
+      String bookmarkString = ProjectPrefUtil.getMiscProjectsPreferenceValue(project,
           WebUI.PHP_BOOKMARK_DEFAULT);
       if (bookmarkString != null && !bookmarkString.equals("")) {
         Bookmark bookmark = sqlBookMarks.find(bookmarkString);
index 833373f..dc350e7 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.actions;
 
index 5f9c54c..5d47f96 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
                IBM Corporation - Initial implementation
-               Klaus Hartlage - www.eclipseproject.de
+               www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.actions;
 
index 755f607..cc237ea 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.actions;
 
index 22e9d8f..e5b75e9 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.actions;
 
index a3be92d..87c7ee5 100644 (file)
@@ -17,7 +17,6 @@ import net.sourceforge.phpdt.internal.compiler.CompilationResult;
 import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
 import net.sourceforge.phpdt.internal.compiler.impl.ReferenceContext;
 import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.ImportBinding;
 import net.sourceforge.phpdt.internal.compiler.lookup.LocalTypeBinding;
 import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilationUnit;
 import net.sourceforge.phpdt.internal.compiler.problem.AbortMethod;
index 9794ce1..6bc82a1 100644 (file)
@@ -244,7 +244,7 @@ public class Expression extends Statement {
 //                     codeStream.recordPositionsFrom(pc, this.sourceStart);
 //             } else {
 //                     // actual non-constant code generation
-//                     throw new ShouldNotImplement(Util.bind("ast.missingCode")); //$NON-NLS-1$
+//                     throw new ShouldNotImplement(ProjectPrefUtil.bind("ast.missingCode")); //$NON-NLS-1$
 //             }
 //     }
 
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteralDQ.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteralDQ.java
new file mode 100644 (file)
index 0000000..793d57c
--- /dev/null
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.phpeclipse.internal.compiler.ast;
+
+/**
+ * 
+ * double quoted string literal
+ */
+public class StringLiteralDQ extends StringLiteral {
+
+  public StringLiteralDQ(char[] token, int s, int e) {
+    super(token, s, e);
+  }
+
+  public StringLiteralDQ(int s, int e) {
+    super(s, e);
+  }
+
+  public String toStringExpression() {
+
+    // handle some special char.....
+    StringBuffer result = new StringBuffer("\""); //$NON-NLS-1$
+    for (int i = 0; i < source.length; i++) {
+      switch (source[i]) {
+      case '\b':
+        result.append("\\b"); //$NON-NLS-1$
+        break;
+      case '\t':
+        result.append("\\t"); //$NON-NLS-1$
+        break;
+      case '\n':
+        result.append("\\n"); //$NON-NLS-1$
+        break;
+      case '\f':
+        result.append("\\f"); //$NON-NLS-1$
+        break;
+      case '\r':
+        result.append("\\r"); //$NON-NLS-1$
+        break;
+      case '\"':
+        result.append("\\\""); //$NON-NLS-1$
+        break;
+      case '\'':
+        result.append("\\'"); //$NON-NLS-1$
+        break;
+      case '\\': //take care not to display the escape as a potential real char
+        result.append("\\\\"); //$NON-NLS-1$
+        break;
+      default:
+        result.append(source[i]);
+      }
+    }
+    result.append("\""); //$NON-NLS-1$
+    return result.toString();
+  }
+
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteralSQ.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteralSQ.java
new file mode 100644 (file)
index 0000000..bc862a9
--- /dev/null
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.phpeclipse.internal.compiler.ast;
+
+/**
+ * 
+ * single quoted string literal
+ */
+public class StringLiteralSQ extends StringLiteral {
+  public StringLiteralSQ(char[] token, int s, int e) {
+    super(token, s, e);
+  }
+
+  public StringLiteralSQ(int s, int e) {
+
+    super(s, e);
+  }
+
+  public String toStringExpression() {
+
+    // handle some special char.....
+    StringBuffer result = new StringBuffer("\'"); //$NON-NLS-1$
+    for (int i = 0; i < source.length; i++) {
+      switch (source[i]) {
+      case '\b':
+        result.append("\\b"); //$NON-NLS-1$
+        break;
+      case '\t':
+        result.append("\\t"); //$NON-NLS-1$
+        break;
+      case '\n':
+        result.append("\\n"); //$NON-NLS-1$
+        break;
+      case '\f':
+        result.append("\\f"); //$NON-NLS-1$
+        break;
+      case '\r':
+        result.append("\\r"); //$NON-NLS-1$
+        break;
+      case '\"':
+        result.append("\\\""); //$NON-NLS-1$
+        break;
+      case '\'':
+        result.append("\\'"); //$NON-NLS-1$
+        break;
+      case '\\': //take care not to display the escape as a potential real char
+        result.append("\\\\"); //$NON-NLS-1$
+        break;
+      default:
+        result.append(source[i]);
+      }
+    }
+    result.append("\'"); //$NON-NLS-1$
+    return result.toString();
+  }
+
+}
\ No newline at end of file
index f932b4d..c485caf 100644 (file)
@@ -1,7 +1,7 @@
 package net.sourceforge.phpeclipse.obfuscator;
 
 /**
- * @author khartlage
+ * Object which holds an PHP identifier name (i.e. class, function, variable,...)
  *  
  */
 public class PHPIdentifier {
index 801d57b..552183e 100644 (file)
@@ -9,7 +9,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 
 import java.util.ArrayList;
index a707726..f79b536 100644 (file)
@@ -9,7 +9,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 
 import java.util.ArrayList;
index 01a510c..d5eeb74 100644 (file)
@@ -9,7 +9,7 @@ package net.sourceforge.phpeclipse.phpeditor;
 
  Contributors:
  IBM Corporation - Initial implementation
- Klaus Hartlage - www.eclipseproject.de
+ www.phpeclipse.de
  **********************************************************************/
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
index 4641ae5..4350d51 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor;
 
index 7eef9ca..02ca163 100644 (file)
@@ -9,7 +9,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 
 import java.io.BufferedInputStream;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPString.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPString.java
deleted file mode 100644 (file)
index 2c4ce70..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-package net.sourceforge.phpeclipse.phpeditor;
-
-/**
- * 
- * @author khartlage
- */
-public class PHPString {
-  private String phpString;
-  private int lineNumber;
-  
-  public PHPString(String phpString, int lineNumber) {
-    this.phpString = phpString;
-    this.lineNumber = lineNumber;
-  }
-  
-  public String getPHPString() {
-    return phpString;
-  }
-    
-  public int getLineNumber() {
-    return lineNumber;
-  }
-}
index 7ce2ef1..81b66fe 100644 (file)
@@ -7,7 +7,7 @@
 
  Contributors:
  IBM Corporation - Initial implementation
- Klaus Hartlage - www.eclipseproject.de
+ www.phpeclipse.de
  **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor;
 import java.io.FileReader;
index a88f3d3..56229b2 100644 (file)
@@ -105,8 +105,8 @@ import org.eclipse.ui.texteditor.TextOperationAction;
  * 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 implementation Klaus Hartlage -
- * www.eclipseproject.de
+ * Contributors: IBM Corporation - Initial implementation 
+ * www.phpeclipse.de
  ******************************************************************************/
 /**
  * PHP specific text editor.
index e3aef09..1cec0bd 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor;
 
index d3be107..5cc6fa6 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor.php;
 
index 685f2d8..91e1339 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor.php;
 
index e4e0b14..d1c86b4 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor.php;
 
index 3850ccf..042fe11 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor.php;
 
index 23212ba..452b3d3 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor.php;
 
index a4a2def..c8755e0 100644 (file)
@@ -45,7 +45,7 @@ import net.sourceforge.phpeclipse.builder.IdentifierIndexManager;
 import net.sourceforge.phpeclipse.phpeditor.PHPEditor;
 import net.sourceforge.phpeclipse.phpeditor.PHPSyntaxRdr;
 import net.sourceforge.phpeclipse.ui.IPreferenceConstants;
-import net.sourceforge.phpeclipse.ui.overlaypages.Util;
+import net.sourceforge.phpeclipse.ui.overlaypages.ProjectPrefUtil;
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
@@ -686,7 +686,7 @@ public class PHPCompletionProcessor implements IContentAssistProcessor {
     // Get The Database bookmark from the Quantum SQL plugin:
     BookmarkCollection sqlBookMarks = BookmarkCollection.getInstance();
     if (sqlBookMarks != null) {
-      String bookmarkString = Util.getMiscProjectsPreferenceValue(project, IPreferenceConstants.PHP_BOOKMARK_DEFAULT);
+      String bookmarkString = ProjectPrefUtil.getMiscProjectsPreferenceValue(project, IPreferenceConstants.PHP_BOOKMARK_DEFAULT);
       if (bookmarkString != null && !bookmarkString.equals("")) {
         Bookmark bookmark = sqlBookMarks.find(bookmarkString);
         ArrayList sqlList = new ArrayList();
index 52bff9c..e91ca82 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor.php;
 
index d45fffc..32d8095 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor.php;
 
index 4fd5ea3..4db149a 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor.php;
 
index bb74616..99b3235 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor.php;
 
index 6aada83..1e467e0 100644 (file)
@@ -9,7 +9,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 
 import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
index cf7f67b..24c25ee 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor.util;
 
index 1d2c944..32589f4 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor.util;
 
index eada1ba..6e049ca 100644 (file)
@@ -7,7 +7,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor.util;
 
index 9529dd2..2e98d5d 100644 (file)
@@ -9,7 +9,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 
 import java.io.BufferedReader;
index fac8bb8..c699b5e 100644 (file)
@@ -9,7 +9,7 @@ package net.sourceforge.phpeclipse.wizards;
 
  Contributors:
  IBM Corporation - Initial implementation
- Klaus Hartlage - www.eclipseproject.de
+ www.phpeclipse.de
  **********************************************************************/
 
 import java.io.ByteArrayInputStream;
index d8a5fd4..09b49a9 100644 (file)
@@ -9,7 +9,7 @@ package net.sourceforge.phpeclipse.wizards;
 
  Contributors:
  IBM Corporation - Initial implementation
- Klaus Hartlage - www.eclipseproject.de
+ www.phpeclipse.de
  **********************************************************************/
 
 import org.eclipse.core.resources.IContainer;
index 6e6b2da..971f3b6 100644 (file)
@@ -9,7 +9,7 @@ package net.sourceforge.phpeclipse.wizards;
 
  Contributors:
  IBM Corporation - Initial implementation
- Klaus Hartlage - www.eclipseproject.de
+ www.phpeclipse.de
  **********************************************************************/
 
 import java.io.ByteArrayInputStream;
index c84715c..d2d5d1e 100644 (file)
@@ -9,7 +9,7 @@ package net.sourceforge.phpeclipse.wizards;
 
  Contributors:
  IBM Corporation - Initial implementation
- Klaus Hartlage - www.eclipseproject.de
+ www.phpeclipse.de
  **********************************************************************/
 
 import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil;
index 3cbf8ed..5ef32d3 100644 (file)
@@ -9,7 +9,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 
 import java.util.MissingResourceException;