Package org.openiaml.model.diagram.helpers

Examples of org.openiaml.model.diagram.helpers.GeneratedElementHandler


      // find elements to delete
      monitor.subTask("Identifying contained elements");
      List<GeneratedElement> result = getElementsToDelete(container);
      monitor.worked(1);
     
      GeneratedElementHandler handler = new GeneratedElementHandler(result, domain);
      if (handler.needsConfirmation()) {
        for (EObject element : handler.getConfirmationElements()) {

          final String title = "Generated element is in use";
          final String message = handler.getConfirmationMessage(element) +
            "\n\nDo you wish to continue deleting the selected elements?";
          final QuestionDialogResult answer = new QuestionDialogResult();
         
          Display.getDefault().syncExec(new Runnable() {
              @Override
              public void run() {
                answer.setResult(MessageDialog.openConfirm(null, title, message));
              }
            });

          // if we cancel, we cancel early
          if (!answer.getResult())
            return false;
        }
      }
     
      monitor.subTask("Deleting related elements");
      // delete all related elements
      handler.deleteOtherElements(diagramEditPart);
      monitor.worked(1);
     
      monitor.subTask("Deleting actual elements");
      for (GeneratedElement actual : result) {
        handler.deleteElement(this.handler, actual, monitor, null, diagramEditPart);
      }
     
      monitor.done();     
      return true;
View Full Code Here


    // there should be six children
    assertEditorHasChildren(6, editor_page);
    ShapeNodeEditPart target = assertHasInputTextField(editor_page, "target", false);
    assertGenerated(target);

    GeneratedElementHandler handler = new GeneratedElementHandler(target);
    assertTrue("we should have incoming edges", handler.needsConfirmation());
    assertEquals("There should only be one element to confirm", 1, handler.getConfirmationElements().size());
    GeneratedElement toConfirm = (GeneratedElement) handler.getConfirmationElements().get(0);

    assertEqualsOneOf(new String[] {
        "The generated element 'InputTextField 'target'' contains elements which are connected to non-generated elements:\n\n" +
        "EventTrigger onChange\n" +
        "CompositeOperation 'update'\n\n" +
        "Deleting 'InputTextField 'target'' will also delete these generated elements, currently in use:\n\n" +
        "CompositeOperation 'update'\n" +
        "EventTrigger onChange",

        // swap Event/Operation around
        "The generated element 'InputTextField 'target'' contains elements which are connected to non-generated elements:\n\n" +
        "CompositeOperation 'update'\n" +
        "EventTrigger onChange\n\n" +
        "Deleting 'InputTextField 'target'' will also delete these generated elements, currently in use:\n\n" +
        "CompositeOperation 'update'\n" +
        "EventTrigger onChange"   
    }, handler.getConfirmationMessage(toConfirm));
  }
View Full Code Here

    // there should be six children
    assertEditorHasChildren(6, editor_page);
    ShapeNodeEditPart target = assertHasInputTextField(editor_page, "target", false);
    assertGenerated(target);

    GeneratedElementHandler handler = new GeneratedElementHandler(target);
    List<EObject> toDelete = handler.getOtherElementsToDelete();

    // there should be two other elements that are important to delete
    assertEquals(2, toDelete.size());

    ShapeNodeEditPart edit = assertHasEvent(editor_page, true, ModelPackage.eINSTANCE.getChangeable_OnChange());
View Full Code Here

TOP

Related Classes of org.openiaml.model.diagram.helpers.GeneratedElementHandler

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.