@Override protected ICommand getDestroyElementCommand(DestroyElementRequest req) { EObject container = req.getElementToDestroy().eContainer(); boolean condition = !(container instanceof QueuedUnit) || container == null; condition &= !(container instanceof FilterUnit); return new CustomDestroyElementCommand(req, (Port) req.getElementToDestroy(), condition); }
/** @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null); cmd.setTransactionNestingEnabled(true); List<EObject> todestroy = new ArrayList<EObject>(); todestroy.add(req.getElementToDestroy()); // cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req)); cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy))); return getGEFWrapper(cmd.reduce()); // return getGEFWrapper(new // org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req)); }
@Override protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { parentTreeNodeEditPart.getParent().refresh(); final List<IGraphicalEditPart> treeChildren = TreeLayoutUtil.getOrderedTreeChildren(parentTreeNodeEditPart); treeChildren.remove(UIUtils.getEditPart(request.getElementToDestroy())); TreeLayoutUtil.setTreeNodesPositionAnnotation(TreeLayoutUtil.getViews(treeChildren)); return CommandResult.newOKCommandResult(); }
/** @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { EObject selectedEObject = req.getElementToDestroy(); IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); if (provider != null) { // Retrieve delete command from the Element Edit service ICommand deleteCommand = provider.getEditCommand(req); if (deleteCommand != null) { return new ICommandProxy(deleteCommand); } } return UnexecutableCommand.INSTANCE; }
/** @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { View view = (View) getHost().getModel(); CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null); cmd.setTransactionNestingEnabled(true); 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 List<EObject> todestroy = new ArrayList<EObject>(); todestroy.add(req.getElementToDestroy()); // cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req)); cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy))); } else { cmd.add( new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand( getEditingDomain(), view)); } return getGEFWrapper(cmd.reduce()); }