Package org.openiaml.model.inference

Examples of org.openiaml.model.inference.EcoreCreateElementsHelper


   * @throws Exception
   */
  public void testRootParentNames() throws Exception {
    // create a blank editor
    testCreateBlank();
    EcoreCreateElementsHelper gmf = getElementCreator();

    // set the root name
    gmf.setName(root, "root element");
    assertEquals(root.getName(), "root element");

    // create a CompositeOperation
    ActivityOperation cop = gmf.createActivityOperation(root);
    assertNotNull(cop);

    // set name
    gmf.setName(cop, "my operation");
    assertEquals(cop.getName(), "my operation");

    // find the edit part for this element
    ShapeNodeEditPart part = assertHasOperation(editor, "my operation");
    assertNotNull(part);

    // what is the content pane?
    IFigure fig = part.getContentPane();
    assertTrue("CompositeOperation should be extended: " + fig.getClass(),
        fig instanceof ExtendedActivityOperationFigure);

    ExtendedActivityOperationFigure ext = (ExtendedActivityOperationFigure) fig;
    // check to see it has the correct initial parent value
    assertEquals("Parent: root element", ext.getFigureActivityOperationParentNameFigure().getText());

    // change the root name
    gmf.setName(root, "a new parent name");
    assertEquals(root.getName(), "a new parent name");
    // the parent label should have changed
    assertEquals("Parent: a new parent name", ext.getFigureActivityOperationParentNameFigure().getText());
  }
View Full Code Here


   * @throws Exception
   */
  public void testRootParentNamesMultiple() throws Exception {
    // create a blank editor
    testCreateBlank();
    EcoreCreateElementsHelper gmf = getElementCreator();

    // set the root name
    gmf.setName(root, "root element");
    assertEquals(root.getName(), "root element");

    // create a CompositeOperation
    ActivityOperation cop = gmf.createActivityOperation(root);
    assertNotNull(cop);

    // set name
    gmf.setName(cop, "my operation");
    assertEquals(cop.getName(), "my operation");

    // find the edit part for this element
    ShapeNodeEditPart partOp = assertHasOperation(editor, "my operation");
    assertNotNull(partOp);
    // what is the content pane?
    IFigure fig_o = partOp.getContentPane();
    assertTrue("CompositeOperation should be extended: " + fig_o.getClass(),
        fig_o instanceof ExtendedActivityOperationFigure);

    ExtendedActivityOperationFigure ext_o = (ExtendedActivityOperationFigure) fig_o;
    // check to see it has the correct initial parent value
    assertEquals("Parent: root element", ext_o.getFigureActivityOperationParentNameFigure().getText());

    // change the root name
    gmf.setName(root, "a new parent name");
    assertEquals(root.getName(), "a new parent name");

    // the parent labels should have changed
    assertEquals("Parent: a new parent name", ext_o.getFigureActivityOperationParentNameFigure().getText());
  }
View Full Code Here

   * @throws Exception
   */
  public void testRootParentNamesNot() throws Exception {
    // create a blank editor
    testCreateBlank();
    EcoreCreateElementsHelper gmf = getElementCreator();

    // set the root name
    gmf.setName(root, "root element");
    assertEquals(root.getName(), "root element");

    // Email is not in Parents
    assertFalse(ParentNamesTestCase.getParentNameElements().contains(MessagingPackage.eINSTANCE.getEmail()));

    // create an Email
    Email page = gmf.createEmail(root);
    assertNotNull(page);

    // set name
    gmf.setName(page, "my email");
    assertEquals(page.getName(), "my email");

    // find the edit part for this element
    ShapeNodeEditPart part = assertHasEmail(editor, "my email");
    assertNotNull(part);
View Full Code Here

       
        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() );
View Full Code Here

   * @throws Exception
   */
  public void testCreatingElements() throws Exception {
    // create a blank editor
    testCreateBlank();
    EcoreCreateElementsHelper gmf = getElementCreator();

    // initially just the default page
    assertEditorHasChildren(1, editor);

    // create a DomainStore
    DomainType ds = gmf.createDomainType(root);
    assertNotNull(ds);

    // and a Frame
    Frame page = gmf.createFrame(root);
    assertNotNull(page);

    // there should be three elements in this editor
    assertEditorHasChildren(3, editor);

    // add another frame
    Frame page2 = gmf.createFrame(root);
    assertNotNull(page2);

    // create a SyncWire between the two
    SyncWire sync = gmf.createSyncWire(root, page, page2);
    assertNotNull(sync);

    // there should be four elements in this editor
    assertEditorHasChildren(4, editor);
  }
View Full Code Here

  }

  public void testCreatingSubEditor() throws Exception {
    // create a blank editor
    testCreateBlank();
    EcoreCreateElementsHelper gmf = getElementCreator();

    // we should be in the root editor
    assertEditorRoot(editor);

    // initially just the initial page
    assertEditorHasChildren(1, editor);

    // create a Page
    Frame page = gmf.createFrame(root);
    assertNotNull(page);

    // set its name
    gmf.setName(page, "page1");
    assertEquals("Page name should have changed", page.getName(), "page1");

    // there should be one element in this editor
    assertEditorHasChildren(2, editor);
View Full Code Here

        @Override
        public EObject reload() throws InferenceException {
          try {
            InternetApplication root = (InternetApplication) DroolsPerformanceTest.this.reload();
            ICreateElementsFactory factory = CachedModelInferer.getInstance().createCreateElementsFactory();
            EcoreCreateElementsHelper handler = (EcoreCreateElementsHelper) factory.createHandler(root);
           
            // add the pages etc
            for (int j = 0; j < i_copy; j++) {
              Frame page = handler.createFrame(root);
              page.setName("test page " + j);
             
              /*
              Button button = (Button) handler.createElement(page, VisualPackage.eINSTANCE.getButton(), ModelPackage.eINSTANCE.getInternetApplication_Children());
              button.setName("test button " + j);
              */
             
              InputTextField text = (InputTextField) handler.createElement(page, VisualPackage.eINSTANCE.getInputTextField(), VisualPackage.eINSTANCE.getFrame_Children());
              text.setName("test field " + j);
             
            }
           
            return root;
View Full Code Here

TOP

Related Classes of org.openiaml.model.inference.EcoreCreateElementsHelper

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.