use of org.eclipse.jface.action.IAction in project jbosstools-hibernate by jbosstools.
the class DiagramViewer method setConnectionsVisibilityForeignKeyConstraint.
public void setConnectionsVisibilityForeignKeyConstraint(boolean connectionsVisibilityForeignKeyConstraint) {
getOrmDiagram().setConnectionsVisibilityForeignKeyConstraint(connectionsVisibilityForeignKeyConstraint);
ActionRegistry registry = getActionRegistry();
IAction action = registry.getAction(ToggleForeignKeyConstraintAction.ACTION_ID);
action.setChecked(connectionsVisibilityForeignKeyConstraint);
}
use of org.eclipse.jface.action.IAction in project jbosstools-hibernate by jbosstools.
the class DiagramViewer method updateConnectionRouterActions.
public void updateConnectionRouterActions() {
boolean res = isManhattanConnectionRouter();
ActionRegistry registry = getActionRegistry();
IAction action = registry.getAction(ConnectionRouterManhattanAction.ACTION_ID);
action.setChecked(res);
action = registry.getAction(ConnectionRouterFanAction.ACTION_ID);
action.setChecked(!res);
}
use of org.eclipse.jface.action.IAction in project jbosstools-hibernate by jbosstools.
the class DiagramViewer method initializeGraphicalViewer.
protected void initializeGraphicalViewer() {
final GraphicalViewer viewer = getGraphicalViewer();
viewer.setEditPartFactory(new OrmEditPartFactory());
//
viewer.setKeyHandler(new GraphicalViewerKeyHandler(viewer).setParent(getCommonKeyHandler()));
//
List<String> zoomLevels = new ArrayList<String>(3);
zoomLevels.add(ZoomManager.FIT_ALL);
zoomLevels.add(ZoomManager.FIT_WIDTH);
zoomLevels.add(ZoomManager.FIT_HEIGHT);
gefRootEditPart.getZoomManager().setZoomLevelContributions(zoomLevels);
IAction zoomIn = new ZoomInAction(gefRootEditPart.getZoomManager());
IAction zoomOut = new ZoomOutAction(gefRootEditPart.getZoomManager());
getActionRegistry().registerAction(zoomIn);
getActionRegistry().registerAction(zoomOut);
//
viewer.setRootEditPart(gefRootEditPart);
viewer.addDropTargetListener(createTransferDropTargetListener());
viewer.setContents(getOrmDiagram());
PopupMenuProvider provider = new PopupMenuProvider(viewer, getActionRegistry());
viewer.setContextMenu(provider);
// $NON-NLS-1$
getSite().registerContextMenu("FlowDiagramContextmenu", provider, viewer);
// Scroll-wheel Zoom
viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1), MouseWheelZoomHandler.SINGLETON);
// Ruler properties
DiagramRuler ruler = getOrmDiagram().getRuler(PositionConstants.WEST);
RulerProvider rulerProvider = null;
if (ruler != null) {
rulerProvider = new DiagramRulerProvider(ruler);
}
getGraphicalViewer().setProperty(RulerProvider.PROPERTY_VERTICAL_RULER, rulerProvider);
ruler = getOrmDiagram().getRuler(PositionConstants.NORTH);
rulerProvider = null;
if (ruler != null) {
rulerProvider = new DiagramRulerProvider(ruler);
}
getGraphicalViewer().setProperty(RulerProvider.PROPERTY_HORIZONTAL_RULER, rulerProvider);
getGraphicalViewer().setProperty(RulerProvider.PROPERTY_RULER_VISIBILITY, new Boolean(getOrmDiagram().getRulerVisibility()));
loadProperties();
updateConnectionRouterActions();
}
use of org.eclipse.jface.action.IAction in project jbosstools-hibernate by jbosstools.
the class DiagramViewer method setConnectionsVisibilityPropertyMapping.
public void setConnectionsVisibilityPropertyMapping(boolean connectionsVisibilityPropertyMapping) {
getOrmDiagram().setConnectionsVisibilityPropertyMapping(connectionsVisibilityPropertyMapping);
ActionRegistry registry = getActionRegistry();
IAction action = registry.getAction(TogglePropertyMappingAction.ACTION_ID);
action.setChecked(connectionsVisibilityPropertyMapping);
}
use of org.eclipse.jface.action.IAction in project jbosstools-hibernate by jbosstools.
the class DiagramViewer method createActions.
@SuppressWarnings("unchecked")
protected void createActions() {
// super.createActions();
// BEGIN: redefine super.createActions
ActionRegistry registry = getActionRegistry();
IAction action;
action = new RefreshAction(this);
registry.registerAction(action);
getEditorSite().getActionBars().setGlobalActionHandler(ActionFactory.REFRESH.getId(), action);
action = new UndoAction(this);
registry.registerAction(action);
getStackActions().add(action.getId());
action = new RedoAction(this);
registry.registerAction(action);
getStackActions().add(action.getId());
action = new SelectAllAction(this);
registry.registerAction(action);
action = new DeleteAction((IWorkbenchPart) this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
action = new SaveAction(this);
registry.registerAction(action);
getPropertyActions().add(action.getId());
registry.registerAction(new PrintDiagramViewerAction(this));
// END: redefine super.createActions
getEditorSite().getActionBars().setGlobalActionHandler(ActionFactory.PRINT.getId(), getActionRegistry().getAction(ActionFactory.PRINT.getId()));
getEditorSite().getActionBars().setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), getActionRegistry().getAction(ActionFactory.SELECT_ALL.getId()));
action = new OpenMappingAction(this);
registry.registerAction(action);
action = new OpenSourceAction(this);
registry.registerAction(action);
action = new ExportImageAction(this);
registry.registerAction(action);
action = new AutoLayoutAction(this);
registry.registerAction(action);
ToggleConnectionsAction actionToggleConnections = new ToggleConnectionsAction(this);
registry.registerAction(actionToggleConnections);
action = new ToggleAssociationAction(this);
registry.registerAction(action);
action = new ToggleClassMappingAction(this);
registry.registerAction(action);
action = new ToggleForeignKeyConstraintAction(this);
registry.registerAction(action);
action = new TogglePropertyMappingAction(this);
registry.registerAction(action);
action = new ConnectionRouterFanAction(this);
registry.registerAction(action);
getPropertyActions().add(action.getId());
action = new ConnectionRouterManhattanAction(this);
registry.registerAction(action);
getPropertyActions().add(action.getId());
ToggleShapeExpandStateAction actionToggleShapeExpandState = new ToggleShapeExpandStateAction(this);
registry.registerAction(actionToggleShapeExpandState);
getSelectionActions().add(actionToggleShapeExpandState.getId());
action = new ShapeExpandAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
action = new ShapeCollapseAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
ToggleShapeVisibleStateAction actionToggleShapeVisibleState = new ToggleShapeVisibleStateAction(this);
registry.registerAction(actionToggleShapeVisibleState);
getSelectionActions().add(actionToggleShapeVisibleState.getId());
action = new ShapeHideAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
action = new ShapeShowAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
// action = new CollapseAllAction(this);
// registry.registerAction(action);
// action = new ExpandAllAction(this);
// registry.registerAction(action);
action = new ZoomInAction(gefRootEditPart.getZoomManager());
registry.registerAction(action);
action = new ZoomOutAction(gefRootEditPart.getZoomManager());
registry.registerAction(action);
action = new LexicalSortingAction(this, null);
registry.registerAction(action);
Action[] act = new Action[4];
act[0] = (Action) registry.getAction(TogglePropertyMappingAction.ACTION_ID);
act[1] = (Action) registry.getAction(ToggleClassMappingAction.ACTION_ID);
act[2] = (Action) registry.getAction(ToggleAssociationAction.ACTION_ID);
act[3] = (Action) registry.getAction(ToggleForeignKeyConstraintAction.ACTION_ID);
// act[4] = null;
// act[5] = (Action)registry.getAction(ConnectionRouterManhattanAction.ACTION_ID);
// act[6] = (Action)registry.getAction(ConnectionRouterFanAction.ACTION_ID);
actionToggleConnections.setMenuCreator(new ActionMenu(act));
// act = new Action[2];
// act[0] = (Action)registry.getAction(ShapeExpandAction.ACTION_ID);
// act[1] = (Action)registry.getAction(ShapeCollapseAction.ACTION_ID);
// actionToggleShapeExpandState.setMenuCreator(new ActionMenu(act));
// act = new Action[2];
// act[0] = (Action)registry.getAction(ShapeShowAction.ACTION_ID);
// act[1] = (Action)registry.getAction(ShapeHideAction.ACTION_ID);
// actionToggleShapeVisibleState.setMenuCreator(new ActionMenu(act));
}
Aggregations