1 11 package org.eclipse.ui.actions; 12 13 import java.util.ArrayList ; 14 import java.util.List ; 15 16 import org.eclipse.core.resources.IContainer; 17 import org.eclipse.core.resources.IResource; 18 import org.eclipse.swt.widgets.Shell; 19 import org.eclipse.ui.PlatformUI; 20 import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; 21 import org.eclipse.ui.internal.ide.IIDEHelpContextIds; 22 23 30 public class MoveResourceAction extends CopyResourceAction { 31 32 35 public static final String ID = PlatformUI.PLUGIN_ID 36 + ".MoveResourceAction"; 38 42 protected List destinations; 43 44 49 public MoveResourceAction(Shell shell) { 50 super(shell, IDEWorkbenchMessages.MoveResourceAction_text); 51 setToolTipText(IDEWorkbenchMessages.MoveResourceAction_toolTip); 52 setId(MoveResourceAction.ID); 53 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, 54 IIDEHelpContextIds.MOVE_RESOURCE_ACTION); 55 } 56 57 60 protected CopyFilesAndFoldersOperation createOperation() { 61 return new MoveFilesAndFoldersOperation(getShell()); 62 } 63 64 69 protected List getDestinations() { 70 return destinations; 71 } 72 73 76 protected IResource[] getResources(List resourceList) { 77 ReadOnlyStateChecker checker = new ReadOnlyStateChecker(getShell(), 78 IDEWorkbenchMessages.MoveResourceAction_title, 79 IDEWorkbenchMessages.MoveResourceAction_checkMoveMessage); 80 return checker.checkReadOnlyResources(super.getResources(resourceList)); 81 } 82 83 86 protected void runOperation(IResource[] resources, IContainer destination) { 87 destinations = new ArrayList (); 89 IResource[] copiedResources = operation.copyResources(resources, 90 destination); 91 92 for (int i = 0; i < copiedResources.length; i++) { 93 destinations.add(destination.getFullPath().append( 94 copiedResources[i].getName())); 95 } 96 } 97 } 98 | Popular Tags |