Search in sources :

Example 1 with SchemaContextMenuProvider

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();
}
Also used : ScrollingGraphicalViewer(org.eclipse.gef.ui.parts.ScrollingGraphicalViewer) ScalableFreeformRootEditPart(org.eclipse.gef.editparts.ScalableFreeformRootEditPart) GraphicalViewerKeyHandler(org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler) GraphicalViewerKeyHandler(org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler) KeyHandler(org.eclipse.gef.KeyHandler) IEditorSite(org.eclipse.ui.IEditorSite) ContextMenuProvider(org.eclipse.gef.ContextMenuProvider) SchemaContextMenuProvider(com.cubrid.common.ui.er.SchemaContextMenuProvider) SchemaContextMenuProvider(com.cubrid.common.ui.er.SchemaContextMenuProvider)

Aggregations

SchemaContextMenuProvider (com.cubrid.common.ui.er.SchemaContextMenuProvider)1 ContextMenuProvider (org.eclipse.gef.ContextMenuProvider)1 KeyHandler (org.eclipse.gef.KeyHandler)1 ScalableFreeformRootEditPart (org.eclipse.gef.editparts.ScalableFreeformRootEditPart)1 GraphicalViewerKeyHandler (org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler)1 ScrollingGraphicalViewer (org.eclipse.gef.ui.parts.ScrollingGraphicalViewer)1 IEditorSite (org.eclipse.ui.IEditorSite)1