1 17 package org.eclipse.emf.edit.ui.action; 18 19 20 import java.util.Collection ; 21 22 import org.eclipse.ui.IEditorPart; 23 import org.eclipse.ui.IWorkbenchPart; 24 25 import org.eclipse.emf.common.command.Command; 26 import org.eclipse.emf.edit.command.CutToClipboardCommand; 27 import org.eclipse.emf.edit.domain.EditingDomain; 28 import org.eclipse.emf.edit.domain.IEditingDomainProvider; 29 import org.eclipse.emf.edit.ui.EMFEditUIPlugin; 30 31 32 35 public class CutAction extends CommandActionHandler 36 { 37 public CutAction(EditingDomain domain) 38 { 39 super(domain, EMFEditUIPlugin.INSTANCE.getString("_UI_Cut_menu_item")); 40 } 41 42 public CutAction() 43 { 44 super(null, EMFEditUIPlugin.INSTANCE.getString("_UI_Cut_menu_item")); 45 } 46 47 public Command createCommand(Collection selection) 48 { 49 return CutToClipboardCommand.create(domain, selection); 50 } 51 52 55 public void setActiveEditor(IEditorPart editorPart) 56 { 57 setActiveWorkbenchPart(editorPart); 58 } 59 60 63 public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart) 64 { 65 if (workbenchPart instanceof IEditingDomainProvider) 66 { 67 domain = ((IEditingDomainProvider)workbenchPart).getEditingDomain(); 68 } 69 } 70 } 71 | Popular Tags |