01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 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: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.actions;
11:
12: import org.eclipse.core.runtime.Assert;
13: import org.eclipse.jface.action.Action;
14: import org.eclipse.ui.PlatformUI;
15: import org.eclipse.ui.actions.WorkingSetFilterActionGroup;
16: import org.eclipse.ui.internal.IWorkbenchHelpContextIds;
17: import org.eclipse.ui.internal.WorkbenchMessages;
18:
19: /**
20: * Clears the selected working set in the working set action group.
21: *
22: * @since 2.1
23: */
24: public class ClearWorkingSetAction extends Action {
25: private WorkingSetFilterActionGroup actionGroup;
26:
27: /**
28: * Creates a new instance of the receiver.
29: *
30: * @param actionGroup the action group this action is created in
31: */
32: public ClearWorkingSetAction(WorkingSetFilterActionGroup actionGroup) {
33: super (WorkbenchMessages.ClearWorkingSetAction_text);
34: Assert.isNotNull(actionGroup);
35: setToolTipText(WorkbenchMessages.ClearWorkingSetAction_toolTip);
36: setEnabled(actionGroup.getWorkingSet() != null);
37: PlatformUI.getWorkbench().getHelpSystem().setHelp(this ,
38: IWorkbenchHelpContextIds.CLEAR_WORKING_SET_ACTION);
39: this .actionGroup = actionGroup;
40: }
41:
42: /**
43: * Overrides method from Action
44: *
45: * @see Action#run
46: */
47: public void run() {
48: actionGroup.setWorkingSet(null);
49: }
50: }
|