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 112887 Details for
Bug 247551
[search] SearchEngine.searchDeclarationsOfReferencedTypes does not return the correct reference when type is in a source folder
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Method implementing the search (improved output)
CodeSnippet.txt (text/plain), 2.53 KB, created by
Frederic Fusier
on 2008-09-18 08:27:01 EDT
(
hide
)
Description:
Method implementing the search (improved output)
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2008-09-18 08:27:01 EDT
Size:
2.53 KB
patch
obsolete
>public void findMatches( IJavaProject javaProject) throws JavaModelException { > this.searchEngine = new SearchEngine(); > List requiredProjects = new ArrayList(); > List requiredPath = new ArrayList(); > IPackageFragmentRoot[] roots = javaProject.getPackageFragmentRoots(); > for (int i=0; i<roots.length; i++) { > StringBuffer buffer = new StringBuffer("Package fragment root: "); > String rootName = roots[i].getElementName(); > if (rootName.length() == 0) rootName = "<default>"; > buffer.append(rootName).append(" (").append(roots[i].getPath()).append(")\n"); > IJavaElement[] children = roots[i].getChildren(); > boolean display = false; > for (int j=0; j<children.length; j++) { > if (children[j].getElementType() == IJavaElement.PACKAGE_FRAGMENT) { > IPackageFragment fragment = (IPackageFragment) children[j]; > String fragmentName = fragment.getElementName(); > if (fragmentName.length() == 0) fragmentName = "<default>"; > buffer.append(" - package fragment: ").append(fragmentName).append("\n"); > ICompilationUnit[] units = fragment.getCompilationUnits(); > for (int k=0; k<units.length; k++) { > display = true; > SearchMatchCollector collector = new SearchMatchCollector(javaProject.getProject()); > buffer.append(" + compilation unit: ").append(units[k].getElementName()).append("\n"); > this.searchEngine.searchDeclarationsOfReferencedTypes(units[k], collector, null); > > SearchMatch[] matches = collector.getMatches(); > int length = matches.length; > if (length == 0) { > buffer.append(" - > No declaration or no referenced types found!").append("\n"); > } else { > buffer.append(" -> "+length+" referenced types were found:").append("\n"); > for (int m = 0; m < length; m++) { > > buffer.append(" "+(m+1)+") "+((IJavaElement)matches[m].getElement()).getElementName()).append("\n"); > IProject p = matches[m].getResource().getProject(); > if (!p.equals(javaProject)) { > if (requiredProjects.indexOf(p) == -1) { > buffer.append(" => project "+p.getName()+" is required").append("\n"); > requiredProjects.add(p); > } > } > > IPath path = matches[m].getResource().getFullPath(); > if (requiredPath.indexOf(path) == -1) { > buffer.append(" => path "+path+" is required").append("\n"); > requiredPath.add(path); > } > } > } > } > } > } > if (display) { > System.out.println(buffer.toString()); > } > } >}
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 247551
:
112769
|
112885
| 112887