private void addWorkingSetAction(IWorkingSet[] workingSets, IMenuManager manager) { FindAction action; if (fEditor != null) action= new WorkingSetFindAction(fEditor, new FindReferencesInWorkingSetAction(fEditor, workingSets), SearchUtil.toString(workingSets)); else action= new WorkingSetFindAction(fSite, new FindReferencesInWorkingSetAction(fSite, workingSets), SearchUtil.toString(workingSets)); action.update(getContext().getSelection()); addAction(action, manager); }
@Override QuerySpecification createQuery(IJavaElement element) throws JavaModelException, InterruptedException { JavaSearchScopeFactory factory= JavaSearchScopeFactory.getInstance(); IWorkingSet[] workingSets= fWorkingSets; if (fWorkingSets == null && isFirstElement()) { workingSets= factory.queryWorkingSets(); if (workingSets == null) return super.createQuery(element); // in workspace if (isMultiSelect()) { fWorkingSets= workingSets; } } else if (isMultiSelect() && isLastElement()) { fWorkingSets= null; } SearchUtil.updateLRUWorkingSets(workingSets); IJavaSearchScope scope= factory.createJavaSearchScope(workingSets, JavaSearchScopeFactory.NO_PROJ); String description= factory.getWorkingSetScopeDescription(workingSets, JavaSearchScopeFactory.NO_PROJ); return new ElementQuerySpecification(element, getLimitTo(), scope, description); } }
@Override void init() { setText(SearchMessages.Search_FindReferencesInWorkingSetAction_label); setToolTipText(SearchMessages.Search_FindReferencesInWorkingSetAction_tooltip); setImageDescriptor(JavaPluginImages.DESC_OBJS_SEARCH_REF); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.FIND_REFERENCES_IN_WORKING_SET_ACTION); }
/** * Note: This constructor is for internal use only. Clients should not call this constructor. * @param editor the Java editor */ public ReferencesSearchGroup(JavaEditor editor) { Assert.isNotNull(editor); fEditor= editor; fSite= fEditor.getSite(); fGroupId= ITextEditorActionConstants.GROUP_FIND; fFindReferencesAction= new FindReferencesAction(editor); fFindReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKSPACE); fEditor.setAction("SearchReferencesInWorkspace", fFindReferencesAction); //$NON-NLS-1$ fFindReferencesInProjectAction= new FindReferencesInProjectAction(fEditor); fFindReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_PROJECT); fEditor.setAction("SearchReferencesInProject", fFindReferencesInProjectAction); //$NON-NLS-1$ fFindReferencesInHierarchyAction= new FindReferencesInHierarchyAction(fEditor); fFindReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_HIERARCHY); fEditor.setAction("SearchReferencesInHierarchy", fFindReferencesInHierarchyAction); //$NON-NLS-1$ fFindReferencesInWorkingSetAction= new FindReferencesInWorkingSetAction(fEditor); fFindReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKING_SET); fEditor.setAction("SearchReferencesInWorkingSet", fFindReferencesInWorkingSetAction); //$NON-NLS-1$ }
@Override public void run() { DependencyExtentQuery query = (DependencyExtentQuery) getInput().getQuery(); IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager(); IWorkingSet set = manager.createWorkingSet("temp", query.getDirectRoots()); //$NON-NLS-1$ new FindReferencesInWorkingSetAction(getViewPart().getSite(), new IWorkingSet[] {set}).run((IType) object); manager.removeWorkingSet(set); } });
QuerySpecification createQuery(IJavaElement element) throws JavaModelException, InterruptedException { JavaSearchScopeFactory factory= JavaSearchScopeFactory.getInstance(); IWorkingSet[] workingSets= fWorkingSets; if (fWorkingSets == null) { workingSets= factory.queryWorkingSets(); if (workingSets == null) return super.createQuery(element); // in workspace } SearchUtil.updateLRUWorkingSets(workingSets); IJavaSearchScope scope= factory.createJavaSearchScope(workingSets, true); String description= factory.getWorkingSetScopeDescription(workingSets, true); return new ElementQuerySpecification(element, getLimitTo(), scope, description); } }
/** * Note: This constructor is for internal use only. Clients should not call this constructor. * @param editor the Java editor * * @noreference This constructor is not intended to be referenced by clients. */ public ReferencesSearchGroup(JavaEditor editor) { Assert.isNotNull(editor); fEditor= editor; fSite= fEditor.getSite(); fGroupId= ITextEditorActionConstants.GROUP_FIND; fFindReferencesAction= new FindReferencesAction(editor); fFindReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKSPACE); fEditor.setAction("SearchReferencesInWorkspace", fFindReferencesAction); //$NON-NLS-1$ fFindReferencesInProjectAction= new FindReferencesInProjectAction(fEditor); fFindReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_PROJECT); fEditor.setAction("SearchReferencesInProject", fFindReferencesInProjectAction); //$NON-NLS-1$ fFindReferencesInHierarchyAction= new FindReferencesInHierarchyAction(fEditor); fFindReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_HIERARCHY); fEditor.setAction("SearchReferencesInHierarchy", fFindReferencesInHierarchyAction); //$NON-NLS-1$ fFindReferencesInWorkingSetAction= new FindReferencesInWorkingSetAction(fEditor); fFindReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKING_SET); fEditor.setAction("SearchReferencesInWorkingSet", fFindReferencesInWorkingSetAction); //$NON-NLS-1$ }
private void doReferenceSearch(final ISelection sel) { IPackageFragmentRoot[] roots = null; try { roots = getSourceRoots(); } catch (JavaModelException e) { } final IPackageFragment fragment = getPackageFragment(sel); if (fragment != null && roots != null) { IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager(); IWorkingSet set = manager.createWorkingSet("temp", roots); //$NON-NLS-1$ new FindReferencesInWorkingSetAction(getPage().getEditorSite(), new IWorkingSet[] {set}).run(fragment); manager.removeWorkingSet(set); } else if (sel instanceof IStructuredSelection) { IStructuredSelection selection = (IStructuredSelection) sel; PackageObject importObject = (PackageObject) selection.getFirstElement(); NewSearchUI.runQueryInBackground(new BlankQuery(importObject)); } }
/** * Note: This constructor is for internal use only. Clients should not call this constructor. * @param editor the Java editor * * @noreference This constructor is not intended to be referenced by clients. */ public ReferencesSearchGroup(JavaEditor editor) { Assert.isNotNull(editor); fEditor= editor; fSite= fEditor.getSite(); fGroupId= ITextEditorActionConstants.GROUP_FIND; fFindReferencesAction= new FindReferencesAction(editor); fFindReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKSPACE); fEditor.setAction("SearchReferencesInWorkspace", fFindReferencesAction); //$NON-NLS-1$ fFindReferencesInProjectAction= new FindReferencesInProjectAction(fEditor); fFindReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_PROJECT); fEditor.setAction("SearchReferencesInProject", fFindReferencesInProjectAction); //$NON-NLS-1$ fFindReferencesInHierarchyAction= new FindReferencesInHierarchyAction(fEditor); fFindReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_HIERARCHY); fEditor.setAction("SearchReferencesInHierarchy", fFindReferencesInHierarchyAction); //$NON-NLS-1$ fFindReferencesInWorkingSetAction= new FindReferencesInWorkingSetAction(fEditor); fFindReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKING_SET); fEditor.setAction("SearchReferencesInWorkingSet", fFindReferencesInWorkingSetAction); //$NON-NLS-1$ }
void init() { setText(SearchMessages.Search_FindReferencesInWorkingSetAction_label); setToolTipText(SearchMessages.Search_FindReferencesInWorkingSetAction_tooltip); setImageDescriptor(JavaPluginImages.DESC_OBJS_SEARCH_REF); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.FIND_REFERENCES_IN_WORKING_SET_ACTION); }
@Override QuerySpecification createQuery(IJavaElement element) throws JavaModelException, InterruptedException { JavaSearchScopeFactory factory= JavaSearchScopeFactory.getInstance(); IWorkingSet[] workingSets= fWorkingSets; if (fWorkingSets == null && isFirstElement()) { workingSets= factory.queryWorkingSets(); if (workingSets == null) return super.createQuery(element); // in workspace if (isMultiSelect()) { fWorkingSets= workingSets; } } else if (isMultiSelect() && isLastElement()) { fWorkingSets= null; } SearchUtil.updateLRUWorkingSets(workingSets); IJavaSearchScope scope= factory.createJavaSearchScope(workingSets, JavaSearchScopeFactory.NO_PROJ); String description= factory.getWorkingSetScopeDescription(workingSets, JavaSearchScopeFactory.NO_PROJ); return new ElementQuerySpecification(element, getLimitTo(), scope, description); } }
private void addWorkingSetAction(IWorkingSet[] workingSets, IMenuManager manager) { FindAction action; if (fEditor != null) action= new WorkingSetFindAction(fEditor, new FindReferencesInWorkingSetAction(fEditor, workingSets), SearchUtil.toString(workingSets)); else action= new WorkingSetFindAction(fSite, new FindReferencesInWorkingSetAction(fSite, workingSets), SearchUtil.toString(workingSets)); action.update(getContext().getSelection()); addAction(action, manager); }
/** * Creates a new <code>ReferencesSearchGroup</code>. The group requires * that the selection provided by the site's selection provider is of type <code> * org.eclipse.jface.viewers.IStructuredSelection</code>. * * @param site the view part that owns this action group */ public ReferencesSearchGroup(IWorkbenchSite site) { fSite= site; fGroupId= IContextMenuConstants.GROUP_SEARCH; fFindReferencesAction= new FindReferencesAction(site); fFindReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKSPACE); fFindReferencesInProjectAction= new FindReferencesInProjectAction(site); fFindReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_PROJECT); fFindReferencesInHierarchyAction= new FindReferencesInHierarchyAction(site); fFindReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_HIERARCHY); fFindReferencesInWorkingSetAction= new FindReferencesInWorkingSetAction(site); fFindReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKING_SET); // register the actions as selection listeners ISelectionProvider provider= fSite.getSelectionProvider(); ISelection selection= provider.getSelection(); registerAction(fFindReferencesAction, provider, selection); registerAction(fFindReferencesInProjectAction, provider, selection); registerAction(fFindReferencesInHierarchyAction, provider, selection); registerAction(fFindReferencesInWorkingSetAction, provider, selection); }
@Override void init() { setText(SearchMessages.Search_FindReferencesInWorkingSetAction_label); setToolTipText(SearchMessages.Search_FindReferencesInWorkingSetAction_tooltip); setImageDescriptor(JavaPluginImages.DESC_OBJS_SEARCH_REF); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.FIND_REFERENCES_IN_WORKING_SET_ACTION); }
private void addWorkingSetAction(IWorkingSet[] workingSets, IMenuManager manager) { FindAction action; if (fEditor != null) action= new WorkingSetFindAction(fEditor, new FindReferencesInWorkingSetAction(fEditor, workingSets), SearchUtil.toString(workingSets)); else action= new WorkingSetFindAction(fSite, new FindReferencesInWorkingSetAction(fSite, workingSets), SearchUtil.toString(workingSets)); action.update(getContext().getSelection()); addAction(action, manager); }
/** * Creates a new <code>ReferencesSearchGroup</code>. The group requires * that the selection provided by the given selection provider is of type * {@link IStructuredSelection}. * * @param site the site that will own the action group. * @param specialSelectionProvider the selection provider used instead of the * sites selection provider. * * @since 3.4 */ public ReferencesSearchGroup(IWorkbenchSite site, ISelectionProvider specialSelectionProvider) { fSite= site; fGroupId= IContextMenuConstants.GROUP_SEARCH; fFindReferencesAction= new FindReferencesAction(site); fFindReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKSPACE); fFindReferencesInProjectAction= new FindReferencesInProjectAction(site); fFindReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_PROJECT); fFindReferencesInHierarchyAction= new FindReferencesInHierarchyAction(site); fFindReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_HIERARCHY); fFindReferencesInWorkingSetAction= new FindReferencesInWorkingSetAction(site); fFindReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKING_SET); // register the actions as selection listeners ISelectionProvider provider= specialSelectionProvider == null ? fSite.getSelectionProvider() : specialSelectionProvider; ISelection selection= provider.getSelection(); registerAction(fFindReferencesAction, provider, selection, specialSelectionProvider); registerAction(fFindReferencesInProjectAction, provider, selection, specialSelectionProvider); registerAction(fFindReferencesInHierarchyAction, provider, selection, specialSelectionProvider); registerAction(fFindReferencesInWorkingSetAction, provider, selection, specialSelectionProvider); }
/** * Creates a new <code>ReferencesSearchGroup</code>. The group requires * that the selection provided by the given selection provider is of type * {@link IStructuredSelection}. * * @param site the site that will own the action group. * @param specialSelectionProvider the selection provider used instead of the * sites selection provider. * * @since 3.4 */ public ReferencesSearchGroup(IWorkbenchSite site, ISelectionProvider specialSelectionProvider) { fSite= site; fGroupId= IContextMenuConstants.GROUP_SEARCH; fFindReferencesAction= new FindReferencesAction(site); fFindReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKSPACE); fFindReferencesInProjectAction= new FindReferencesInProjectAction(site); fFindReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_PROJECT); fFindReferencesInHierarchyAction= new FindReferencesInHierarchyAction(site); fFindReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_HIERARCHY); fFindReferencesInWorkingSetAction= new FindReferencesInWorkingSetAction(site); fFindReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKING_SET); // register the actions as selection listeners ISelectionProvider provider= specialSelectionProvider == null ? fSite.getSelectionProvider() : specialSelectionProvider; ISelection selection= provider.getSelection(); registerAction(fFindReferencesAction, provider, selection, specialSelectionProvider); registerAction(fFindReferencesInProjectAction, provider, selection, specialSelectionProvider); registerAction(fFindReferencesInHierarchyAction, provider, selection, specialSelectionProvider); registerAction(fFindReferencesInWorkingSetAction, provider, selection, specialSelectionProvider); }