Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 50713 Details for
Bug 148380
[search] get IType from TypeNameRequestor result
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
JDT/UI patch to test this implementation
v01-ui.txt (text/plain), 7.07 KB, created by
Frederic Fusier
on 2006-09-22 13:37:41 EDT
(
hide
)
Description:
JDT/UI patch to test this implementation
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2006-09-22 13:37:41 EDT
Size:
7.07 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >Index: core extension/org/eclipse/jdt/internal/corext/util/TypeInfo.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/TypeInfo.java,v >retrieving revision 1.20 >diff -u -r1.20 TypeInfo.java >--- core extension/org/eclipse/jdt/internal/corext/util/TypeInfo.java 12 May 2006 13:40:53 -0000 1.20 >+++ core extension/org/eclipse/jdt/internal/corext/util/TypeInfo.java 22 Sep 2006 14:30:49 -0000 >@@ -20,6 +20,7 @@ > import org.eclipse.jdt.core.JavaModelException; > import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.core.search.IJavaSearchScope; >+import org.eclipse.jdt.core.search.TypeNameMatch; > > import org.eclipse.jdt.ui.dialogs.ITypeInfoRequestor; > >@@ -43,7 +44,9 @@ > return fInfo.getEnclosingName(); > } > } >- >+ >+ public TypeNameMatch match; >+ > final String fName; > final String fPackage; > final char[][] fEnclosingNames; >@@ -67,6 +70,14 @@ > fEnclosingNames= enclosingTypes; > } > >+ protected TypeInfo(TypeNameMatch match) { >+ this.match = match; >+ fPackage= new String(match.getPackageName()); >+ fName= new String(match.getTypeName()); >+ fModifiers= match.getModifiers(); >+ fEnclosingNames= match.getEnclosingTypeNames(); >+ } >+ > public int hashCode() { > return (fPackage.hashCode() << 16) + fName.hashCode(); > } >@@ -251,6 +262,12 @@ > return null; > } > >+ public IType getType() throws JavaModelException { >+ if (this.match != null) { >+ return this.match.getType(); >+ } >+ return null; >+ } > protected boolean doEquals(TypeInfo other) { > // Don't compare the modifiers since they aren't relevant to identify > // a type. >Index: ui/org/eclipse/jdt/internal/ui/dialogs/TypeInfoViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/TypeInfoViewer.java,v >retrieving revision 1.41 >diff -u -r1.41 TypeInfoViewer.java >--- ui/org/eclipse/jdt/internal/ui/dialogs/TypeInfoViewer.java 23 Jun 2006 14:55:29 -0000 1.41 >+++ ui/org/eclipse/jdt/internal/ui/dialogs/TypeInfoViewer.java 22 Sep 2006 14:30:50 -0000 >@@ -64,7 +64,9 @@ > import org.eclipse.jdt.core.search.IJavaSearchConstants; > import org.eclipse.jdt.core.search.IJavaSearchScope; > import org.eclipse.jdt.core.search.SearchEngine; >+import org.eclipse.jdt.core.search.SearchMatch; > import org.eclipse.jdt.core.search.SearchPattern; >+import org.eclipse.jdt.core.search.TypeNameMatch; > import org.eclipse.jdt.core.search.TypeNameRequestor; > > import org.eclipse.jdt.internal.corext.util.Messages; >@@ -136,6 +138,46 @@ > } > } > >+ private static class NewSearchRequestor extends org.eclipse.jdt.core.search.SearchRequestor { >+ private volatile boolean fStop; >+ >+ private Set fHistory; >+ >+ private TypeInfoFilter fFilter; >+ private TypeInfoFactory fFactory= new TypeInfoFactory(); >+ private List fResult; >+ >+ public NewSearchRequestor(TypeInfoFilter filter) { >+ super(); >+ fResult= new ArrayList(2048); >+ fFilter= filter; >+ } >+ public TypeInfo[] getResult() { >+ return (TypeInfo[])fResult.toArray(new TypeInfo[fResult.size()]); >+ } >+ public void cancel() { >+ fStop= true; >+ } >+ public void setHistory(Set history) { >+ fHistory= history; >+ } >+ public void acceptSearchMatch(SearchMatch match) throws CoreException { >+ TypeNameMatch typeNameMatch = (TypeNameMatch) match; >+ if (fStop) >+ return; >+ char[] packageName = typeNameMatch.getPackageName(); >+ char[] typeName = typeNameMatch.getTypeName(); >+ if (TypeFilter.isFiltered(packageName, typeName)) >+ return; >+ TypeInfo type= fFactory.create(packageName, typeName, typeNameMatch.getEnclosingTypeNames(), typeNameMatch.getModifiers(), typeNameMatch.getPath()); >+ type.match = typeNameMatch; >+ if (fHistory.contains(type)) >+ return; >+ if (fFilter.matchesFilterExtension(type)) >+ fResult.add(type); >+ } >+ } >+ > protected static class TypeInfoComparator implements Comparator { > private TypeInfoLabelProvider fLabelProvider; > private TypeInfoFilter fFilter; >@@ -626,14 +668,14 @@ > private static class SearchEngineJob extends AbstractSearchJob { > private IJavaSearchScope fScope; > private int fElementKind; >- private SearchRequestor fReqestor; >+ private NewSearchRequestor fReqestor; > > public SearchEngineJob(int ticket, TypeInfoViewer viewer, TypeInfoFilter filter, OpenTypeHistory history, int numberOfVisibleItems, int mode, > IJavaSearchScope scope, int elementKind) { > super(ticket, viewer, filter, history, numberOfVisibleItems, mode); > fScope= scope; > fElementKind= elementKind; >- fReqestor= new SearchRequestor(filter); >+ fReqestor= new NewSearchRequestor(filter); > } > public void stop() { > fReqestor.cancel(); >Index: ui/org/eclipse/jdt/internal/ui/dialogs/TypeSelectionDialog2.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/TypeSelectionDialog2.java,v >retrieving revision 1.23 >diff -u -r1.23 TypeSelectionDialog2.java >--- ui/org/eclipse/jdt/internal/ui/dialogs/TypeSelectionDialog2.java 1 Jun 2006 10:14:54 -0000 1.23 >+++ ui/org/eclipse/jdt/internal/ui/dialogs/TypeSelectionDialog2.java 22 Sep 2006 14:30:50 -0000 >@@ -42,6 +42,7 @@ > import org.eclipse.ui.dialogs.ISelectionStatusValidator; > import org.eclipse.ui.dialogs.SelectionStatusDialog; > >+import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jdt.core.IType; > import org.eclipse.jdt.core.JavaConventions; > import org.eclipse.jdt.core.JavaModelException; >@@ -70,6 +71,7 @@ > private boolean fMultipleSelection; > private IRunnableContext fRunnableContext; > private IJavaSearchScope fScope; >+ private IJavaProject project; > private int fElementKind; > > private String fInitialFilter; >@@ -179,7 +181,8 @@ > if (fValidator != null) { > List jElements= new ArrayList(); > for (int i= 0; i < selection.length; i++) { >- IType type= selection[i].resolveType(fScope); >+// IType type= selection[i].resolveType(fScope); >+ IType type= selection[i].getType(); > if (type != null) { > jElements.add(type); > } else { >@@ -257,16 +260,17 @@ > } > > // If the scope is null then it got computed by the type selection component. >- if (fScope == null) { >- fScope= fContent.getScope(); >- } >+// if (fScope == null) { >+// fScope= fContent.getScope(); >+// } > > OpenTypeHistory history= OpenTypeHistory.getInstance(); > List result= new ArrayList(selected.length); > for (int i= 0; i < selected.length; i++) { > try { > TypeInfo typeInfo= selected[i]; >- IType type= typeInfo.resolveType(fScope); >+// IType type= typeInfo.resolveType(fScope); >+ IType type= typeInfo.getType(); > if (type == null) { > String title= JavaUIMessages.TypeSelectionDialog_errorTitle; > String message= Messages.format(JavaUIMessages.TypeSelectionDialog_dialogMessage, typeInfo.getPath());
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 148380
:
50710
|
50713
|
50714
|
51323
|
51563