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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java (-14 / +32 lines)
Lines 1997-2003 Link Here
1997
				"	public static void ZZZ2(int i) {}\n"+
1997
				"	public static void ZZZ2(int i) {}\n"+
1998
				"}");
1998
				"}");
1999
		
1999
		
2000
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2000
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true);
2001
		ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test0072", "Test.java");
2001
		ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test0072", "Test.java");
2002
	
2002
	
2003
		String str = cu.getSource();
2003
		String str = cu.getSource();
Lines 2005-2014 Link Here
2005
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2005
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2006
		cu.codeComplete(cursorLocation, requestor, this.wcOwner);
2006
		cu.codeComplete(cursorLocation, requestor, this.wcOwner);
2007
	
2007
	
2008
		int end1 = cursorLocation;
2009
		int start1 = end1 - "ZZ".length();
2010
		
2011
		int end2 = cursorLocation;
2012
		int start2 = end2 - "test0072.p.ImportedClass.ZZ".length();
2013
		
2008
		assertResults(
2014
		assertResults(
2009
				"ZZZ1[FIELD_REF]{test0072.p.ImportedClass.ZZZ1;, Ltest0072.p.ImportedClass;, I, ZZZ1, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
2015
				"ZZZ1[FIELD_REF]{ZZZ1;, Ltest0072.p.ImportedClass;, I, ZZZ1, null, ["+start1+", "+end1+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
2010
				"ZZZ2[METHOD_IMPORT]{test0072.p.ImportedClass.ZZZ2;, Ltest0072.p.ImportedClass;, ()V, ZZZ2, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
2016
				"ZZZ2[METHOD_IMPORT]{test0072.p.ImportedClass.ZZZ2;, Ltest0072.p.ImportedClass;, ()V, ZZZ2, null, ["+start2+", "+end2+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
2011
				"ZZZ2[METHOD_IMPORT]{test0072.p.ImportedClass.ZZZ2;, Ltest0072.p.ImportedClass;, (I)V, ZZZ2, (i), " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
2017
				"ZZZ2[METHOD_IMPORT]{test0072.p.ImportedClass.ZZZ2;, Ltest0072.p.ImportedClass;, (I)V, ZZZ2, (i), ["+start2+", "+end2+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
2012
				requestor.getResults());
2018
				requestor.getResults());
2013
	} finally {
2019
	} finally {
2014
		if(importedClass != null) {
2020
		if(importedClass != null) {
Lines 2034-2040 Link Here
2034
				"	}\n"+
2040
				"	}\n"+
2035
				"}");
2041
				"}");
2036
		
2042
		
2037
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2043
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true);
2038
		ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test0073", "Test.java");
2044
		ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test0073", "Test.java");
2039
	
2045
	
2040
		String str = cu.getSource();
2046
		String str = cu.getSource();
Lines 2042-2051 Link Here
2042
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2048
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2043
		cu.codeComplete(cursorLocation, requestor, this.wcOwner);
2049
		cu.codeComplete(cursorLocation, requestor, this.wcOwner);
2044
	
2050
	
2051
		int end1 = cursorLocation;
2052
		int start1 = end1 - "ZZ".length();
2053
		
2054
		int end2 = cursorLocation;
2055
		int start2 = end2 - "test0073.p.ImportedClass.Inner.ZZ".length();
2056
		
2045
		assertResults(
2057
		assertResults(
2046
				"ZZZ1[FIELD_REF]{test0073.p.ImportedClass.Inner.ZZZ1;, Ltest0073.p.ImportedClass$Inner;, I, ZZZ1, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
2058
				"ZZZ1[FIELD_REF]{ZZZ1;, Ltest0073.p.ImportedClass$Inner;, I, ZZZ1, null, ["+start1+", "+end1+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
2047
				"ZZZ2[METHOD_IMPORT]{test0073.p.ImportedClass.Inner.ZZZ2;, Ltest0073.p.ImportedClass$Inner;, ()V, ZZZ2, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
2059
				"ZZZ2[METHOD_IMPORT]{test0073.p.ImportedClass.Inner.ZZZ2;, Ltest0073.p.ImportedClass$Inner;, ()V, ZZZ2, null, ["+start2+", "+end2+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
2048
				"ZZZ2[METHOD_IMPORT]{test0073.p.ImportedClass.Inner.ZZZ2;, Ltest0073.p.ImportedClass$Inner;, (I)V, ZZZ2, (i), " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
2060
				"ZZZ2[METHOD_IMPORT]{test0073.p.ImportedClass.Inner.ZZZ2;, Ltest0073.p.ImportedClass$Inner;, (I)V, ZZZ2, (i), ["+start2+", "+end2+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
2049
				requestor.getResults());
2061
				requestor.getResults());
2050
	} finally {
2062
	} finally {
2051
		if(importedClass != null) {
2063
		if(importedClass != null) {
Lines 2071-2077 Link Here
2071
				"	}\n"+
2083
				"	}\n"+
2072
				"}");
2084
				"}");
2073
		
2085
		
2074
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2086
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true);
2075
		ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test0074", "Test.java");
