Examples of DesignPosition


Examples of org.eclipse.jst.pagedesigner.viewer.DesignPosition

//    try {
      if (_resultRange == null) {
        return null;
      }
      IDOMPosition startPos = _resultRange.getStartPosition();
      DesignPosition start = DOMPositionHelper.toDesignPosition(startPos);
      if (_resultRange.isEmpty()) {
        return new DesignRange(start, start);
      }
            IDOMPosition endPos = _resultRange.getEndPosition();
            return new DesignRange(start, DOMPositionHelper
View Full Code Here

Examples of org.eclipse.jst.pagedesigner.viewer.DesignPosition

      _log.error("invalid range"); //$NON-NLS-1$
      return;
    }
    IMovementMediator moveMediator = new InlineEditingNavigationMediator(
        new ActionData(ActionData.KEYBOARD_NAVAGATION, null));
    DesignPosition position = range.getEndPosition();
    Caret caret = _viewer.getCaret();
    Point point = null;
    DesignPosition newPos = position;
    EditPart containerpart = null, rootpart1;
    if (_up) {
      point = new Point(((CaretPositionTracker) _viewer).getXoffset(),
          caret.getBounds().y);
    } else {
View Full Code Here

Examples of org.eclipse.jst.pagedesigner.viewer.DesignPosition

      DesignRange range = (DesignRange) selection;
      if (!range.isValid()) {
        return null;
      }
      if (range.isEmpty()) {
        DesignPosition position = range.getStartPosition();
        if (position.getOffset() == 0
            || position.getContainerNode() instanceof Text) {
          return position.getContainerPart();
        }
                return position.getSiblingEditPart(false);
      }
            return RangeUtil.findCommonAncestor(range);
    } else {
      return null;
    }
View Full Code Here

Examples of org.eclipse.jst.pagedesigner.viewer.DesignPosition

   */
  @Override
  public Command getCommand(Request request) {
    if (request instanceof ItemCreationRequest) {
      ItemCreationRequest r = (ItemCreationRequest) request;
      DesignPosition position = findPosition((ItemCreationRequest)request);
     
      if (position == null) {
        return null;
      }

View Full Code Here

Examples of org.eclipse.jst.pagedesigner.viewer.DesignPosition

   * @return true if should insert element
   */
  public boolean checkInsertElement(LocalDropRequest request,
      EditPart[] host, Map results, DesignPosition[] dpHolder,
      IDOMPosition[] position) {
    DesignPosition designPosition = EditPartPositionHelper
        .findEditPartPosition(host[0], request.getLocation(),
            new DnDPositionValidator(new ActionData(
                ActionData.DATABINDING_DND, request)));
    dpHolder[0] = designPosition;
    if (designPosition == null) {
      return false;
    }

    host[0] = designPosition.getContainerPart();
    position[0] = DOMPositionHelper.toDOMPosition(designPosition);
    ILocalDropHandler[] handlers = RegistryReader.getAllHandlers();
    Object localData = request.getLocalObject();
    for (int i = 0; i < handlers.length; i++) {
      FeedBackInfo feedback = handlers[i].supportInsertElements(
View Full Code Here

Examples of org.eclipse.jst.pagedesigner.viewer.DesignPosition

      EditPart part = (EditPart) container.getAdapterFor(EditPart.class);
      if (part != null) {
        if (container instanceof Text) {
          String textData = ((Text) container).getData();
          String displayData = ((TextEditPart) part).getTextData();
          return new DesignPosition(part,
              textDataOffsetToDisplayOffset(textData,
                  displayData, position.getOffset()));
        }
                Node pre = position.getPreviousSiblingNode();
                while (pre != null) {
                  int index = findChildEditPartIndex(part, pre);
                  if (index != -1) {
                    return new DesignPosition(part, index + 1);
                  }
                  pre = pre.getPreviousSibling();
                }
                return new DesignPosition(part, 0);
      }
            position = new DOMRefPosition(position.getContainerNode(),
                false);
    } while (true);
  }
View Full Code Here

Examples of org.eclipse.jst.pagedesigner.viewer.DesignPosition

      EditPart part = (EditPart) container.getAdapterFor(EditPart.class);
      if (part != null) {
        if (container instanceof Text) {
          String textData = ((Text) container).getData();
          String displayData = ((TextEditPart) part).getTextData();
          return new DesignPosition(part,
              textDataOffsetToDisplayOffset(textData,
                  displayData, position.getOffset()));
        }
                Node pre = position.getPreviousSiblingNode();
                while (pre != null) {
                  int index = findChildEditPartIndex(part, pre);
                  if (index != -1) {
                    return new DesignPosition(part, index + 1);
                  }
                  pre = pre.getPreviousSibling();
                }
                return new DesignPosition(part, 0);
      }
            return DesignPosition.INVALID;
    } while (true);
  }
View Full Code Here

Examples of org.eclipse.jst.pagedesigner.viewer.DesignPosition

   * @param range
   * @return the design range
   */
  public static DesignRange toDesignRange(DOMRange range) {
    if (range.getStartPosition() == range.getEndPosition()) {
      DesignPosition dp = DOMPositionHelper.toDesignPosition(range
          .getStartPosition());
      return new DesignRange(dp, dp);
    }
    return new DesignRange(DOMPositionHelper.toDesignPosition(range
        .getStartPosition()), DOMPositionHelper.toDesignPosition(range
View Full Code Here

Examples of org.eclipse.jst.pagedesigner.viewer.DesignPosition

      startDomPos = endDomPos;
    } else if (endDomPos == null) {
      endDomPos = startDomPos;
    }
    if (startDomPos != null) {
      DesignPosition startPos = null, endPos = null;
      startPos = DOMPositionHelper.toDesignPosition(startDomPos);
      endPos = DOMPositionHelper.toDesignPosition(endDomPos);
      if (startPos != null) {
        return new DesignRange(startPos, endPos);
      }
View Full Code Here

Examples of org.eclipse.jst.pagedesigner.viewer.DesignPosition

    try {
      if (range == null) {
        return null;
      }
      IDOMPosition startPos = range.getStartPosition();
      DesignPosition start = DOMPositionHelper.toDesignPosition(startPos);
      if (range.isEmpty()) {
        return new DesignRange(start, start);
      }
            IDOMPosition endPos = range.getEndPosition();
            return new DesignRange(start, DOMPositionHelper
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.