Package org.eclipse.gmf.runtime.diagram.ui.editparts

Examples of org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart


    // there should be one element in this editor
    assertEditorHasChildren(2, editor);

    // find the edit part for the page
    ShapeNodeEditPart pageNode = assertHasFrame(editor, "page1");

    // open the page
    DiagramDocumentEditor pageEditor = openDiagram(pageNode);
    assertNotNull(pageEditor);
    assertEditorFrame(pageEditor);
View Full Code Here


    // there should be three children
    assertEditorHasChildren(3, editor);

    // a primitive operation, a frame, and a shortcutted EventTrigger
    assertHasBuiltinOperation(editor, "op", false);
    ShapeNodeEditPart page = assertHasFrame(editor, "page", false);
    assertHasEvent(editor, true, ModelPackage.eINSTANCE.getScope_OnInit());

    // open the domain store
    DiagramDocumentEditor editor_page = openDiagram(page);
View Full Code Here

    // get contents
    assertHasFrame(editor, "target");
    assertHasFrame(editor, "other");
 
    // open page
    ShapeNodeEditPart page = assertHasFrame(editor, "target");
    editor_page = openDiagram(page);
    assertEditorFrame(editor_page);

    // get text field
    ShapeNodeEditPart text1 = assertHasInputTextField(editor_page, "target text field");
    editor_text = openDiagram(text1);
    assertEditorVisual(editor_text);
   
    // it should be empty
    assertEditorHasChildren(0, editor_text);