2087
		ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test0074", "Test.java");
2076
	
2088
	
2077
		String str = cu.getSource();
2089
		String str = cu.getSource();
Lines 2079-2088 Link Here
2079
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2091
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2080
		cu.codeComplete(cursorLocation, requestor, this.wcOwner);
2092
		cu.codeComplete(cursorLocation, requestor, this.wcOwner);
2081
	
2093
	
2094
		int end1 = cursorLocation;
2095
		int start1 = end1 - "ZZ".length();
2096
		
2097
		int end2 = cursorLocation;
2098
		int start2 = end2 - "test0074.p.ImportedClass.Inner.ZZ".length();
2099
		
2082
		assertResults(
2100
		assertResults(
2083
				"ZZZ1[FIELD_REF]{test0074.p.ImportedClass.Inner.ZZZ1;, Ltest0074.p.ImportedClass$Inner;, I, ZZZ1, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
2101
				"ZZZ1[FIELD_REF]{ZZZ1;, Ltest0074.p.ImportedClass$Inner;, I, ZZZ1, null, ["+start1+", "+end1+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
2084
				"ZZZ2[METHOD_IMPORT]{test0074.p.ImportedClass.Inner.ZZZ2;, Ltest0074.p.ImportedClass$Inner;, ()V, ZZZ2, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
2102
				"ZZZ2[METHOD_IMPORT]{test0074.p.ImportedClass.Inner.ZZZ2;, Ltest0074.p.ImportedClass$Inner;, ()V, ZZZ2, null, ["+start2+", "+end2+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
2085
				"ZZZ2[METHOD_IMPORT]{test0074.p.ImportedClass.Inner.ZZZ2;, Ltest0074.p.ImportedClass$Inner;, (I)V, ZZZ2, (i), " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
2103
				"ZZZ2[METHOD_IMPORT]{test0074.p.ImportedClass.Inner.ZZZ2;, Ltest0074.p.ImportedClass$Inner;, (I)V, ZZZ2, (i), ["+start2+", "+end2+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
2086
				requestor.getResults());
2104
				requestor.getResults());
2087
	} finally {
2105
	} finally {
2088
		if(importedClass != null) {
2106
		if(importedClass != null) {
Lines 7373-7382 Link Here
7373
	            result.context);
7391
	            result.context);
7374
	
7392
	
7375
	    int end = result.cursorLocation;
7393
	    int end = result.cursorLocation;
7376
		int start = end - "test0223.AType.va".length();
7394
		int start = end - "va".length();
7377
		
7395
		
7378
		assertResults(
7396
		assertResults(
7379
				"VAR[FIELD_REF]{test0223.AType.VAR;, Ltest0223.AType;, I, VAR, null, ["+start+", "+end+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_NON_RESTRICTED) + "}",
7397
				"VAR[FIELD_REF]{VAR;, Ltest0223.AType;, I, VAR, null, ["+start+", "+end+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_NON_RESTRICTED) + "}",
7380
				result.proposals);
7398
				result.proposals);
7381
	} finally {
7399
	} finally {
7382
		if(paramClass1 != null) {
7400
		if(paramClass1 != null) {
(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (-8 / +4 lines)
Lines 2028-2034 Link Here
2028
											}
2028
											}
2029
											if(importReference.isStatic()) {
2029
											if(importReference.isStatic()) {
2030
												if(!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) {
2030
												if(!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) {
2031
													long positions = importReference.sourcePositions[importReference.sourcePositions.length - 1];
2032
													setSourceRange((int) (positions >>> 32), (int) positions);
2031
													this.findImportsOfStaticFields(lastToken, ref);
2033
													this.findImportsOfStaticFields(lastToken, ref);
2034
													setSourceRange(importReference.sourceStart, importReference.declarationSourceEnd);
2032
												}
2035
												}
2033
												if(!this.requestor.isIgnored(CompletionProposal.METHOD_NAME_REFERENCE)) {
2036
												if(!this.requestor.isIgnored(CompletionProposal.METHOD_NAME_REFERENCE)) {
2034
													this.findImportsOfStaticMethods(lastToken, ref);
2037
													this.findImportsOfStaticMethods(lastToken, ref);
Lines 3939-3952 Link Here
3939
				&& !field.canBeSeenBy(this.unitScope.fPackage))
3942
				&& !field.canBeSeenBy(this.unitScope.fPackage))
3940
				continue next;
3943
				continue next;
3941
			
3944
			
3942
			char[] completionName = CharOperation.concat(
3945
			char[] completionName = CharOperation.concat(field.name, SEMICOLON);
3943
					field.declaringClass.qualifiedPackageName(),
3944
					'.',
3945
					field.declaringClass.qualifiedSourceName(),
3946
					'.',
3947
					field.name);
3948
			
3949
			completionName = CharOperation.concat(completionName, SEMICOLON);
3950
			
3946
			
3951
			int relevance = computeBaseRelevance();
3947
			int relevance = computeBaseRelevance();
3952
			relevance += computeRelevanceForResolution();
3948
			relevance += computeRelevanceForResolution();

Return to bug 188247