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

Collapse All | Expand All

(-)core extension/org/eclipse/jdt/internal/corext/util/TypeInfo.java (-1 / +18 lines)
Lines 20-25 Link Here
20
import org.eclipse.jdt.core.JavaModelException;
20
import org.eclipse.jdt.core.JavaModelException;
21
import org.eclipse.jdt.core.compiler.CharOperation;
21
import org.eclipse.jdt.core.compiler.CharOperation;
22
import org.eclipse.jdt.core.search.IJavaSearchScope;
22
import org.eclipse.jdt.core.search.IJavaSearchScope;
23
import org.eclipse.jdt.core.search.TypeDeclarationNameMatch;
23
24
24
import org.eclipse.jdt.ui.dialogs.ITypeInfoRequestor;
25
import org.eclipse.jdt.ui.dialogs.ITypeInfoRequestor;
25
26
Lines 43-49 Link Here
43
			return fInfo.getEnclosingName();
44
			return fInfo.getEnclosingName();
44
		}
45
		}
45
	}
46
	}
46
	
47
48
	public TypeDeclarationNameMatch match;
49
47
	final String fName;
50
	final String fName;
48
	final String fPackage;
51
	final String fPackage;
49
	final char[][] fEnclosingNames;
52
	final char[][] fEnclosingNames;
Lines 67-72 Link Here
67
		fEnclosingNames= enclosingTypes;
70
		fEnclosingNames= enclosingTypes;
68
	}
71
	}
69
	
72
	
73
	protected TypeInfo(TypeDeclarationNameMatch match) {
74
		this.match = match;
75
		fPackage= new String(match.getPackageName());
76
		fName= new String(match.getTypeName());
77
		fModifiers= match.getModifiers();
78
		fEnclosingNames= match.getEnclosingTypeNames();
79
	}
80
	
70
	public int hashCode() {
81
	public int hashCode() {
71
		return (fPackage.hashCode() << 16) + fName.hashCode();
82
		return (fPackage.hashCode() << 16) + fName.hashCode();
72
	}
83
	}
Lines 251-256 Link Here
251
		return null;
262
		return null;
252
	}
263
	}
253
264
265
	public IType getType() throws JavaModelException {
266
		if (this.match != null) {
267
			return this.match.getType();
268
		}
269
		return null;
270
	}
254
	protected boolean doEquals(TypeInfo other) {
271
	protected boolean doEquals(TypeInfo other) {
255
		// Don't compare the modifiers since they aren't relevant to identify
272
		// Don't compare the modifiers since they aren't relevant to identify
256
		// a type.
273
		// a type.
(-)ui/org/eclipse/jdt/internal/ui/dialogs/TypeInfoViewer.java (-2 / +44 lines)
Lines 64-70 Link Here
64
import org.eclipse.jdt.core.search.IJavaSearchConstants;
64
import org.eclipse.jdt.core.search.IJavaSearchConstants;
65
import org.eclipse.jdt.core.search.IJavaSearchScope;
65
import org.eclipse.jdt.core.search.IJavaSearchScope;
66
import org.eclipse.jdt.core.search.SearchEngine;
66
import org.eclipse.jdt.core.search.SearchEngine;
67
import org.eclipse.jdt.core.search.SearchMatch;
67
import org.eclipse.jdt.core.search.SearchPattern;
68
import org.eclipse.jdt.core.search.SearchPattern;
69
import org.eclipse.jdt.core.search.TypeDeclarationNameMatch;
68
import org.eclipse.jdt.core.search.TypeNameRequestor;
70
import org.eclipse.jdt.core.search.TypeNameRequestor;
69
71
70
import org.eclipse.jdt.internal.corext.util.Messages;
72
import org.eclipse.jdt.internal.corext.util.Messages;
Lines 136-141 Link Here
136
		}
138
		}
137
	}
139
	}
138
	
140
	
141
	private static class NewSearchRequestor extends org.eclipse.jdt.core.search.SearchRequestor {
142
		private volatile boolean fStop;
143
		
144
		private Set fHistory;
145
146
		private TypeInfoFilter fFilter;
147
		private TypeInfoFactory fFactory= new TypeInfoFactory();
148
		private List fResult;
149
		
150
		public NewSearchRequestor(TypeInfoFilter filter) {
151
			super();
152
			fResult= new ArrayList(2048);
153
			fFilter= filter;
154
		}
155
		public TypeInfo[] getResult() {
156
			return (TypeInfo[])fResult.toArray(new TypeInfo[fResult.size()]);
157
		}
158
		public void cancel() {
159
			fStop= true;
160
		}
161
		public void setHistory(Set history) {
162
			fHistory= history;
163
		}
164
		public void acceptSearchMatch(SearchMatch match) throws CoreException {
165
			TypeDeclarationNameMatch typeNameMatch = (TypeDeclarationNameMatch) match;
166
			if (fStop)
167
				return;
168
			char[] packageName = typeNameMatch.getPackageName();
169
			char[] typeName = typeNameMatch.getTypeName();
170
			if (TypeFilter.isFiltered(packageName, typeName))
171
				return;
172
			TypeInfo type= fFactory.create(packageName, typeName, typeNameMatch.getEnclosingTypeNames(), typeNameMatch.getModifiers(), typeNameMatch.getPath());
173
			type.match = typeNameMatch;
174
			if (fHistory.contains(type))
175
				return;
176
			if (fFilter.matchesFilterExtension(type))
177
				fResult.add(type);
178
		}
179
	}
