Examples of DesignPosition


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

    boolean result = super.canReference(target, atRight);
    if (EditModelQuery.isText(target.getNode())) {
      if (((Text) target.getNode()).getData().length() == 0) {
        result = false;
      } else if (EditModelQuery.isTransparentText(target.getNode())) {
        DesignPosition position = new DesignRefPosition(target
            .getPart(), atRight);
        if (EditPartPositionHelper.getConcretePart(position, atRight) != null) {
          result = true;
        } else {
          EditPart part = EditPartPositionHelper.getNextConcretPart(
View Full Code Here

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

  protected boolean canRun(IHTMLGraphicalViewer viewer) {
    if (viewer != null && viewer.isInRangeMode()
        && viewer.getModel().getDocument().hasChildNodes()) {
      DesignRange range = viewer.getRangeSelection();
      if (range != null && range.isValid()) {
        DesignPosition startPos = range.getStartPosition();
        DesignPosition endPos = range.getEndPosition();
        if (startPos != endPos) {
          return true;
        }
      }
    }
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) {
          return position.getContainerPart();
        }
                return position.getSiblingEditPart(true);
      }
            return RangeUtil.findCommonAncestor(range);
    } else {
      return null;
    }
View Full Code Here

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

    IDOMNode node1 = (IDOMNode) region1;

    if (node1 == null) {
      IDOMPosition endOfDoc = new DOMRefPosition2(model.getDocument(),
          true);
      DesignPosition p = DOMPositionHelper.toDesignPosition(endOfDoc);
      return new DesignRange(p, p);
    }

    if ((region1 == region2 || node1.getEndOffset() == offset + length)
        && !(node1 instanceof Text)) {
      // ok, we selected a single node.
      EditPart part = (EditPart) node1.getAdapterFor(EditPart.class);
      if (part != null) {
        return new StructuredSelection(part);
      }
    }

    // when we reach here, we'll create a DesignerRange
    IDOMPosition position1 = toDOMPosition(model, region1, offset);
    IDOMPosition position2 = (length == 0 ? position1 : toDOMPosition(
        model, region2, offset + length));

    if (position1 == null || position2 == null) {
      return new DesignRange(null, null);
    }
    DesignPosition p1 = DOMPositionHelper.toDesignPosition(position1);
    DesignPosition p2 = (length == 0 ? p1 : DOMPositionHelper
        .toDesignPosition(position2));
    if (p1 == null || p2 == null) {
      return new DesignRange(null, null);
    }
View Full Code Here

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

    range = normalize(range);
    if (part instanceof DocumentEditPart)
      return true;
    EditPart parent = part.getParent();
    int index = parent.getChildren().indexOf(part);
    DesignPosition left = new DesignPosition(parent, index);
    DesignPosition right = new DesignPosition(parent, index + 1);
    int compare = compareDesignPosition(left, range.getEndPosition());
    if (compare == 1 || compare == 0 || compare == Integer.MIN_VALUE)
      return false;

    compare = compareDesignPosition(right, range.getStartPosition());
View Full Code Here

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

   */
  public static EditPart findCommonAncestor(DesignRange range) {
    if (!range.isValid()) {
      return null;
    }
    DesignPosition startPosition = range.getStartPosition();
    DesignPosition endPosition = range.getEndPosition();
    return findCommonAncester(startPosition.getContainerPart(), endPosition
        .getContainerPart());
  }
View Full Code Here

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

   * (non-Javadoc)
   *
   * @see org.eclipse.gef.commands.Command#execute()
   */
  public void execute() {
    DesignPosition position = null;
    if (_viewer.isInRangeMode()) {
      if (_viewer.getRangeSelection() != null
          && _viewer.getRangeSelection().isValid()) {
        position = _viewer.getRangeSelection().getEndPosition();
        position = performInlineMode(_forward);
View Full Code Here

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

    }
    setRange(position);
  }

  private DesignPosition performObjectMode() {
    DesignPosition result = null;
    IMovementMediator validator = new InlineEditingNavigationMediator(
        new ActionData(ActionData.KEYBOARD_NAVAGATION, null));
    DesignPosition position = getCurrentObjectPosition();
    if (position != null) {
      _viewer.setRange(position, position);
      if (!validator.isValidPosition(position)) {
        position = performInlineMode(_forward);
        if (validator.isValidPosition(position)) {
View Full Code Here

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

    if (range == null || !range.isValid()) {
      _log.error("invalid range"); //$NON-NLS-1$
      return null;
    }

    DesignPosition position = range.getEndPosition();
    if (position.getContainerPart() instanceof TextEditPart) {
      int length = ((TextEditPart) position.getContainerPart())
          .getTextData().length();
      int newoffset = position.getOffset() + (_forward ? 1 : -1);
      if (newoffset >= 0 && newoffset <= length) {
        DesignPosition newposi = new DesignPosition(position
            .getContainerPart(), newoffset);
        return newposi;
      }
    }
    DesignPosition newpos = EditHelper.moveToNextEditPosition(
        ActionData.KEYBOARD_NAVAGATION, position, forward);
    return newpos;
  }
View Full Code Here

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

    } else {
      List parts = _viewer.getSelectedEditParts();
      if (parts.size() > 0) {
        EditPart selection = (EditPart) parts.get(0);
        if (selection instanceof SubNodeEditPart) {
          DesignPosition position = new DesignRefPosition(selection,
              _forward);
          result = new DesignRange(position, position);
        }
      }
    }
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.