use of com.cubrid.common.ui.spi.action.MenuProvider in project cubrid-manager by CUBRID.
the class SchemaInfoEditorPart method createContextMenu.
/**
*
* Create the context menu
*
* @param control Control
*/
private void createContextMenu(final Control control) {
MenuManager contextMenuManager = new MenuManager();
contextMenuManager.setRemoveAllWhenShown(true);
contextMenuManager.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
ISelectionProvider provider = ActionManager.getInstance().getSelectionProvider();
if (!(provider instanceof TreeViewer)) {
return;
}
TreeViewer viewer = (TreeViewer) provider;
viewer.setSelection(new StructuredSelection(schemaNode), true);
viewer.getTree().setFocus();
MenuProvider menuProvider = new MenuProvider();
String type = schemaNode.getType();
if (NodeType.SYSTEM_TABLE.equals(type)) {
menuProvider.buildSystemTableMenu(manager);
} else if (NodeType.SYSTEM_VIEW.equals(type)) {
menuProvider.buildSystemViewMenu(manager);
} else if (NodeType.USER_PARTITIONED_TABLE_FOLDER.equals(type)) {
menuProvider.buildUserTableMenu(manager, schemaNode);
} else if (NodeType.USER_PARTITIONED_TABLE.equals(type)) {
menuProvider.buildPartitionedTableMenu(manager);
} else if (NodeType.USER_TABLE.equals(type)) {
menuProvider.buildUserTableMenu(manager, schemaNode);
} else if (NodeType.USER_VIEW.equals(type)) {
menuProvider.buildUserViewMenu(manager);
}
manager.remove(ShowSchemaEditorAction.ID);
}
});
Menu contextMenu = contextMenuManager.createContextMenu(control);
control.setMenu(contextMenu);
}
Aggregations