Package org.eclipse.gef

Examples of org.eclipse.gef.EditPart


  /**
   * Adjust the position to an editable area.
   */
  public EditPart getEditableContainer(Target target) {
    EditPart part = target.getPart();
    if (hasEditableArea(target)) {
      return target.getPart();
    }
    while (part != null && !(part instanceof DocumentEditPart)) {
      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


        DesignPosition position = new DesignRefPosition(target
            .getPart(), atRight);
        if (EditPartPositionHelper.getConcretePart(position, atRight) != null) {
          result = true;
        } else {
          EditPart part = EditPartPositionHelper.getNextConcretPart(
              position, atRight);
          EditPart oppPart = EditPartPositionHelper
              .getNextConcretPart(position, !atRight);
          if (part == null) {
            if (oppPart == null) {
              result = true;
            }
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 == null) {
      return;
    }

    TableOperationContext context = TableOperationContext
View Full Code Here

   * (non-Javadoc)
   *
   * @see org.eclipse.gef.EditPolicy#getCommand(org.eclipse.gef.Request)
   */
  public Command getCommand(Request request) {
    EditPart part = this.getHost();
    IHTMLGraphicalViewer viewer = null;
    if (part instanceof TextEditPart) {
      //TODO: ?? part = (TextEditPart) part;
      viewer = (IHTMLGraphicalViewer) part.getViewer();
    }
    if (request instanceof LinkRequest) {
      LinkRequest req = (LinkRequest) request;
      String identifier = req.getIdentifier();
      DesignRange range = req.getDesignRange();
View Full Code Here

    }

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

    if (range == null || !range.isValid())
      return false;
    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;
View Full Code Here

    if (a1 == null || a2 == null)
      return Integer.MIN_VALUE;
    if (a1.get(0) != a2.get(0))
      return Integer.MIN_VALUE; // not same DocumentEditPart
    for (int i = 1;; i++) {
      EditPart p1a = (EditPart) a1.get(i);
      EditPart p2a = (EditPart) a2.get(i);
      if (p1a == p2a) {
        if (p1a != null)
                {
          continue; // same ancester
                }
                // both are null. just compare the offset.
                return offset1 < offset2 ? -1
                    : (offset1 == offset2 ? 0 : 1);
      }
      // p1a != p2a. now we can just compare p1a and p2a to decide the
      // order.
      if (p1a != null)
        offset1 = p1a.getParent().getChildren().indexOf(p1a);
      if (p2a != null)
        offset2 = p2a.getParent().getChildren().indexOf(p2a);
      if ((p1a == null && p2a == null) || (p1a != null && p2a != null)) {
        return offset1 < offset2 ? -1 : (offset1 == offset2 ? 0 : 1);
      } else if (p1a == null) {
        return offset1 <= offset2 ? -1 : 1;
      } else {
View Full Code Here

  /**
   * Refreshes the design page. Allows an external action to force a refresh
   * after an external change, such as a DT skin change.
   */
  public void refreshDesignViewer() {
    EditPart contentEditPart = _designViewer.getGraphicViewer().getRootEditPart().getContents();
    if (contentEditPart instanceof DocumentEditPart) {
      ((DocumentEditPart)contentEditPart).styleChanged();
    }
  }
View Full Code Here

    List list2 = getAncesters(part2);
    if (list2 == null)
      return null;
    if (list1.get(0) != list2.get(0))
      return null;
    EditPart common = (EditPart) list1.get(0);
    for (int i = 1;; i++) {
      EditPart p1 = (EditPart) list1.get(i);
      EditPart p2 = (EditPart) list2.get(i);
      if (p1 == null || p2 == null)
        return common;
      if (p1 != p2)
        return common;
      common = p1;
View Full Code Here

   * @param constraint
   */
  public DesignResizeComponentCommand(EditPart child, Object constraint) {
    this._part = child;
    this._constraint = constraint;
    EditPart part = child;
    if (part instanceof ScalableRootEditPart) {
            // TODO: eh?
            // do nothing I guess...
    } else {
      while (part != null
          && !(part.getParent() instanceof ScalableRootEditPart)) {
        part = part.getParent();
      }
    }
    if (part != null) {
      EditPartViewer viewer = ((ScalableRootEditPart) part.getParent())
          .getViewer();
      HTMLEditor editor = ((HTMLEditor) ((DefaultEditDomain) ((IHTMLGraphicalViewer) viewer)
          .getEditDomain()).getEditorPart());
      _viewer = editor.getTextEditor().getTextViewer();
    }
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.