Examples of DesignRange


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

   * (non-Javadoc)
   *
   * @see org.eclipse.jst.pagedesigner.commands.range.DesignerToolBarAction#getCommand()
   */
  protected Command getCommand() {
    DesignRange range = getViewer().getRangeSelection();
    DOMRange dRange = DOMRangeHelper.toDOMRange(range);
    Command command;
    if (isApplied(dRange)) {
      // command = new UnapplyStyleCommand(getViewer(), _expectedTag,
      // null, null);
View Full Code Here

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

   */
  public void updateStatus() {
    IHTMLGraphicalViewer viewer = getViewer();
    if (viewer != null && viewer.isInRangeMode()
        && viewer.getModel().getDocument().hasChildNodes()) {
      DesignRange range = getViewer().getRangeSelection();
      if (range != null && range.isValid()) {
        DOMRange domRange = null;
        domRange = new DOMRange(DOMPositionHelper.toDOMPosition(range
            .getStartPosition()), DOMPositionHelper
            .toDOMPosition(range.getEndPosition()));
        if (isApplied(domRange)) {
          this.setChecked(true);
        } else {
          this.setChecked(false);
        }
View Full Code Here

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

   * @see org.eclipse.jst.pagedesigner.actions.range.DesignerToolBarAction#canRun(org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer)
   */
  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.DesignRange

        return (EditPart) structsel.getFirstElement();
      } else {
        return null;
      }
    } else if (selection instanceof DesignRange) {
      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);
      }
View Full Code Here

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

      viewer = (IHTMLGraphicalViewer) part.getViewer();
    }
    if (request instanceof LinkRequest) {
      LinkRequest req = (LinkRequest) request;
      String identifier = req.getIdentifier();
      DesignRange range = req.getDesignRange();
            // TODO: when part !instancof TextEditPart, viewer == null
      Command command = new MakeLinkCommand(identifier, viewer, part,
          range);
      return command;
    }
View Full Code Here

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

    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);
    }

    return new DesignRange(p1, p2);

  }
View Full Code Here

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

    }
    int result = compareDesignPosition(range.getStartPosition(), range
        .getEndPosition());
    if (result == 1)
        {
      return new DesignRange(range.getEndPosition(), range
          .getStartPosition());
        }
        return range;
  }
View Full Code Here

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

    }
    return result;
  }

  private DesignPosition performInlineMode(boolean forward) {
    DesignRange range = _viewer.getRangeSelection();

    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) {
View Full Code Here

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

      _viewer.setRange(newpos, newpos);
    }
  }

  private DesignPosition getCurrentObjectPosition() {
    DesignRange result = null;
    if (_viewer.isInRangeMode()) {
      result = _viewer.getRangeSelection();
    } 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);
        }
      }
    }
    return result != null && result.isValid() ? result.getEndPosition()
        : null;
  }
View Full Code Here

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

    int position = -1;
    int length = -1;
    ISelection selection = getViewer().getSelection();
    if (selection != null) {
      if (getViewer().isInRangeMode()) {
        DesignRange range = (DesignRange) selection;
        if (range.isValid()) {
          IDOMPosition domPos = DOMPositionHelper.toDOMPosition(range
              .getStartPosition());
          IDOMPosition domEnd = DOMPositionHelper.toDOMPosition(range
              .getEndPosition());
          if (!EditValidateUtil.validPosition(domPos)
              || !EditValidateUtil.validPosition(domEnd)) {
            return false;
          }
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.