1 12 package org.eclipse.jdt.internal.ui.callhierarchy; 13 14 import org.eclipse.jdt.core.JavaModelException; 15 16 import org.eclipse.jface.action.Action; 17 18 import org.eclipse.ui.IWorkingSet; 19 import org.eclipse.ui.PlatformUI; 20 21 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; 22 import org.eclipse.jdt.internal.ui.JavaPlugin; 23 import org.eclipse.jdt.internal.ui.search.JavaSearchScopeFactory; 24 import org.eclipse.jdt.internal.ui.util.ExceptionHandler; 25 26 class SelectWorkingSetAction extends Action { 27 private final SearchScopeActionGroup fGroup; 28 29 public SelectWorkingSetAction(SearchScopeActionGroup group) { 30 super(CallHierarchyMessages.SearchScopeActionGroup_workingset_select_text); 31 this.fGroup = group; 32 setToolTipText(CallHierarchyMessages.SearchScopeActionGroup_workingset_select_tooltip); 33 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.CALL_HIERARCHY_SEARCH_SCOPE_ACTION); 34 } 35 40 public void run() { 41 try { 42 IWorkingSet[] workingSets; 43 workingSets = JavaSearchScopeFactory.getInstance().queryWorkingSets(); 44 if (workingSets != null) { 45 this.fGroup.setActiveWorkingSets(workingSets); 46 SearchUtil.updateLRUWorkingSets(workingSets); 47 } else { 48 this.fGroup.setActiveWorkingSets(null); 49 } 50 } catch (JavaModelException e) { 51 ExceptionHandler.handle(e, JavaPlugin.getActiveWorkbenchShell(), 52 CallHierarchyMessages.SelectWorkingSetAction_error_title, 53 CallHierarchyMessages.SelectWorkingSetAction_error_message); 54 } catch (InterruptedException e) { 55 } 57 } 58 } 59 | Popular Tags |