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.actions;
11:
12: import org.eclipse.core.resources.IResource;
13: import org.eclipse.core.runtime.CoreException;
14: import org.eclipse.core.runtime.IProgressMonitor;
15: import org.eclipse.jface.viewers.IStructuredSelection;
16: import org.eclipse.swt.widgets.Shell;
17: import org.eclipse.ui.PlatformUI;
18: import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
19: import org.eclipse.ui.internal.ide.IIDEHelpContextIds;
20:
21: /**
22: * Standard action for scrubbing the local content in the local file system of
23: * the selected resources and all of their descendents.
24: * <p>
25: * This class may be instantiated; it is not intended to be subclassed.
26: * </p>
27: * @deprecated This class is obsolete; there is no support in the workspace
28: * for scrubbing local content.
29: */
30: public class ScrubLocalAction extends WorkspaceAction {
31:
32: /**
33: * The id of this action.
34: */
35: public static final String ID = "org.eclipse.ui.ScrubLocalAction";//$NON-NLS-1$
36:
37: /**
38: * Creates a new action.
39: *
40: * @param shell the shell for any dialogs
41: */
42: public ScrubLocalAction(Shell shell) {
43: super (shell, IDEWorkbenchMessages.ScrubLocalAction_text);
44: setToolTipText(IDEWorkbenchMessages.ScrubLocalAction_toolTip);
45: setId(ID);
46: PlatformUI.getWorkbench().getHelpSystem().setHelp(this ,
47: IIDEHelpContextIds.SCRUB_LOCAL_ACTION);
48: }
49:
50: /* (non-Javadoc)
51: * Method declared on WorkspaceAction.
52: */
53: protected String getOperationMessage() {
54: return IDEWorkbenchMessages.ScrubLocalAction_progress;
55: }
56:
57: /* (non-Javadoc)
58: * Method declared on WorkspaceAction.
59: */
60: protected String getProblemsMessage() {
61: return IDEWorkbenchMessages.ScrubLocalAction_problemsMessage;
62: }
63:
64: /* (non-Javadoc)
65: * Method declared on WorkspaceAction.
66: */
67: protected String getProblemsTitle() {
68: return IDEWorkbenchMessages.ScrubLocalAction_problemsTitle;
69: }
70:
71: /* (non-Javadoc)
72: * Method declared on WorkspaceAction.
73: */
74: protected void invokeOperation(IResource resource,
75: IProgressMonitor monitor) throws CoreException {
76: resource.setLocal(false, IResource.DEPTH_INFINITE, monitor);
77: }
78:
79: /**
80: * The <code>ScrubLocalAction</code> implementation of this
81: * <code>SelectionListenerAction</code> method ensures that this action is
82: * disabled if any of the selections are not resources.
83: */
84: protected boolean updateSelection(IStructuredSelection s) {
85: return super .updateSelection(s)
86: && getSelectedNonResources().size() == 0;
87: }
88: }
|