1 14 package org.eclipse.jdt.internal.ui.callhierarchy; 15 16 import org.eclipse.ui.PlatformUI; 17 18 import org.eclipse.jdt.core.IMethod; 19 import org.eclipse.jdt.core.JavaModelException; 20 import org.eclipse.jdt.core.search.IJavaSearchScope; 21 import org.eclipse.jdt.core.search.SearchEngine; 22 23 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; 24 import org.eclipse.jdt.internal.ui.JavaPlugin; 25 import org.eclipse.jdt.internal.ui.search.JavaSearchScopeFactory; 26 27 28 class SearchScopeHierarchyAction extends SearchScopeAction { 29 private final SearchScopeActionGroup fGroup; 30 31 public SearchScopeHierarchyAction(SearchScopeActionGroup group) { 32 super(group, CallHierarchyMessages.SearchScopeActionGroup_hierarchy_text); 33 this.fGroup = group; 34 setToolTipText(CallHierarchyMessages.SearchScopeActionGroup_hierarchy_tooltip); 35 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.CALL_HIERARCHY_SEARCH_SCOPE_ACTION); 36 } 37 38 public IJavaSearchScope getSearchScope() { 39 try { 40 IMethod method = this.fGroup.getView().getMethod(); 41 42 if (method != null) { 43 return SearchEngine.createHierarchyScope(method.getDeclaringType()); 44 } else { 45 return null; 46 } 47 } catch (JavaModelException e) { 48 JavaPlugin.log(e); 49 } 50 51 return null; 52 } 53 54 57 public int getSearchScopeType() { 58 return SearchScopeActionGroup.SEARCH_SCOPE_TYPE_HIERARCHY; 59 } 60 61 64 public String getFullDescription() { 65 IMethod method = this.fGroup.getView().getMethod(); 66 return JavaSearchScopeFactory.getInstance().getHierarchyScopeDescription(method.getDeclaringType()); 67 } 68 69 } 70 | Popular Tags |