Improved "Open Include" and "Open Include List" for external workspaces
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / SourceElementParser.java
index 21df17c..3ff7c78 100644 (file)
@@ -108,7 +108,9 @@ public class SourceElementParser extends CommentRecorderParser {//extends
     super(new ProblemReporter(DefaultErrorHandlingPolicies.exitAfterAllProblems(), options, problemFactory) {
       public void record(IProblem problem, CompilationResult unitResult, ReferenceContext referenceContext) {
         unitResult.record(problem, referenceContext);
-        requestor.acceptProblem(problem);
+        if (requestor!=null) {
+          requestor.acceptProblem(problem);
+        }
       }
     });
     // true);
@@ -1115,6 +1117,38 @@ public class SourceElementParser extends CommentRecorderParser {//extends
     return null;
   }
 
+  public CompilationUnitDeclaration parseCompletionUnit(ICompilationUnit unit, boolean fullParse) {
+
+    //         boolean old = diet;
+    //         if (fullParse) {
+    //                 unknownRefs = new NameReference[10];
+    //                 unknownRefsCounter = 0;
+    //         }
+
+    try {
+      //                       diet = true;
+      this.reportReferenceInfo = fullParse;
+      CompilationResult compilationUnitResult = new CompilationResult(unit, 0, 0, this.options.maxProblemsPerUnit);
+      CompilationUnitDeclaration parsedUnit = parse(unit, compilationUnitResult, false);
+//      if (scanner.recordLineSeparator) {
+//        requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
+//      }
+//      int initialStart = this.scanner.initialPosition;
+//      int initialEnd = this.scanner.eofPosition;
+//      //                     if (this.localDeclarationVisitor != null || fullParse){
+//      //                             diet = false;
+//      //                             this.getMethodBodies(parsedUnit);
+//      //                     }
+//      this.scanner.resetTo(initialStart, initialEnd);
+//      notifySourceElementRequestor(parsedUnit);
+      return parsedUnit;
+    } catch (AbortCompilation e) {
+      // ignore this exception
+    } finally {
+      //                       diet = old;
+    }
+    return null;
+  }
   //public void parseTypeMemberDeclarations(
   //   ISourceType sourceType,
   //   ICompilationUnit sourceUnit,