Package org.eclipse.gef

Examples of org.eclipse.gef.GraphicalEditPart


    }

    private static class ActionDecorationEditPolicy extends NonResizableEditPolicy {
        @Override
        protected List<Handle> createSelectionHandles() {
            GraphicalEditPart editPart = (GraphicalEditPart) getHost();
            List<Handle> list = new ArrayList<Handle>();
            // use custom drag trackers
            NonResizableHandleKit.addMoveHandle(editPart, list, editPart.getDragTracker(null), SharedCursors.SIZEALL);
            NonResizableHandleKit.addCornerHandles(editPart, list, editPart.getDragTracker(null), SharedCursors.SIZEALL);
            return list;
        }
View Full Code Here


            this.selection = structuredSelection;
            if (structuredSelection.size() > 1) {
                return;
            }
            EditPart source = (EditPart) selected;
            GraphicalEditPart target = (GraphicalEditPart) getGraphicalViewer().getEditPartRegistry().get((GraphElement) source.getModel());
            if (target != null && target.getFigure().isVisible()) {
                getGraphicalViewer().select(target);
            }
        }
    }
View Full Code Here

            }
        }
    }

    public void select(GraphElement element) {
        GraphicalEditPart target = (GraphicalEditPart) getGraphicalViewer().getEditPartRegistry().get(element);
        if (target == null || !target.getFigure().isVisible()) {
            getOutlineViewer().select(element);
            return;
        }
        Rectangle targetElementConstraint = element.getConstraint();
        GraphElement parentElement = element.getParent();
View Full Code Here

        }

        private void getAllChildren(EditPart editPart, List<EditPart> allChildren) {
            List<EditPart> children = editPart.getChildren();
            for (int i = 0; i < children.size(); i++) {
                GraphicalEditPart child = (GraphicalEditPart) children.get(i);
                allChildren.add(child);
                allChildren.addAll(child.getSourceConnections());
                allChildren.addAll(child.getTargetConnections());
                getAllChildren(child, allChildren);
            }
        }
View Full Code Here

      // root host. we always support it has editable area.
      if (host == rootHost) {
        if (host.getChildren().size() > 0) {
          List children = host.getChildren();
          for (int i = 0, size = children.size(); i < size; i++) {
            GraphicalEditPart child = (GraphicalEditPart) children
                .get(i);
            DesignPosition position = innerFindEditPartPosition(
                rootHost, child, p, boxLine, validator);
            if (position != null) {
              return position;
            }
          }
        }
        if (boxLine.getPartsList().size() == 0) {
          if (lPart.contains(p)) {
            // found!!!
            return new DesignPosition(host, 0);
          }
          addToCurrentLine(boxLine, host, p, validator);
        }
      }
      // container
      else {
        // can't edit it.
        if (!validator.hasEditableArea(target)) {
          if (lPart.contains(p) && //
              (validator.isValidPosition(new DesignRefPosition(
                  target.getPart(), true)) || //
              validator.isValidPosition(new DesignRefPosition(
                  target.getPart(), false)))) {
            return new DesignRefPosition(host, lPart
                .isBeforePoint(p)
                || !lPart.atLeftPart(p));
          }
                    addToCurrentLine(boxLine, host, p, validator);
        }
        // can edit
        else {
          // contains p
          if (lPart.contains(p) || //
              (!validator.isValidPosition(new DesignRefPosition(
                  target.getPart(), true)) && //
              !validator.isValidPosition(new DesignRefPosition(
                  target.getPart(), false)))) {
            if (host.getChildren().size() > 0) {
              List children = host.getChildren();
              for (int i = 0, size = children.size(); i < size; i++) {
                GraphicalEditPart child = (GraphicalEditPart) children
                    .get(i);
                DesignPosition position = innerFindEditPartPosition(
                    rootHost, child, p, boxLine, validator);
                if (position != null) {
                  return position;
View Full Code Here

      // root host. we always support it has editable area.
      if (host == rootHost) {
        if (host.getChildren().size() > 0) {
          List children = host.getChildren();
          for (int i = 0, size = children.size(); i < size; i++) {
            GraphicalEditPart child = (GraphicalEditPart) children
                .get(i);
            DesignPosition position = innerFindEditPartPositionConstrained(
                rootHost, child, p, boxLine, validator);
            if (position != null) {
              return position;
            }
          }
        } else {
          if (lPart.contains(p)) {
            // found!!!
            return new DesignPosition(host, 0);
          }
          addToCurrentLine(boxLine, host, p, validator);
        }
      }
      // container
      else {
        // can't edit it.
        if (!validator.hasEditableArea(target)
            || !validator.allowsMoveIn(target)) {
          if (validator.canReference(target, true)
              || validator.canReference(target, false)) {
            if (lPart.contains(p)) {
              return new DesignRefPosition(host, lPart
                  .isBeforePoint(p)
                  || !lPart.atLeftPart(p));
            }
                        addToCurrentLine(boxLine, host, p, validator);
          }
        }
        // can edit
        else {
          // contains p
          if (lPart.contains(p)) {
            if (host.getChildren().size() > 0) {
              List children = host.getChildren();
              for (int i = 0, size = children.size(); i < size; i++) {
                GraphicalEditPart child = (GraphicalEditPart) children
                    .get(i);
                DesignPosition position = innerFindEditPartPositionConstrained(
                    rootHost, child, p, boxLine, validator);
                if (position != null) {
                  return position;
View Full Code Here

      result[1] = null;
      return true;
    }
    // TODO: never read GraphicalEditPart ref = null;
    for (int i = 0, size = children.size(); i < size; i++) {
      GraphicalEditPart child = (GraphicalEditPart) children.get(i);
      Rectangle rect = getAbsoluteBounds(child);

      if (rect.contains(p)) {
        IFigure figure = child.getFigure();
        if (figure instanceof ICSSFigure) {
          List frags = ((ICSSFigure) figure).getFragmentsForRead();
          if (frags.size() > 1) // more than one frags, so is a zig
          // zag.
          {
View Full Code Here

  protected List createSelectionHandles() {
    String elementName = ((Element) getHost().getModel()).getLocalName();
    if ("column".equalsIgnoreCase(elementName)) { //$NON-NLS-1$
      List list = new ArrayList();

      GraphicalEditPart part = (GraphicalEditPart) getHost();
           
            {
          MoveHandle borderhandle = new MoveHandle(part, new ColumnBorderHandleLocator(
              part));
          list.add(borderhandle);
View Full Code Here

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

@SuppressWarnings("rawtypes")
protected Command getCloneCommand(ChangeBoundsRequest request) {
  CloneCommand clone = new CloneCommand()
  clone.setParent((MusicContainerForm)getHost().getModel())
  Iterator i = request.getEditParts().iterator();
  GraphicalEditPart currPart = null
  while (i.hasNext()) {
    currPart = (GraphicalEditPart)i.next();
    clone.addPart((BasicElement)currPart.getModel(),
        (Rectangle)getConstraintFor(request, currPart));
  }
 
  return clone;
}
View Full Code Here

TOP

Related Classes of org.eclipse.gef.GraphicalEditPart

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.