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 155087 Details for
Bug 296617
[search] TypeReferenceLocator does not update the java doc flag
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Modified SearchAction
SearchAction.java (text/plain), 3.63 KB, created by
Frederic Fusier
on 2009-12-28 09:59:58 EST
(
hide
)
Description:
Modified SearchAction
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2009-12-28 09:59:58 EST
Size:
3.63 KB
patch
obsolete
>package jdtsearch.popup.actions; > >import java.util.Iterator; > >import org.eclipse.core.resources.IResource; >import org.eclipse.core.runtime.CoreException; >import org.eclipse.jdt.core.ICompilationUnit; >import org.eclipse.jdt.core.IJavaElement; >import org.eclipse.jdt.core.IType; >import org.eclipse.jdt.core.JavaCore; >import org.eclipse.jdt.core.search.IJavaSearchConstants; >import org.eclipse.jdt.core.search.SearchEngine; >import org.eclipse.jdt.core.search.SearchMatch; >import org.eclipse.jdt.core.search.SearchParticipant; >import org.eclipse.jdt.core.search.SearchPattern; >import org.eclipse.jdt.core.search.SearchRequestor; >import org.eclipse.jdt.internal.core.search.JavaSearchParticipant; >import org.eclipse.jface.action.IAction; >import org.eclipse.jface.dialogs.MessageDialog; >import org.eclipse.jface.viewers.ISelection; >import org.eclipse.jface.viewers.IStructuredSelection; >import org.eclipse.swt.widgets.Shell; >import org.eclipse.ui.IActionDelegate; >import org.eclipse.ui.IObjectActionDelegate; >import org.eclipse.ui.IWorkbenchPart; > >public class SearchAction implements IObjectActionDelegate { > > private Shell shell; > private ISelection selection; > private static SearchEngine engine = new SearchEngine(); > > /** > * Constructor for Action1. > */ > public SearchAction() { > super(); > } > > /** > * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart) > */ > public void setActivePart(IAction action, IWorkbenchPart targetPart) { > shell = targetPart.getSite().getShell(); > } > > /** > * @see IActionDelegate#run(IAction) > */ > public void run(IAction action) { > IStructuredSelection structuredSelection = (IStructuredSelection)selection; > for( Iterator<?> it = structuredSelection.iterator(); it.hasNext(); ) { > IResource currentResource = (IResource)( it.next()); > IJavaElement element = JavaCore.create( currentResource ); > // if the element is a compilation unit > if (element.getElementType() == IJavaElement.COMPILATION_UNIT){ > ICompilationUnit cu = (ICompilationUnit)element; > try { > // get all types > IType[] types = cu.getAllTypes(); > for (int i = 0; i < types.length; i++) { > // get the type > IType type = types[i]; > MessageDialog.openInformation(shell,"JDTSearch Plug-in","Running search on: " + type.getElementName()); > // create the search requester > TypeDependencySearchRequestor requestor = new TypeDependencySearchRequestor(); > // run the search >// engine.searchDeclarationsOfReferencedTypes(type, requestor, null); > SearchPattern pattern = SearchPattern.createPattern(type, IJavaSearchConstants.REFERENCES); > engine.search(pattern, > new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() }, > SearchEngine.createWorkspaceScope(), > requestor, > null); > } > }catch (Exception e) { > } > } > } > > } > > private class TypeDependencySearchRequestor extends SearchRequestor { > public TypeDependencySearchRequestor() { > } > > public void acceptSearchMatch(SearchMatch match) throws CoreException { > // get the matched element > IJavaElement matchedElement = (IJavaElement) match.getElement(); > // try to see if the type we got here is on of the types we are > // interested in > String message = "Found a reference in "; > if (match.isInsideDocComment()) { > message += "the javadoc comment of "; > } > message += matchedElement.getElementName(); > MessageDialog.openInformation(shell,"JDTSearch Plug-in",message); > } > } > > /** > * @see IActionDelegate#selectionChanged(IAction, ISelection) > */ > public void selectionChanged(IAction action, ISelection selection) { > this.selection = selection; > } >}
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 Raw
Actions:
View
Attachments on
bug 296617
:
153523
|
153614
|
153615
| 155087