Package org.eclipse.emf.transaction

Examples of org.eclipse.emf.transaction.RecordingCommand


  }

  public void save() {
    TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(resource);
    if (domain != null) {
      domain.getCommandStack().execute(new RecordingCommand(domain) {
        @Override
        protected void doExecute() {
          saveResource();
        }
      });
View Full Code Here


        }
      } catch (IOException e) {
        Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
        ErrorUtils.showErrorWithLogging(status);
      }
      basicCommandStack.execute(new RecordingCommand(getEditingDomain()) {

        @Override
        protected void doExecute() {
          importDiagram();
        }
View Full Code Here

    final TransactionalEditingDomain domain = tempDomain;
   
    //open a command do allow undo of all command in one undo
   

    RecordingCommand CompleteCMD = new RecordingCommand(domain) {
 
      protected void doExecute() {     

        //get top package
        org.eclipse.uml2.uml.Package topPackage = UmlElement.getNearestPackage();
       
        while (topPackage.getOwner() instanceof Package){
          topPackage = (Package)topPackage.getOwner();
          //recursively take nearest package until reaching the top
        }
       
        final org.eclipse.uml2.uml.Package finalTopPackage = topPackage;
       
        //test the presence of the "ProxyRequirement" Package
       
        Package proxyPackage = (Package)topPackage.getPackagedElement(PROXY_PACKAGE_NAME);
       
        //test if already present, if not need creation
       
        if (proxyPackage == null){
          //means that the package have to be created
         
          RecordingCommand PackCMD = new RecordingCommand(domain) {
           
            @Override
            protected void doExecute() {
              org.eclipse.uml2.uml.Package tempPackage = UMLFactory.eINSTANCE.createPackage();
              tempPackage.setName(PROXY_PACKAGE_NAME);
              finalTopPackage.getPackagedElements().add(tempPackage);
            }
          };
         
          domain.getCommandStack().execute(PackCMD);
         
        }
       
        final Package finalProxyPackage = (Package)topPackage.getPackagedElement(PROXY_PACKAGE_NAME);
       
        RecordingCommand ReqCMD = new RequirementCreateCommand(domain, finalProxyPackage, requirement.getIdentifier(), requirement.getDesc());
       
        domain.getCommandStack().execute(ReqCMD);
       
        org.eclipse.uml2.uml.Class proxyreq = (org.eclipse.uml2.uml.Class)finalProxyPackage.getPackagedElement(requirement.getIdentifier());
       
        RecordingCommand SatCMD = new SatisfyCreateCommand(domain, (NamedElement)UmlElement, (NamedElement)proxyreq, trace.getIdentifier());
       
        domain.getCommandStack().execute(SatCMD);
   
        System.out.println("Link between");
        System.out.println("  Requirement: " + requirement);
View Full Code Here

        BasicCommandStack basicCommandStack = (BasicCommandStack) getEditingDomain().getCommandStack();

        if (input instanceof DiagramEditorInput) {

          basicCommandStack.execute(new RecordingCommand(getEditingDomain()) {

            @Override
            protected void doExecute() {
              importDiagram(model);
            }
View Full Code Here

  private void importDiagram(final Bpmn2MemoryModel model) {
    final Diagram diagram = getDiagramTypeProvider().getDiagram();
    diagram.setActive(true);

    getEditingDomain().getCommandStack().execute(new RecordingCommand(getEditingDomain()) {

      @Override
      protected void doExecute() {

        if (model.getBpmnModel().getPools().size() > 0) {
View Full Code Here

    }

    // Create a resource for this file.
    final Resource resource = resourceSet.createResource(diagramResourceUri);
    final CommandStack commandStack = editingDomain.getCommandStack();
    commandStack.execute(new RecordingCommand(editingDomain) {

      @Override
      protected void doExecute() {
        resource.setTrackingModification(true);
View Full Code Here

  private static final String ID_PATTERN = "%s%s";

  public static void runModelChange(final Runnable runnable, final TransactionalEditingDomain editingDomain, final String label) {

    editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain, label) {

      protected void doExecute() {
        runnable.run();
      }
    });
View Full Code Here

TOP

Related Classes of org.eclipse.emf.transaction.RecordingCommand

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.