use of com.cubrid.common.ui.er.SchemaContextMenuProvider in project cubrid-manager by CUBRID.
the class ERSchemaEditor method createGraphicalViewer.
/**
* Creates a new <code>GraphicalViewer</code>, configures, registers and
* initializes it.
*
* @param parent the parent composite
* @return a new <code>GraphicalViewer</code>
*/
protected void createGraphicalViewer(Composite parent) {
IEditorSite editorSite = getEditorSite();
ScrollingGraphicalViewer viewer = createGraphicalViewer(editorSite, parent);
ScalableFreeformRootEditPart rootEditPart = (ScalableFreeformRootEditPart) viewer.getRootEditPart();
zoomManager = rootEditPart.getZoomManager();
zoomManager.setZoomLevels(ZOOM_LEVELS);
// hook the viewer into the EditDomain
getEditDomain().addViewer(viewer);
// acticate the viewer as selection provider for Eclipse
getSite().setSelectionProvider(viewer);
viewer.setContents(erSchema);
ContextMenuProvider provider = new SchemaContextMenuProvider(viewer, getActionRegistry());
viewer.setContextMenu(provider);
getSite().registerContextMenu(provider.getId(), provider, viewer);
graphicalViewer = viewer;
// key handler
GraphicalViewerKeyHandler graphicalViewerKeyHandler = new GraphicalViewerKeyHandler(viewer);
KeyHandler parentKeyHandler = graphicalViewerKeyHandler.setParent(getCommonKeyHandler());
viewer.setKeyHandler(parentKeyHandler);
registDropTarget();
}
Aggregations