org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest Java Examples
The following examples show how to use
org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TypeItemSemanticEditPolicy.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ private void addDestroyChildNodesCommand(ICompositeCommand cmd) { View view = (View) getHost().getModel(); for (Iterator<?> nit = view.getChildren().iterator(); nit.hasNext();) { Node node = (Node) nit.next(); switch (CrossflowVisualIDRegistry.getVisualID(node)) { case TypeTypeFieldsCompartmentEditPart.VISUAL_ID: for (Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) { Node cnode = (Node) cit.next(); switch (CrossflowVisualIDRegistry.getVisualID(cnode)) { case Field3EditPart.VISUAL_ID: cmd.add(new DestroyElementCommand( new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true // don't need explicit deletion of cnode as parent's view deletion would clean child views as well // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode)); break; } } break; } } }
Example #2
Source File: MessageFlowFactory.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public static void removeMessageFlow(TransactionalEditingDomain editingDomain, AbstractCatchMessageEvent target, DiagramEditPart dep) { EditPart ep = findEditPart(dep, target); CompositeCommand command = new CompositeCommand("Remove MessageFlows"); for (Object connection : ((AbstractGraphicalEditPart) ep).getTargetConnections()) { if (connection instanceof MessageFlowEditPart) { MessageFlowEditPart connectionPart = (MessageFlowEditPart) connection; MessageFlow flow = (MessageFlow) connectionPart.resolveSemanticElement(); SetCommand c = new SetCommand(editingDomain, flow.getTarget(), ProcessPackage.Literals.ABSTRACT_CATCH_MESSAGE_EVENT__EVENT, null); editingDomain.getCommandStack().execute(c); command.add(new DeleteCommand(editingDomain, connectionPart.getPrimaryView())); DestroyElementRequest req = new DestroyElementRequest(editingDomain, flow, false); DestroyElementCommand rmComd = new DestroyElementCommand(req); command.add(rmComd); } } dep.getDiagramEditDomain().getDiagramCommandStack().execute(new ICommandProxy(command.reduce())); dep.getDiagramEditDomain().getDiagramCommandStack().flush(); dep.refresh(); }
Example #3
Source File: RegionEditHelper.java From statecharts with Eclipse Public License 1.0 | 6 votes |
@Override protected ICommand getBasicDestroyElementCommand(final DestroyElementRequest req) { // Deletion is only allowed if subdiagrams are not opened in another // editor return new DestroyElementCommand(req) { @Override protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { if (getElementToDestroy() instanceof State && getElementToDestroy().eResource() != null) { boolean success = DiagramPartitioningUtil.closeSubdiagramEditors((State) getElementToDestroy()); if (success) return super.doExecute(monitor, info); else return Status.CANCEL_STATUS; } return super.doExecute(monitor, info); } }; }
Example #4
Source File: VertexEditHelper.java From statecharts with Eclipse Public License 1.0 | 6 votes |
@Override protected ICommand getDestroyDependentsCommand(DestroyDependentsRequest req) { Vertex elementToDestroy = (Vertex) req.getElementToDestroy(); EList<Transition> incomingTransitions = elementToDestroy .getIncomingTransitions(); if (incomingTransitions.size() != 0) { CompositeCommand compoundCommand = new CompositeCommand( "Delete vertex"); for (Transition transition : incomingTransitions) { DestroyElementCommand destroyCommand = new DestroyElementCommand( new DestroyElementRequest(transition, false)); compoundCommand.add(destroyCommand); } return compoundCommand; } return super.getDestroyDependentsCommand(req); }
Example #5
Source File: ScriptedTaskItemSemanticEditPolicy.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ private void addDestroyChildNodesCommand(ICompositeCommand cmd) { View view = (View) getHost().getModel(); for (Iterator<?> nit = view.getChildren().iterator(); nit.hasNext();) { Node node = (Node) nit.next(); switch (CrossflowVisualIDRegistry.getVisualID(node)) { case ScriptedTaskScriptedTaskOutputVariablesCompartmentEditPart.VISUAL_ID: for (Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) { Node cnode = (Node) cit.next(); switch (CrossflowVisualIDRegistry.getVisualID(cnode)) { case Field2EditPart.VISUAL_ID: cmd.add(new DestroyElementCommand( new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true // don't need explicit deletion of cnode as parent's view deletion would clean child views as well // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode)); break; } } break; } } }
Example #6
Source File: FieldItemSemanticEditPolicy.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { View view = (View) getHost().getModel(); CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null); cmd.setTransactionNestingEnabled(false); EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ if (annotation == null) { // there are indirectly referenced children, need extra commands: false addDestroyShortcutsCommand(cmd, view); // delete host element cmd.add(new DestroyElementCommand(req)); } else { cmd.add(new DeleteCommand(getEditingDomain(), view)); } return getGEFWrapper(cmd.reduce()); }
Example #7
Source File: Field2ItemSemanticEditPolicy.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { View view = (View) getHost().getModel(); CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null); cmd.setTransactionNestingEnabled(false); EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ if (annotation == null) { // there are indirectly referenced children, need extra commands: false addDestroyShortcutsCommand(cmd, view); // delete host element cmd.add(new DestroyElementCommand(req)); } else { cmd.add(new DeleteCommand(getEditingDomain(), view)); } return getGEFWrapper(cmd.reduce()); }
Example #8
Source File: ParameterItemSemanticEditPolicy.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { View view = (View) getHost().getModel(); CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null); cmd.setTransactionNestingEnabled(false); EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ if (annotation == null) { // there are indirectly referenced children, need extra commands: false addDestroyShortcutsCommand(cmd, view); // delete host element cmd.add(new DestroyElementCommand(req)); } else { cmd.add(new DeleteCommand(getEditingDomain(), view)); } return getGEFWrapper(cmd.reduce()); }
Example #9
Source File: LanguageItemSemanticEditPolicy.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ private void addDestroyChildNodesCommand(ICompositeCommand cmd) { View view = (View) getHost().getModel(); for (Iterator<?> nit = view.getChildren().iterator(); nit.hasNext();) { Node node = (Node) nit.next(); switch (CrossflowVisualIDRegistry.getVisualID(node)) { case LanguageLanguageParametersCompartmentEditPart.VISUAL_ID: for (Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) { Node cnode = (Node) cit.next(); switch (CrossflowVisualIDRegistry.getVisualID(cnode)) { case ParameterEditPart.VISUAL_ID: cmd.add(new DestroyElementCommand( new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true // don't need explicit deletion of cnode as parent's view deletion would clean child views as well // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode)); break; } } break; } } }
Example #10
Source File: LanguageItemSemanticEditPolicy.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { View view = (View) getHost().getModel(); CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null); cmd.setTransactionNestingEnabled(false); EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ if (annotation == null) { // there are indirectly referenced children, need extra commands: false addDestroyChildNodesCommand(cmd); addDestroyShortcutsCommand(cmd, view); // delete host element cmd.add(new DestroyElementCommand(req)); } else { cmd.add(new DeleteCommand(getEditingDomain(), view)); } return getGEFWrapper(cmd.reduce()); }
Example #11
Source File: Field3ItemSemanticEditPolicy.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { View view = (View) getHost().getModel(); CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null); cmd.setTransactionNestingEnabled(false); EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ if (annotation == null) { // there are indirectly referenced children, need extra commands: false addDestroyShortcutsCommand(cmd, view); // delete host element cmd.add(new DestroyElementCommand(req)); } else { cmd.add(new DeleteCommand(getEditingDomain(), view)); } return getGEFWrapper(cmd.reduce()); }
Example #12
Source File: CrossflowBaseItemSemanticEditPolicy.java From scava with Eclipse Public License 2.0 | 5 votes |
/** * @generated */ protected Command getSemanticCommandSwitch(IEditCommandRequest req) { if (req instanceof CreateRelationshipRequest) { return getCreateRelationshipCommand((CreateRelationshipRequest) req); } else if (req instanceof CreateElementRequest) { return getCreateCommand((CreateElementRequest) req); } else if (req instanceof ConfigureRequest) { return getConfigureCommand((ConfigureRequest) req); } else if (req instanceof DestroyElementRequest) { return getDestroyElementCommand((DestroyElementRequest) req); } else if (req instanceof DestroyReferenceRequest) { return getDestroyReferenceCommand((DestroyReferenceRequest) req); } else if (req instanceof DuplicateElementsRequest) { return getDuplicateCommand((DuplicateElementsRequest) req); } else if (req instanceof GetEditContextRequest) { return getEditContextCommand((GetEditContextRequest) req); } else if (req instanceof MoveRequest) { return getMoveCommand((MoveRequest) req); } else if (req instanceof ReorientReferenceRelationshipRequest) { return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req); } else if (req instanceof ReorientRelationshipRequest) { return getReorientRelationshipCommand((ReorientRelationshipRequest) req); } else if (req instanceof SetRequest) { return getSetCommand((SetRequest) req); } return null; }
Example #13
Source File: UpdateAnnotationsOnDestroyElementCommand.java From statecharts with Eclipse Public License 1.0 | 5 votes |
public UpdateAnnotationsOnDestroyElementCommand( DestroyElementRequest request, IGraphicalEditPart parentTreeNodeEditPart) { super(request.getEditingDomain(), request.getLabel(), null); Assert.isNotNull(request, "request is null."); Assert.isNotNull(parentTreeNodeEditPart, "parentTreeNodeEditPart is null."); this.request = request; this.parentTreeNodeEditPart = parentTreeNodeEditPart; }
Example #14
Source File: PoolItemSemanticEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { View view = (View) getHost().getModel(); CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null); cmd.setTransactionNestingEnabled(false); for (Iterator<?> it = view.getTargetEdges().iterator(); it.hasNext();) { Edge incomingLink = (Edge) it.next(); if (ProcessVisualIDRegistry.getVisualID(incomingLink) == TextAnnotationAttachmentEditPart.VISUAL_ID) { DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false); cmd.add(new DestroyElementCommand(r)); cmd.add(new DeleteCommand(getEditingDomain(), incomingLink)); continue; } } EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ if (annotation == null) { // there are indirectly referenced children, need extra commands: false addDestroyChildNodesCommand(cmd); addDestroyShortcutsCommand(cmd, view); // delete host element cmd.add(new DestroyElementCommand(req)); } else { cmd.add(new DeleteCommand(getEditingDomain(), view)); } final EObject pool = req.getElementToDestroy(); if (pool instanceof Pool) { for (MessageFlow f : ModelHelper.getMainProcess(pool).getMessageConnections()) { if (pool.equals(ModelHelper.getParentProcess(f.getSource()))) { cmd.add(new DestroyElementCommand(new DestroyElementRequest(f, false))); } } } return getGEFWrapper(cmd.reduce()); }
Example #15
Source File: SubProcessEvent2ItemSemanticEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { View view = (View) getHost().getModel(); CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null); cmd.setTransactionNestingEnabled(false); for (Iterator<?> it = view.getTargetEdges().iterator(); it.hasNext();) { Edge incomingLink = (Edge) it.next(); if (ProcessVisualIDRegistry.getVisualID(incomingLink) == TextAnnotationAttachmentEditPart.VISUAL_ID) { DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false); cmd.add(new DestroyElementCommand(r)); cmd.add(new DeleteCommand(getEditingDomain(), incomingLink)); continue; } } EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ if (annotation == null) { // there are indirectly referenced children, need extra commands: false addDestroyChildNodesCommand(cmd); addDestroyShortcutsCommand(cmd, view); // delete host element cmd.add(new DestroyElementCommand(req)); } else { cmd.add(new DeleteCommand(getEditingDomain(), view)); } final EObject pool = req.getElementToDestroy(); if (pool instanceof Pool) { for (MessageFlow f : ModelHelper.getMainProcess(pool).getMessageConnections()) { if (pool.equals(ModelHelper.getParentProcess(f.getSource()))) { cmd.add(new DestroyElementCommand(new DestroyElementRequest(f, false))); } } } return getGEFWrapper(cmd.reduce()); }
Example #16
Source File: LaneItemSemanticEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { View view = (View) getHost().getModel(); CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null); cmd.setTransactionNestingEnabled(false); for (Iterator<?> it = view.getTargetEdges().iterator(); it.hasNext();) { Edge incomingLink = (Edge) it.next(); if (ProcessVisualIDRegistry.getVisualID(incomingLink) == TextAnnotationAttachmentEditPart.VISUAL_ID) { DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false); cmd.add(new DestroyElementCommand(r)); cmd.add(new DeleteCommand(getEditingDomain(), incomingLink)); continue; } } EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ if (annotation == null) { // there are indirectly referenced children, need extra commands: false addDestroyChildNodesCommand(cmd); addDestroyShortcutsCommand(cmd, view); // delete host element cmd.add(new DestroyElementCommand(req)); } else { cmd.add(new DeleteCommand(getEditingDomain(), view)); } final EObject pool = req.getElementToDestroy(); if (pool instanceof Pool) { for (MessageFlow f : ModelHelper.getMainProcess(pool).getMessageConnections()) { if (pool.equals(ModelHelper.getParentProcess(f.getSource()))) { cmd.add(new DestroyElementCommand(new DestroyElementRequest(f, false))); } } } return getGEFWrapper(cmd.reduce()); }
Example #17
Source File: SubProcessEventItemSemanticEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { View view = (View) getHost().getModel(); CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null); cmd.setTransactionNestingEnabled(false); for (Iterator<?> it = view.getTargetEdges().iterator(); it.hasNext();) { Edge incomingLink = (Edge) it.next(); if (ProcessVisualIDRegistry.getVisualID(incomingLink) == TextAnnotationAttachmentEditPart.VISUAL_ID) { DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false); cmd.add(new DestroyElementCommand(r)); cmd.add(new DeleteCommand(getEditingDomain(), incomingLink)); continue; } } EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ if (annotation == null) { // there are indirectly referenced children, need extra commands: false addDestroyChildNodesCommand(cmd); addDestroyShortcutsCommand(cmd, view); // delete host element cmd.add(new DestroyElementCommand(req)); } else { cmd.add(new DeleteCommand(getEditingDomain(), view)); } final EObject pool = req.getElementToDestroy(); if (pool instanceof Pool) { for (MessageFlow f : ModelHelper.getMainProcess(pool).getMessageConnections()) { if (pool.equals(ModelHelper.getParentProcess(f.getSource()))) { cmd.add(new DestroyElementCommand(new DestroyElementRequest(f, false))); } } } return getGEFWrapper(cmd.reduce()); }
Example #18
Source File: ProcessBaseItemSemanticEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected Command getSemanticCommandSwitch(IEditCommandRequest req) { if (req instanceof CreateRelationshipRequest) { return getCreateRelationshipCommand((CreateRelationshipRequest) req); } else if (req instanceof CreateElementRequest) { return getCreateCommand((CreateElementRequest) req); } else if (req instanceof ConfigureRequest) { return getConfigureCommand((ConfigureRequest) req); } else if (req instanceof DestroyElementRequest) { return getDestroyElementCommand((DestroyElementRequest) req); } else if (req instanceof DestroyReferenceRequest) { return getDestroyReferenceCommand((DestroyReferenceRequest) req); } else if (req instanceof DuplicateElementsRequest) { return getDuplicateCommand((DuplicateElementsRequest) req); } else if (req instanceof GetEditContextRequest) { return getEditContextCommand((GetEditContextRequest) req); } else if (req instanceof MoveRequest) { return getMoveCommand((MoveRequest) req); } else if (req instanceof ReorientReferenceRelationshipRequest) { return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req); } else if (req instanceof ReorientRelationshipRequest) { return getReorientRelationshipCommand((ReorientRelationshipRequest) req); } else if (req instanceof SetRequest) { return getSetCommand((SetRequest) req); } return null; }
Example #19
Source File: CrossflowBaseItemSemanticEditPolicy.java From scava with Eclipse Public License 2.0 | 4 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { return null; }
Example #20
Source File: MessageFlowItemSemanticEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { return getGEFWrapper(new DestroyElementCommand(req)); }
Example #21
Source File: SequenceFlowItemSemanticEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { return getGEFWrapper(new DestroyElementCommand(req)); }
Example #22
Source File: TextAnnotationAttachmentItemSemanticEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { return getGEFWrapper(new DestroyElementCommand(req)); }
Example #23
Source File: ProcessBaseItemSemanticEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { return null; }