コード例 #1
0
 @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);
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 /** @generated */
 protected Command getDestroyElementCommand(DestroyElementRequest req) {
   CompoundCommand cc = getDestroyEdgesCommand();
   addDestroyShortcutsCommand(cc);
   View view = (View) getHost().getModel();
   if (view.getEAnnotation("Shortcut") != null) { // $NON-NLS-1$
     req.setElementToDestroy(view);
   }
   cc.add(getGEFWrapper(new DestroyElementCommand(req)));
   return cc.unwrap();
 }
コード例 #4
0
 /** @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));
 }
コード例 #5
0
  @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());
 }