180
139
	protected static class TypeInfoComparator implements Comparator {
181
	protected static class TypeInfoComparator implements Comparator {
140
		private TypeInfoLabelProvider fLabelProvider;
182
		private TypeInfoLabelProvider fLabelProvider;
141
		private TypeInfoFilter fFilter;
183
		private TypeInfoFilter fFilter;
Lines 626-639 Link Here
626
	private static class SearchEngineJob extends AbstractSearchJob {
668
	private static class SearchEngineJob extends AbstractSearchJob {
627
		private IJavaSearchScope fScope;
669
		private IJavaSearchScope fScope;
628
		private int fElementKind;
670
		private int fElementKind;
629
		private SearchRequestor fReqestor;
671
		private NewSearchRequestor fReqestor;
630
		
672
		
631
		public SearchEngineJob(int ticket, TypeInfoViewer viewer, TypeInfoFilter filter, OpenTypeHistory history, int numberOfVisibleItems, int mode, 
673
		public SearchEngineJob(int ticket, TypeInfoViewer viewer, TypeInfoFilter filter, OpenTypeHistory history, int numberOfVisibleItems, int mode, 
632
				IJavaSearchScope scope, int elementKind) {
674
				IJavaSearchScope scope, int elementKind) {
633
			super(ticket, viewer, filter, history, numberOfVisibleItems, mode);
675
			super(ticket, viewer, filter, history, numberOfVisibleItems, mode);
634
			fScope= scope;
676
			fScope= scope;
635
			fElementKind= elementKind;
677
			fElementKind= elementKind;
636
			fReqestor= new SearchRequestor(filter);
678
			fReqestor= new NewSearchRequestor(filter);
637
		}
679
		}
638
		public void stop() {
680
		public void stop() {
639
			fReqestor.cancel();
681
			fReqestor.cancel();
(-)ui/org/eclipse/jdt/internal/ui/dialogs/TypeSelectionDialog2.java (-5 / +9 lines)
Lines 42-47 Link Here
42
import org.eclipse.ui.dialogs.ISelectionStatusValidator;
42
import org.eclipse.ui.dialogs.ISelectionStatusValidator;
43
import org.eclipse.ui.dialogs.SelectionStatusDialog;
43
import org.eclipse.ui.dialogs.SelectionStatusDialog;
44
44
45
import org.eclipse.jdt.core.IJavaProject;
45
import org.eclipse.jdt.core.IType;
46
import org.eclipse.jdt.core.IType;
46
import org.eclipse.jdt.core.JavaConventions;
47
import org.eclipse.jdt.core.JavaConventions;
47
import org.eclipse.jdt.core.JavaModelException;
48
import org.eclipse.jdt.core.JavaModelException;
Lines 70-75 Link Here
70
	private boolean fMultipleSelection;
71
	private boolean fMultipleSelection;
71
	private IRunnableContext fRunnableContext;
72
	private IRunnableContext fRunnableContext;
72
	private IJavaSearchScope fScope;
73
	private IJavaSearchScope fScope;
74
	private IJavaProject project;
73
	private int fElementKind;
75
	private int fElementKind;
74
	
76
	
75
	private String fInitialFilter;
77
	private String fInitialFilter;
Lines 179-185 Link Here
179
				if (fValidator != null) {
181
				if (fValidator != null) {
180
					List jElements= new ArrayList();
182
					List jElements= new ArrayList();
181
					for (int i= 0; i < selection.length; i++) {
183
					for (int i= 0; i < selection.length; i++) {
182
						IType type= selection[i].resolveType(fScope);
184
//						IType type= selection[i].resolveType(fScope);
185
						IType type= selection[i].getType();
183
						if (type != null) {
186
						if (type != null) {
184
							jElements.add(type);
187
							jElements.add(type);
185
						} else {
188
						} else {
Lines 257-272 Link Here
257
		}
260
		}
258
		
261
		
259
		// If the scope is null then it got computed by the type selection component.
262
		// If the scope is null then it got computed by the type selection component.
260
		if (fScope == null) {
263
//		if (fScope == null) {
261
			fScope= fContent.getScope();
264
//			fScope= fContent.getScope();
262
		}
265
//		}
263
		
266
		
264
		OpenTypeHistory history= OpenTypeHistory.getInstance();
267
		OpenTypeHistory history= OpenTypeHistory.getInstance();
265
		List result= new ArrayList(selected.length);
268
		List result= new ArrayList(selected.length);
266
		for (int i= 0; i < selected.length; i++) {
269
		for (int i= 0; i < selected.length; i++) {
267
			try {
270
			try {
268
				TypeInfo typeInfo= selected[i];
271
				TypeInfo typeInfo= selected[i];
269
				IType type= typeInfo.resolveType(fScope);
272
//				IType type= typeInfo.resolveType(fScope);
273
				IType type= typeInfo.getType();
270
				if (type == null) {
274
				if (type == null) {
271
					String title= JavaUIMessages.TypeSelectionDialog_errorTitle; 
275
					String title= JavaUIMessages.TypeSelectionDialog_errorTitle; 
272
					String message= Messages.format(JavaUIMessages.TypeSelectionDialog_dialogMessage, typeInfo.getPath()); 
276
					String message= Messages.format(JavaUIMessages.TypeSelectionDialog_dialogMessage, typeInfo.getPath()); 

Return to bug 148380