Examples of DiagramEditor


Examples of org.eclipse.graphiti.ui.editor.DiagramEditor

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

Examples of org.eclipse.graphiti.ui.editor.DiagramEditor

  }
 
  @Test
  public void editLiteralTest() throws Exception {
   
    final DiagramEditor de = TestUtil.loadFile("test.dispel");
   
    final Diagram d = de.getDiagramTypeProvider().getDiagram();
   
    //Create a string literal
    //We know it will appear in the top left
    createCI(de, "DirectEditTest");
   
    syncExec(new VoidResult() {
      @Override
      public void run() {
        //Have to set mouse location inside part for some annoying
        //reason
        de.getMouseLocation().x = 20;
        de.getMouseLocation().y = 20;

        final SWTBotGefEditor editor = mBot.gefEditor("test");
       
        //Should activate with double click
        SWTBotGefEditPart ep = editor.getEditPart("\"DirectEditTest\""
View Full Code Here

Examples of org.eclipse.graphiti.ui.editor.DiagramEditor

  }
 
  @Test
  public void testDeletePE() {
   
    final DiagramEditor de = TestUtil.loadFile("test.dispel");
 
    Diagram d = de.getDiagramTypeProvider().getDiagram();
    ILinkService ls = Graphiti.getLinkService();
   
    Shape peShape = null;
    EObject linked = null;

    //Find a PE
    for (Shape s : d.getChildren()) {
      linked = ls.getBusinessObjectForLinkedPictogramElement(s);
      if (linked instanceof LocalVariableStatement) {
        if (((LocalVariableStatement) linked).getVariable().getName(
            ).equals("DemoEcho")) {
          peShape = s;
          break;
        }
      }
    }
   
    assertNotNull(peShape);
    assertNotNull(linked.eContainer());
   
    //Take a note of any incoming connections
    List<Connection> cons = new ArrayList<Connection>();
    for (Anchor a :peShape.getAnchors()) {
      cons.addAll(a.getIncomingConnections());
    }

    //Just make sure they're linked
    for (Connection c : cons) {
      assertNotNull(c.getParent());
    }
 
    final Shape deleteShape = peShape;
 
    //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);
View Full Code Here

Examples of org.eclipse.graphiti.ui.editor.DiagramEditor

 
  @Test
  public void testAddCI() {
   
    final DiagramEditor de = TestUtil.loadFile("test.dispel");
   
    final Diagram d = de.getDiagramTypeProvider().getDiagram();
   
    //Shouldn't have a literal with this name yet
    Pair<Shape, EObject> notHere = TestUtil.getLiteralWithName(
        "\"Test String Literal\"", d);
    assertNull(notHere.getLeft());

    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();
                CreateStringLiteralFeature litFeat = null;
                for(ICreateFeature ic : fp.getCreateFeatures()) {
                  if (ic instanceof CreateStringLiteralFeature) {
                    litFeat = (CreateStringLiteralFeature) ic;
View Full Code Here

Examples of org.eclipse.graphiti.ui.editor.DiagramEditor

    IEditorPart ep =  PlatformUI.getWorkbench(
        ).getActiveWorkbenchWindow().getActivePage().getActiveEditor();
   
    assertTrue(ep instanceof DiagramEditor);
   
    DiagramEditor de = (DiagramEditor) ep;
    Diagram d = di.getDiagram();
   
    de.getDiagramTypeProvider().getFeatureProvider(
        ).updateIfPossible(new UpdateContext(d));
   
    return de;
  }
View Full Code Here

Examples of org.eclipse.graphiti.ui.editor.DiagramEditor

  public void runModelChange(final Runnable runnable) {
    PictogramElement pe = getSelectedPictogramElement();
    if (pe != null) {
      Object bo = getBusinessObject(pe);
      if (bo instanceof ServiceTask) {
        DiagramEditor diagramEditor = (DiagramEditor) getDiagramEditor();
        TransactionalEditingDomain editingDomain = diagramEditor.getEditingDomain();
        ActivitiUiUtil.runModelChange(runnable, editingDomain, "Model Update");
      }
    }
  }
View Full Code Here

Examples of org.eclipse.graphiti.ui.editor.DiagramEditor

            if (className != null) {
              classNameText.setText(className);
            }

            DiagramEditor diagramEditor = (DiagramEditor) getDiagramEditor();
            TransactionalEditingDomain editingDomain = diagramEditor.getEditingDomain();

            ActivitiUiUtil.runModelChange(new Runnable() {
              @Override
              public void run() {
                Object bo = getBusinessObject(getSelectedPictogramElement());
View Full Code Here

Examples of org.eclipse.graphiti.ui.editor.DiagramEditor

  private void saveImplementationType(final String type) {
    PictogramElement pe = getSelectedPictogramElement();
    if (pe != null) {
      final Object bo = getBusinessObject(pe);
      if (bo instanceof ServiceTask) {
        DiagramEditor diagramEditor = (DiagramEditor) getDiagramEditor();
        TransactionalEditingDomain editingDomain = diagramEditor.getEditingDomain();
        ActivitiUiUtil.runModelChange(new Runnable() {
          @Override
          public void run() {
            ServiceTask serviceTask = (ServiceTaskbo;
            serviceTask.setImplementationType(type);
View Full Code Here

Examples of org.eclipse.graphiti.ui.editor.DiagramEditor

    final Object bo = getBusinessObject(pe);
    if (bo instanceof Activity == false) return;
    final Activity activity = (Activity) bo;
   
   
    DiagramEditor diagramEditor = (DiagramEditor) getDiagramEditor();
    TransactionalEditingDomain editingDomain = diagramEditor.getEditingDomain();
    ActivitiUiUtil.runModelChange(new Runnable() {
      public void run() {
        getMultiInstanceDef(activity).setSequential(sequential);
      }
    }, editingDomain, "Model Update");
View Full Code Here

Examples of org.eclipse.graphiti.ui.editor.DiagramEditor

   * @return the ActionRegistry or null
   */
  public static final ActionRegistry getActionRegistry() {
    IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
    if (part instanceof DiagramEditor) {
      DiagramEditor editor = (DiagramEditor) part;
      return (ActionRegistry) editor.getAdapter(ActionRegistry.class);
    }
    return null;
  }
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.