Package org.eclipse.jst.pagedesigner.dom

Examples of org.eclipse.jst.pagedesigner.dom.DOMRange


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


  /**
   * @param range
   */
  public void setEnabled(DesignRange range) {
    DOMRange domRange = null;
    // We didn't deal with undo, so only enable is set.
    domRange = new DOMRange(DOMPositionHelper.toDOMPosition(range
        .getStartPosition()), DOMPositionHelper.toDOMPosition(range
        .getEndPosition()));
    if (canRun(domRange)) {
      this.setEnabled(true);
    } else {
View Full Code Here

   * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute()
   */
  protected final void doExecute() {
    DesignRange range = getViewer().getRangeSelection();
    if (range != null && range.isValid()) {
      DOMRange domrange = (range == null || !range.isValid()) ? null
          : toDOMRange(range);
      _resultRange = doRangeExecute(domrange);
    }
  }
View Full Code Here

  /**
   * @param range
   * @return
   */
  private DOMRange toDOMRange(DesignRange range) {
    return new DOMRange(DOMPositionHelper.toDOMPosition(range
        .getStartPosition()), DOMPositionHelper.toDOMPosition(range
        .getEndPosition()));
  }
View Full Code Here

    DesignEdit edit = new CutEdit(selection, getViewer());
    if (EditModelQuery.isSame(selection)) {
      return null;
    }
        if (edit.perform()) {
          return new DOMRange(edit.getOperationPosition(), edit
              .getOperationPosition());
        }
        return selection;
  }
View Full Code Here

  void setRange(DOMRange range) {
    range = EditHelper.normal(range);
    IDOMPosition start = EditHelper.ensureDOMPosition(range
        .getStartPosition());
    IDOMPosition end = EditHelper.ensureDOMPosition(range.getEndPosition());
    _range = new DOMRange(start, end);
    EditValidateUtil.validRange(range);
  }
View Full Code Here

        .addFilter(SWT.Selection, listener);
    boolean status = edit.perform();
    getViewer().getControl().getDisplay().removeFilter(SWT.Selection,
        listener);
    if (status) {
      return new DOMRange(edit.getOperationPosition(), edit
          .getOperationPosition());
    }
        return selection;
  }
View Full Code Here

        }
      }
      StructuredSelection sel = new StructuredSelection(parts);
      return sel;
    } else if (_rangeSelection != null) {
      DOMRange newrange = handleReplacement(_rangeSelection,
          _originalElement, _replacement);
      return DOMRangeHelper.toDesignRange(newrange);
    } else {
      return null;
    }
View Full Code Here

      _log.info("EditHelper, now we are at:" + opPosition); //$NON-NLS-1$
    }
    if (EditModelQuery.isSame(opPosition, getOperationPosition())) {
      return;
    }
        setRange(new DOMRange(opPosition, getOperationPosition()));
        deleteRange();
  }
View Full Code Here

        common = p.getLowestContainer();
      } else {
        common = EditModelQuery.getInstance().getCommonAncestor(start,
            end);
      }
      DOMRange rt;
      // This code is for h1-h6 only, it may need to be replaced.
      if ((rt = replaceExistingH(start, end)) != null) {
        return rt;
      }
      // replace existing p
      if (getTag().equalsIgnoreCase(IHTMLConstants.TAG_P)) {
        rt = replaceExistingP(start, end);
        if (rt != null) {
          return rt;
        }
      }
      if (start.getContainerNode() == end.getContainerNode()) {
        int offset1 = start.getOffset();
        int offset2 = end.getOffset();
        IDOMPosition old = start;
        start = split(start);
        // parent is splited
        if (start != old) {
          container = start.getNextSiblingNode();
          offset2 -= offset1;
          end = new DOMPosition(container, offset2);
        }
        end = split(end);
      } else {
        start = split(common, start);
        end = split(common, end);
      }
      range = InsertStyleTag(new DOMRange(start, end));
    }
    return range;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jst.pagedesigner.dom.DOMRange

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.