Java Code Examples for org.eclipse.draw2d.PositionConstants#MIDDLE

The following examples show how to use org.eclipse.draw2d.PositionConstants#MIDDLE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ERDiagramActionBarContributor.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void buildActions() {
    addRetargetAction(new RetargetAction(ActionFactory.SELECT_ALL.getId(), "selectAll"));
    addRetargetAction(new RetargetAction(ActionFactory.PRINT.getId(), "print"));

    addRetargetAction(new DeleteRetargetAction());
    addRetargetAction(new RetargetAction(ActionFactory.COPY.getId(), "copy"));
    addRetargetAction(new RetargetAction(ActionFactory.PASTE.getId(), "paste"));

    addRetargetAction(new UndoRetargetAction());
    addRetargetAction(new RedoRetargetAction());

    final ZoomInRetargetAction zoomInAction = new ZoomInRetargetAction();
    zoomInAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ZOOM_IN));
    final ZoomOutRetargetAction zoomOutAction = new ZoomOutRetargetAction();
    zoomOutAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ZOOM_OUT));
    addRetargetAction(zoomInAction);
    addRetargetAction(zoomOutAction);
    addRetargetAction(new ZoomAdjustRetargetAction());

    final RetargetAction gridAction = new RetargetAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY, ResourceString.getResourceString("action.title.grid"), IAction.AS_CHECK_BOX);
    gridAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.GRID));

    addRetargetAction(gridAction);

    final RetargetAction gridSnapAction = new RetargetAction(GEFActionConstants.TOGGLE_SNAP_TO_GEOMETRY, ResourceString.getResourceString("action.title.grid.snap"), IAction.AS_CHECK_BOX);
    gridSnapAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.GRID_SNAP));

    addRetargetAction(gridSnapAction);

    final RetargetAction tooltipAction = new RetargetAction(TooltipAction.ID, ResourceString.getResourceString("action.title.tooltip"), IAction.AS_CHECK_BOX);
    tooltipAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.TOOLTIP));
    addRetargetAction(tooltipAction);

    final RetargetAction lockEditAction = new RetargetAction(LockEditAction.ID, ResourceString.getResourceString("action.title.lock.edit"), IAction.AS_CHECK_BOX);
    lockEditAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.LOCK_EDIT));
    addRetargetAction(lockEditAction);

    addRetargetAction(new ExportToDBRetargetAction());

    final AlignmentRetargetAction alignLeftAction = new AlignmentRetargetAction(PositionConstants.LEFT);
    alignLeftAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_LEFT));
    alignLeftAction.setDisabledImageDescriptor(null);
    addRetargetAction(alignLeftAction);
    final AlignmentRetargetAction alignCenterAction = new AlignmentRetargetAction(PositionConstants.CENTER);
    alignCenterAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_CENTER));
    alignCenterAction.setDisabledImageDescriptor(null);
    addRetargetAction(alignCenterAction);
    final AlignmentRetargetAction alignRightAction = new AlignmentRetargetAction(PositionConstants.RIGHT);
    alignRightAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_RIGHT));
    alignRightAction.setDisabledImageDescriptor(null);
    addRetargetAction(alignRightAction);
    final AlignmentRetargetAction alignTopAction = new AlignmentRetargetAction(PositionConstants.TOP);
    alignTopAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_TOP));
    alignTopAction.setDisabledImageDescriptor(null);
    addRetargetAction(alignTopAction);
    final AlignmentRetargetAction alignMiddleAction = new AlignmentRetargetAction(PositionConstants.MIDDLE);
    alignMiddleAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_MIDDLE));
    alignMiddleAction.setDisabledImageDescriptor(null);
    addRetargetAction(alignMiddleAction);
    final AlignmentRetargetAction alignBottomAction = new AlignmentRetargetAction(PositionConstants.BOTTOM);
    alignBottomAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_BOTTOM));
    alignBottomAction.setDisabledImageDescriptor(null);
    addRetargetAction(alignBottomAction);

    final MatchWidthRetargetAction matchWidthAction = new MatchWidthRetargetAction();
    matchWidthAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.MATCH_WIDTH));
    matchWidthAction.setDisabledImageDescriptor(null);
    addRetargetAction(matchWidthAction);
    final MatchHeightRetargetAction matchHeightAction = new MatchHeightRetargetAction();
    matchHeightAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.MATCH_HEIGHT));
    matchHeightAction.setDisabledImageDescriptor(null);
    addRetargetAction(matchHeightAction);

    addRetargetAction(new HorizontalLineRetargetAction());
    addRetargetAction(new VerticalLineRetargetAction());

    addRetargetAction(new ChangeBackgroundColorRetargetAction());
}
 
