### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java,v retrieving revision 1.214 diff -u -r1.214 CompletionParser.java --- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 22 Apr 2010 12:56:48 -0000 1.214 +++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 5 May 2010 05:57:54 -0000 @@ -4465,6 +4465,14 @@ } return false; } +protected boolean isInsideArrayInitializer(){ + int i = this.elementPtr; + if (i > -1 && this.elementKindStack[i] == K_ARRAY_INITIALIZER) { + return true; + } + + return false; +} public CompilationUnitDeclaration parse(ICompilationUnit sourceUnit, CompilationResult compilationResult, int cursorLoc) { this.cursorLocation = cursorLoc; @@ -4620,6 +4628,17 @@ if(oldElement != this.currentElement) { popElement(K_LOCAL_INITIALIZER_DELIMITER); } + } else if(this.currentElement != null && this.currentElement instanceof RecoveredField) { + // To make sure the array initializer is popped when the focus is shifted to the parent + // in case we're restarting recovery inside an array initializer + RecoveredElement oldElement = this.currentElement; + super.recoveryExitFromVariable(); + if(oldElement != this.currentElement) { + if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_ARRAY_INITIALIZER) { + popElement(K_ARRAY_INITIALIZER); + popElement(K_FIELD_INITIALIZER_DELIMITER); + } + } } else { super.recoveryExitFromVariable(); } Index: codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java,v retrieving revision 1.91 diff -u -r1.91 AssistParser.java --- codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java 30 Mar 2010 06:36:00 -0000 1.91 +++ codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java 5 May 2010 05:58:02 -0000 @@ -1241,6 +1241,9 @@ } return false; } +protected boolean isInsideArrayInitializer(){ + return false; +} protected int lastIndexOfElement(int kind) { int i = this.elementPtr; while(i > -1) { @@ -1638,13 +1641,19 @@ // only look for headers if (this.referenceContext instanceof CompilationUnitDeclaration || this.assistNode != null){ - if(isInsideMethod() && + if((isInsideMethod() || isInsideArrayInitializer()) && isIndirectlyInsideFieldInitialization() && this.assistNode == null ){ prepareForBlockStatements(); goForBlockStatementsOrCatchHeader(); - } else { + } /*else if(isInsideArrayInitializer() && + isIndirectlyInsideFieldInitialization() && + this.assistNode == null + ){ + prepareForBlockStatements(); + goForInitializer(); + } */else { prepareForHeaders(); goForHeaders(); this.diet = true; // passed this point, will not consider method bodies