Package org.eclipse.gef

Examples of org.eclipse.gef.EditPart


    new ExposeHelper((IHTMLGraphicalViewer) viewer).exposeArea(rect);
    viewLocation = port.getViewLocation();
    Dimension offset = lastLocation.getDifference(viewLocation);

    p.translate(offset.width, offset.height);
    EditPart part = viewer.findObjectAt(p);
    if (part != null && !(part instanceof ScalableRootEditPart)) {
      while (part != null) {
        Target target = new Target(part);
        if (hasEditableArea(target)) {
          if (allowsMoveIn(target)
              || EditModelQuery.isChild(target.getNode(),
                  position.getContainerNode())) {
            break;
          }
        }
        part = part.getParent();
      }
      if (part instanceof DocumentEditPart
          && RootContainerPositionRule
              .hasBasicContainers((Document) part.getModel())) {
        Node node = RootContainerPositionRule
            .getBasicContainer((Document) part.getModel());
        part = Target.resolvePart(node);
      }
      return part;
    }
        return null;
View Full Code Here


   * restricted.
   *
   * @see org.eclipse.jst.pagedesigner.validation.caret.IPositionRule#hasEditableArea(org.eclipse.jst.pagedesigner.validation.caret.Target)
   */
  public boolean hasEditableArea(Target target) {
    EditPart part = target.getPart();
    if (part == null) {
      return false;
    }
    Node node = target.getNode();
    if (hasBasicContainers(EditModelQuery.getDocumentNode(node))) {
View Full Code Here

   *
   * @param part
   * @return a design position one before part
   */
  public static DesignPosition createPositionBeforePart(EditPart part) {
    EditPart parent = part.getParent();

    if (parent == null) {
      return new DesignPosition(part, 0);
    }
        return new DesignPosition(parent, parent.getChildren()
            .indexOf(part));
  }
View Full Code Here

   *
   * @param part
   * @return the design position for one after part
   */
  public static DesignPosition createPositionAfterPart(EditPart part) {
    EditPart parent = part.getParent();

    if (parent == null) {
      return new DesignPosition(part, part.getChildren().size());
    }
        return new DesignPosition(parent, parent.getChildren()
            .indexOf(part) + 1);
  }
View Full Code Here

    _width = rect.width;
    _height = rect.height;
  }

  private void resetBounds(LayoutPart lPart) {
    EditPart part = lPart.getPart();
    Rectangle rect = lPart.getAbsoluteBounds();
    resetBounds(rect);
    _parts.clear();
    _parts.put(part, lPart);
  }
View Full Code Here

    if (selection instanceof IStructuredSelection) {
      Object[] array = ((IStructuredSelection) selection).toArray();
      _structuredSelectedNodes = new ArrayList();
      if (array != null) {
        for (int i = 0; i < array.length; i++) {
          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

      // selection
      List parts = new ArrayList();
      for (int i = 0, size = _structuredSelectedNodes.size(); i < size; i++) {
        Object obj = _structuredSelectedNodes.get(i);
        if (obj instanceof INodeNotifier) {
          EditPart part = (EditPart) ((INodeNotifier) obj)
              .getAdapterFor(EditPart.class);
          if (part != null)
            parts.add(part);
        }
      }
View Full Code Here

    try {
      final int CARET_OFFSET = 1;
      if (position == null || !position.isValid()) {
        return null;
      }
      EditPart containerEditPart = position.getContainerPart();
      if (containerEditPart instanceof TextEditPart) {
        CSSTextFigure figure = (CSSTextFigure) ((TextEditPart) containerEditPart)
            .getFigure();
        ret = figure.calculateCaretPosition(position.getOffset());
        figure.translateToAbsolute(ret);
        ret.width = CaretUpdater.CARET_WIDTH;
      } else {
        int offset = position.getOffset();
        // there is no child
        if (containerEditPart.getChildren().isEmpty()
            || LayoutPart.getConcretePart(containerEditPart) == null) {
          IFigure figure = ((GraphicalEditPart) containerEditPart)
              .getFigure();
          Rectangle bounds = figure.getBounds();
          if (figure instanceof CSSFigure) {
            List fragments = ((CSSFigure) figure)
                .getFragmentsForRead();
            if (fragments.size() > 0) {
              FlowBox box = (FlowBox) fragments.get(fragments
                  .size() - 1);
              bounds = LayoutPart.getBounds(box);
            }
          }

          ret = new Rectangle(bounds.x + CARET_OFFSET, bounds.y,
              CaretUpdater.CARET_WIDTH, bounds.height);

          figure.translateToAbsolute(ret);
        } else if (offset >= 0
            && offset <= containerEditPart.getChildren().size()) {
          ret = getRefRect(position);
        }
      }
    } catch (Exception e) {
      // This should never happen, we catch here for later analysis.
View Full Code Here

          boxLine, validator);
      if (position == null) {
        position = innerFindEditPartPosition(host, host, p, boxLine,
            validator);
        if (position == null) {
          EditPart part = boxLine.getClosestPart();
          if (part != null) {
            LayoutPart layoutPart = new LayoutPart(part, p);
            position = layoutPart.resolvePosition(validator);
          }
        }
View Full Code Here

          host, host, p, boxLine, validator);
      if (position == null) {
        position = innerFindEditPartPositionConstrained(host, host, p,
            boxLine, validator);
        if (position == null) {
          EditPart part = boxLine.getClosestPart();
          if (part != null) {
            LayoutPart layoutPart = new LayoutPart(part, p);
            position = layoutPart.resolvePosition(validator);
          }
        }
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.