Example 2
Source File: ERDiagramAlignmentAction.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
/**
     * Initializes the actions UI presentation.
     */
    protected void initUI() {
        switch (alignment) {
            case PositionConstants.LEFT:
                setId(GEFActionConstants.ALIGN_LEFT);
                setText(ALIGNMENT_ACTION_LEFT.getText());
                setToolTipText(ALIGNMENT_ACTION_LEFT.getToolTipText());
                setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_LEFT));
                // setDisabledImageDescriptor(ALIGNMENT_ACTION_LEFT
                // .getDisabledImageDescriptor());
                break;

            case PositionConstants.RIGHT:
                setId(GEFActionConstants.ALIGN_RIGHT);
                setText(ALIGNMENT_ACTION_RIGHT.getText());
                setToolTipText(ALIGNMENT_ACTION_RIGHT.getToolTipText());
                setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_RIGHT));
//			setDisabledImageDescriptor(ALIGNMENT_ACTION_RIGHT
//					.getDisabledImageDescriptor());
                break;

            case PositionConstants.TOP:
                setId(GEFActionConstants.ALIGN_TOP);
                setText(ALIGNMENT_ACTION_TOP.getText());
                setToolTipText(ALIGNMENT_ACTION_TOP.getToolTipText());
                setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_TOP));
//			setDisabledImageDescriptor(ALIGNMENT_ACTION_TOP
//					.getDisabledImageDescriptor());
                break;

            case PositionConstants.BOTTOM:
                setId(GEFActionConstants.ALIGN_BOTTOM);
                setText(ALIGNMENT_ACTION_BOTTOM.getText());
                setToolTipText(ALIGNMENT_ACTION_BOTTOM.getToolTipText());
                setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_BOTTOM));
//			setDisabledImageDescriptor(ALIGNMENT_ACTION_BOTTOM
//					.getDisabledImageDescriptor());
                break;

            case PositionConstants.CENTER:
                setId(GEFActionConstants.ALIGN_CENTER);
                setText(ALIGNMENT_ACTION_CENTER.getText());
                setToolTipText(ALIGNMENT_ACTION_CENTER.getToolTipText());
                setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_CENTER));
//			setDisabledImageDescriptor(ALIGNMENT_ACTION_CENTER
//					.getDisabledImageDescriptor());
                break;

            case PositionConstants.MIDDLE:
                setId(GEFActionConstants.ALIGN_MIDDLE);
                setText(ALIGNMENT_ACTION_MIDDLE.getText());
                setToolTipText(ALIGNMENT_ACTION_MIDDLE.getToolTipText());
                setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_MIDDLE));
//			setDisabledImageDescriptor(ALIGNMENT_ACTION_MIDDLE
//					.getDisabledImageDescriptor());
                break;
        }
    }
 
