use of com.archimatetool.editor.diagram.actions.OpacityAction in project archi by archimatetool.
the class AbstractDiagramEditor method createActions.
/**
* Add some extra Actions - *after* the graphical viewer has been created
*/
@SuppressWarnings("unchecked")
protected void createActions(GraphicalViewer viewer) {
ActionRegistry registry = getActionRegistry();
IAction action;
// Zoom Manager tweaking
ZoomManager zoomManager = (ZoomManager) getAdapter(ZoomManager.class);
double[] zoomLevels = { .25, .5, .75, 1, 1.5, 2, 3, 4, 6, 8 };
zoomManager.setZoomLevels(zoomLevels);
List<String> zoomContributionLevels = new ArrayList<String>();
zoomContributionLevels.add(ZoomManager.FIT_ALL);
zoomContributionLevels.add(ZoomManager.FIT_WIDTH);
zoomContributionLevels.add(ZoomManager.FIT_HEIGHT);
zoomManager.setZoomLevelContributions(zoomContributionLevels);
// Zoom Actions
IAction zoomIn = new ZoomInAction(zoomManager);
IAction zoomOut = new ZoomOutAction(zoomManager);
IAction zoomNormal = new ZoomNormalAction(zoomManager);
registry.registerAction(zoomIn);
registry.registerAction(zoomOut);
registry.registerAction(zoomNormal);
// Add these zoom actions to the key binding service
IHandlerService service = getEditorSite().getService(IHandlerService.class);
service.activateHandler(zoomIn.getActionDefinitionId(), new ActionHandler(zoomIn));
service.activateHandler(zoomOut.getActionDefinitionId(), new ActionHandler(zoomOut));
service.activateHandler(zoomNormal.getActionDefinitionId(), new ActionHandler(zoomNormal));
// Add our own Select All Action so we can select connections as well
action = new SelectAllAction(this);
registry.registerAction(action);
// Add our own Print Action
action = new PrintDiagramAction(this);
registry.registerAction(action);
// Direct Edit Rename
action = new DirectEditAction(this);
// Set this for Global Handler
action.setId(ActionFactory.RENAME.getId());
// Externalise this one
action.setText(Messages.AbstractDiagramEditor_4);
action.setToolTipText(Messages.AbstractDiagramEditor_13);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Change the Delete Action label
action = registry.getAction(ActionFactory.DELETE.getId());
action.setText(Messages.AbstractDiagramEditor_2);
action.setToolTipText(action.getText());
getUpdateCommandStackActions().add((UpdateAction) action);
// Paste
PasteAction pasteAction = new PasteAction(this, viewer);
registry.registerAction(pasteAction);
getSelectionActions().add(pasteAction.getId());
// Paste Special
PasteSpecialAction pasteSpecialAction = new PasteSpecialAction(this, viewer);
registry.registerAction(pasteSpecialAction);
getSelectionActions().add(pasteSpecialAction.getId());
// Cut
action = new CutAction(this, pasteAction);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Copy
action = new CopyAction(this, pasteAction);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Use Grid Action
action = new ToggleGridEnabledAction();
registry.registerAction(action);
// Show Grid Action
action = new ToggleGridVisibleAction();
registry.registerAction(action);
// Snap to Alignment Guides
action = new ToggleSnapToAlignmentGuidesAction();
registry.registerAction(action);
// Ruler
// IAction showRulers = new ToggleRulerVisibilityAction(getGraphicalViewer());
// registry.registerAction(showRulers);
action = new MatchWidthAction(this);
// Externalise string as it's internal to GEF
action.setText(Messages.AbstractDiagramEditor_5);
action.setToolTipText(Messages.AbstractDiagramEditor_14);
registry.registerAction(action);
getSelectionActions().add(action.getId());
action = new MatchHeightAction(this);
registry.registerAction(action);
// Externalise string as it's internal to GEF
action.setText(Messages.AbstractDiagramEditor_6);
action.setToolTipText(Messages.AbstractDiagramEditor_15);
getSelectionActions().add(action.getId());
action = new MatchSizeAction(this);
registry.registerAction(action);
// Externalise string as it's internal to GEF
action.setText(Messages.AbstractDiagramEditor_22);
action.setToolTipText(Messages.AbstractDiagramEditor_23);
getSelectionActions().add(action.getId());
action = new AlignmentAction((IWorkbenchPart) this, PositionConstants.LEFT);
// Externalise string as it's internal to GEF
action.setText(Messages.AbstractDiagramEditor_7);
action.setToolTipText(Messages.AbstractDiagramEditor_16);
registry.registerAction(action);
getSelectionActions().add(action.getId());
action = new AlignmentAction((IWorkbenchPart) this, PositionConstants.RIGHT);
// Externalise string as it's internal to GEF
action.setText(Messages.AbstractDiagramEditor_8);
action.setToolTipText(Messages.AbstractDiagramEditor_17);
registry.registerAction(action);
getSelectionActions().add(action.getId());
action = new AlignmentAction((IWorkbenchPart) this, PositionConstants.TOP);
// Externalise string as it's internal to GEF
action.setText(Messages.AbstractDiagramEditor_9);
action.setToolTipText(Messages.AbstractDiagramEditor_18);
registry.registerAction(action);
getSelectionActions().add(action.getId());
action = new AlignmentAction((IWorkbenchPart) this, PositionConstants.BOTTOM);
// Externalise string as it's internal to GEF
action.setText(Messages.AbstractDiagramEditor_10);
action.setToolTipText(Messages.AbstractDiagramEditor_19);
registry.registerAction(action);
getSelectionActions().add(action.getId());
action = new AlignmentAction((IWorkbenchPart) this, PositionConstants.CENTER);
// Externalise string as it's internal to GEF
action.setText(Messages.AbstractDiagramEditor_11);
action.setToolTipText(Messages.AbstractDiagramEditor_20);
registry.registerAction(action);
getSelectionActions().add(action.getId());
action = new AlignmentAction((IWorkbenchPart) this, PositionConstants.MIDDLE);
// Externalise string as it's internal to GEF
action.setText(Messages.AbstractDiagramEditor_12);
action.setToolTipText(Messages.AbstractDiagramEditor_21);
registry.registerAction(action);
getSelectionActions().add(action.getId());
// Default Size
action = new DefaultEditPartSizeAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Reset Aspect Ratio
action = new ResetAspectRatioAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Properties
action = new PropertiesAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
// Fill Colour
action = new FillColorAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Connection Line Width
action = new ConnectionLineWidthAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Connection Line Color
action = new LineColorAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Font
action = new FontAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Font Colour
action = new FontColorAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Fill Opacity
action = new OpacityAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Outline Opacity
action = new OutlineOpacityAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Export As Image
action = new ExportAsImageAction(this);
registry.registerAction(action);
// Export As Image to Clipboard
action = new ExportAsImageToClipboardAction(this);
registry.registerAction(action);
// Connection Router types
action = new ConnectionRouterAction.BendPointConnectionRouterAction(this);
registry.registerAction(action);
action = new ConnectionRouterAction.ManhattanConnectionRouterAction(this);
registry.registerAction(action);
// Send Backward
action = new SendBackwardAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Bring Forward
action = new BringForwardAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Send to Back
action = new SendToBackAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Bring To Front
action = new BringToFrontAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Text Alignment Actions
for (TextAlignmentAction a : TextAlignmentAction.createActions(this)) {
registry.registerAction(a);
getSelectionActions().add(a.getId());
getUpdateCommandStackActions().add(a);
}
// Text Position Actions
for (TextPositionAction a : TextPositionAction.createActions(this)) {
registry.registerAction(a);
getSelectionActions().add(a.getId());
getUpdateCommandStackActions().add(a);
}
// Lock Object
action = new LockObjectAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Border Color
action = new BorderColorAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
getUpdateCommandStackActions().add((UpdateAction) action);
// Full Screen
if (!PlatformUtils.isMac()) {
action = new FullScreenAction(this);
registry.registerAction(action);
}
// Select Element in Tree
action = new SelectElementInTreeAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
}
Aggregations