### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/CompletionTestsRequestor2.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTestsRequestor2.java,v retrieving revision 1.20 diff -u -r1.20 CompletionTestsRequestor2.java --- src/org/eclipse/jdt/core/tests/model/CompletionTestsRequestor2.java 12 Jan 2007 17:58:59 -0000 1.20 +++ src/org/eclipse/jdt/core/tests/model/CompletionTestsRequestor2.java 5 Feb 2007 09:34:54 -0000 @@ -71,8 +71,8 @@ } public void allowAllRequiredProposals() { - for (int i = CompletionProposal.ANONYMOUS_CLASS_DECLARATION; i <= CompletionProposal.TYPE_IMPORT; i++) { - for (int j = CompletionProposal.ANONYMOUS_CLASS_DECLARATION; j <= CompletionProposal.TYPE_IMPORT; j++) { + for (int i = CompletionProposal.ANONYMOUS_CLASS_DECLARATION; i <= CompletionProposal.ALLOCATION_TYPE_REF; i++) { + for (int j = CompletionProposal.ANONYMOUS_CLASS_DECLARATION; j <= CompletionProposal.ALLOCATION_TYPE_REF; j++) { this.setAllowsRequiredProposals(i, j, true); } } @@ -298,6 +298,9 @@ case CompletionProposal.TYPE_IMPORT : buffer.append("TYPE_IMPORT"); //$NON-NLS-1$ break; + case CompletionProposal.ALLOCATION_TYPE_REF : + buffer.append("ALLOCATION_TYPE_REF"); //$NON-NLS-1$ + break; default : buffer.append("PROPOSAL"); //$NON-NLS-1$ break; @@ -423,6 +426,7 @@ case CompletionProposal.TYPE_REF : case CompletionProposal.TYPE_IMPORT : case CompletionProposal.JAVADOC_TYPE_REF : + case CompletionProposal.ALLOCATION_TYPE_REF : return new String(Signature.getSignatureSimpleName(proposal.getSignature())); case CompletionProposal.FIELD_REF : case CompletionProposal.KEYWORD: Index: src/org/eclipse/jdt/core/tests/model/CompletionTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java,v retrieving revision 1.142 diff -u -r1.142 CompletionTests.java --- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 24 Jan 2007 16:27:41 -0000 1.142 +++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 5 Feb 2007 09:34:54 -0000 @@ -2678,7 +2678,9 @@ } else { assertResults( "CompletionEmptyTypeName1[TYPE_REF]{CompletionEmptyTypeName1, , LCompletionEmptyTypeName1;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}\n"+ - "A[TYPE_REF]{A, , LA;, null, null, " +(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", + "CompletionEmptyTypeName1[ALLOCATION_TYPE_REF]{CompletionEmptyTypeName1, , LCompletionEmptyTypeName1;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_ALLOCATION +R_NON_RESTRICTED)+"}\n"+ + "A[TYPE_REF]{A, , LA;, null, null, " +(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ + "A[ALLOCATION_TYPE_REF]{A, , LA;, null, null, " +(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_ALLOCATION + R_NON_RESTRICTED)+"}", requestor.getResults()); } } @@ -2862,12 +2864,15 @@ requestor.getContext()); if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { assertResults( - "AType[TYPE_REF]{AType, test, Ltest.AType;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", + "AType[TYPE_REF]{AType, test, Ltest.AType;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + + "AType[ALLOCATION_TYPE_REF]{AType, test, Ltest.AType;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_ALLOCATION + R_NON_RESTRICTED) + "}", requestor.getResults()); } else { assertResults( "Test[TYPE_REF]{Test, test, Ltest.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "AType[TYPE_REF]{AType, test, Ltest.AType;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", + "Test[ALLOCATION_TYPE_REF]{Test, test, Ltest.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_ALLOCATION + R_NON_RESTRICTED) + "}\n" + + "AType[TYPE_REF]{AType, test, Ltest.AType;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + + "AType[ALLOCATION_TYPE_REF]{AType, test, Ltest.AType;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_ALLOCATION + R_NON_RESTRICTED) + "}", requestor.getResults()); } } finally { @@ -2964,12 +2969,15 @@ if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { assertResults( - "AInterface[TYPE_REF]{AInterface, test, Ltest.AInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", + "AInterface[TYPE_REF]{AInterface, test, Ltest.AInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + + "AInterface[ALLOCATION_TYPE_REF]{AInterface, test, Ltest.AInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_ALLOCATION + R_NON_RESTRICTED) + "}", requestor.getResults()); } else { assertResults( "Test[TYPE_REF]{Test, test, Ltest.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "AInterface[TYPE_REF]{AInterface, test, Ltest.AInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", + "Test[ALLOCATION_TYPE_REF]{Test, test, Ltest.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_ALLOCATION + R_NON_RESTRICTED) + "}\n" + + "AInterface[TYPE_REF]{AInterface, test, Ltest.AInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + + "AInterface[ALLOCATION_TYPE_REF]{AInterface, test, Ltest.AInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_ALLOCATION + R_NON_RESTRICTED) + "}", requestor.getResults()); } } finally { @@ -3090,8 +3098,12 @@ assertResults( "ABC[TYPE_REF]{p1.ABC, p1, Lp1.ABC;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + "ABC[TYPE_REF]{p2.ABC, p2, Lp2.ABC;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + + "ABC[ALLOCATION_TYPE_REF]{p1.ABC, p1, Lp1.ABC;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_ALLOCATION + R_NON_RESTRICTED)+"}\n" + + "ABC[ALLOCATION_TYPE_REF]{p2.ABC, p2, Lp2.ABC;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_ALLOCATION + R_NON_RESTRICTED)+"}\n" + "A3[TYPE_REF]{A3, , LA3;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + - "A[TYPE_REF]{A, , LA;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", + "A3[ALLOCATION_TYPE_REF]{A3, , LA3;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_ALLOCATION + R_NON_RESTRICTED)+"}\n" + + "A[TYPE_REF]{A, , LA;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + + "A[ALLOCATION_TYPE_REF]{A, , LA;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_ALLOCATION + R_NON_RESTRICTED)+"}", requestor.getResults()); } @@ -9581,7 +9593,8 @@ this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); assertResults( - "CompletionMemberType.Y[TYPE_REF]{Y, , LCompletionMemberType$Y;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_EXACT_NAME+ R_UNQUALIFIED + R_NON_RESTRICTED)+"}", + "CompletionMemberType.Y[TYPE_REF]{Y, , LCompletionMemberType$Y;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_EXACT_NAME+ R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ + "CompletionMemberType.Y[ALLOCATION_TYPE_REF]{Y, , LCompletionMemberType$Y;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_EXACT_NAME+ R_UNQUALIFIED + R_ALLOCATION + R_NON_RESTRICTED)+"}", requestor.getResults()); } public void testCompletionMemberType2() throws JavaModelException { @@ -9609,7 +9622,9 @@ } else { assertResults( "CompletionMemberType2[TYPE_REF]{CompletionMemberType2, test, Ltest.CompletionMemberType2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "CompletionMemberType2.MemberException[TYPE_REF]{MemberException, test, Ltest.CompletionMemberType2$MemberException;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION+ R_NON_RESTRICTED)+"}", + "CompletionMemberType2[ALLOCATION_TYPE_REF]{CompletionMemberType2, test, Ltest.CompletionMemberType2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + +R_ALLOCATION + R_NON_RESTRICTED)+"}\n"+ + "CompletionMemberType2.MemberException[TYPE_REF]{MemberException, test, Ltest.CompletionMemberType2$MemberException;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION+ R_NON_RESTRICTED)+"}\n"+ + "CompletionMemberType2.MemberException[ALLOCATION_TYPE_REF]{MemberException, test, Ltest.CompletionMemberType2$MemberException;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION+ R_ALLOCATION + R_NON_RESTRICTED)+"}", requestor.getResults()); } } @@ -9632,7 +9647,8 @@ this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); assertResults( - "CompletionMemberType3.MemberException[TYPE_REF]{MemberException, test, Ltest.CompletionMemberType3$MemberException;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION+ R_UNQUALIFIED + R_NON_RESTRICTED) +"}", + "CompletionMemberType3.MemberException[TYPE_REF]{MemberException, test, Ltest.CompletionMemberType3$MemberException;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION+ R_UNQUALIFIED + R_NON_RESTRICTED) +"}\n"+ + "CompletionMemberType3.MemberException[ALLOCATION_TYPE_REF]{MemberException, test, Ltest.CompletionMemberType3$MemberException;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION+ R_UNQUALIFIED + R_ALLOCATION + R_NON_RESTRICTED) +"}", requestor.getResults()); } public void testCompletionMessageSendIsParent1() throws JavaModelException { @@ -10404,12 +10420,15 @@ if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { assertResults( - "PX[TYPE_REF]{pack2.PX, pack2, Lpack2.PX;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED)+ "}", + "PX[TYPE_REF]{pack2.PX, pack2, Lpack2.PX;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED)+"}\n" + + "PX[ALLOCATION_TYPE_REF]{pack2.PX, pack2, Lpack2.PX;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE+ R_ALLOCATION + R_NON_RESTRICTED)+ "}", requestor.getResults()); } else { assertResults( "CompletionQualifiedExpectedType[TYPE_REF]{CompletionQualifiedExpectedType, test, Ltest.CompletionQualifiedExpectedType;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + - "PX[TYPE_REF]{pack2.PX, pack2, Lpack2.PX;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED)+ "}", + "CompletionQualifiedExpectedType[ALLOCATION_TYPE_REF]{CompletionQualifiedExpectedType, test, Ltest.CompletionQualifiedExpectedType;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_ALLOCATION + R_NON_RESTRICTED)+"}\n" + + "PX[TYPE_REF]{pack2.PX, pack2, Lpack2.PX;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED)+"}\n" + + "PX[ALLOCATION_TYPE_REF]{pack2.PX, pack2, Lpack2.PX;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE+ R_ALLOCATION + R_NON_RESTRICTED)+ "}", requestor.getResults()); } } Index: src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java,v retrieving revision 1.81 diff -u -r1.81 CompletionTests_1_5.java --- src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 19 Jan 2007 17:06:24 -0000 1.81 +++ src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 5 Feb 2007 09:34:56 -0000 @@ -7595,7 +7595,8 @@ result.proposals); } else { assertResults( - "Test[TYPE_REF]{Test, test0232, Ltest0232.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", + "Test[TYPE_REF]{Test, test0232, Ltest0232.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n"+ + "Test[ALLOCATION_TYPE_REF]{Test, test0232, Ltest0232.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_ALLOCATION + R_NON_RESTRICTED) + "}", result.proposals); } } @@ -7621,7 +7622,8 @@ result.context); assertResults( - "Test0233Z[TYPE_REF]{Test0233Z, test0233, Ltest0233.Test0233Z;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_UNQUALIFIED + R_NON_RESTRICTED) + "}", + "Test0233Z[TYPE_REF]{Test0233Z, test0233, Ltest0233.Test0233Z;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n"+ + "Test0233Z[ALLOCATION_TYPE_REF]{Test0233Z, test0233, Ltest0233.Test0233Z;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_UNQUALIFIED + R_ALLOCATION + R_NON_RESTRICTED) + "}", result.proposals); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97860 #P org.eclipse.jdt.core Index: codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java,v retrieving revision 1.30 diff -u -r1.30 RelevanceConstants.java --- codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java 19 Oct 2006 13:47:37 -0000 1.30 +++ codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java 5 Feb 2007 09:35:00 -0000 @@ -41,4 +41,5 @@ int R_VALUE_TAG = 31; int R_NON_INHERITED = 2; int R_NO_PROBLEMS = 1; + int R_ALLOCATION = 1; } Index: codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java,v retrieving revision 1.316 diff -u -r1.316 CompletionEngine.java --- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 26 Jan 2007 10:41:27 -0000 1.316 +++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 5 Feb 2007 09:35:00 -0000 @@ -6322,7 +6322,8 @@ boolean proposeType = !this.requestor.isIgnored(CompletionProposal.TYPE_REF) || - !this.requestor.isIgnored(CompletionProposal.JAVADOC_TYPE_REF); + !this.requestor.isIgnored(CompletionProposal.JAVADOC_TYPE_REF) || + !this.requestor.isIgnored(CompletionProposal.ALLOCATION_TYPE_REF); boolean proposeAllMemberTypes = !this.assistNodeIsConstructor; @@ -6514,6 +6515,22 @@ this.printDebug(proposal); } } + if(this.assistNodeIsConstructor && !this.requestor.isIgnored(CompletionProposal.ALLOCATION_TYPE_REF)) { + CompletionProposal proposal = this.createProposal(CompletionProposal.ALLOCATION_TYPE_REF, this.actualCompletionPosition); + proposal.setDeclarationSignature(packageName); + proposal.setSignature(getSignature(refBinding)); + proposal.setPackageName(packageName); + proposal.setTypeName(typeName); + proposal.setCompletion(completionName); + proposal.setFlags(refBinding.modifiers); + proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); + proposal.setRelevance(relevance+R_ALLOCATION); + proposal.setAccessibility(accessibility); + this.requestor.accept(proposal); + if(DEBUG) { + this.printDebug(proposal); + } + } } } } @@ -6566,7 +6583,8 @@ boolean proposeType = !this.requestor.isIgnored(CompletionProposal.TYPE_REF) || - !this.requestor.isIgnored(CompletionProposal.JAVADOC_TYPE_REF); + !this.requestor.isIgnored(CompletionProposal.JAVADOC_TYPE_REF) || + !this.requestor.isIgnored(CompletionProposal.ALLOCATION_TYPE_REF); char[] qualifiedName = CharOperation.concatWith(packageBinding.compoundName, token, '.'); @@ -6754,6 +6772,21 @@ this.printDebug(proposal); } } + if(this.assistNodeIsConstructor && !this.requestor.isIgnored(CompletionProposal.ALLOCATION_TYPE_REF)) { + CompletionProposal proposal = this.createProposal(CompletionProposal.ALLOCATION_TYPE_REF, this.actualCompletionPosition); + proposal.setDeclarationSignature(typeBinding.qualifiedPackageName()); + proposal.setSignature(getSignature(typeBinding)); + proposal.setPackageName(typeBinding.qualifiedPackageName()); + proposal.setTypeName(typeBinding.qualifiedSourceName()); + proposal.setCompletion(typeBinding.sourceName()); + proposal.setFlags(typeBinding.modifiers); + proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); + proposal.setRelevance(relevance); + this.requestor.accept(proposal); + if(DEBUG) { + this.printDebug(proposal); + } + } } } } @@ -8192,6 +8225,26 @@ } } + // Create a allocation type reference proposal if necessary + if(this.assistNodeIsConstructor && !this.requestor.isIgnored(CompletionProposal.ALLOCATION_TYPE_REF)) { + CompletionProposal proposal = CompletionProposal.create(CompletionProposal.ALLOCATION_TYPE_REF, this.actualCompletionPosition - this.offset); + proposal.nameLookup = this.nameEnvironment.nameLookup; + proposal.completionEngine = this; + proposal.setDeclarationSignature(packageName); + proposal.setSignature(createNonGenericTypeSignature(packageName, typeName)); + proposal.setPackageName(packageName); + proposal.setTypeName(typeName); + proposal.setCompletion(completionName); + proposal.setFlags(modifiers); + proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); + proposal.setRelevance(relevance+R_ALLOCATION); + proposal.setAccessibility(accessibility); + this.requestor.accept(proposal); + if(DEBUG) { + this.printDebug(proposal); + } + } + // Create javadoc text proposal if necessary if ((this.assistNodeInJavadoc & CompletionOnJavadoc.TEXT) != 0 && !this.requestor.isIgnored(CompletionProposal.JAVADOC_TYPE_REF)) { char[] javadocCompletion= inlineTagCompletion(completionName, JavadocTagConstants.TAG_LINK); @@ -8239,6 +8292,25 @@ } } + // Create a allocation type reference proposal if necessary + if(this.assistNodeIsConstructor && !this.requestor.isIgnored(CompletionProposal.ALLOCATION_TYPE_REF)) { + CompletionProposal proposal = CompletionProposal.create(CompletionProposal.ALLOCATION_TYPE_REF, this.actualCompletionPosition - this.offset); + proposal.nameLookup = this.nameEnvironment.nameLookup; + proposal.completionEngine = this; + proposal.setDeclarationSignature(refBinding.qualifiedPackageName()); + proposal.setSignature(getSignature(refBinding)); + proposal.setPackageName(refBinding.qualifiedPackageName()); + proposal.setTypeName(typeName); + proposal.setCompletion(completionName); + proposal.setFlags(refBinding.modifiers); + proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); + proposal.setRelevance(relevance+R_ALLOCATION); + this.requestor.accept(proposal); + if(DEBUG) { + this.printDebug(proposal); + } + } + // Create javadoc text proposal if necessary if ((this.assistNodeInJavadoc & CompletionOnJavadoc.TEXT) != 0 && !this.requestor.isIgnored(CompletionProposal.JAVADOC_TYPE_REF)) { char[] javadocCompletion= inlineTagCompletion(completionName, JavadocTagConstants.TAG_LINK); @@ -8395,6 +8467,9 @@ case CompletionProposal.TYPE_IMPORT : buffer.append("TYPE_IMPORT"); //$NON-NLS-1$ break; + case CompletionProposal.ALLOCATION_TYPE_REF : + buffer.append("ALLOCATION_TYPE_REF"); //$NON-NLS-1$ + break; default : buffer.append("PROPOSAL"); //$NON-NLS-1$ break; Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java,v retrieving revision 1.60 diff -u -r1.60 CodeSnippetToCuMapper.java --- eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java 7 Dec 2006 14:50:04 -0000 1.60 +++ eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java 5 Feb 2007 09:35:00 -0000 @@ -155,6 +155,7 @@ public void accept(CompletionProposal proposal) { switch(proposal.getKind()) { case CompletionProposal.TYPE_REF: + case CompletionProposal.ALLOCATION_TYPE_REF: int flags = proposal.getFlags(); if((flags & Flags.AccEnum) == 0 && (flags & Flags.AccInterface) == 0) { Index: model/org/eclipse/jdt/core/CompletionProposal.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CompletionProposal.java,v retrieving revision 1.38 diff -u -r1.38 CompletionProposal.java --- model/org/eclipse/jdt/core/CompletionProposal.java 26 Jan 2007 10:41:27 -0000 1.38 +++ model/org/eclipse/jdt/core/CompletionProposal.java 5 Feb 2007 09:35:00 -0000 @@ -725,6 +725,8 @@ */ public static final int TYPE_IMPORT = 23; + public static final int ALLOCATION_TYPE_REF = 24; + /** * First valid completion kind. * @@ -737,7 +739,7 @@ * * @since 3.1 */ - protected static final int LAST_KIND = TYPE_IMPORT; + protected static final int LAST_KIND = ALLOCATION_TYPE_REF; /** * Kind of completion request. @@ -2026,6 +2028,9 @@ case CompletionProposal.TYPE_IMPORT : buffer.append("TYPE_IMPORT"); //$NON-NLS-1$ break; + case CompletionProposal.ALLOCATION_TYPE_REF : + buffer.append("ALLOCATION_TYPE_REF"); //$NON-NLS-1$ + break; default : buffer.append("PROPOSAL"); //$NON-NLS-1$ break;