private void doSearch(ISelection sel) { IPackageFragment frag = getPackageFragment(sel); if (frag != null) { FindReferencesAction action = new FindReferencesAction(getPage().getEditorSite()); action.run(frag); } else if (sel instanceof IStructuredSelection) { IStructuredSelection selection = (IStructuredSelection) sel; PackageObject exportObject = (PackageObject) selection.getFirstElement(); NewSearchUI.runQueryInBackground(new BlankQuery(exportObject)); } }
private IPackageFragment getPackageFragment(ISelection sel) { if (sel instanceof IStructuredSelection) { IStructuredSelection selection = (IStructuredSelection) sel; if (selection.size() != 1) return null; IBaseModel model = getPage().getModel(); if (!(model instanceof IPluginModelBase)) return null; return PDEJavaHelper.getPackageFragment( ((PackageObject) selection.getFirstElement()).getName(), ((IPluginModelBase) model).getPluginBase().getId(), getPage().getPDEEditor().getCommonProject()); } return null; }