1 17 package org.eclipse.emf.edit.ui.action; 18 19 20 import java.util.Collection ; 21 22 import org.eclipse.jface.viewers.ISelection; 23 import org.eclipse.ui.IEditorPart; 24 import org.eclipse.ui.IWorkbenchPart; 25 26 import org.eclipse.emf.common.command.Command; 27 import org.eclipse.emf.common.command.UnexecutableCommand; 28 import org.eclipse.emf.edit.command.CreateChildCommand; 29 import org.eclipse.emf.edit.domain.EditingDomain; 30 31 32 36 public class CreateSiblingAction extends StaticSelectionCommandAction 37 { 38 41 protected Object descriptor; 42 43 48 public CreateSiblingAction(IWorkbenchPart workbenchPart, ISelection selection, 49 Object descriptor) 50 { 51 super(workbenchPart); 52 this.descriptor = descriptor; 53 configureAction(selection); 54 } 55 56 61 public CreateSiblingAction(IEditorPart editorPart, ISelection selection, 62 Object descriptor) 63 { 64 this((IWorkbenchPart)editorPart, selection, descriptor); 65 } 66 67 71 protected Command createActionCommand(EditingDomain editingDomain, 72 Collection collection) 73 { 74 if (collection.size() == 1) 75 { 76 return CreateChildCommand.create(editingDomain, null, 77 descriptor, collection); 78 } 79 return UnexecutableCommand.INSTANCE; 80 } 81 } 82 | Popular Tags |