Package org.eclipse.gmf.runtime.emf.commands.core.command

Examples of org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand


      final Resource newResource = diagramDocument.getEditingDomain()
          .getResourceSet().createResource(newResoruceURI);
      final Diagram diagramCopy = (Diagram) EcoreUtil
          .copy(diagramDocument.getDiagram());
      try {
        new AbstractTransactionalCommand(
            diagramDocument.getEditingDomain(),
            NLS
                .bind(
                    OntoUML.diagram.part.Messages.OntoUMLDocumentProvider_SaveAsOperation,
                    diagramCopy.getName()), affectedFiles) {
View Full Code Here


        .append(myFileCreationPage.getFileName());
    URI diagramModelURI = URI.createFileURI(diagramModelPath.toString());
    ResourceSet resourceSet = myEditingDomain.getResourceSet();
    final Resource diagramResource = resourceSet
        .createResource(diagramModelURI);
    AbstractTransactionalCommand command = new AbstractTransactionalCommand(
        myEditingDomain,
        OntoUML.diagram.part.Messages.OntoUMLNewDiagramFileWizard_InitDiagramCommand,
        affectedFiles) {

      protected CommandResult doExecuteWithResult(
View Full Code Here

    final Resource diagramResource = editingDomain.getResourceSet()
        .createResource(diagramURI);
    final Resource modelResource = editingDomain.getResourceSet()
        .createResource(modelURI);
    final String diagramName = diagramURI.lastSegment();
    AbstractTransactionalCommand command = new AbstractTransactionalCommand(
        editingDomain,
        OntoUML.diagram.part.Messages.OntoUMLDiagramEditorUtil_CreateDiagramCommandLabel,
        Collections.EMPTY_LIST) {
      protected CommandResult doExecuteWithResult(
          IProgressMonitor monitor, IAdaptable info)
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

      IRunnableWithProgress op = new WorkspaceModifyOperation(null) {

        protected void execute(IProgressMonitor monitor)
            throws CoreException, InterruptedException {

          AbstractTransactionalCommand command = new AbstractTransactionalCommand(
              domain,
              "Move into separate model file",
              Collections.EMPTY_LIST /* TODO make this select the correct affected files */) {

            @Override
            protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
                IAdaptable info) throws ExecutionException {

              Resource modelResource = domain.getResourceSet().createResource(modelPage.getURI());
              modelResource.getContents().add(object);
              try {
                modelResource.save(org.openiaml.model.diagram.part.IamlDiagramEditorUtil
                    .getSaveOptions());
              } catch (IOException e) {
                return CommandResult.newErrorCommandResult(e);
              }

              return CommandResult.newOKCommandResult();
            }
          };

          try {
            IStatus result = command.execute(new NullProgressMonitor(), null);
            if (!result.isOK()) {
              logStatus(result);
            }
          } catch (ExecutionException e) {
            throw new RuntimeException(e);
View Full Code Here

    List<Object> affectedFiles = new LinkedList<Object>();
    affectedFiles.add(diagramFile);
    TransactionalEditingDomain myEditingDomain = GMFEditingDomainFactory.INSTANCE
      .createEditingDomain();
   
    AbstractTransactionalCommand command = new AbstractTransactionalCommand(
        myEditingDomain,
        options.initMessage,
        affectedFiles) {

      @Override
View Full Code Here

    final Resource diagramResource = editingDomain.getResourceSet()
        .createResource(diagramURI);
    final Resource modelResource = editingDomain.getResourceSet()
        .createResource(modelURI);
    final String diagramName = diagramURI.lastSegment();
    AbstractTransactionalCommand command = new AbstractTransactionalCommand(
        editingDomain,
        Messages.DispelDiagramEditorUtil_CreateDiagramCommandLabel,
        Collections.EMPTY_LIST) {
      protected CommandResult doExecuteWithResult(
          IProgressMonitor monitor, IAdaptable info)
View Full Code Here

    final Resource diagramResource = editingDomain.getResourceSet()
        .createResource(diagramURI);
    final Resource modelResource = editingDomain.getResourceSet()
        .createResource(modelURI);
    final String diagramName = diagramURI.lastSegment();
    AbstractTransactionalCommand command = new AbstractTransactionalCommand(
        editingDomain,
        eu.admire.visual.pmml.treemodel._40.diagram.part.Messages.PMMLDiagramEditorUtil_CreateDiagramCommandLabel,
        Collections.EMPTY_LIST) {
      protected CommandResult doExecuteWithResult(
          IProgressMonitor monitor, IAdaptable info)
View Full Code Here

      final Resource newResource = diagramDocument.getEditingDomain()
          .getResourceSet().createResource(newResoruceURI);
      final Diagram diagramCopy = (Diagram) EcoreUtil
          .copy(diagramDocument.getDiagram());
      try {
        new AbstractTransactionalCommand(
            diagramDocument.getEditingDomain(),
            NLS.bind(
                Messages.DispelDocumentProvider_SaveAsOperation,
                diagramCopy.getName()), affectedFiles) {
          protected CommandResult doExecuteWithResult(
View Full Code Here

    URI diagramModelURI = URI.createPlatformResourceURI(diagramFile
        .getFullPath().toString(), true);

    final Resource diagramResource = resourceSet
        .createResource(diagramModelURI);
    AbstractTransactionalCommand command = new AbstractTransactionalCommand(
        editingDomain,
        "Initializing Diagram",
        affectedFiles) {

      protected CommandResult doExecuteWithResult(
View Full Code Here

TOP

Related Classes of org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand

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.