Package org.eclipse.gef

Examples of org.eclipse.gef.EditPart


        return null;
    }

    @SuppressWarnings("unchecked")
    public void init( BoxPart owner ) {
        EditPart parentPart = owner.getParent();
        PageImpl pageImpl = (PageImpl) parentPart.getModel();
        EList<Box> boxes = (EList<Box>) pageImpl.getBoxes();
        Box box = owner.getBoxPrinter().getBox();
        boxes.move(0, box);
    }
View Full Code Here


        return null;
    }

    @SuppressWarnings("unchecked")
    public void init( BoxPart owner ) {
        EditPart parentPart = owner.getParent();
        PageImpl pageImpl = (PageImpl) parentPart.getModel();
        EList<Box> boxes = (EList<Box>) pageImpl.getBoxes();
        int size = boxes.size();
        Box box = owner.getBoxPrinter().getBox();
        boxes.move(size - 1, box);
    }
View Full Code Here

* @since 0.3
*/
public class PartFactory implements EditPartFactory {

    public EditPart createEditPart( EditPart context, Object model ) {
        EditPart part = null;

        if (model instanceof Connection) {
            part = new ConnectionPart();
        } else if (model instanceof Page) {
            part = new PagePart();
        }

        // Default to something that will provide a decent default
        if (part == null && model instanceof Box) {
            part = new BoxPart();
        }

        part.setModel(model);

        return part;
    }
View Full Code Here

        return null;
    }

    @SuppressWarnings("unchecked")
    public void init( BoxPart owner ) {
        EditPart parentPart = owner.getParent();
        PageImpl pageImpl = (PageImpl) parentPart.getModel();
        EList<Box> boxes = (EList<Box>) pageImpl.getBoxes();
        Box box = owner.getBoxPrinter().getBox();
        int i = boxes.indexOf(box);
        if (i <= 0)
            return;
View Full Code Here

     * @author jody
     */
    public static class SelectionToolWithDoubleClick extends SelectionTool {
        @Override
        protected boolean handleDoubleClick( int button ) {
            EditPart part = getTargetEditPart();

            // handle any "double click actions here
            return super.handleDoubleClick(button);
        }
View Full Code Here

      List parts = getSelectedObjects();
      for (int i=0; i<parts.size(); i++){
        Object o = parts.get(i);
        if (!(o instanceof EditPart))
          return false;
        EditPart part = (EditPart)o;
        if (!(part.getModel() instanceof Box))
                if( !(((Box)part.getModel()).getBoxPrinter() instanceof MapBoxPrinter) )
                    return false;
      }
      return true;
    }
View Full Code Here

    private Command getCommand() {
      List editparts = getSelectedObjects();
      CompoundCommand cc = new CompoundCommand();
      cc.setDebugLabel("Edit Maps");//$NON-NLS-1$
      for (int i=0; i < editparts.size(); i++) {
        EditPart part = (EditPart)editparts.get(i);
        cc.add(part.getCommand(request));
      }
      return cc;
    }
View Full Code Here

  public void selectNodes(EditPart parent)
  {
    for (int i = 0; i < parent.getChildren().size(); i++)
    {
      EditPart node = (EditPart) parent.getChildren().get(i);

      if (node.getChildren() != Collections.EMPTY_LIST)
      {
        if (selectionType != SIMPLE_NODES)
        {
          main.getViewer().appendSelection(node);
        }
View Full Code Here

    Iterator selectedObjects =
      ((IStructuredSelection) viewer.getSelection()).iterator();

    while (selectedObjects.hasNext())
    {
      EditPart childEditPart = (EditPart) selectedObjects.next();

      // if selected one is a node or compound delete is called
      if (childEditPart instanceof ChsCompoundEditPart)
      {
        RemoveCompoundCommand command = new RemoveCompoundCommand();
        command.setCompound((CompoundModel) childEditPart.getModel());
        command.execute();
      }
    }
  }
View Full Code Here

        }
        IStructuredSelection structuredSelection = (IStructuredSelection) selection;
        Object selectedObject = structuredSelection.getFirstElement();
        if (!(selectedObject instanceof EditPart))
            return;
        EditPart source = (EditPart) selectedObject;
        select((GraphElement) source.getModel());
    }
View Full Code Here

TOP

Related Classes of org.eclipse.gef.EditPart

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.