Package org.eclipse.gmf.runtime.common.core.command

Examples of org.eclipse.gmf.runtime.common.core.command.ICommand


  /**
   * @generated
   */
  protected ICommand getInsteadCommand(IEditCommandRequest req) {
    ICommand epCommand = (ICommand) req.getParameter(EDIT_POLICY_COMMAND);
    req.setParameter(EDIT_POLICY_COMMAND, null);
    ICommand ehCommand = super.getInsteadCommand(req);
    if (epCommand == null) {
      return ehCommand;
    }
    if (ehCommand == null) {
      return epCommand;
View Full Code Here


      elementType = null;
    }
    Command semanticCommand = getSemanticCommandSwitch(completedRequest);
    if (elementType != null) {
      if (semanticCommand != null) {
        ICommand command = semanticCommand instanceof ICommandProxy ? ((ICommandProxy) semanticCommand)
            .getICommand()
            : new CommandProxy(semanticCommand);
        completedRequest
            .setParameter(
                OntoUML.diagram.edit.helpers.OntoUMLBaseEditHelper.EDIT_POLICY_COMMAND,
                command);
      }
      ICommand command = elementType.getEditCommand(completedRequest);
      if (command != null) {
        if (!(command instanceof CompositeTransactionalCommand)) {
          TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost())
              .getEditingDomain();
          command = new CompositeTransactionalCommand(editingDomain,
              command.getLabel()).compose(command);
        }
        semanticCommand = new ICommandProxy(command);
      }
    }
    boolean shouldProceed = true;
View Full Code Here

   */
  public void deleteOtherElements(final IGraphicalEditPart diagramEditPart) {
    if (editingDomain == null)
      throw new RuntimeException("Cannot delete related elements; we do not have an editing domain.");
   
    ICommand command = new AbstractTransactionalCommand(editingDomain, "delete related elements", Collections.EMPTY_LIST) {

      @Override
      protected CommandResult doExecuteWithResult(
          IProgressMonitor monitor, IAdaptable info)
          throws ExecutionException {
       
        try {
          // we don't want to just delete related elements;
          // we want to delete _all_ elements
          for (GeneratedElement selected : selectedElements) {
            EcoreCreateElementsHelper helper = new EmfInferenceHandler(
                editingDomain,
                Collections.EMPTY_LIST,
                monitor,
                info,
                selected.eResource() );
           
            // get all elements to delete
            List<EObject> toDelete = new GeneratedElementDeleter(selected).getElementsToDelete();
           
            for (EObject d : toDelete) {
              deleteElement(helper, d, monitor, info, diagramEditPart);
            }
          }
         
          if (diagramEditPart != null)
            diagramEditPart.refresh();
        } catch (InferenceException e) {
          throw new ExecutionException(e.getMessage(), e);
        }
       
        return CommandResult.newOKCommandResult();
      }

    };
   
    try {
      command.execute(new NullProgressMonitor(), null);
    } catch (ExecutionException e) {
      throw new RuntimeException(e.getMessage(), e);
    }
   
  }
View Full Code Here

  /**
   * @generated
   */
  protected ICommand getInsteadCommand(IEditCommandRequest req) {
    ICommand epCommand = (ICommand) req.getParameter(EDIT_POLICY_COMMAND);
    req.setParameter(EDIT_POLICY_COMMAND, null);
    ICommand ehCommand = super.getInsteadCommand(req);
    if (epCommand == null) {
      return ehCommand;
    }
    if (ehCommand == null) {
      return epCommand;
View Full Code Here

  /**
   * @generated
   */
  protected ICommand getInsteadCommand(IEditCommandRequest req) {
    ICommand epCommand = (ICommand) req.getParameter(EDIT_POLICY_COMMAND);
    req.setParameter(EDIT_POLICY_COMMAND, null);
    ICommand ehCommand = super.getInsteadCommand(req);
    if (epCommand == null) {
      return ehCommand;
    }
    if (ehCommand == null) {
      return epCommand;
View Full Code Here

    ConfigureRequest configureRequest = new ConfigureRequest(
        getEditingDomain(), newElement, elementType);
    configureRequest.setClientContext(((CreateElementRequest) getRequest())
        .getClientContext());
    configureRequest.addParameters(getRequest().getParameters());
    ICommand configureCommand = elementType
        .getEditCommand(configureRequest);
    if (configureCommand != null && configureCommand.canExecute()) {
      configureCommand.execute(monitor, info);
    }
  }
View Full Code Here

   * @generated
   */
  private Command getEditHelperCommand(IEditCommandRequest request,
      Command editPolicyCommand) {
    if (editPolicyCommand != null) {
      ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy) editPolicyCommand)
          .getICommand()
          : new CommandProxy(editPolicyCommand);
      request
          .setParameter(
              eu.admire.visual.pmml.treemodel._40.diagram.edit.helpers.PMMLBaseEditHelper.EDIT_POLICY_COMMAND,
              command);
    }
    IElementType requestContextElementType = getContextElementType(request);
    request
        .setParameter(
            eu.admire.visual.pmml.treemodel._40.diagram.edit.helpers.PMMLBaseEditHelper.CONTEXT_ELEMENT_TYPE,
            requestContextElementType);
    ICommand command = requestContextElementType.getEditCommand(request);
    request
        .setParameter(
            eu.admire.visual.pmml.treemodel._40.diagram.edit.helpers.PMMLBaseEditHelper.EDIT_POLICY_COMMAND,
            null);
    request
        .setParameter(
            eu.admire.visual.pmml.treemodel._40.diagram.edit.helpers.PMMLBaseEditHelper.CONTEXT_ELEMENT_TYPE,
            null);
    if (command != null) {
      if (!(command instanceof CompositeTransactionalCommand)) {
        command = new CompositeTransactionalCommand(getEditingDomain(),
            command.getLabel()).compose(command);
      }
      return new ICommandProxy(command);
    }
    return editPolicyCommand;
  }
View Full Code Here

    ConfigureRequest configureRequest = new ConfigureRequest(
        getEditingDomain(), newElement, elementType);
    configureRequest.setClientContext(((CreateElementRequest) getRequest())
        .getClientContext());
    configureRequest.addParameters(getRequest().getParameters());
    ICommand configureCommand = elementType
        .getEditCommand(configureRequest);
    if (configureCommand != null && configureCommand.canExecute()) {
      configureCommand.execute(monitor, info);
    }
  }
View Full Code Here

    ConfigureRequest configureRequest = new ConfigureRequest(
        getEditingDomain(), newElement, elementType);
    configureRequest.setClientContext(((CreateElementRequest) getRequest())
        .getClientContext());
    configureRequest.addParameters(getRequest().getParameters());
    ICommand configureCommand = elementType
        .getEditCommand(configureRequest);
    if (configureCommand != null && configureCommand.canExecute()) {
      configureCommand.execute(monitor, info);
    }
  }
View Full Code Here

    ConfigureRequest configureRequest = new ConfigureRequest(
        getEditingDomain(), newElement, elementType);
    configureRequest.setClientContext(((CreateElementRequest) getRequest())
        .getClientContext());
    configureRequest.addParameters(getRequest().getParameters());
    ICommand configureCommand = elementType
        .getEditCommand(configureRequest);
    if (configureCommand != null && configureCommand.canExecute()) {
      configureCommand.execute(monitor, info);
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.gmf.runtime.common.core.command.ICommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.