1 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 31 public class ScrubLocalAction extends WorkspaceAction { 32 33 36 public static final String ID = "org.eclipse.ui.ScrubLocalAction"; 38 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 54 protected String getOperationMessage() { 55 return IDEWorkbenchMessages.ScrubLocalAction_progress; 56 } 57 58 61 protected String getProblemsMessage() { 62 return IDEWorkbenchMessages.ScrubLocalAction_problemsMessage; 63 } 64 65 68 protected String getProblemsTitle() { 69 return IDEWorkbenchMessages.ScrubLocalAction_problemsTitle; 70 } 71 72 75 protected void invokeOperation(IResource resource, IProgressMonitor monitor) 76 throws CoreException { 77 resource.setLocal(false, IResource.DEPTH_INFINITE, monitor); 78 } 79 80 85 protected boolean updateSelection(IStructuredSelection s) { 86 return super.updateSelection(s) 87 && getSelectedNonResources().size() == 0; 88 } 89 } 90 | Popular Tags |