Examples of GraphicalEditPart


Examples of org.eclipse.gef.GraphicalEditPart

  Command result = null;
  List selection = getSelectedObjects();
  if (selection != null && selection.size() == 1) {
    Object obj = selection.get(0);
    if (obj instanceof GraphicalEditPart) {
      GraphicalEditPart gep = (GraphicalEditPart)obj;
      Object template = getClipboardContents();
      if (template != null) {
        CreationFactory factory = getFactory(template);
        if (factory != null) {
          CreateRequest request = new CreateRequest();
          request.setFactory(factory);
          request.setLocation(getPasteLocation(gep));
          result = gep.getCommand(request);
        }
      }
    }
  }
  return result;
View Full Code Here

Examples of org.eclipse.gef.GraphicalEditPart

 
  EditPart after = getInsertionReference(request);
  int index = getHost().getChildren().indexOf(after);
 
  Iterator i = request.getEditParts().iterator();
  GraphicalEditPart currPart = null;
 
  while (i.hasNext()) {
    currPart = (GraphicalEditPart)i.next();
    clone.addPart((LogicSubpart)currPart.getModel(), index++);
  }
 
  return clone;
}
View Full Code Here

Examples of org.eclipse.gef.GraphicalEditPart

protected Command getAddCommand(Request generic) {
  ChangeBoundsRequest request = (ChangeBoundsRequest)generic;
  List editParts = request.getEditParts();
  CompoundCommand command = new CompoundCommand();
  command.setDebugLabel("Add in ConstrainedLayoutEditPolicy");//$NON-NLS-1$
  GraphicalEditPart childPart;
  Rectangle r;
  Object constraint;

  for (int i = 0; i < editParts.size(); i++) {
    childPart = (GraphicalEditPart)editParts.get(i);
    r = childPart.getFigure().getBounds().getCopy();
    //convert r to absolute from childpart figure
    childPart.getFigure().translateToAbsolute(r);
    r = request.getTransformedRectangle(r);
    //convert this figure to relative
    getLayoutContainer().translateToRelative(r);
    getLayoutContainer().translateFromParent(r);
    r.translate(getLayoutOrigin().getNegated());
View Full Code Here

Examples of org.eclipse.gef.GraphicalEditPart

  CloneCommand clone = new CloneCommand();
 
  clone.setParent((LogicDiagram)getHost().getModel());
 
  Iterator i = request.getEditParts().iterator();
  GraphicalEditPart currPart = null;
 
  while (i.hasNext()) {
    currPart = (GraphicalEditPart)i.next();
    clone.addPart((LogicSubpart)currPart.getModel(),
        (Rectangle)getConstraintForClone(currPart, request));
  }
 
  // Attach to horizontal guide, if one is given
  Integer guidePos = (Integer)request.getExtendedData()
View Full Code Here

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

      ShapeNodeEditPart part = assertHasFrame(editor, "Home");
      Frame e = (Frame) part.resolveSemanticElement();
      assertFalse(e.isIsGenerated());
      assertFalse(e.isOverridden());
     
      GraphicalEditPart name = (GraphicalEditPart) part.getChildren().get(0);
     
      // check the label name
      assertEquals("Home", ((IAccessibleTextAwareEditPart) name).getLabelText());
     
      // and check that it is NOT bold
      assertIsBold(name.getFigure().getFont().getFontData(), false);
    }
   
    {
      ShapeNodeEditPart part = assertHasFrame(editor, "Overridden Frame");
      Frame e = (Frame) part.resolveSemanticElement();
      assertFalse(e.isIsGenerated());
      assertTrue(e.isOverridden());
     
      GraphicalEditPart name = (GraphicalEditPart) part.getChildren().get(0);
     
      // check the label name
      assertEquals("Overridden Frame", ((IAccessibleTextAwareEditPart) name).getLabelText());
     
      // and check that it is bold
      assertIsBold(name.getFigure().getFont().getFontData(), true);
    }
   
  }
