Package org.eclipse.jst.pagedesigner.viewer

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


   * (non-Javadoc)
   *
   * @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


        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
                .toDesignPosition(endPos));
            // TODO: don't know what this exception catch is for
//    } catch (Exception e) {
//      // "Selection error"
//      _log.error("Error.RangeModeCommand.SetSelection"); //$NON-NLS-1$
View Full Code Here

   *
   * @see org.eclipse.gef.commands.Command#execute()
   */
  public void execute() {
    int OFFSET = 2;
    DesignRange range = _viewer.getRangeSelection();
    if (range == null || !range.isValid()) {
      _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) {
View Full Code Here

        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
            || position.getContainerNode() instanceof Text) {
          return position.getContainerPart();
        }
                return position.getSiblingEditPart(false);
View Full Code Here

          EditPart part = (EditPart) array[i];
          _structuredSelectedNodes.add(part.getModel());
        }
      }
    } else if (selection instanceof DesignRange) {
      DesignRange range = (DesignRange) selection;
      _rangeSelection = DOMRangeHelper.toDOMRange(range);
    }
  }
View Full Code Here

   *
   * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
   */
  public void fillContextMenu(IMenuManager contextMenu)
    {
    DesignRange selection = fixUpSelection(getContext().getSelection());
    if (selection == null) {
      return;
    }
        IContributionItem styleSubMenuItem =
            contextMenu.find(PageDesignerActionConstants.STYLE_SUBMENU_ID);
View Full Code Here

  /**
   * Update the status
   */
  protected void updateStatus() {
    DesignRange range = _viewer.getRangeSelection();
    DOMRange domRange = null;
    if (range != 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

   * @return true if this action can run
   */
  protected boolean canRun(IHTMLGraphicalViewer viewer) {
    if (viewer != null && viewer.isInRangeMode()
        && viewer.getModel().getDocument().hasChildNodes()) {
      DesignRange range = viewer.getRangeSelection();
      if (range != null && range.isValid()) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

   */
  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
        .getEndPosition()));
  }
View Full Code Here

   *
   * @see org.eclipse.jface.action.IAction#run()
   */
  public void run() {
    // Assert.isTrue(_viewer != null && _viewer.isInRangeMode());
    DesignRange range = _viewer.getRangeSelection();
    if (range == null || !range.isValid()) {
      return;
    }
    Command command = getCommand();
    if (command != null) {
      command.execute();
View Full Code Here

TOP

Related Classes of org.eclipse.jst.pagedesigner.viewer.DesignRange

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.