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

Collapse All | Expand All

(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (-6 / +6 lines)
Lines 2935-2942 Link Here
2935
			(CompletionOnQualifiedNameReference) astNode;
2935
			(CompletionOnQualifiedNameReference) astNode;
2936
		this.completionToken = ref.completionIdentifier;
2936
		this.completionToken = ref.completionIdentifier;
2937
		long completionPosition = ref.sourcePositions[ref.sourcePositions.length - 1];
2937
		long completionPosition = ref.sourcePositions[ref.sourcePositions.length - 1];
2938
		this.assistNodeIsInsideCase = assistNodeIsInsideCase(astNode, this.parser.assistNodeParent);
2938
		
2939
2940
		if (qualifiedBinding.problemId() == ProblemReasons.NotFound) {
2939
		if (qualifiedBinding.problemId() == ProblemReasons.NotFound) {
2941
			setSourceAndTokenRange((int) (completionPosition >>> 32), (int) completionPosition);
2940
			setSourceAndTokenRange((int) (completionPosition >>> 32), (int) completionPosition);
2942
			// complete field members with missing fields type
2941
			// complete field members with missing fields type
Lines 3080-3086 Link Here
3080
		this.assistNodeIsSuperType = ref.isSuperType();
3079
		this.assistNodeIsSuperType = ref.isSuperType();
3081
		this.assistNodeIsExtendedType = assistNodeIsExtendedType(astNode, astNodeParent);
3080
		this.assistNodeIsExtendedType = assistNodeIsExtendedType(astNode, astNodeParent);
3082
		this.assistNodeIsInterfaceExcludingAnnotation = assistNodeIsInterfaceExcludingAnnotation(astNode, astNodeParent);
3081
		this.assistNodeIsInterfaceExcludingAnnotation = assistNodeIsInterfaceExcludingAnnotation(astNode, astNodeParent);
3083
		this.assistNodeIsInsideCase = assistNodeIsInsideCase(astNode, astNodeParent);
3084
		
3082
		
3085
		this.completionToken = ref.completionIdentifier;
3083
		this.completionToken = ref.completionIdentifier;
3086
		long completionPosition = ref.sourcePositions[ref.tokens.length];
3084
		long completionPosition = ref.sourcePositions[ref.tokens.length];
Lines 3141-3147 Link Here
3141
		CompletionOnSingleNameReference singleNameReference = (CompletionOnSingleNameReference) astNode;
3139
		CompletionOnSingleNameReference singleNameReference = (CompletionOnSingleNameReference) astNode;
3142
		this.completionToken = singleNameReference.token;
3140
		this.completionToken = singleNameReference.token;
3143
		SwitchStatement switchStatement = astNodeParent instanceof SwitchStatement ? (SwitchStatement) astNodeParent : null;
3141
		SwitchStatement switchStatement = astNodeParent instanceof SwitchStatement ? (SwitchStatement) astNodeParent : null;
3144
		this.assistNodeIsInsideCase = assistNodeIsInsideCase(astNode, astNodeParent);
3145
		if (switchStatement != null
3142
		if (switchStatement != null
3146
				&& switchStatement.expression.resolvedType != null
3143
				&& switchStatement.expression.resolvedType != null
3147
				&& switchStatement.expression.resolvedType.isEnum()) {
3144
				&& switchStatement.expression.resolvedType.isEnum()) {
Lines 3217-3223 Link Here
3217
		this.assistNodeIsSuperType = singleRef.isSuperType();
3214
		this.assistNodeIsSuperType = singleRef.isSuperType();
3218
		this.assistNodeIsExtendedType = assistNodeIsExtendedType(astNode, astNodeParent);
3215
		this.assistNodeIsExtendedType = assistNodeIsExtendedType(astNode, astNodeParent);
3219
		this.assistNodeIsInterfaceExcludingAnnotation = assistNodeIsInterfaceExcludingAnnotation(astNode, astNodeParent);
3216
		this.assistNodeIsInterfaceExcludingAnnotation = assistNodeIsInterfaceExcludingAnnotation(astNode, astNodeParent);
3220
		this.assistNodeIsInsideCase = assistNodeIsInsideCase(astNode, astNodeParent);
3221
		
3217
		
3222
		// can be the start of a qualified type name
3218
		// can be the start of a qualified type name
3223
		if (qualifiedBinding == null) {
3219
		if (qualifiedBinding == null) {
Lines 3664-3669 Link Here
3664
			}
3660
			}
3665
		} else if (parent instanceof SwitchStatement) {
3661
		} else if (parent instanceof SwitchStatement) {
3666
			SwitchStatement switchStatement = (SwitchStatement) parent;
3662
			SwitchStatement switchStatement = (SwitchStatement) parent;
3663
			this.assistNodeIsInsideCase = assistNodeIsInsideCase(node, parent);
3667
			if (switchStatement.expression != null &&
3664
			if (switchStatement.expression != null &&
3668
					switchStatement.expression.resolvedType != null) {
3665
					switchStatement.expression.resolvedType != null) {
3669
				addExpectedType(switchStatement.expression.resolvedType, scope);
3666
				addExpectedType(switchStatement.expression.resolvedType, scope);
Lines 9727-9732 Link Here
9727
		if (selector == null && notInJavadoc) {
9724
		if (selector == null && notInJavadoc) {
9728
			return;
9725
			return;
9729
		}
9726
		}
9727
		
9728
		if (this.assistNodeIsInsideCase)
9729
			return;		// no methods should be proposed inside case expression
9730
9730
9731
		ReferenceBinding currentType = receiverType;
9731
		ReferenceBinding currentType = receiverType;
9732
		if (notInJavadoc) {
9732
		if (notInJavadoc) {
Lines 11555-11561 Link Here
11555
									-1,
11555
									-1,
11556
									-1);
11556
									-1);
11557
							}
11557
							}
11558
							if(proposeMethod && !insideAnnotationAttribute && !this.assistNodeIsInsideCase) {
11558
							if(proposeMethod && !insideAnnotationAttribute) {
11559
								findMethods(
11559
								findMethods(
11560
									token,
11560
									token,
11561
									null,
11561
									null,
(-)src/org/eclipse/jdt/core/tests/model/CompletionTests.java (+1 lines)
Lines 23026-23031 Link Here
23026
		"	public static final int[] ZZZ5 = null;\n" +
23026
		"	public static final int[] ZZZ5 = null;\n" +
23027
		"	public static final Object[] ZZZ6 = null;\n" +
23027
		"	public static final Object[] ZZZ6 = null;\n" +
23028
		"	public static final short ZZZ7 = 0;\n" +
23028
		"	public static final short ZZZ7 = 0;\n" +
23029
		"	public static int ZZZMethod(){ return 1;}\n" +
23029
		"	int ZZZ8(){return 1;}\n" +
23030
		"	int ZZZ8(){return 1;}\n" +
23030
		"	void foo(int i){\n" +
23031
		"	void foo(int i){\n" +
23031
		"		final int ZZZ01 = 1;\n" +
23032
		"		final int ZZZ01 = 1;\n" +

Return to bug 343342