1 | package org.eclipse.emf.edit.ui.action;↵ | | 1 | package org.eclipse.emf.edit.ui.action;↵
|
|
|
2 | import java.util.Collection;↵ | | 2 | import java.util.Collection;↵
|
|
3 | import org.eclipse.ui.IEditorPart;↵ | | 3 | import org.eclipse.ui.IEditorPart;↵
|
4 | import org.eclipse.ui.IWorkbenchPart;↵ | | 4 | import org.eclipse.ui.IWorkbenchPart;↵
|
|
5 | import org.eclipse.emf.common.command.Command;↵ | | 5 | import org.eclipse.emf.common.command.Command;↵
|
6 | import org.eclipse.emf.edit.command.CopyToClipboardCommand;↵ | | 6 | import org.eclipse.emf.edit.command.CutToClipboardCommand;↵
|
7 | import org.eclipse.emf.edit.domain.EditingDomain;↵ | | 7 | import org.eclipse.emf.edit.domain.EditingDomain;↵
|
8 | import org.eclipse.emf.edit.domain.IEditingDomainProvider;↵ | | 8 | import org.eclipse.emf.edit.domain.IEditingDomainProvider;↵
|
9 | import org.eclipse.emf.edit.ui.EMFEditUIPlugin;↵ | | 9 | import org.eclipse.emf.edit.ui.EMFEditUIPlugin;↵
|
|
|
10 | /**↵ | | 10 | /**↵
|
11 | * A copy action is implemented by creating a {@link CopyToClipboardCommand}.↵ | | 11 | * A cut action is implemented by creating a {@link CutToClipboardCommand}.↵
|
12 | */↵ | | 12 | */↵
|
13 | public class CopyAction extends CommandActionHandler↵ | | 13 | public class CutAction extends CommandActionHandler↵
|
14 | {↵ | | 14 | {↵
|
15 | public CopyAction(EditingDomain domain)↵ | | 15 | public CutAction(EditingDomain domain)↵
|
16 | {↵ | | 16 | {↵
|
17 | super(domain, EMFEditUIPlugin.INSTANCE.getString("_UI_Copy_menu_item"));↵ | | 17 | super(domain, EMFEditUIPlugin.INSTANCE.getString("_UI_Cut_menu_item"));↵
|
18 | }↵ | | 18 | }↵
|
|
19 | public CopyAction()↵ | | 19 | public CutAction()↵
|
20 | {↵ | | 20 | {↵
|
21 | super(null, EMFEditUIPlugin.INSTANCE.getString("_UI_Copy_menu_item"));↵ | | 21 | super(null, EMFEditUIPlugin.INSTANCE.getString("_UI_Cut_menu_item"));↵
|
22 | }↵ | | 22 | }↵
|
|
23 | @Override↵ | | 23 | @Override↵
|
24 | public Command createCommand(Collection<?> selection)↵ | | 24 | public Command createCommand(Collection<?> selection)↵
|
25 | {↵ | | 25 | {↵
|
26 | return CopyToClipboardCommand.create(domain, selection);↵ | | 26 | return CutToClipboardCommand.create(domain, selection);↵
|
27 | }↵ | | 27 | }↵
|
|
28 | /**↵ | | 28 | /**↵
|
29 | * @deprecated As of EMF 2.1.0, replaced by {@link #setActiveWorkbenchPart}.↵ | | 29 | * @deprecated As of EMF 2.1.0, replaced by {@link #setActiveWorkbenchPart}.↵
|
30 | */↵ | | 30 | */↵
|
31 | @Deprecated↵ | | 31 | @Deprecated↵
|
32 | public void setActiveEditor(IEditorPart editorPart)↵ | | 32 | public void setActiveEditor(IEditorPart editorPart)↵
|
33 | {↵ | | 33 | {↵
|
34 | setActiveWorkbenchPart(editorPart);↵ | | 34 | setActiveWorkbenchPart(editorPart);↵
|
35 | }↵ | | 35 | }↵
|
|
36 | /**↵ | | 36 | /**↵
|
37 | * @since 2.1.0↵ | | 37 | * @since 2.1.0↵
|
38 | */↵ | | 38 | */↵
|
39 | public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)↵ | | 39 | public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)↵
|
40 | {↵ | | 40 | {↵
|
41 | if (workbenchPart instanceof IEditingDomainProvider)↵ | | 41 | if (workbenchPart instanceof IEditingDomainProvider)↵
|
42 | {↵ | | 42 | {↵
|
43 | domain = ((IEditingDomainProvider)workbenchPart).getEditingDomain();↵ | | 43 | domain = ((IEditingDomainProvider)workbenchPart).getEditingDomain();↵
|
44 | }↵ | | 44 | }↵
|
45 | }↵ | | 45 | }↵
|
46 | } | | 46 | }
|