View Full Code Here

    {
      // there should only be two children
      assertEditorHasChildren(2, editor);
     
      // open page
      ShapeNodeEditPart page = assertHasFrame(editor, "target");
      editor_page = openDiagram(page);
      assertEditorFrame(editor_page);
     
      // there should be two children (text fields)
      assertEditorHasChildren(2, editor_page);
      ShapeNodeEditPart text1 = assertHasInputTextField(editor_page, "target text field");
      assertNotShortcut(text1);
      assertNotGenerated(text1);
      ShapeNodeEditPart text2 = assertHasInputTextField(editor_page, "in sync");
      assertNotShortcut(text2);
      assertNotGenerated(text2);
      ConnectionNodeEditPart sync = assertHasSyncWire(editor_page, text1, text2, "sync");
      assertNotGenerated(sync);
     
      // select the first text field and infer!
      runAction(new InferContainedElementsAction(), text1);
     
      // save it
      editor_page.doSave(new NullProgressMonitor());
     
      // there should not be any new elements in the local editor
      assertEditorHasChildren(2, editor_page);
     
      // however, if we open up the text field, there should be elements
      // in here generated
      editor_text = openDiagram(text1);
 
      checkPartialInferenceEditor();
     
      // however, if we now close this diagram and infer in place,
      // we should get the rest of the normal editor
      editor_text.close(false);
      editor_text = null;
      editor_page.close(false);
      editor_page = null;
      editor.close(false);
      editor = null;
    }
   
    // delete the target diagram
    IFile model = getProject().getFile(getModel());
    IFile modelNew = getProject().getFile("new-model.iaml");
    IFile diagramNew = getProject().getFile("new-model.iaml_diagram");
    if (modelNew.exists()) {
      getProject().haltDelete(modelNew);
     
    }
    if (diagramNew.exists()) {
      getProject().haltDelete(diagramNew);
    }
    assertFalse(modelNew.exists());
    assertFalse(diagramNew.exists());
   
    // infer
    inferSourceModelFile(model);
    getProject().refreshProject();
   
    // try renaming the model file
    // (otherwise, it seems only the old diagram is stored in memory, and the test case below fails)
    model.move(modelNew.getFullPath(), true, monitor);
    getProject().refreshProject();
   
    assertTrue("New model file " + modelNew + " exists", modelNew.exists());
 
    // re-init diagram and reload
    initialiseAndLoadDiagram(modelNew, diagramNew);
   
    {
      // there should only be two children
      assertEditorHasChildren(2, editor);
     
      // open page
      ShapeNodeEditPart page = assertHasFrame(editor, "target");
      editor_page = openDiagram(page);
      assertEditorFrame(editor_page);
     
      // there should be three children (text fields and access and init)
      assertEditorHasChildren(4, editor_page);
      ShapeNodeEditPart text1 = assertHasInputTextField(editor_page, "target text field");
      assertNotShortcut(text1);
      assertNotGenerated(text1);
      ShapeNodeEditPart text2 = assertHasInputTextField(editor_page, "in sync");
      assertNotShortcut(text2);
      assertNotGenerated(text2);
      ConnectionNodeEditPart sync = assertHasSyncWire(editor_page, text1, text2, "sync");
      assertNotGenerated(sync);
      ShapeNodeEditPart access = assertHasEvent(editor_page, false, ModelPackage.eINSTANCE.getAccessible_OnAccess());
      assertGenerated(access);
      ShapeNodeEditPart init = assertHasEvent(editor_page, false, ModelPackage.eINSTANCE.getScope_OnInit());
      assertGenerated(init);
     
      // in the fully inferred file, there should be lots of children
      editor_text = openDiagram(text1);
     
View Full Code Here

   
    // there should only be two children
    assertEditorHasChildren(2, editor);
   
    // open page
    ShapeNodeEditPart page = assertHasFrame(editor, "target");
    editor_page = openDiagram(page);
    assertEditorFrame(editor_page);
   
    // there should be three children (text fields and access and oninit)
    assertEditorHasChildren(4, editor_page);
    ShapeNodeEditPart text1 = assertHasInputTextField(editor_page, "target text field");
    assertNotShortcut(text1);
    assertNotGenerated(text1);
    ShapeNodeEditPart text2 = assertHasInputTextField(editor_page, "in sync");
    assertNotShortcut(text2);
    assertNotGenerated(text2);
    ConnectionNodeEditPart sync = assertHasSyncWire(editor_page, text1, text2, "sync");
    assertNotGenerated(sync);
    ShapeNodeEditPart access = assertHasEvent(editor_page, false, ModelPackage.eINSTANCE.getAccessible_OnAccess());
    assertGenerated(access);
    ShapeNodeEditPart init = assertHasEvent(editor_page, false,ModelPackage.eINSTANCE.getScope_OnInit());
    assertGenerated(init);
   
    // in the fully inferred file, there should be lots of children
    editor_text = openDiagram(text1);
   
View Full Code Here

  protected void checkPartialInferenceEditor(int expectedChildren) {
    assertEditorVisual(editor_text);
   
    assertEditorHasChildren(expectedChildren, editor_text);
   
    ShapeNodeEditPart access = assertHasEvent(editor_text, false, ModelPackage.eINSTANCE.getAccessible_OnAccess());
    ShapeNodeEditPart edit = assertHasEvent(editor_text, false, ModelPackage.eINSTANCE.getChangeable_OnChange());
    ShapeNodeEditPart update = assertHasOperation(editor_text, "update", false);
    ShapeNodeEditPart init = assertHasOperation(editor_text, "init", false);
    ShapeNodeEditPart fieldValue = assertHasFieldValue(editor_text, false);
    ShapeNodeEditPart condition = assertHasPrimitiveCondition(editor_text, "fieldValue is set", false);
   
    // model 0.4.4
    ShapeNodeEditPart label = assertHasLabel(editor_text, "Warning", false);
    ShapeNodeEditPart canCast = assertHasPrimitiveCondition(editor_text, "can cast?", false);

    // model 0.5.1
    ShapeNodeEditPart currentInput = assertHasValue(editor_text, "currentInput", false);
    ShapeNodeEditPart condition2 = assertHasActivityPredicate(editor_text, "currentInput is set", false);
    ShapeNodeEditPart notEmpty = assertHasPrimitiveCondition(editor_text, "not empty", false);
    ShapeNodeEditPart empty = assertHasPrimitiveCondition(editor_text, "empty", false);
    ShapeNodeEditPart show = assertHasBuiltinOperation(editor_text, "show", false);
    ShapeNodeEditPart hide = assertHasBuiltinOperation(editor_text, "hide", false);
    ShapeNodeEditPart onClick = assertHasEvent(editor_text, null, false, ModelPackage.eINSTANCE.getVisibleThing_OnClick());
    ShapeNodeEditPart onInput = assertHasEvent(editor_text, null, false, ModelPackage.eINSTANCE.getVisibleThing_OnInput());

    // all generated
    assertGenerated(access);
    assertGenerated(edit);
    assertGenerated(update);
View Full Code Here

    assertEditorVisual(editor_text);
   
    // use checkPartialInferenceEditor() to check the base elements; should not have changed
    checkPartialInferenceEditor(22);
   
    ShapeNodeEditPart condition2 = assertHasPrimitiveCondition(editor_text, "fieldValue is set", true);

    ShapeNodeEditPart edit2 = assertHasEvent(editor_text, true, ModelPackage.eINSTANCE.getChangeable_OnChange());
    ShapeNodeEditPart update2 = assertHasOperation(editor_text, "update", true);
    ShapeNodeEditPart fieldValue2 = assertHasFieldValue(editor_text, true);

    // model 0.4.4
    ShapeNodeEditPart label2 = assertHasLabel(editor_text, "Warning", true);
    ShapeNodeEditPart canCast2 = assertHasPrimitiveCondition(editor_text, "can cast?", true);

    // all generated
    assertGenerated(edit2);
    assertGenerated(update2);
    assertGenerated(fieldValue2);
   
    // model 0.4.4
    assertGenerated(label2);
    assertGenerated(canCast2);
   
    // additional connections on previously contained elements
    ShapeNodeEditPart access = assertHasEvent(editor_text, false, ModelPackage.eINSTANCE.getAccessible_OnAccess());
    ShapeNodeEditPart edit = assertHasEvent(editor_text, false, ModelPackage.eINSTANCE.getChangeable_OnChange());
    ShapeNodeEditPart init = assertHasOperation(editor_text, "init", false);
    ShapeNodeEditPart fieldValue = assertHasFieldValue(editor_text, false);
   
    // connected by run wire
    ConnectionNodeEditPart run = assertHasECARule(editor_text, access, init, "run");
    assertGenerated(run);
    ConnectionNodeEditPart param = assertHasParameter(editor_text, fieldValue2, run);
View Full Code Here

   */
  public void testConditionEditor() throws Exception {

    initializeModelFile();

    ShapeNodeEditPart property = assertHasValue(editor, "target property", false);
    ShapeNodeEditPart condition = assertHasFunction(editor, "target condition", false);

    editor_sub = openDiagram(condition);
    assertEditorCondition(editor_sub);

    // there should be two elements, one shortcut
    ShapeNodeEditPart property2 = assertHasValue(editor_sub, "target property", true);
    ShapeNodeEditPart var = assertHasTemporaryVariable(editor_sub, "target", false);

    assertHasDataFlowEdge(editor_sub, property2, var);
    // identical elements being rendered
    assertSameReferencedElement(property, property2);
   
View Full Code Here

   */
  public void testOperationEditor() throws Exception {

    initializeModelFile();

    ShapeNodeEditPart property = assertHasValue(editor, "target property", false);
    ShapeNodeEditPart operation = assertHasOperation(editor, "target operation", false);

    editor_sub = openDiagram(operation);
    assertEditorOperation(editor_sub);

    // there should be two elements, one shortcut
    ShapeNodeEditPart property2 = assertHasValue(editor_sub, "target property", true);
    ShapeNodeEditPart var = assertHasTemporaryVariable(editor_sub, "target", false);

    assertHasDataFlowEdge(editor_sub, property2, var);
    // identical elements being rendered
    assertSameReferencedElement(property, property2);

View Full Code Here

   
    // there should only be two children
    assertEditorHasChildren(3, editor);
   
    // get contents
    ShapeNodeEditPart page = assertHasFrame(editor, "container");
    assertHasDomainType(editor, "domain schema");
    assertHasDomainSource(editor, "domain source");
   
    // open page
    DiagramDocumentEditor editor_page = openDiagram(page);
    try {
      assertEditorFrame(editor_page);
     
      // should have three children
      assertEditorHasChildren(3, editor_page);
      ShapeNodeEditPart form = assertHasInputForm(editor_page, "target form", false);
      ShapeNodeEditPart source = assertHasDomainSource(editor_page, "domain source", true);
     
      ShapeNodeEditPart iterator = assertHasDomainIterator(editor_page, "iterator");
     
      // connected by a SyncWire
      assertHasSyncWire(editor_page, iterator, form, "sync");
     
      // the iterator has a select edge
View Full Code Here

TOP

Related Classes of org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart

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.