Package org.eclipse.gef

Examples of org.eclipse.gef.EditPart


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


        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 {
      point = new Point(((CaretPositionTracker) _viewer).getXoffset(),
View Full Code Here

    return result;
  }

  private EditPart getRootEditablePart(EditPart part,
      IMovementMediator moveMediator) {
    EditPart rootpart = null;
    if ((rootpart = ((InlineEditingNavigationMediator) moveMediator)
        .getRootConstainedEditableContainer(new Target(part))) == null) {
      rootpart = moveMediator.getEditableContainer(new Target(part));
    }
    return rootpart;
View Full Code Here

   * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
   */
  public void fillContextMenu(IMenuManager menu) {
    ISelection selection = this.getContext().getSelection();

    EditPart part = findCommonAncesterPart(selection);
    if (!(part instanceof NodeEditPart)) {
      return;
    }

    NodeEditPart original = (NodeEditPart) part;
    // start from the parent of part
    while (part.getParent() instanceof ElementEditPart) {
      ElementEditPart elementEditPart = (ElementEditPart) part
          .getParent();

      IElementEdit elementEdit = elementEditPart.getElementEdit();
      if (elementEdit != null) {
        boolean filled = elementEdit.fillContainerContextMenu(menu,
            elementEditPart, original, selection);
        if (filled) {
          break;
        }
      }

      part = part.getParent();
    }
  }
View Full Code Here

     */
    protected String getDropHintText(DesignPosition position)
    {
        StringBuffer buffer = new StringBuffer("Place"); //$NON-NLS-1$
       
        EditPart prevPart = position.getSiblingEditPart(false);
        EditPart nextPart = position.getSiblingEditPart(true);

        if (nextPart instanceof ElementEditPart)
        {
            buffer.append(" before "); //$NON-NLS-1$
            buffer.append(((ElementEditPart)nextPart).getTagConvert().getHostElement().getNodeName());
View Full Code Here

        return null;
  }

  public IDOMModel getModel() {
    // XXX: temp implementation.
    EditPart part = this.getContents();
    if (part != null) {
      return ((IDOMNode) part.getModel()).getModel();
    }
        return null;
  }
View Full Code Here

    List list = this.getSelectedEditParts();
    if (list.isEmpty()) {
      return null;
    }
    for (int i = 0, n = list.size(); i < n; i++) {
      EditPart part = (EditPart) list.get(i);
      if (part.getSelected() == EditPart.SELECTED_PRIMARY) {
        return part;
      }
    }
    return (EditPart) list.get(0);
  }
View Full Code Here

   *
   * @see org.eclipse.jst.pagedesigner.parts.IHTMLGraphicalViewer#ensureRangeSelectionMode()
   */
  public void ensureRangeSelectionMode() {
    if (!_rangeMode) {
      EditPart primary = getPrimarySelectedNode();
      this.deselectAll();
      DesignPosition begin = primary == null ? DesignPosition.INVALID
          : DesignPosition.createPositionBeforePart(primary);
      DesignPosition after = primary == null ? DesignPosition.INVALID
          : DesignPosition.createPositionAfterPart(primary);
View Full Code Here

  public EditPart getRootConstainedEditableContainer(Target target) {
    // if (EditModelQuery.isDocument(target.getNode()))
    // {
    // return target.getPart();
    // }
    EditPart part = target.getPart();
    while (part != null) {
      if (hasEditableArea(target) && !allowsMoveOut(target)) {
        break;
      }
      part = part.getParent();
      target = new Target(part);
    }
    if (part instanceof DocumentEditPart
        && RootContainerPositionRule.hasBasicContainers((Document) part
            .getModel())) {
      Node node = RootContainerPositionRule
          .getBasicContainer((Document) part.getModel());
      part = Target.resolvePart(node);
    }

    return part;
  }
View Full Code Here

  /**
   * @see org.eclipse.jst.pagedesigner.validation.caret.IMovementMediator#getConstainedEditableContainer(org.eclipse.jst.pagedesigner.validation.caret.Target)
   */
  public EditPart getConstainedEditableContainer(Target target) {
    EditPart part = target.getPart();
    while (part != null) {
      if (hasEditableArea(target)) {
        break;
      }
      part = part.getParent();
      target = new Target(part);
    }
    if (part instanceof DocumentEditPart
        && RootContainerPositionRule.hasBasicContainers((Document) part
            .getModel())) {
      Node node = RootContainerPositionRule
          .getBasicContainer((Document) part.getModel());
      part = Target.resolvePart(node);
    }
    return part;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.gef.EditPart

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.