/** @see org.eclipse.gef.commands.Command#execute() */ public void execute() { oldSource.removeOutput(transition); oldTarget.removeInput(transition); parent.addChild(newActivity); newIncomingTransition = new Transition(oldSource, newActivity); newOutgoingTransition = new Transition(newActivity, oldTarget); }
/** @see org.eclipse.gef.commands.Command#undo() */ public void undo() { oldSource.removeOutput(newIncomingTransition); oldTarget.removeInput(newOutgoingTransition); newActivity.removeInput(newIncomingTransition); newActivity.removeOutput(newOutgoingTransition); parent.removeChild(newActivity); oldSource.addOutput(transition); oldTarget.addInput(transition); }
/** * Sets the Activity to be added. * * @param activity the new activity */ public void setNewActivity(Activity activity) { newActivity = activity; newActivity.setName("a " + (parent.getChildren().size() + 1)); }