01: /*******************************************************************************
02: * Copyright (c) 2000, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Jesper Kamstrup Linnet (eclipse@kamstrup-linnet.dk) - initial API and implementation
10: * (report 36180: Callers/Callees view)
11: *******************************************************************************/package org.eclipse.jdt.internal.ui.callhierarchy;
12:
13: import org.eclipse.jdt.core.JavaModelException;
14:
15: import org.eclipse.jface.action.Action;
16:
17: import org.eclipse.ui.IWorkingSet;
18: import org.eclipse.ui.PlatformUI;
19:
20: import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
21: import org.eclipse.jdt.internal.ui.JavaPlugin;
22: import org.eclipse.jdt.internal.ui.search.JavaSearchScopeFactory;
23: import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
24:
25: class SelectWorkingSetAction extends Action {
26: private final SearchScopeActionGroup fGroup;
27:
28: public SelectWorkingSetAction(SearchScopeActionGroup group) {
29: super (
30: CallHierarchyMessages.SearchScopeActionGroup_workingset_select_text);
31: this .fGroup = group;
32: setToolTipText(CallHierarchyMessages.SearchScopeActionGroup_workingset_select_tooltip);
33: PlatformUI.getWorkbench().getHelpSystem().setHelp(this ,
34: IJavaHelpContextIds.CALL_HIERARCHY_SEARCH_SCOPE_ACTION);
35: }
36:
37: /*
38: * (non-Javadoc)
39: *
40: * @see org.eclipse.jface.action.Action#run()
41: */
42: public void run() {
43: try {
44: IWorkingSet[] workingSets;
45: workingSets = JavaSearchScopeFactory.getInstance()
46: .queryWorkingSets();
47: if (workingSets != null) {
48: this .fGroup.setActiveWorkingSets(workingSets);
49: SearchUtil.updateLRUWorkingSets(workingSets);
50: } else {
51: this .fGroup.setActiveWorkingSets(null);
52: }
53: } catch (JavaModelException e) {
54: ExceptionHandler
55: .handle(
56: e,
57: JavaPlugin.getActiveWorkbenchShell(),
58: CallHierarchyMessages.SelectWorkingSetAction_error_title,
59: CallHierarchyMessages.SelectWorkingSetAction_error_message);
60: } catch (InterruptedException e) {
61: // cancel pressed
62: }
63: }
64: }
|