KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > actions > ScrubLocalAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.actions;
12
13 import org.eclipse.core.resources.IResource;
14 import org.eclipse.core.runtime.CoreException;
15 import org.eclipse.core.runtime.IProgressMonitor;
16 import org.eclipse.jface.viewers.IStructuredSelection;
17 import org.eclipse.swt.widgets.Shell;
18 import org.eclipse.ui.PlatformUI;
19 import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
20 import org.eclipse.ui.internal.ide.IIDEHelpContextIds;
21
22 /**
23  * Standard action for scrubbing the local content in the local file system of
24  * the selected resources and all of their descendents.
25  * <p>
26  * This class may be instantiated; it is not intended to be subclassed.
27  * </p>
28  * @deprecated This class is obsolete; there is no support in the workspace
29  * for scrubbing local content.
30  */

31 public class ScrubLocalAction extends WorkspaceAction {
32
33     /**
34      * The id of this action.
35      */

36     public static final String JavaDoc ID = "org.eclipse.ui.ScrubLocalAction";//$NON-NLS-1$
37

38     /**
39      * Creates a new action.
40      *
41      * @param shell the shell for any dialogs
42      */

43     public ScrubLocalAction(Shell shell) {
44         super(shell, IDEWorkbenchMessages.ScrubLocalAction_text);
45         setToolTipText(IDEWorkbenchMessages.ScrubLocalAction_toolTip);
46         setId(ID);
47         PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
48                 IIDEHelpContextIds.SCRUB_LOCAL_ACTION);
49     }
50
51     /* (non-Javadoc)
52      * Method declared on WorkspaceAction.
53      */

54     protected String JavaDoc getOperationMessage() {
55         return IDEWorkbenchMessages.ScrubLocalAction_progress;
56     }
57
58     /* (non-Javadoc)
59      * Method declared on WorkspaceAction.
60      */

61     protected String JavaDoc getProblemsMessage() {
62         return IDEWorkbenchMessages.ScrubLocalAction_problemsMessage;
63     }
64
65     /* (non-Javadoc)
66      * Method declared on WorkspaceAction.
67      */

68     protected String JavaDoc getProblemsTitle() {
69         return IDEWorkbenchMessages.ScrubLocalAction_problemsTitle;
70     }
71
72     /* (non-Javadoc)
73      * Method declared on WorkspaceAction.
74      */

75     protected void invokeOperation(IResource resource, IProgressMonitor monitor)
76             throws CoreException {
77         resource.setLocal(false, IResource.DEPTH_INFINITE, monitor);
78     }
79
80     /**
81      * The <code>ScrubLocalAction</code> implementation of this
82      * <code>SelectionListenerAction</code> method ensures that this action is
83      * disabled if any of the selections are not resources.
84      */

85     protected boolean updateSelection(IStructuredSelection s) {
86         return super.updateSelection(s)
87                 && getSelectedNonResources().size() == 0;
88     }
89 }
90
Popular Tags