View | Details | Raw Unified | Return to bug 292087 | Differences between
and this patch

Collapse All | Expand All

(-)codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java (+19 lines)
Lines 4465-4470 Link Here
4465
	}
4465
	}
4466
	return false;
4466
	return false;
4467
}
4467
}
4468
protected boolean isInsideArrayInitializer(){
4469
	int i = this.elementPtr;
4470
	if (i > -1 && this.elementKindStack[i] == K_ARRAY_INITIALIZER) {
4471
		return true;
4472
	}
4473
	
4474
	return false;
4475
}
4468
public CompilationUnitDeclaration parse(ICompilationUnit sourceUnit, CompilationResult compilationResult, int cursorLoc) {
4476
public CompilationUnitDeclaration parse(ICompilationUnit sourceUnit, CompilationResult compilationResult, int cursorLoc) {
4469
4477
4470
	this.cursorLocation = cursorLoc;
4478
	this.cursorLocation = cursorLoc;
Lines 4620-4625 Link Here
4620
		if(oldElement != this.currentElement) {
4628
		if(oldElement != this.currentElement) {
4621
			popElement(K_LOCAL_INITIALIZER_DELIMITER);
4629
			popElement(K_LOCAL_INITIALIZER_DELIMITER);
4622
		}
4630
		}
4631
	} else if(this.currentElement != null && this.currentElement instanceof RecoveredField) {
4632
		// To make sure the array initializer is popped when the focus is shifted to the parent
4633
		// in case we're restarting recovery inside an array initializer
4634
		RecoveredElement oldElement = this.currentElement;
4635
		super.recoveryExitFromVariable();
4636
		if(oldElement != this.currentElement) {
4637
			if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_ARRAY_INITIALIZER) {
4638
				popElement(K_ARRAY_INITIALIZER);
4639
				popElement(K_FIELD_INITIALIZER_DELIMITER);
4640
			}
4641
		}
4623
	} else {
4642
	} else {
4624
		super.recoveryExitFromVariable();
4643
		super.recoveryExitFromVariable();
4625
	}
4644
	}
(-)codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java (-2 / +11 lines)
Lines 1241-1246 Link Here
1241
	}
1241
	}
1242
	return false;
1242
	return false;
1243
}
1243
}
1244
protected boolean isInsideArrayInitializer(){
1245
	return false;
1246
}
1244
protected int lastIndexOfElement(int kind) {
1247
protected int lastIndexOfElement(int kind) {
1245
	int i = this.elementPtr;
1248
	int i = this.elementPtr;
1246
	while(i > -1) {
1249
	while(i > -1) {
Lines 1638-1650 Link Here
1638
	// only look for headers
1641
	// only look for headers
1639
	if (this.referenceContext instanceof CompilationUnitDeclaration
1642
	if (this.referenceContext instanceof CompilationUnitDeclaration
1640
		|| this.assistNode != null){
1643
		|| this.assistNode != null){
1641
		if(isInsideMethod() &&
1644
		if((isInsideMethod() || isInsideArrayInitializer()) &&
1642
			isIndirectlyInsideFieldInitialization() &&
1645
			isIndirectlyInsideFieldInitialization() &&
1643
			this.assistNode == null
1646
			this.assistNode == null
1644
			){
1647
			){
1645
			prepareForBlockStatements();
1648
			prepareForBlockStatements();
1646
			goForBlockStatementsOrCatchHeader();
1649
			goForBlockStatementsOrCatchHeader();
1647
		} else {
1650
		} /*else if(isInsideArrayInitializer() &&
1651
				isIndirectlyInsideFieldInitialization() &&
1652
				this.assistNode == null
1653
				){
1654
				prepareForBlockStatements();
1655
				goForInitializer();
1656
		} */else {
1648
			prepareForHeaders();
1657
			prepareForHeaders();
1649
			goForHeaders();
1658
			goForHeaders();
1650
			this.diet = true; // passed this point, will not consider method bodies
1659
			this.diet = true; // passed this point, will not consider method bodies

Return to bug 292087