List of usage examples for org.eclipse.jdt.internal.core.search BasicSearchEngine createHierarchyScope
public static IJavaSearchScope createHierarchyScope(IType type) throws JavaModelException
From source file:com.liferay.ide.portlet.ui.wizard.NewPortletClassWizardPage.java
License:Open Source License
protected void handleClassButtonSelected(Control control, String baseClass, String title, String message) { getControl().setCursor(new Cursor(getShell().getDisplay(), SWT.CURSOR_WAIT)); IPackageFragmentRoot packRoot = (IPackageFragmentRoot) model .getProperty(INewJavaClassDataModelProperties.JAVA_PACKAGE_FRAGMENT_ROOT); if (packRoot == null) { return;//from ww w . ja v a 2 s.c o m } // this eliminates the non-exported classpath entries // final IJavaSearchScope scope = // TypeSearchEngine.createJavaSearchScopeForAProject(packRoot.getJavaProject(), // true, true); IJavaSearchScope scope = null; try { IType type = packRoot.getJavaProject().findType(baseClass); if (type == null) { return; } scope = BasicSearchEngine.createHierarchyScope(type); } catch (JavaModelException e) { PortletUIPlugin.logError(e); return; } // This includes all entries on the classpath. This behavior is // identical // to the Super Class Browse Button on the Create new Java Class Wizard // final IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new // IJavaElement[] {root.getJavaProject()} ); FilteredTypesSelectionDialog dialog = new FilteredTypesSelectionDialogEx(getShell(), false, getWizard().getContainer(), scope, IJavaSearchConstants.CLASS); dialog.setTitle(title); dialog.setMessage(message); if (dialog.open() == Window.OK) { IType type = (IType) dialog.getFirstResult(); String classFullPath = J2EEUIMessages.EMPTY_STRING; if (type != null) { classFullPath = type.getFullyQualifiedName(); } if (control instanceof Text) { ((Text) control).setText(classFullPath); } else if (control instanceof Combo) { ((Combo) control).setText(classFullPath); } getControl().setCursor(null); return; } getControl().setCursor(null); }
From source file:org.eclipse.jdt.core.search.SearchEngine.java
License:Open Source License
/** * Returns a Java search scope limited to the hierarchy of the given type. * The Java elements resulting from a search with this scope will * be types in this hierarchy, or members of the types in this hierarchy. * * @param type the focus of the hierarchy scope * @return a new hierarchy scope// w ww .ja v a 2 s . c om * @exception JavaModelException if the hierarchy could not be computed on the given type */ public static IJavaSearchScope createHierarchyScope(IType type) throws JavaModelException { return BasicSearchEngine.createHierarchyScope(type); }