Package org.eclipse.wb.core.gef.command

Examples of org.eclipse.wb.core.gef.command.EditCommand


  //
  ////////////////////////////////////////////////////////////////////////////
  @Override
  protected Command getCreateCommand(CreateRequest request) {
    final LayoutInfo newLayout = (LayoutInfo) request.getNewObject();
    return new EditCommand(m_container) {
      @Override
      protected void executeEdit() throws Exception {
        m_container.setLayout(newLayout);
      }
    };
View Full Code Here


  @Override
  protected void updateTooltipCommand() {
    double width0 = (double) m_newSize.width / getParentHeight();
    final double width = (int) (100 * width0) / 100.0;
    m_tooltip = "width: " + width;
    m_command = new EditCommand(m_widget) {
      @Override
      protected void executeEdit() throws Exception {
        ColumnLayoutInfo.getColumnData(m_widget).setWidth(width);
      }
    };
View Full Code Here

  private TextFeedback m_textFeedback;

  //
  private Command getResizeCommand(ChangeBoundsRequest request) {
    final Rectangle newBounds = request.getTransformedRectangle(getHostFigure().getBounds());
    return new EditCommand(m_column) {
      @Override
      protected void executeEdit() throws Exception {
        int newWidth = Math.max(newBounds.width, 0);
        m_column.setWidth(newWidth);
      }
View Full Code Here

    if (m_resizeDirection == IPositionConstants.EAST) {
      if (m_ctrlPressed) {
        int offset = getParentWidth() - m_newSize.width;
        final String width = offset > 0 ? "-" + offset : "" + offset;
        m_tooltip = "width: " + width + "\nRelease Ctrl to set width in percents";
        m_command = new EditCommand(m_widget) {
          @Override
          protected void executeEdit() throws Exception {
            AnchorLayoutInfo.getAnchorData(m_widget).setAnchorWidth(width);
          }
        };
      } else {
        final String width = m_newSize.width * 100 / getParentWidth() + "%";
        m_tooltip = "width: " + width + "\nPress Ctrl to set offset from right";
        m_command = new EditCommand(m_widget) {
          @Override
          protected void executeEdit() throws Exception {
            AnchorLayoutInfo.getAnchorData(m_widget).setAnchorWidth(width);
          }
        };
      }
    }
    // SOUTH
    if (m_resizeDirection == IPositionConstants.SOUTH) {
      if (m_ctrlPressed) {
        int offset = getParentHeight() - m_newSize.height;
        final String height = offset > 0 ? "-" + offset : "" + offset;
        m_tooltip = "height: " + height + "\nRelease Ctrl to set height in percents";
        m_command = new EditCommand(m_widget) {
          @Override
          protected void executeEdit() throws Exception {
            AnchorLayoutInfo.getAnchorData(m_widget).setAnchorHeight(height);
          }
        };
      } else {
        final String height = m_newSize.height * 100 / getParentHeight() + "%";
        m_tooltip = "height: " + height + "\nPress Ctrl to set offset from bottom";
        m_command = new EditCommand(m_widget) {
          @Override
          protected void executeEdit() throws Exception {
            AnchorLayoutInfo.getAnchorData(m_widget).setAnchorHeight(height);
          }
        };
View Full Code Here

  @Override
  protected void updateTooltipCommand() {
    if (m_ctrlPressed) {
      final String height = m_newSize.height * 100 / getParentHeight() + "%";
      m_tooltip = "height: " + height + "\nRelease Ctrl to set height in pixels";
      m_command = new EditCommand(m_widget) {
        @Override
        protected void executeEdit() throws Exception {
          RowLayoutInfo.getRowData(m_widget).setHeight(height);
        }
      };
    } else {
      final int height = m_newSize.height;
      m_tooltip = "height: " + height + "px" + "\nPress Ctrl to set height in percents";
      m_command = new EditCommand(m_widget) {
        @Override
        protected void executeEdit() throws Exception {
          RowLayoutInfo.getRowData(m_widget).setHeight(height);
        }
      };
View Full Code Here

  // Commands
  //
  ////////////////////////////////////////////////////////////////////////////
  @Override
  protected Command getCreateCommand(final Object newObject, final Object referenceObject) {
    return new EditCommand(m_portal) {
      @Override
      protected void executeEdit() throws Exception {
        command_CREATE(newObject, referenceObject);
      }
    };
View Full Code Here

        });
  }

  @Override
  protected Command getMoveCommand(final Object moveObject, final Object referenceObject) {
    return new EditCommand(m_portal) {
      @Override
      protected void executeEdit() throws Exception {
        command_MOVE(moveObject, referenceObject);
      }
    };
View Full Code Here

    };
  }

  @Override
  protected Command getAddCommand(final Object addObject, final Object referenceObject) {
    return new EditCommand(m_portal) {
      @Override
      protected void executeEdit() throws Exception {
        command_ADD(addObject, referenceObject);
      }
    };
View Full Code Here

  //
  ////////////////////////////////////////////////////////////////////////////
  @Override
  protected Command getCreateCommand(Object newObject, Object referenceObject) {
    final LayoutInfo newLayout = (LayoutInfo) newObject;
    return new EditCommand(m_container) {
      @Override
      protected void executeEdit() throws Exception {
        m_container.setLayout(newLayout);
      }
    };
View Full Code Here

  //
  ////////////////////////////////////////////////////////////////////////////
  @Override
  protected Command getCreateCommand(Object newObject, Object referenceObject) {
    final LayoutInfo newLayout = (LayoutInfo) newObject;
    return new EditCommand(m_container) {
      @Override
      protected void executeEdit() throws Exception {
        m_container.setLayout(newLayout);
      }
    };
View Full Code Here

TOP

Related Classes of org.eclipse.wb.core.gef.command.EditCommand

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.