diff options
| author | ssankaran | 2014-02-04 12:33:38 +0000 |
|---|---|---|
| committer | ssankaran | 2014-02-04 12:33:38 +0000 |
| commit | 7dbc472feab6f8985cd72052d6eaace52c7ea562 (patch) | |
| tree | 82d6be679eb1da7596ff97947d22b7e5d000d510 | |
| parent | 696ed15a1e8614ddbc6d608510de2603ca6573e4 (diff) | |
| download | eclipse.jdt.core-7dbc472feab6f8985cd72052d6eaace52c7ea562.tar.gz eclipse.jdt.core-7dbc472feab6f8985cd72052d6eaace52c7ea562.tar.xz eclipse.jdt.core-7dbc472feab6f8985cd72052d6eaace52c7ea562.zip | |
2 files changed, 19 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java index 77284d2d9e..e21913933c 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java @@ -682,7 +682,7 @@ public final class CompletionEngine this.lookupEnvironment = new LookupEnvironment(this, this.compilerOptions, this.problemReporter, nameEnvironment); this.parser = - new CompletionParser(this.problemReporter, this.requestor.isExtendedContextRequired()); + new CompletionParser(this.problemReporter, this.requestor.isExtendedContextRequired(), monitor); this.owner = owner; this.monitor = monitor; } diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java index b1b435c2fa..54f20fa45a 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java @@ -28,6 +28,7 @@ package org.eclipse.jdt.internal.codeassist.complete; import java.util.HashSet; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jdt.internal.compiler.*; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.env.*; @@ -172,6 +173,8 @@ public class CompletionParser extends AssistParser { private boolean storeSourceEnds; public HashtableOfObjectToInt sourceEnds; private boolean inReferenceExpression; + private IProgressMonitor monitor; + private int resumeOnSyntaxError = 0; public CompletionParser(ProblemReporter problemReporter, boolean storeExtraSourceEnds) { super(problemReporter); @@ -183,6 +186,10 @@ public CompletionParser(ProblemReporter problemReporter, boolean storeExtraSourc this.sourceEnds = new HashtableOfObjectToInt(); } } +public CompletionParser(ProblemReporter problemReporter, boolean storeExtraSourceEnds, IProgressMonitor monitor) { + this(problemReporter, storeExtraSourceEnds); + this.monitor = monitor; +} private void addPotentialName(char[] potentialVariableName, int start, int end) { int length = this.potentialVariableNames.length; if (this.potentialVariableNamesPtr >= length - 1) { @@ -5018,6 +5025,17 @@ public void restoreAssistParser(Object parserState) { this.cursorLocation = state[0]; completionScanner.cursorLocation = state[1]; } +@Override +protected int resumeOnSyntaxError() { + if (this.monitor != null) { + if (++this.resumeOnSyntaxError > 100) { + this.resumeOnSyntaxError = 0; + if (this.monitor.isCanceled()) + return HALT; + } + } + return super.resumeOnSyntaxError(); +} /* * Reset context so as to resume to regular parse loop * If unable to reset for resuming, answers false. |
