Package org.eclipse.jst.pagedesigner.parts

Examples of org.eclipse.jst.pagedesigner.parts.ElementEditPart


        .getTableOperationContext(part);
    if (context == null) {
      return;
    }

    final ElementEditPart tablePart = context.getTablePart();

    if (tablePart == null || !supportTableActions(tablePart)) {
      return;
    }

    final int cellRow = context.getRowIndex();
    final int cellColumn = context.getColumnIndex();

    String tag = ((IDOMElement) tablePart.getIDOMNode()).getLocalName();
    final IMenuManager tableMenu = new MenuManager(tag);

    // ok, we passed the checking, now let's create the actions.
    tableMenu.add(action);
    tableMenu.addMenuListener(new IMenuListener() {
View Full Code Here


    }

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

   * (non-Javadoc)
   *
   * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
   */
  public void fillContextMenu(IMenuManager menu) {
    ElementEditPart part = fixUpSelection(getContext().getSelection());
    if (part == null) {
      return;
    }
    IDOMElement ele = (IDOMElement) part.getIDOMNode();
        addPositionRelativeMenu(menu, part, ele);
    addStylelMenu(menu, part, ele);

    // next add element special actions
    IElementEdit elementEdit = part.getElementEdit();
    if (elementEdit != null) {
      elementEdit.fillContextMenu(menu, ele);
    }
  }
View Full Code Here

   * @see org.eclipse.jst.pagedesigner.elementedit.IElementEdit#fillContextMenu(org.eclipse.jface.action.IMenuManager,
   *      org.w3c.dom.Element)
   */
  public void fillContextMenu(IMenuManager contextMenu, Element ele) {

    final ElementEditPart tablePart =
      (ElementEditPart) ((IDOMElement) ele).getAdapterFor(EditPart.class);

    final Element table = (Element) tablePart.getModel();

    final TableChildElementPosition position = new TableUtil(table).getPosition((Node)null);
    final int cellRow = position.getRowIndex();
    final int cellColumn = position.getColumnIndex();

View Full Code Here

  /**
   * @param request
   * @return true if we should be using object mode for this request
   */
  public boolean shouldUseObjectMode(Request request) {
    ElementEditPart part = (ElementEditPart) this.getHost();
    if (isStyleTags(part)) {
      return false;
    }
    if (part.isWidget()
        || (!part.canHaveDirectTextChild() && !part
            .haveNonWhitespaceTextChild())) {
      return true;
    }
    if (request instanceof SelectionRequest
        && ((SelectionRequest) request).isControlKeyPressed()) {
      return true;
    }
    if (request instanceof LocationModifierRequest
        && ((LocationModifierRequest) request).isControlKeyPressed()) {
      return true;
    }

    // for other elements
    if (request instanceof LocationRequest) {
      Point location = ((LocationRequest) request).getLocation()
          .getCopy();
      part.getFigure().translateToRelative(location);
      return shouldUseObjectMode(location);
    }
        return false; // should not happen
  }
View Full Code Here

   * (non-Javadoc)
   *
   * @see org.eclipse.gef.editpolicies.ResizableEditPolicy#getResizeCommand(org.eclipse.gef.requests.ChangeBoundsRequest)
   */
  protected Command getResizeCommand(ChangeBoundsRequest request) {
    ElementEditPart part = (ElementEditPart) this.getHost();

    Rectangle rect = part.getFigure().getBounds();
    rect = request.getTransformedRectangle(rect);
    int width = rect.width;
    int height = rect.height;

    // since the user dragged rectangle included border/padding of the
    // element. And if the element's
    // width/height style setting don't include border padding, then we need
    // to set the element's width/height
    // style property a little smaller.
    if (part.getFigure() instanceof CSSFigure) {
      CSSFigure cssfigure = (CSSFigure) part.getFigure();
      ICSSStyle style = cssfigure.getCSSStyle();
      if (style != null && !style.isSizeIncludeBorderPadding()) {
        width -= (style.getBorderInsets().getWidth() + style
            .getPaddingInsets().getWidth());
        height -= (style.getBorderInsets().getHeight() + style
            .getPaddingInsets().getHeight());
      }
    }

    //make sure to only change the dimensions for the direction of the resize request.
    int resizeDirection = request.getResizeDirection();
    switch (resizeDirection) {
      case PositionConstants.EAST:
      case PositionConstants.WEST:
        //resizing, only the width, so set the height to -1;
        height = -1;
        break;
      case PositionConstants.NORTH:
      case PositionConstants.SOUTH:
        //resizing only the height, so set the width to -1
        width = -1;
        break;
      default:
        //all others are changing both directions...
    }
    return getResizeCommand((IDOMElement) part.getIDOMNode(), width, height);
  }
View Full Code Here

   * @param part
   * @return the operation context for part
   */
  public static TableOperationContext getTableOperationContext(EditPart part) {
    EditPart originalPart = part;
    ElementEditPart tablePart = null;
    CSSTableLayout2 tableLayout = null;

    while (part.getParent() instanceof ElementEditPart) {
      part = part.getParent();
      IFigure figure = ((GraphicalEditPart) part).getFigure();
View Full Code Here

TOP

Related Classes of org.eclipse.jst.pagedesigner.parts.ElementEditPart

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.