use of org.eclipse.jface.action.IMenuManager in project azure-tools-for-java by Microsoft.
the class QueueFileEditor method createTablePopUp.
private void createTablePopUp(Composite parent) {
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
if (tableViewer.getSelection().isEmpty()) {
return;
}
if (tableViewer.getSelection() instanceof IStructuredSelection) {
manager.add(fileEditorVirtualNode.createPopupAction(OPEN));
Action action = fileEditorVirtualNode.createPopupAction(DEQUEUE);
if (queueTable.getSelectionIndex() != 0) {
action.setEnabled(false);
}
manager.add(action);
}
}
});
Menu menu = menuMgr.createContextMenu(tableViewer.getControl());
tableViewer.getControl().setMenu(menu);
}
use of org.eclipse.jface.action.IMenuManager in project azure-tools-for-java by Microsoft.
the class ServiceExplorerView method hookContextMenu.
private void hookContextMenu() {
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
if (viewer.getSelection().isEmpty()) {
return;
}
if (viewer.getSelection() instanceof IStructuredSelection) {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
Node node = ((TreeNode) selection.getFirstElement()).node;
if (node.hasNodeActions()) {
for (final NodeAction nodeAction : node.getNodeActions()) {
ImageDescriptor imageDescriptor = nodeAction.getIconPath() != null ? Activator.getImageDescriptor("icons/" + nodeAction.getIconPath()) : null;
Action action = new Action(nodeAction.getName(), imageDescriptor) {
public void run() {
nodeAction.fireNodeActionEvent();
}
};
action.setEnabled(nodeAction.isEnabled());
manager.add(action);
}
}
}
}
});
Menu menu = menuMgr.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
}
use of org.eclipse.jface.action.IMenuManager in project cubrid-manager by CUBRID.
the class BrokerStatusView method createAsTable.
/**
* Create app server table
*
* @param comp the parent composite
*
*/
private void createAsTable(Composite comp) {
Composite asComposite = new Composite(comp, SWT.NONE);
GridData gdAs = new GridData(SWT.FILL, SWT.FILL, true, true);
asComposite.setLayoutData(gdAs);
asComposite.setLayout(new GridLayout());
asTableViewer = new TableViewer(asComposite, SWT.FULL_SELECTION | SWT.NO_SCROLL | SWT.V_SCROLL | SWT.BORDER);
Table asTable = asTableViewer.getTable();
asTable.setHeaderVisible(true);
asTable.setLinesVisible(true);
asTable.setLayoutData(gdAs);
TableLayout asLayout = new TableLayout();
setAsLayout(asLayout);
asTable.setLayout(asLayout);
TableColumn tblColumn = new TableColumn(asTable, SWT.CENTER);
tblColumn.setText(Messages.tblAsId);
tblColumn.setToolTipText(Messages.tblAsId);
tblColumn = new TableColumn(asTable, SWT.CENTER);
tblColumn.setText(Messages.tblAsProcess);
tblColumn.setToolTipText(Messages.tblAsProcess);
tblColumn = new TableColumn(asTable, SWT.CENTER);
tblColumn.setText(Messages.tblAsQps);
tblColumn.setToolTipText(Messages.tblAsQps);
tblColumn = new TableColumn(asTable, SWT.CENTER);
tblColumn.setText(Messages.tblAsLqs);
tblColumn.setToolTipText(Messages.tblAsLqs);
tblColumn = new TableColumn(asTable, SWT.CENTER);
tblColumn.setText(Messages.tblAsPort);
tblColumn.setToolTipText(Messages.tblAsPort);
tblColumn = new TableColumn(asTable, SWT.CENTER);
tblColumn.setText(Messages.tblAsSize);
tblColumn.setToolTipText(Messages.tblAsSize);
tblColumn = new TableColumn(asTable, SWT.CENTER);
tblColumn.setText(Messages.tblAsStatus);
tblColumn.setToolTipText(Messages.tblAsStatus);
tblColumn = new TableColumn(asTable, SWT.CENTER);
tblColumn.setText(Messages.tblAsDb);
tblColumn.setToolTipText(Messages.tblAsDb);
tblColumn = new TableColumn(asTable, SWT.CENTER);
tblColumn.setText(Messages.tblAsHost);
tblColumn.setToolTipText(Messages.tblAsHost);
tblColumn = new TableColumn(asTable, SWT.CENTER);
tblColumn.setText(Messages.tblAsLastAccess);
tblColumn.setToolTipText(Messages.tblAsLastAccess);
tblColumn = new TableColumn(asTable, SWT.CENTER);
tblColumn.setText(Messages.tblAsLct);
tblColumn.setToolTipText(Messages.tblAsLct);
tblColumn = new TableColumn(asTable, SWT.CENTER);
tblColumn.setText(Messages.tblAsClientIp);
tblColumn.setToolTipText(Messages.tblAsClientIp);
tblColumn = new TableColumn(asTable, SWT.CENTER);
tblColumn.setText(Messages.tblAsCur);
tblColumn.setToolTipText(Messages.tblAsCur);
asTableViewer.setContentProvider(new ApplyServerContentProvider());
asTableViewer.setLabelProvider(new ApplyServerLabelProvider());
asTableViewer.setInput(asinfoLst);
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);
}
use of org.eclipse.jface.action.IMenuManager in project cubrid-manager by CUBRID.
the class ActionAdvisor method showMenu.
public void showMenu(IMenuManager menuManager) {
ActionManager manager = ActionManager.getInstance();
MenuManager fileMenu = new MenuManager(Messages.mnu_fileMenuName, IActionConstants.MENU_FILE);
MenuManager editMenu = new MenuManager(Messages.mnu_editMenuName, IActionConstants.MENU_EDIT);
MenuManager toolsMenu = new MenuManager(Messages.mnu_toolsMenuName, IActionConstants.MENU_TOOLS);
MenuManager actionMenu = new MenuManager(Messages.mnu_actionMenuName, IActionConstants.MENU_ACTION);
// MenuManager helpMenu = new MenuManager(Messages.mnu_helpMneuName,
// IWorkbenchActionConstants.M_HELP);
// fill in file menu
fileMenu.add(manager.getAction(ConnectHostAction.ID));
fileMenu.add(manager.getAction(DisConnectHostAction.ID));
fileMenu.add(new Separator());
fileMenu.add(manager.getAction(AddHostAction.ID));
fileMenu.add(manager.getAction(EditHostAction.ID));
fileMenu.add(manager.getAction(DeleteHostAction.ID));
fileMenu.add(new Separator());
fileMenu.add(manager.getAction(CubridServerImportAction.ID));
fileMenu.add(manager.getAction(CubridServerExportAction.ID));
fileMenu.add(new Separator());
fileMenu.add(closeAction);
fileMenu.add(closeAllAction);
fileMenu.add(new Separator());
fileMenu.add(manager.getAction(OpenQueryAction.ID));
fileMenu.add(saveAction);
fileMenu.add(saveasAction);
fileMenu.add(saveAllAction);
fileMenu.add(new Separator());
// fileMenu.add(manager.getAction(OpenSchemaEditorAction.ID));
// fileMenu.add(new Separator());
fileMenu.add(manager.getAction(RestoreQueryEditorAction.ID));
fileMenu.add(new Separator());
fileMenu.add(manager.getAction(ImportHostsAction.ID));
fileMenu.add(SelectWorkspaceDialog.getWorkspaceMenu(ApplicationType.CUBRID_MANAGER.getShortName(), Version.buildVersionId));
fileMenu.add(new Separator());
ActionContributionItem preferencesActionItem = new ActionContributionItem(preferenceAction);
fileMenu.add(preferencesActionItem);
if (Util.isMac()) {
preferencesActionItem.setVisible(false);
}
fileMenu.add(manager.getAction(RefreshAction.ID));
fileMenu.add(new Separator());
fileMenu.add(quitAction);
fileMenu.add(new Separator());
// fill in edit menu
editMenu.add(undoRetargetAction);
editMenu.add(redoRetargetAction);
editMenu.add(new Separator());
editMenu.add(copyRetargetAction);
editMenu.add(cutRetargetAction);
editMenu.add(pasteRetargetAction);
editMenu.add(new Separator());
editMenu.add(findRetargetAction);
editMenu.add(manager.getAction(GotoLineAction.ID));
// fill in the run menu
toolsMenu.add(manager.getAction(QueryNewAction.ID));
toolsMenu.add(manager.getAction(QueryNewCustomAction.ID));
toolsMenu.add(new Separator());
toolsMenu.add(manager.getAction(StartServiceAction.ID));
toolsMenu.add(manager.getAction(StopServiceAction.ID));
toolsMenu.add(new Separator());
toolsMenu.add(manager.getAction(StartDatabaseAction.ID));
toolsMenu.add(manager.getAction(StopDatabaseAction.ID));
toolsMenu.add(new Separator());
toolsMenu.add(manager.getAction(StartBrokerEnvAction.ID));
toolsMenu.add(manager.getAction(StopBrokerEnvAction.ID));
toolsMenu.add(new Separator());
toolsMenu.add(manager.getAction(ChangeManagerPasswordAction.ID));
toolsMenu.add(manager.getAction(UserManagementAction.ID));
toolsMenu.add(new Separator());
toolsMenu.add(manager.getAction(BrokerLogParserAction.ID));
toolsMenu.add(manager.getAction(BrokerLogTopMergeAction.ID));
toolsMenu.add(new Separator());
toolsMenu.add(manager.getAction(SchemaCommentInstallAction.ID));
toolsMenu.add(manager.getAction(ServiceDashboardAction.ID));
menuManager.insertBefore(getMenuInsertPoint(menuManager), fileMenu);
menuManager.insertBefore(getMenuInsertPoint(menuManager), editMenu);
menuManager.insertBefore(getMenuInsertPoint(menuManager), toolsMenu);
menuManager.insertBefore(getMenuInsertPoint(menuManager), actionMenu);
menuManager.update(true);
}
use of org.eclipse.jface.action.IMenuManager in project cubrid-manager by CUBRID.
the class PerspectiveChangedListener method showPerspective.
public void showPerspective(PerspectiveChangeEvent event) {
WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
ICoolBarManager coolBarManager = window.getCoolBarManager2();
IMenuManager menuManager = window.getMenuBarManager();
ActionAdvisor.getInstance().showToolbar(coolBarManager);
ActionAdvisor.getInstance().showMenu(menuManager);
}
ActionManager.getInstance().setMenuProvider(menuProvider);
LayoutManager.getInstance().setStatusLineContrItem(cubridStatusLineContrItem);
LayoutManager.getInstance().setTitleLineContrItem(cubridTitleLineContrItem);
cubridTitleLineContrItem.changeTitleForNavigator(null);
LayoutManager.getInstance().setWorkbenchContrItem(cubridWorkbenchContrItem);
CubridNavigatorView cubridNavigatorView = CubridNavigatorView.findNavigationView();
if (cubridNavigatorView != null) {
cubridNavigatorView.setFocus();
}
}
Aggregations