use of org.talend.sqlbuilder.erdiagram.ui.actions.ErDiagramItemDeleteAction in project tdi-studio-se by Talend.
the class ErDiagramMenuProvider method buildContextMenu.
@Override
public void buildContextMenu(IMenuManager menu) {
menu.add(new Separator(RELATION));
menu.add(new Separator(GEFActionConstants.GROUP_EDIT));
IAction action;
action = getAction(ActionFactory.DELETE.getId());
((ErDiagramItemDeleteAction) action).update();
if (action.isEnabled()) {
menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
}
CreateRelationAction createRelation;
createRelation = new CreateRelationAction(part);
createRelation.update();
if (createRelation.isEnabled()) {
menu.add(createRelation);
}
TableAddAction addAction = new TableAddAction(part);
addAction.update();
menu.add(addAction);
}
use of org.talend.sqlbuilder.erdiagram.ui.actions.ErDiagramItemDeleteAction in project tdi-studio-se by Talend.
the class ErdiagramDiagramEditor method configureGraphicalViewer.
//$NON-NLS-1$
@SuppressWarnings("unchecked")
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
ScrollingGraphicalViewer viewer = (ScrollingGraphicalViewer) getGraphicalViewer();
ErDiagramRootEditPart root = new ErDiagramRootEditPart();
IAction deleteAction = new ErDiagramItemDeleteAction(this);
getActionRegistry().registerAction(deleteAction);
getSelectionActions().add(deleteAction.getId());
viewer.setRootEditPart(root);
ErDiagramPartFactory partFactory = new ErDiagramPartFactory();
// set the factory to use for creating EditParts for elements in the
// model
getGraphicalViewer().setEditPartFactory(partFactory);
getGraphicalViewer().setKeyHandler(new GraphicalViewerKeyHandler(getGraphicalViewer()).setParent(getCommonKeyHandler()));
/** * Management of the context menu ** */
ContextMenuProvider cmProvider = new ErDiagramMenuProvider(this, viewer, getActionRegistry());
viewer.setContextMenu(cmProvider);
/** * Snap To Grid ** */
// Grid properties
getGraphicalViewer().setProperty(SnapToGrid.PROPERTY_GRID_SPACING, new Dimension(GRID_SIZE, GRID_SIZE));
getGraphicalViewer().setProperty(SnapToGrid.PROPERTY_GRID_ENABLED, new Boolean(true));
// We keep grid visibility and enablement in sync
getGraphicalViewer().setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE, new Boolean(true));
IAction showGrid = new ToggleGridAction(getGraphicalViewer());
getActionRegistry().registerAction(showGrid);
/** * Snap To Geometry ** */
getGraphicalViewer().setProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED, new Boolean(false));
IAction snapAction = new ToggleSnapToGeometryAction(getGraphicalViewer());
getActionRegistry().registerAction(snapAction);
}
Aggregations