View Full Code Here

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

      ShapeNodeEditPart part = assertHasOperation(frame, "Normal Operation");
      ActivityOperation e = (ActivityOperation) part.resolveSemanticElement();
      assertFalse(e.isIsGenerated());
      assertFalse(e.isOverridden());
     
      GraphicalEditPart name = (GraphicalEditPart) part.getChildren().get(0);
     
      // check the label name
      assertEquals("Normal Operation", ((IAccessibleTextAwareEditPart) name).getLabelText());
     
      // and check that it is NOT bold
      assertIsBold(name.getFigure().getFont().getFontData(), false);
    }
   
    {
      ShapeNodeEditPart part = assertHasOperation(frame, "Overridden Operation");
      ActivityOperation e = (ActivityOperation) part.resolveSemanticElement();
      assertFalse(e.isIsGenerated());
      assertTrue(e.isOverridden());
     
      GraphicalEditPart name = (GraphicalEditPart) part.getChildren().get(0);
     
      // check the label name
      assertEquals("Overridden Operation", ((IAccessibleTextAwareEditPart) name).getLabelText());
     
      // and check that it is bold
      assertIsBold(name.getFigure().getFont().getFontData(), true);
    }
   
  }
View Full Code Here

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

      if (shouldHalt(imagesSaved)) {
        break;    // halt
      }     

      if (obj instanceof GraphicalEditPart) {
        GraphicalEditPart child = (GraphicalEditPart) obj;
       
        // only select children with open policies
        if (child.getEditPolicy(EditPolicyRoles.OPEN_ROLE) != null) {
         
          DiagramDocumentEditor newEd = openSubDiagram(child);
          if (newEd == null || newEd == editor) {
            // didn't do anything: continue
            continue;
View Full Code Here

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

     
      // save all the children now
      List<RenderedChildInformation> children = new ArrayList<RenderedChildInformation>();
      for (Object o : part.getChildren()) {
        if (o instanceof GraphicalEditPart) {
          GraphicalEditPart gep = (GraphicalEditPart) o;
         
          RenderedChildInformation info = new RenderedChildInformation(
              gep.resolveSemanticElement(),
              gep.getContentPane().getBounds(),
              IamlBreadcrumb.getEObjectBreadcrumbString(gep.resolveSemanticElement()) );
          children.add(info);
        }
      }
      partChildrenListMap.put(part, children);
     
View Full Code Here

Examples of org.eclipse.wb.gef.graphical.GraphicalEditPart

  @Override
  protected boolean isRequestCondition(Request _request) {
    if (_request instanceof ChangeBoundsRequest) {
      ChangeBoundsRequest request = (ChangeBoundsRequest) _request;
      Object type = request.getType();
      GraphicalEditPart host = getHost();
      ILayoutRequestValidator validator = getRequestValidator();
      boolean isMove =
          Request.REQ_MOVE.equals(type) && validator.validateMoveRequest(host, request);
      boolean isAdd = Request.REQ_ADD.equals(type) && validator.validateMoveRequest(host, request);
      return isMove || isAdd;
View Full Code Here

Examples of org.eclipse.wb.gef.graphical.GraphicalEditPart

              "// filler filler filler filler filler",
              "// filler filler filler filler filler",
              "<ui:UiBinder>",
              "  <g:FlowPanel/>",
              "</ui:UiBinder>");
      GraphicalEditPart panelEditPart = canvas.getEditPart(originalPanel);
      Figure panelFigure = panelEditPart.getFigure();
      // no device yet
      assertEquals(new Rectangle(20, 20, 450, 300), panelFigure.getBounds());
      // set device
      DeviceSelectionSupport.setDevice(originalPanel, DeviceManager.getDevice("generic.qvga"));
      assertEquals(new Rectangle(25, 25, 240, 320), panelFigure.getBounds());
    }
    // parse again
    {
      openSourcePage();
      m_lastContext.getDocument().replace(0, 0, " ");
      openDesignPage();
      fetchContentFields();
    }
    // ...still has device
    {
      assertNotSame(originalPanel, m_contentObject);
      GraphicalEditPart panelEditPart = canvas.getEditPart(m_contentObject);
      Figure panelFigure = panelEditPart.getFigure();
      assertEquals(new Rectangle(25, 25, 240, 320), panelFigure.getBounds());
    }
  }
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.