Example 3
Source File: ERDiagramActionBarContributor.java    From erflute with Apache License 2.0 4 votes vote down vote up
@Override
protected void buildActions() {
    addRetargetAction(new RetargetAction(ActionFactory.SELECT_ALL.getId(), "selectAll"));
    addRetargetAction(new RetargetAction(ActionFactory.PRINT.getId(), "print"));

    addRetargetAction(new DeleteRetargetAction());
    addRetargetAction(new RetargetAction(ActionFactory.COPY.getId(), "copy"));
    addRetargetAction(new RetargetAction(ActionFactory.PASTE.getId(), "paste"));

    addRetargetAction(new UndoRetargetAction());
    addRetargetAction(new RedoRetargetAction());

    final ZoomInRetargetAction zoomInAction = new ZoomInRetargetAction();
    zoomInAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.ZOOM_IN));
    final ZoomOutRetargetAction zoomOutAction = new ZoomOutRetargetAction();
    zoomOutAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.ZOOM_OUT));
    addRetargetAction(zoomInAction);
    addRetargetAction(zoomOutAction);
    addRetargetAction(new ZoomAdjustRetargetAction());

    final RetargetAction gridAction = new RetargetAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY,
            DisplayMessages.getMessage("action.title.grid"), IAction.AS_CHECK_BOX);
    gridAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.GRID));
    addRetargetAction(gridAction);

    final RetargetAction tooltipAction =
            new RetargetAction(ToggleMainColumnAction.ID, DisplayMessages.getMessage("action.title.tooltip"), IAction.AS_CHECK_BOX);
    tooltipAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.TOOLTIP));
    addRetargetAction(tooltipAction);

    final RetargetAction toggleMainColumnAction =
            new RetargetAction(ToggleMainColumnAction.ID, DisplayMessages.getMessage("action.title.mainColumn"), IAction.AS_CHECK_BOX);
    toggleMainColumnAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.MAIN_COLUMN));
    addRetargetAction(toggleMainColumnAction);

    final RetargetAction exportDdlAction =
            new RetargetAction(ExportToDDLAction.ID, DisplayMessages.getMessage("dialog.title.export.ddl"), IAction.AS_CHECK_BOX);
    exportDdlAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.EXPORT_DDL));
    addRetargetAction(exportDdlAction);

    final RetargetAction lockEditAction =
            new RetargetAction(LockEditAction.ID, DisplayMessages.getMessage("action.title.lock.edit"), IAction.AS_CHECK_BOX);
    lockEditAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.LOCK_EDIT));
    addRetargetAction(lockEditAction);

    addRetargetAction(new ExportToDBRetargetAction());

    final AlignmentRetargetAction alignLeftAction = new AlignmentRetargetAction(PositionConstants.LEFT);
    alignLeftAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_LEFT));
    alignLeftAction.setDisabledImageDescriptor(null);
    addRetargetAction(alignLeftAction);
    final AlignmentRetargetAction alignCenterAction = new AlignmentRetargetAction(PositionConstants.CENTER);
    alignCenterAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_CENTER));
    alignCenterAction.setDisabledImageDescriptor(null);
    addRetargetAction(alignCenterAction);
    final AlignmentRetargetAction alignRightAction = new AlignmentRetargetAction(PositionConstants.RIGHT);
    alignRightAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_RIGHT));
    alignRightAction.setDisabledImageDescriptor(null);
    addRetargetAction(alignRightAction);
    final AlignmentRetargetAction alignTopAction = new AlignmentRetargetAction(PositionConstants.TOP);
    alignTopAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_TOP));
    alignTopAction.setDisabledImageDescriptor(null);
    addRetargetAction(alignTopAction);
    final AlignmentRetargetAction alignMiddleAction = new AlignmentRetargetAction(PositionConstants.MIDDLE);
    alignMiddleAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_MIDDLE));
    alignMiddleAction.setDisabledImageDescriptor(null);
    addRetargetAction(alignMiddleAction);
    final AlignmentRetargetAction alignBottomAction = new AlignmentRetargetAction(PositionConstants.BOTTOM);
    alignBottomAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_BOTTOM));
    alignBottomAction.setDisabledImageDescriptor(null);
    addRetargetAction(alignBottomAction);

    final MatchWidthRetargetAction matchWidthAction = new MatchWidthRetargetAction();
    matchWidthAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.MATCH_WIDTH));
    matchWidthAction.setDisabledImageDescriptor(null);
    addRetargetAction(matchWidthAction);
    final MatchHeightRetargetAction matchHeightAction = new MatchHeightRetargetAction();
    matchHeightAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.MATCH_HEIGHT));
    matchHeightAction.setDisabledImageDescriptor(null);
    addRetargetAction(matchHeightAction);

    addRetargetAction(new HorizontalLineRetargetAction());
    addRetargetAction(new VerticalLineRetargetAction());

    addRetargetAction(new ChangeBackgroundColorRetargetAction());
}
 
Example 4
Source File: ERDiagramAlignmentAction.java    From erflute with Apache License 2.0 4 votes vote down vote up
/**
 * Initializes the actions UI presentation.
 */
