Examples of Diagram


Examples of org.eclipse.gmf.runtime.notation.Diagram

  private ISelection getNavigatorSelection() {
    IDiagramDocument document = getDiagramDocument();
    if (document == null) {
      return StructuredSelection.EMPTY;
    }
    Diagram diagram = document.getDiagram();
    if (diagram == null || diagram.eResource() == null) {
      return StructuredSelection.EMPTY;
    }
    IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
    if (file != null) {
      DispelNavigatorItem item = new DispelNavigatorItem(diagram, file,
          false);
      return new StructuredSelection(item);
    }
View Full Code Here

Examples of org.eclipse.gmf.runtime.notation.Diagram

  /**
   * @generated
   */
  public Diagram createDiagram(IAdaptable semanticAdapter,
      String diagramKind, PreferencesHint preferencesHint) {
    Diagram diagram = NotationFactory.eINSTANCE.createDiagram();
    diagram.getStyles().add(NotationFactory.eINSTANCE.createDiagramStyle());
    diagram
        .setType(eu.admire.visual.pmml._40.diagram.edit.parts.PMMLTypeEditPart.MODEL_ID);
    diagram.setElement(getSemanticElement(semanticAdapter));
    diagram.setMeasurementUnit(MeasurementUnit.PIXEL_LITERAL);
    return diagram;
  }
View Full Code Here

Examples of org.eclipse.graphiti.mm.pictograms.Diagram

  @Test
  public void testAddPE() {
   
    final DiagramEditor de = TestUtil.loadFile("test.dispel");
   
    final Diagram d = de.getDiagramTypeProvider().getDiagram();
   
    //Shouldn't have a PE with this type yet
    Pair<Shape, LocalVariableStatement> notHere = getPEWithType(
        "AssociatorXml", d);
    assertNull(notHere.getLeft());
View Full Code Here

Examples of org.eclipse.graphiti.mm.pictograms.Diagram

  @Test
  public void testLiteralToPEConnection() {
   
    final DiagramEditor de = TestUtil.loadFile("addConnection.dispel");
   
    Diagram d = de.getDiagramTypeProvider().getDiagram();
    ILinkService ls = Graphiti.getLinkService();
   
    ContainerShape peShape = null;
    EObject linked = null;
   
    //Get Demo Echo PE
    for (Shape s : d.getChildren()) {
      linked = ls.getBusinessObjectForLinkedPictogramElement(s);
      if (linked instanceof LocalVariableStatement) {
        if (((LocalVariableStatement) linked).getVariable().getName(
            ).equals("DemoEcho")) {
          assertTrue(s instanceof ContainerShape);
          peShape = (ContainerShape) s;
          break;
        }
      }
    }
   
    assertNotNull(peShape);
    assertNotNull(linked.eContainer());
   
    //Find Literal
    Shape literalShape = null;
    for (Shape s : d.getChildren()) {
      linked = ls.getBusinessObjectForLinkedPictogramElement(s);
      if (linked instanceof ConnectionInitialization) {
        ConnectionInitialization ci = (ConnectionInitialization) linked;
        EObject e = Utility.getChildLiteral(ci);
        if (Utility.getLiteralValue(
View Full Code Here

Examples of org.eclipse.graphiti.mm.pictograms.Diagram

  @Test
  public void testDeleteCI() {
   
    final DiagramEditor de = TestUtil.loadFile("test.dispel");
 
    Diagram d = de.getDiagramTypeProvider().getDiagram();
   
    Pair<Shape, EObject> ciPair = TestUtil.getLiteralWithName(
        "\"Hello World\"", d);
   
    assertNotNull(ciPair.getLeft());
    assertNotNull(ciPair.getRight());
    assertNotNull(Utility.getParentConnectionStatement(ciPair.getRight()));
    assertNotNull(Utility.getParentConnectionStatement(ciPair.getRight()
        ).eContainer());
   
    //Take a note of any outgoing connections
    List<Connection> cons = new ArrayList<Connection>();
    for (Anchor a : ciPair.getLeft().getAnchors()) {
      cons.addAll(a.getOutgoingConnections());
    }

    //Just make sure they're linked
    for (Connection c : cons) {
      assertNotNull(c.getParent());
    }
 
    final Shape deleteShape = ciPair.getLeft();
 
    //Have to async call delete within transaction, then use swtbot to
    //confirm
    asyncExec((new VoidResult() {
      @Override
      public void run() {

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

              @Override
              protected void doExecute() {
                IDiagramTypeProvider dtp =
                    de.getDiagramTypeProvider();
                IFeatureProvider fp = dtp.getFeatureProvider();

                final DeleteContext dc = new DeleteContext(
                    deleteShape);
                final IDeleteFeature df =
                    de.getDiagramTypeProvider(
                    ).getFeatureProvider().getDeleteFeature(
                        dc);

                assert(df.canDelete(dc));
                df.delete(dc);
              }});
      }}));
   
    SWTBotShell shell = mBot.shell("Confirm Delete");
    shell.activate();
    mBot.button("Yes").click();   
    mBot.sleep(1000);
    mBot.menu("File").menu("Save").click();
    mBot.sleep(1000);

    //Make sure deleted from diagram and model   
    assertFalse(d.getChildren().contains(deleteShape));
    assertNull(Utility.getParentConnectionStatement(ciPair.getRight()
        ).eContainer());
    //Outgoing connections should be dead too
    for (Connection c : cons) {
      assertNull(c.getParent());
View Full Code Here

Examples of org.eclipse.graphiti.mm.pictograms.Diagram

    //Have to put commands in a transaction if we want to change things
    final Runnable runnable = new Runnable() {
      public void run() {

        Diagram diagram = Graphiti.getPeCreateService().createDiagram(
            "DISPEL", localName, false);
        diagramResource.getContents().add(diagram);
      }
    };

    editingDomain.getCommandStack().execute(
        new RecordingCommand(editingDomain, "create diagram") {
          protected void doExecute() {
            runnable.run();
          }
        });

    try {
      diagramResource.save(getSaveOptions());
    } catch (IOException e) {
      MessageDialog.openError(Utility.getShell(),
          "Save Failed",
          "Failed to save diagram resource");
      Activator.logError("Failed to save diagram resource", e);
     
    }

    List<EObject> contents = diagramResource.getContents();

    Diagram d = null;
    CompilationUnit compUnit = null;
    String fragment = "";
    for (EObject e : contents) {
      if ((compUnit == null) && (e instanceof CompilationUnit)) {
        compUnit = (CompilationUnit) e;
View Full Code Here

Examples of org.kite9.diagram.adl.Diagram

  @Kite9Item
  public Diagram someDesignItem() {
    Glyph g1 = new Glyph("stereo", "project:" + this.getClass().getName(), null, null);
    Glyph g2 = new Glyph("stereo", "project:" + Another.class.getName(), null, null);

    return new Diagram("somename", createList((Contained) g1, g2), null);
  }
View Full Code Here

Examples of org.stathissideris.ascii2image.graphics.Diagram

      if(options.processingOptions.printDebugOutput()){
        if (!stdOut) System.out.println("Using grid:");
        grid.printDebug();
      }
     
      Diagram diagram = new Diagram(grid, options);
      if (!stdOut) System.out.println("Rendering to file: "+toFilename);
     
     
      RenderedImage image = new BitmapRenderer().renderToImage(diagram, options.renderingOptions);
     
View Full Code Here

Examples of org.stathissideris.ascii2image.graphics.Diagram

      for(int i = 0; i < iterations; i++) {
        System.out.println("iteration "+i);
       
        TextGrid grid = new TextGrid();
        grid.loadFrom(inputFilename);
        new Diagram(grid, options);
      }
     
      long b = java.lang.System.currentTimeMillis();
     
      System.out.println((b-a) + "msec for " + iterations + " iterations on "+inputFilename);
View Full Code Here

Examples of org.stathissideris.ascii2image.graphics.Diagram

        error("Cannot initialize text grid");
      }
    } catch (UnsupportedEncodingException e1) {
      error("Cannot initialize text grid");
    }
    Diagram diagram = new Diagram(textGrid, options);
    RenderedImage image = new BitmapRenderer().renderToImage(diagram,
        options.renderingOptions);

    try {
      ImageIO.write(image, "png", outputFile);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.