use of org.eclipse.jface.action.IMenuManager in project cubrid-manager by CUBRID.
the class BrokerDashboardViewPart method createPartControl.
/**
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*
* @param parent the parent composite
*/
public void createPartControl(Composite parent) {
final ScrolledComposite scrolledComp = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
composite = new Composite(scrolledComp, SWT.NONE);
composite.setLayout(new GridLayout());
BrokerTblColumnSetHelp bcsh = BrokerTblColumnSetHelp.getInstance();
bcsh.loadSetting(BrokerTblColumnSetHelp.StatusColumn.BrokerStatusBasicColumn, BrokerStatusBasicColumn.values());
bcsh.loadSetting(BrokerTblColumnSetHelp.StatusColumn.BrokerStatusAsColumn, BrokerStatusAsColumn.values());
bcsh.loadSetting(BrokerTblColumnSetHelp.StatusColumn.BrokerStatusJqColumn, BrokerStatusJqColumn.values());
brokerTablePart.setServerInfo(serverInfo);
brokerTablePart.setAppendDiag(true);
basicTableViewer = brokerTablePart.createBasicTable(composite);
asTableViewer = brokerTablePart.createAsTable(composite);
jqTableViewer = brokerTablePart.createJobTable(composite);
makeActions();
composite.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent event) {
updateTableLayout();
}
});
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
menuManager.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
IStructuredSelection selection = (IStructuredSelection) asTableViewer.getSelection();
ApplyServerInfo as = (ApplyServerInfo) (selection.toArray()[0]);
RestartAction restartAcion = new RestartAction(as.getAs_id());
manager.add(restartAcion);
}
});
Menu contextMenu = menuManager.createContextMenu(asTableViewer.getControl());
asTableViewer.getControl().setMenu(contextMenu);
scrolledComp.setContent(composite);
scrolledComp.setExpandHorizontal(true);
scrolledComp.setExpandVertical(true);
scrolledComp.setMinHeight(300);
scrolledComp.setMinWidth(800);
}
use of org.eclipse.jface.action.IMenuManager in project cubrid-manager by CUBRID.
the class MonitorDashboardEditor method configureGraphicalViewer.
/**
* @see org.eclipse.gef.ui.parts.GraphicalEditor.configureGraphicalViewer
*/
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
GraphicalViewer viewer = getGraphicalViewer();
ScalableFreeformRootEditPart rootEditPart = new ScalableFreeformRootEditPart();
viewer.setRootEditPart(rootEditPart);
viewer.setEditPartFactory(new MonitorEditPartFacotry());
ZoomManager manager = rootEditPart.getZoomManager();
double[] zoomLevels = new double[] { 1.0, 1.2, 1.4, 1.6, 1.8, 2.0 };
manager.setZoomLevels(zoomLevels);
getActionRegistry().registerAction(new ZoomInAction(manager));
getActionRegistry().registerAction(new ZoomOutAction(manager));
KeyHandler keyHandler = new GefViewerKeyHandler(viewer);
keyHandler.put(KeyStroke.getReleased('', 97, SWT.CONTROL), getActionRegistry().getAction(ActionFactory.SELECT_ALL.getId()));
keyHandler.put(KeyStroke.getPressed('+', SWT.KEYPAD_ADD, 0), getActionRegistry().getAction(GEFActionConstants.ZOOM_IN));
keyHandler.put(KeyStroke.getPressed('-', SWT.KEYPAD_SUBTRACT, 0), getActionRegistry().getAction(GEFActionConstants.ZOOM_OUT));
viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.CTRL), MouseWheelZoomHandler.SINGLETON);
viewer.setKeyHandler(keyHandler);
//initialize context menu
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
menuManager.addMenuListener(new IMenuListener() {
/**
* get menus to show.
*
* @param manager IMenuManager
*/
public void menuAboutToShow(IMenuManager manager) {
IStructuredSelection selection = (IStructuredSelection) getGraphicalViewer().getSelection();
String[] ids = new String[] {};
if (null == selection || selection.isEmpty() || selection.getFirstElement() instanceof DashboardPart) {
manager.add(getActionRegistry().getAction(ActionFactory.SELECT_ALL.getId()));
ids = new String[] { AddHostMonitorAction.ID, SEPARATOR, DashboardRefreshAction.ID };
} else if (selection.getFirstElement() instanceof HostMonitorPart) {
ids = new String[] { MonitorDetailAction.ID, DeleteHostMonitorAction.ID, EditAliasNameAction.ID, SEPARATOR, //HARoleChangeAction.ID, SEPARATOR,
HostDashboardHistoryAction.ID, AddDatabaseMonitorAction.ID, AddBrokerMonitorAction.ID, SEPARATOR, HideHostAction.ID, MinimizeFigureAction.ID, DashboardRefreshAction.ID };
} else if (selection.getFirstElement() instanceof DatabaseMonitorPart) {
ids = new String[] { MonitorDetailAction.ID, DeleteDatabaseMonitorAction.ID, EditAliasNameAction.ID, SEPARATOR, DbDashboardHistoryAction.ID, OpenApplyLogDBLogAction.ID, OpenCopyLogDBLogAction.ID, OpenDatabaseLogAction.ID, SEPARATOR, ShowHostAction.ID, MinimizeFigureAction.ID, DashboardRefreshAction.ID };
} else if (selection.getFirstElement() instanceof BrokerMonitorPart) {
ids = new String[] { MonitorDetailAction.ID, DeleteBrokerMonitorAction.ID, EditAliasNameAction.ID, SEPARATOR, ShowBrokerClientAction.ID, ShowBrokerDabaseAction.ID, SEPARATOR, ShowHostAction.ID, MinimizeFigureAction.ID, DashboardRefreshAction.ID };
} else if (selection.getFirstElement() instanceof ClientMonitorPart) {
ids = new String[] { EditAliasNameAction.ID };
} else if (selection.getFirstElement() instanceof BrokerDBListMonitorPart) {
ids = new String[] { EditAliasNameAction.ID };
}
for (String id : ids) {
if (id.equals(SEPARATOR)) {
manager.add(new Separator());
} else {
IAction action = ActionManager.getInstance().getAction(id);
((ISelectionAction) action).setSelectionProvider(getGraphicalViewer());
ActionManager.addActionToManager(manager, action);
}
}
manager.update(true);
}
});
viewer.setContextMenu(menuManager);
}
use of org.eclipse.jface.action.IMenuManager in project cubrid-manager by CUBRID.
the class CubridMenuProvider method buildReplicationMenu.
/**
* Add replication related actions to menu manager
*
* @param parent the parent menu manager
*/
private void buildReplicationMenu(IMenuManager parent) {
IMenuManager manager = new MenuManager(Messages.menuReplication);
parent.add(manager);
addActionToManager(manager, getAction(ViewReplicationAction.ID));
manager.add(new Separator());
MenuManager masterMenu = new MenuManager(Messages.masterDbActionGroupName);
manager.add(masterMenu);
addActionToManager(masterMenu, getAction(StartReplicationServerAction.ID));
addActionToManager(masterMenu, getAction(StopReplicationServerAction.ID));
manager.add(new Separator());
if (StartReplicationAgentAction.isSupportedNode(parent)) {
addActionToManager(manager, getAction(StartReplicationAgentAction.ID));
}
if (StopReplicationAgentAction.isSupportedNode(parent)) {
addActionToManager(manager, getAction(StopReplicationAgentAction.ID));
}
manager.add(new Separator());
MenuManager slaveMenu = new MenuManager(Messages.slaveDbActionGroupName);
manager.add(slaveMenu);
if (StartSlaveDbAction.isSupportedNode(parent)) {
addActionToManager(slaveMenu, getAction(StartSlaveDbAction.ID));
}
if (StopSlaveDbAction.isSupportedNode(parent)) {
addActionToManager(slaveMenu, getAction(StopSlaveDbAction.ID));
}
manager.add(new Separator());
addActionToManager(manager, getAction(ConfigureReplicationParamAction.ID));
addActionToManager(manager, getAction(ChangeSlaveDbAction.ID));
manager.add(new Separator());
addActionToManager(manager, getAction(MonitorReplicationPerfAction.ID));
addActionToManager(manager, getAction(ViewReplicationErrorLogAction.ID));
}
use of org.eclipse.jface.action.IMenuManager in project cubrid-manager by CUBRID.
the class CubridMenuProvider method buildMenu.
/**
* Build the context menu and menubar menu according to the selected cubrid
* node
*
* @param manager the parent menu manager
* @param node the ICubridNode object
*/
public void buildMenu(IMenuManager manager, ICubridNode node) {
// fill Action Menu according to node type
if (node == null) {
LOGGER.error("ICubridNode is a null.");
return;
}
String type = node.getType();
if (CubridNodeType.SERVER.equals(type)) {
addActionToManager(manager, getAction(HostDashboardAction.ID));
addActionToManager(manager, getAction(ViewServerVersionAction.ID));
// #1 Disable the HA/Shard wizard
// if (CompatibleUtil.isSupportNewHAConfFile(node.getServer().getServerInfo())) {
// manager.add(new Separator());
// addActionToManager(manager, getAction(EasyHAAction.ID));
// }
// #1 Disable the HA/Shard wizard
// if (node.getServer() != null
// && node.getServer().getServerInfo() != null
// && CompatibleUtil.isSupportShard(node.getServer().getServerInfo())) {
// manager.add(new Separator());
// addActionToManager(manager, getAction(AddShardAction.ID));
// }
manager.add(new Separator());
addActionToManager(manager, getAction(PropertyAction.ID));
addActionToManager(manager, getAction(UnifyHostConfigAction.ID));
IMenuManager configMenu = new MenuManager(Messages.confActionGroupName);
manager.add(configMenu);
addActionToManager(configMenu, getAction(EditCubridConfigAction.ID));
addActionToManager(configMenu, getAction(ImportCubridConfigAction.ID));
addActionToManager(configMenu, getAction(ExportCubridConfigAction.ID));
configMenu.add(new Separator());
addActionToManager(configMenu, getAction(EditBrokerConfigAction.ID));
addActionToManager(configMenu, getAction(ImportBrokerConfigAction.ID));
addActionToManager(configMenu, getAction(ExportBrokerConfigAction.ID));
configMenu.add(new Separator());
addActionToManager(configMenu, getAction(EditCmConfigAction.ID));
addActionToManager(configMenu, getAction(ImportCmConfigAction.ID));
addActionToManager(configMenu, getAction(ExportCmConfigAction.ID));
if (CompatibleUtil.isSupportNewHAConfFile(node.getServer().getServerInfo())) {
configMenu.add(new Separator());
addActionToManager(configMenu, getAction(EditHAConfigAction.ID));
addActionToManager(configMenu, getAction(ImportHAConfigAction.ID));
addActionToManager(configMenu, getAction(ExportHAConfigAction.ID));
}
manager.add(new Separator());
} else if (CubridNodeType.DATABASE_FOLDER.equals(type)) {
addActionToManager(manager, getAction(CreateDatabaseAction.ID));
manager.add(new Separator());
// addActionToManager(manager, getAction(OpenSchemaEditorAction.ID));
// manager.add(new Separator());
addActionToManager(manager, getAction(PropertyAction.ID));
manager.add(new Separator());
} else if (CubridNodeType.DATABASE.equals(type)) {
buildDatabaseMenu(manager, node);
} else if (CubridNodeType.USER_FOLDER.equals(type)) {
addActionToManager(manager, getAction(AddUserAction.ID));
} else if (CubridNodeType.USER.equals(type)) {
addActionToManager(manager, getAction(EditUserAction.ID));
addActionToManager(manager, getAction(DeleteUserAction.ID));
} else if (CubridNodeType.BACKUP_PLAN_FOLDER.equals(type)) {
addActionToManager(manager, getAction(AddBackupPlanAction.ID));
addActionToManager(manager, getAction(BackupErrLogAction.ID));
} else if (CubridNodeType.BACKUP_PLAN.equals(type)) {
addActionToManager(manager, getAction(EditBackupPlanAction.ID));
addActionToManager(manager, getAction(DeleteBackupPlanAction.ID));
} else if (CubridNodeType.QUERY_PLAN_FOLDER.equals(type)) {
addActionToManager(manager, getAction(AddQueryPlanAction.ID));
addActionToManager(manager, getAction(QueryLogAction.ID));
} else if (CubridNodeType.QUERY_PLAN.equals(type)) {
addActionToManager(manager, getAction(EditQueryPlanAction.ID));
addActionToManager(manager, getAction(DeleteQueryPlanAction.ID));
} else if (CubridNodeType.DBSPACE_FOLDER.equals(type)) {
addActionToManager(manager, getAction(AddVolumeAction.ID));
manager.add(new Separator());
addActionToManager(manager, getAction(SetAutoAddVolumeAction.ID));
addActionToManager(manager, getAction(AutoAddVolumeLogAction.ID));
manager.add(new Separator());
addActionToManager(manager, getAction(DatabaseStatusViewAction.ID));
} else if (CubridNodeType.GENERIC_VOLUME_FOLDER.equals(type)) {
addActionToManager(manager, getAction(AddVolumeAction.ID));
addActionToManager(manager, getAction(SpaceFolderViewAction.ID));
} else if (CubridNodeType.DATA_VOLUME_FOLDER.equals(type)) {
addActionToManager(manager, getAction(AddVolumeAction.ID));
addActionToManager(manager, getAction(SpaceFolderViewAction.ID));
} else if (CubridNodeType.INDEX_VOLUME_FOLDER.equals(type)) {
addActionToManager(manager, getAction(AddVolumeAction.ID));
addActionToManager(manager, getAction(SpaceFolderViewAction.ID));
} else if (CubridNodeType.TEMP_VOLUME_FOLDER.equals(type)) {
addActionToManager(manager, getAction(AddVolumeAction.ID));
addActionToManager(manager, getAction(SpaceFolderViewAction.ID));
} else if (CubridNodeType.ACTIVE_LOG_FOLDER.equals(type)) {
addActionToManager(manager, getAction(SpaceFolderViewAction.ID));
} else if (CubridNodeType.ARCHIVE_LOG_FOLDER.equals(type)) {
addActionToManager(manager, getAction(SpaceFolderViewAction.ID));
} else if (CubridNodeType.GENERIC_VOLUME.equals(type)) {
addActionToManager(manager, getAction(SpaceInfoViewAction.ID));
} else if (CubridNodeType.DATA_VOLUME.equals(type)) {
addActionToManager(manager, getAction(SpaceInfoViewAction.ID));
} else if (CubridNodeType.INDEX_VOLUME.equals(type)) {
addActionToManager(manager, getAction(SpaceInfoViewAction.ID));
} else if (CubridNodeType.TEMP_VOLUME.equals(type)) {
addActionToManager(manager, getAction(SpaceInfoViewAction.ID));
} else if (CubridNodeType.BROKER_FOLDER.equals(type)) {
if (StartBrokerEnvAction.isSupportedNode(node)) {
addActionToManager(manager, getAction(StartBrokerEnvAction.ID));
}
if (StopBrokerEnvAction.isSupportedNode(node)) {
addActionToManager(manager, getAction(StopBrokerEnvAction.ID));
}
manager.add(new Separator());
addActionToManager(manager, getAction(ShowBrokerEnvStatusAction.ID));
manager.add(new Separator());
addActionToManager(manager, getAction(EditBrokerConfigAction.ID));
addActionToManager(manager, getAction(PropertyAction.ID));
manager.add(new Separator());
} else if (CubridNodeType.BROKER.equals(type)) {
if (StartBrokerAction.isSupportedNode(node)) {
addActionToManager(manager, getAction(StartBrokerAction.ID));
}
if (StopBrokerAction.isSupportedNode(node)) {
addActionToManager(manager, getAction(StopBrokerAction.ID));
}
if (RestartBrokerAction.isSupportedNode(node)) {
addActionToManager(manager, getAction(RestartBrokerAction.ID));
}
manager.add(new Separator());
addActionToManager(manager, getAction(ShowBrokerStatusAction.ID));
manager.add(new Separator());
addActionToManager(manager, getAction(PropertyAction.ID));
manager.add(new Separator());
} else if (CubridNodeType.SHARD_FOLDER.equals(type)) {
if (StartShardEnvAction.isSupportedNode(node)) {
addActionToManager(manager, getAction(StartShardEnvAction.ID));
}
if (StopShardEnvAction.isSupportedNode(node)) {
addActionToManager(manager, getAction(StopShardEnvAction.ID));
}
manager.add(new Separator());
addActionToManager(manager, getAction(ShowShardStatusAction.ID));
manager.add(new Separator());
addActionToManager(manager, getAction(PropertyAction.ID));
manager.add(new Separator());
} else if (CubridNodeType.SHARD.equals(type)) {
if (StartShardAction.isSupportedNode(node)) {
addActionToManager(manager, getAction(StartShardAction.ID));
}
if (StopShardAction.isSupportedNode(node)) {
addActionToManager(manager, getAction(StopShardAction.ID));
}
manager.add(new Separator());
addActionToManager(manager, getAction(PropertyAction.ID));
} else if (CubridNodeType.MONITOR_FOLDER.equals(type)) {
//status monitor action
if (CompatibleUtil.isSupportBrokerOrDBStatusMonitor(node.getServer().getServerInfo())) {
addActionToManager(manager, getAction(AddMonitorInstanceAction.ID));
manager.add(new Separator());
addActionToManager(manager, getAction(ShowBrokerMonitorHistoryAction.ID));
addActionToManager(manager, getAction(ShowDatabaseMonitorHistoryAction.ID));
} else {
addActionToManager(manager, getAction(AddStatusMonitorTemplateAction.ID));
}
//system monitor action
if (CompatibleUtil.isSupportSystemMonitor(node.getServer().getServerInfo())) {
manager.add(new Separator());
addActionToManager(manager, getAction(ShowHostSystemMonitorHistoryAction.ID));
addActionToManager(manager, getAction(ShowDbSystemMonitorHistoryAction.ID));
}
//monitor statistic action
if (CompatibleUtil.isSupportMonitorStatistic(node.getServer().getServerInfo())) {
manager.add(new Separator());
addActionToManager(manager, getAction(AddMonitorStatisticPageAction.ID));
addActionToManager(manager, getAction(CheckMonitorIntervalAction.ID));
}
/*} else if (CubridNodeType.STATUS_MONITOR_FOLDER.equals(type)) {
if (CompatibleUtil.isSupportBrokerOrDBStatusMonitor(node.getServer().getServerInfo())) {
addActionToManager(manager, getAction(AddMonitorInstanceAction.ID));
manager.add(new Separator());
addActionToManager(manager, getAction(ShowBrokerMonitorHistoryAction.ID));
addActionToManager(manager, getAction(ShowDatabaseMonitorHistoryAction.ID));
} else {
addActionToManager(manager, getAction(AddStatusMonitorTemplateAction.ID));
}
} else if (CubridNodeType.MONITOR_STATISTIC_FOLDER.equals(type)) {
addActionToManager(manager, getAction(AddMonitorStatisticPageAction.ID));
addActionToManager(manager, getAction(CheckMonitorIntervalAction.ID));*/
} else if (CubridNodeType.MONITOR_STATISTIC_PAGE.equals(type)) {
addActionToManager(manager, getAction(OpenMonitorStatisticPageAction.ID));
addActionToManager(manager, getAction(DeleteMonitorStatisticPageAction.ID));
if (node.getParent() == null) {
manager.add(new Separator());
addActionToManager(manager, getAction(AddMonitorDashboardAction.ID));
addActionToManager(manager, getAction(AddMonitorStatisticPageAction.ID));
}
} else if (CubridNodeType.STATUS_MONITOR_TEMPLATE.equals(type)) {
addActionToManager(manager, getAction(ShowStatusMonitorAction.ID));
if (CompatibleUtil.isSupportBrokerOrDBStatusMonitor(node.getServer().getServerInfo())) {
if (!Messages.msgDbStatusMonitorName.equals(node.getLabel()) && !Messages.msgBrokerStatusMonitorName.equals(node.getLabel())) {
addActionToManager(manager, getAction(EditMonitorInstanceAction.ID));
addActionToManager(manager, getAction(DelMonitorInstanceAction.ID));
}
} else {
manager.add(new Separator());
addActionToManager(manager, getAction(EditStatusMonitorTemplateAction.ID));
addActionToManager(manager, getAction(DeleteStatusMonitorTemplateAction.ID));
}
/*} else if (CubridNodeType.SYSTEM_MONITOR_FOLDER.equals(type)) {
if (CompatibleUtil.isSupportSystemMonitor(node.getServer().getServerInfo())) {
addActionToManager(manager, getAction(ShowHostSystemMonitorHistoryAction.ID));
addActionToManager(manager, getAction(ShowDbSystemMonitorHistoryAction.ID));
}*/
} else if (CubridNodeType.SYSTEM_MONITOR_TEMPLATE.equals(type)) {
addActionToManager(manager, getAction(ShowSystemMonitorAction.ID));
} else if (CubridNodeType.LOGS_BROKER_ACCESS_LOG_FOLDER.equals(type)) {
addActionToManager(manager, getAction(RemoveAllAccessLogAction.ID));
} else if (CubridNodeType.LOGS_BROKER_ACCESS_LOG.equals(type)) {
addActionToManager(manager, getAction(LogViewAction.ID));
addActionToManager(manager, getAction(RemoveLogAction.ID));
manager.add(new Separator());
addActionToManager(manager, getAction(LogPropertyAction.ID));
} else if (CubridNodeType.LOGS_BROKER_ERROR_LOG_FOLDER.equals(type)) {
addActionToManager(manager, getAction(RemoveAllErrorLogAction.ID));
} else if (CubridNodeType.LOGS_BROKER_ERROR_LOG.equals(type)) {
addActionToManager(manager, getAction(LogViewAction.ID));
addActionToManager(manager, getAction(RemoveLogAction.ID));
manager.add(new Separator());
addActionToManager(manager, getAction(LogPropertyAction.ID));
} else if (CubridNodeType.LOGS_BROKER_ADMIN_LOG.equals(type)) {
addActionToManager(manager, getAction(LogViewAction.ID));
addActionToManager(manager, getAction(ResetAdminLogAction.ID));
manager.add(new Separator());
addActionToManager(manager, getAction(LogPropertyAction.ID));
} else if (CubridNodeType.BROKER_SQL_LOG_FOLDER.equals(type)) {
addActionToManager(manager, getAction(RemoveAllScriptLogAction.ID));
addActionToManager(manager, getAction(AnalyzeSqlLogAction.ID));
} else if (CubridNodeType.BROKER_SQL_LOG.equals(type)) {
addActionToManager(manager, getAction(LogViewAction.ID));
manager.add(new Separator());
addActionToManager(manager, getAction(AnalyzeSqlLogAction.ID));
addActionToManager(manager, getAction(ExecuteSqlLogAction.ID));
addActionToManager(manager, getAction(RemoveLogAction.ID));
manager.add(new Separator());
addActionToManager(manager, getAction(LogPropertyAction.ID));
} else if (CubridNodeType.LOGS_SERVER_DATABASE_LOG.equals(type)) {
addActionToManager(manager, getAction(LogViewAction.ID));
addActionToManager(manager, getAction(RemoveLogAction.ID));
manager.add(new Separator());
addActionToManager(manager, getAction(LogPropertyAction.ID));
} else if (CubridNodeType.LOGS_SERVER_DATABASE_FOLDER.equals(type)) {
addActionToManager(manager, getAction(RemoveAllDbLogAction.ID));
} else if (CubridNodeType.LOGS_MANAGER_ACCESS_LOG.equals(type) || CubridNodeType.LOGS_MANAGER_ERROR_LOG.equals(type)) {
addActionToManager(manager, getAction(ManagerLogViewAction.ID));
addActionToManager(manager, getAction(RemoveAllManagerLogAction.ID));
} else if (CubridNodeType.MONITOR_DASHBOARD.equals(type)) {
addActionToManager(manager, getAction(OpenMonitorDashboardAction.ID));
addActionToManager(manager, getAction(EditMonitorDashboardAction.ID));
addActionToManager(manager, getAction(DeleteMonitorDashboardAction.ID));
manager.add(new Separator());
addActionToManager(manager, getAction(AddMonitorDashboardAction.ID));
addActionToManager(manager, getAction(AddMonitorStatisticPageAction.ID));
manager.add(new Separator());
} else if (NodeType.GROUP.equals(type)) {
addActionToManager(manager, getAction(ConnectHostAction.ID));
manager.add(new Separator());
addActionToManager(manager, getAction(AddHostAction.ID));
manager.add(new Separator());
super.buildMenu(manager, node);
} else {
super.buildMenu(manager, node);
}
// This menu hide if it hasn't any hidden menu node.
if (node.isContainer() && ShowHiddenElementsAction.isSupportedNode(node)) {
manager.add(new Separator());
ActionManager.addActionToManager(manager, ActionManager.getInstance().getAction(ShowHiddenElementsAction.ID));
}
manager.update(true);
}
use of org.eclipse.jface.action.IMenuManager in project cubrid-manager by CUBRID.
the class CUBRIDTextEditor method createPartControl.
/**
* Create Part Controls.
*
* @param parent composite.
*/
public void createPartControl(Composite parent) {
final Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new FillLayout());
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
initTextViewer(composite);
undoManager.connect(textViewer);
createActions();
updateActions();
//create context menu
MenuManager contextMenuManager = new MenuManager("#PopupMenu", "CUBRIDTExtEditorContextMenu");
contextMenuManager.setRemoveAllWhenShown(true);
contextMenuManager.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
createContextMenu(manager);
}
});
Menu contextMenu = contextMenuManager.createContextMenu(textViewer.getTextWidget());
textViewer.getTextWidget().setMenu(contextMenu);
IWorkbenchPartSite site = getSite();
site.registerContextMenu(contextMenuManager, textViewer);
site.setSelectionProvider(textViewer);
textViewer.getTextWidget().addFocusListener(new FocusListener() {
public void focusGained(FocusEvent event) {
hookRetargetActions();
}
public void focusLost(FocusEvent event) {
unHookRetargetActions();
}
});
}
Aggregations