/** * Brand new AppendNewAction action object. * * @param editor * @param aFactory * @param label */ public AppendNewAction(IWorkbenchPart editor, AbstractUIObjectFactory aFactory, String label) { super(editor); this.factory = aFactory; cachedInstance = factory.getNewObject(); setId(calculateID()); setText(label); setToolTipText(NLS.bind(Messages.AppendNewAction_Add_a_1, (new Object[] {getText()}))); setImageDescriptor(factory.getSmallImageDescriptor()); }
/** * Return the create command. * * @return the create command for add the new activity. */ public Command getCreateCommand() { if (fSelection == null) { return null; } CompoundCommand compoundCmd = new CompoundCommand(); BPELEditor bpelEditor = (BPELEditor) getWorkbenchPart(); EditPartViewer viewer = bpelEditor.getGraphicalViewer(); EObject model = (EObject) factory.getNewObject(); compoundCmd.add(new InsertInContainerCommand(fSelection, model, null)); compoundCmd.add(new SetSelectionCommand(fSelection, true)); compoundCmd.add(new SetSelectionCommand(model, false)); compoundCmd.add(new SetNameAndDirectEditCommand(model, viewer)); return compoundCmd; }