View | Details | Raw Unified | Return to bug 48350
Collapse All | Expand All

(-)codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java (-9 / +8 lines)
Lines 12-18 Link Here
12
12
13
import java.util.*;
13
import java.util.*;
14
14
15
import org.eclipse.jdt.core.IType;
16
import org.eclipse.jdt.core.compiler.*;
15
import org.eclipse.jdt.core.compiler.*;
17
import org.eclipse.jdt.internal.codeassist.impl.*;
16
import org.eclipse.jdt.internal.codeassist.impl.*;
18
import org.eclipse.jdt.internal.codeassist.select.*;
17
import org.eclipse.jdt.internal.codeassist.select.*;
Lines 24-31 Link Here
24
import org.eclipse.jdt.internal.compiler.problem.*;
23
import org.eclipse.jdt.internal.compiler.problem.*;
25
import org.eclipse.jdt.internal.compiler.impl.*;
24
import org.eclipse.jdt.internal.compiler.impl.*;
26
import org.eclipse.jdt.internal.core.SelectionRequestor;
25
import org.eclipse.jdt.internal.core.SelectionRequestor;
26
import org.eclipse.jdt.internal.core.SourceType;
27
import org.eclipse.jdt.internal.core.SourceTypeElementInfo;
27
import org.eclipse.jdt.internal.core.SourceTypeElementInfo;
28
import org.eclipse.jdt.internal.core.util.ASTNodeFinder;
28
import org.eclipse.jdt.internal.core.util.ASTNodeFinder;
29
import org.eclipse.jdt.internal.core.util.ElementInfoConverter;
29
30
30
/**
31
/**
31
 * The selection engine is intended to infer the nature of a selected name in some
32
 * The selection engine is intended to infer the nature of a selected name in some
Lines 749-761 Link Here
749
	 *      a type name which is to be resolved in the context of a compilation unit.
750
	 *      a type name which is to be resolved in the context of a compilation unit.
750
	 *		NOTE: the type name is supposed to be correctly reduced (no whitespaces, no unicodes left)
751
	 *		NOTE: the type name is supposed to be correctly reduced (no whitespaces, no unicodes left)
751
	 * 
752
	 * 
752
	 * @param topLevelTypes org.eclipse.jdt.internal.compiler.env.ISourceType[]
753
	 * @param topLevelTypes SourceTypeElementInfo[]
753
	 *      a source form of the top level types of the compilation unit in which code assist is invoked.
754
	 *      a source form of the top level types of the compilation unit in which code assist is invoked.
754
755
755
	 *  @param searchInEnvironment
756
	 *  @param searchInEnvironment
756
	 * 	if <code>true</code> and no selection could be found in context then search type in environment.
757
	 * 	if <code>true</code> and no selection could be found in context then search type in environment.
757
	 */
758
	 */
758
	public void selectType(ISourceType sourceType, char[] typeName, ISourceType[] topLevelTypes, boolean searchInEnvironment) {
759
	public void selectType(ISourceType sourceType, char[] typeName, SourceTypeElementInfo[] topLevelTypes, boolean searchInEnvironment) {
759
		try {
760
		try {
760
			this.acceptedAnswer = false;
761
			this.acceptedAnswer = false;
761
762
Lines 768-779 Link Here
768
			}
769
			}
769
			// compute parse tree for this most outer type
770
			// compute parse tree for this most outer type
770
			CompilationResult result = new CompilationResult(outerType.getFileName(), 1, 1, this.compilerOptions.maxProblemsPerUnit);
771
			CompilationResult result = new CompilationResult(outerType.getFileName(), 1, 1, this.compilerOptions.maxProblemsPerUnit);
772
			if (!(sourceType instanceof SourceTypeElementInfo)) return;
773
			SourceType typeHandle = (SourceType) ((SourceTypeElementInfo)sourceType).getHandle();
771
			CompilationUnitDeclaration parsedUnit =
774
			CompilationUnitDeclaration parsedUnit =
772
				SourceTypeConverter.buildCompilationUnit(
775
				ElementInfoConverter.buildCompilationUnit(
773
						topLevelTypes,
776
						topLevelTypes,
774
						// no need for field and methods
777
						typeHandle.isAnonymous() || typeHandle.isLocal(),
775
						SourceTypeConverter.MEMBER_TYPE, // need member types
776
						// no need for field initialization
777
						this.parser.problemReporter(), 
778
						this.parser.problemReporter(), 
778
						result);
779
						result);
779
780
Lines 783-790 Link Here
783
					System.out.println(parsedUnit.toString());
784
					System.out.println(parsedUnit.toString());
784
				}
785
				}
785
				// find the type declaration that corresponds to the original source type
786
				// find the type declaration that corresponds to the original source type
786
				if (!(sourceType instanceof SourceTypeElementInfo)) return;
787
				IType typeHandle = ((SourceTypeElementInfo)sourceType).getHandle();
788
				TypeDeclaration typeDecl = new ASTNodeFinder(parsedUnit).findType(typeHandle);
787
				TypeDeclaration typeDecl = new ASTNodeFinder(parsedUnit).findType(typeHandle);
789
788
790
				if (typeDecl != null) {
789
				if (typeDecl != null) {
(-)model/org/eclipse/jdt/internal/core/SourceType.java (-2 / +2 lines)
Lines 701-709 Link Here
701
			
701
			
702
	 	IType[] topLevelTypes = this.getCompilationUnit().getTypes();
702
	 	IType[] topLevelTypes = this.getCompilationUnit().getTypes();
703
	 	int length = topLevelTypes.length;
703
	 	int length = topLevelTypes.length;
704
	 	ISourceType[] topLevelInfos = new ISourceType[length];
704
	 	SourceTypeElementInfo[] topLevelInfos = new SourceTypeElementInfo[length];
705
	 	for (int i = 0; i < length; i++) {
705
	 	for (int i = 0; i < length; i++) {
706
			topLevelInfos[i] = (ISourceType)((SourceType)topLevelTypes[i]).getElementInfo();
706
			topLevelInfos[i] = (SourceTypeElementInfo) ((SourceType)topLevelTypes[i]).getElementInfo();
707
		}
707
		}
708
			
708
			
709
		engine.selectType(info, typeName.toCharArray(), topLevelInfos, false);
709
		engine.selectType(info, typeName.toCharArray(), topLevelInfos, false);

Return to bug 48350