protected void initUI() {
    switch (alignment) {
    case PositionConstants.LEFT:
        setId(GEFActionConstants.ALIGN_LEFT);
        setText(ALIGNMENT_ACTION_LEFT.getText());
        setToolTipText(ALIGNMENT_ACTION_LEFT.getToolTipText());
        setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_LEFT));
        break;

    case PositionConstants.RIGHT:
        setId(GEFActionConstants.ALIGN_RIGHT);
        setText(ALIGNMENT_ACTION_RIGHT.getText());
        setToolTipText(ALIGNMENT_ACTION_RIGHT.getToolTipText());
        setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_RIGHT));
        break;

    case PositionConstants.TOP:
        setId(GEFActionConstants.ALIGN_TOP);
        setText(ALIGNMENT_ACTION_TOP.getText());
        setToolTipText(ALIGNMENT_ACTION_TOP.getToolTipText());
        setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_TOP));
        break;

    case PositionConstants.BOTTOM:
        setId(GEFActionConstants.ALIGN_BOTTOM);
        setText(ALIGNMENT_ACTION_BOTTOM.getText());
        setToolTipText(ALIGNMENT_ACTION_BOTTOM.getToolTipText());
        setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_BOTTOM));
        break;

    case PositionConstants.CENTER:
        setId(GEFActionConstants.ALIGN_CENTER);
        setText(ALIGNMENT_ACTION_CENTER.getText());
        setToolTipText(ALIGNMENT_ACTION_CENTER.getToolTipText());
        setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_CENTER));
        break;

    case PositionConstants.MIDDLE:
        setId(GEFActionConstants.ALIGN_MIDDLE);
        setText(ALIGNMENT_ACTION_MIDDLE.getText());
        setToolTipText(ALIGNMENT_ACTION_MIDDLE.getToolTipText());
        setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_MIDDLE));
        break;
    }
}
 
Example 5
Source File: ERDiagramAlignmentAction.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
/**
	 * Initializes the actions UI presentation.
	 */
	protected void initUI() {
		switch (alignment) {
		case PositionConstants.LEFT:
			setId(GEFActionConstants.ALIGN_LEFT);
			setText(ALIGNMENT_ACTION_LEFT.getText());
			setToolTipText(ALIGNMENT_ACTION_LEFT.getToolTipText());
			setImageDescriptor(Activator
					.getImageDescriptor(ImageKey.ALIGN_LEFT));
			// setDisabledImageDescriptor(ALIGNMENT_ACTION_LEFT
			// .getDisabledImageDescriptor());
			break;

		case PositionConstants.RIGHT:
			setId(GEFActionConstants.ALIGN_RIGHT);
			setText(ALIGNMENT_ACTION_RIGHT.getText());
			setToolTipText(ALIGNMENT_ACTION_RIGHT.getToolTipText());
			setImageDescriptor(Activator
					.getImageDescriptor(ImageKey.ALIGN_RIGHT));
//			setDisabledImageDescriptor(ALIGNMENT_ACTION_RIGHT
//					.getDisabledImageDescriptor());
			break;

		case PositionConstants.TOP:
			setId(GEFActionConstants.ALIGN_TOP);
			setText(ALIGNMENT_ACTION_TOP.getText());
			setToolTipText(ALIGNMENT_ACTION_TOP.getToolTipText());
			setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_TOP));
//			setDisabledImageDescriptor(ALIGNMENT_ACTION_TOP
//					.getDisabledImageDescriptor());
			break;

		case PositionConstants.BOTTOM:
			setId(GEFActionConstants.ALIGN_BOTTOM);
			setText(ALIGNMENT_ACTION_BOTTOM.getText());
			setToolTipText(ALIGNMENT_ACTION_BOTTOM.getToolTipText());
			setImageDescriptor(Activator
					.getImageDescriptor(ImageKey.ALIGN_BOTTOM));
//			setDisabledImageDescriptor(ALIGNMENT_ACTION_BOTTOM
//					.getDisabledImageDescriptor());
			break;

		case PositionConstants.CENTER:
			setId(GEFActionConstants.ALIGN_CENTER);
			setText(ALIGNMENT_ACTION_CENTER.getText());
			setToolTipText(ALIGNMENT_ACTION_CENTER.getToolTipText());
			setImageDescriptor(Activator
					.getImageDescriptor(ImageKey.ALIGN_CENTER));
//			setDisabledImageDescriptor(ALIGNMENT_ACTION_CENTER
//					.getDisabledImageDescriptor());
			break;

		case PositionConstants.MIDDLE:
			setId(GEFActionConstants.ALIGN_MIDDLE);
			setText(ALIGNMENT_ACTION_MIDDLE.getText());
			setToolTipText(ALIGNMENT_ACTION_MIDDLE.getToolTipText());
			setImageDescriptor(Activator
					.getImageDescriptor(ImageKey.ALIGN_MIDDLE));
//			setDisabledImageDescriptor(ALIGNMENT_ACTION_MIDDLE
//					.getDisabledImageDescriptor());
			break;
		}
	}