Java Code Examples for org.eclipse.draw2d.PositionConstants#LEFT
The following examples show how to use
org.eclipse.draw2d.PositionConstants#LEFT .
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: CustomAnchor.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private static int getClosestSide(Point p, Rectangle r) { double diff = Math.abs(r.preciseX() + r.preciseWidth() - p.preciseX()); int side = PositionConstants.RIGHT; double currentDiff = Math.abs(r.preciseX() - p.preciseX()); if (currentDiff < diff) { diff = currentDiff; side = PositionConstants.LEFT; } currentDiff = Math.abs(r.preciseY() + r.preciseHeight() - p.preciseY()); if (currentDiff < diff) { diff = currentDiff; side = PositionConstants.BOTTOM; } currentDiff = Math.abs(r.preciseY() - p.preciseY()); if (currentDiff < diff) { diff = currentDiff; side = PositionConstants.TOP; } return side; }
Example 2
Source File: CustomTextDirectEditManager.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected CellEditor createCellEditorOn(Composite composite) { if (!Platform.getOS().equals(Platform.OS_MACOSX)) { ILabelDelegate label = (ILabelDelegate) getEditPart().getAdapter( ILabelDelegate.class); int style = SWT.WRAP | SWT.MULTI; if (label != null /* && label.isTextWrapOn() */) { switch (label.getTextJustification()) { case PositionConstants.LEFT: style = style | SWT.LEAD; break; case PositionConstants.RIGHT: style = style | SWT.TRAIL; break; case PositionConstants.CENTER: style = style | SWT.CENTER; break; default: break; } } return new CustomWrapTextCellEditor(composite, style); } else { //USE normal textcelleditor if running on mac return super.createCellEditorOn(composite); } }
Example 3
Source File: Helper.java From neoscada with Eclipse Public License 1.0 | 4 votes |
public static int convertPosition ( final String position, final int defaultValue ) { if ( "CENTER".equals ( position ) ) { return PositionConstants.CENTER; } else if ( "LEFT".equals ( position ) ) { return PositionConstants.LEFT; } else if ( "RIGHT".equals ( position ) ) { return PositionConstants.RIGHT; } else if ( "TOP".equals ( position ) ) { return PositionConstants.TOP; } else if ( "BOTTOM".equals ( position ) ) { return PositionConstants.BOTTOM; } else if ( "EAST".equals ( position ) ) { return PositionConstants.EAST; } else if ( "WEST".equals ( position ) ) { return PositionConstants.WEST; } else if ( "NORTH".equals ( position ) ) { return PositionConstants.NORTH; } else if ( "SOUTH".equals ( position ) ) { return PositionConstants.SOUTH; } return defaultValue; }
Example 4
Source File: ERDiagramActionBarContributor.java From ermasterr with Apache License 2.0 | 4 votes |
/** * {@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 5
Source File: ERDiagramAlignmentAction.java From ermasterr with Apache License 2.0 | 4 votes |
/** * 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 6
Source File: ERDiagramActionBarContributor.java From erflute with Apache License 2.0 | 4 votes |
@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 7
Source File: ERDiagramAlignmentAction.java From erflute with Apache License 2.0 | 4 votes |
/** * 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 8
Source File: CustomAnchor.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override public Point getOrthogonalLocation(Point orthoReference) { PrecisionPoint ownReference = new PrecisionPoint(getReferencePoint()); // PrecisionRectangle bounds = new PrecisionRectangle(getBox()); PrecisionRectangle bounds = new PrecisionRectangle(CustomRectilinearRouter.getAnchorableFigureBounds(getOwner())); getOwner().translateToAbsolute(bounds); bounds.expand(0.000001, 0.000001); PrecisionPoint preciseOrthoReference = new PrecisionPoint(orthoReference); int orientation = PositionConstants.NONE; if (bounds.contains(preciseOrthoReference)) { int side = getClosestSide(ownReference, bounds); switch (side) { case PositionConstants.LEFT: case PositionConstants.RIGHT: ownReference.preciseY = preciseOrthoReference.preciseY(); orientation = PositionConstants.HORIZONTAL; break; case PositionConstants.TOP: case PositionConstants.BOTTOM: ownReference.preciseX = preciseOrthoReference.preciseX(); orientation = PositionConstants.VERTICAL; break; } } else if (preciseOrthoReference.preciseX >= bounds.preciseX && preciseOrthoReference.preciseX <= bounds.preciseX + bounds.preciseWidth) { ownReference.preciseX = preciseOrthoReference.preciseX; orientation = PositionConstants.VERTICAL; } else if (preciseOrthoReference.preciseY >= bounds.preciseY && preciseOrthoReference.preciseY <= bounds.preciseY + bounds.preciseHeight) { ownReference.preciseY = preciseOrthoReference.preciseY; orientation = PositionConstants.HORIZONTAL; } ownReference.updateInts(); Point location = getLocation(ownReference, preciseOrthoReference); if (location == null) { location = getLocation(orthoReference); orientation = PositionConstants.NONE; } if (orientation != PositionConstants.NONE) { PrecisionPoint loc = new PrecisionPoint(location); if (orientation == PositionConstants.VERTICAL) { loc.preciseX = preciseOrthoReference.preciseX; } else { loc.preciseY = preciseOrthoReference.preciseY; } loc.updateInts(); location = loc; } return location; }
Example 9
Source File: ERDiagramAlignmentAction.java From ermaster-b with Apache License 2.0 | 4 votes |
/** * 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; } }