use of com.cubrid.common.ui.spi.action.ActionManager 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);
// fill in file menu
fileMenu.add(manager.getAction(OpenQueryConnAction.ID));
fileMenu.add(manager.getAction(CloseQueryConnAction.ID));
fileMenu.add(new Separator());
fileMenu.add(manager.getAction(NewQueryConnAction.ID));
fileMenu.add(manager.getAction(EditQueryConnAction.ID));
fileMenu.add(manager.getAction(DeleteQueryConnAction.ID));
fileMenu.add(new Separator());
fileMenu.add(manager.getAction(ConnectionUrlImportAction.ID));
fileMenu.add(manager.getAction(ConnectionUrlExportAction.ID));
fileMenu.add(new Separator());
fileMenu.add(manager.getAction(ConnectionImportAction.ID));
fileMenu.add(manager.getAction(ConnectionExportAction.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(RestoreQueryEditorAction.ID));
fileMenu.add(new Separator());
fileMenu.add(manager.getAction(ImportConnsAction.ID));
fileMenu.add(SelectWorkspaceDialog.getWorkspaceMenu(ApplicationType.CUBRID_QUERY_BROWSER.getShortName(), Version.buildVersionId));
fileMenu.add(new Separator());
ActionContributionItem preferencesActionItem = new ActionContributionItem(preferenceAction);
fileMenu.add(preferencesActionItem);
if (Util.isMac()) {
}
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 tools menu
toolsMenu.add(manager.getAction(QueryNewAction.ID));
toolsMenu.add(manager.getAction(QueryNewCustomAction.ID));
toolsMenu.add(new Separator());
toolsMenu.add(manager.getAction(OIDNavigatorAction.ID));
toolsMenu.add(new Separator());
toolsMenu.add(manager.getAction(NewTableAction.ID));
toolsMenu.add(manager.getAction(CreateViewAction.ID));
toolsMenu.add(new Separator());
toolsMenu.add(manager.getAction(CreateSerialAction.ID));
toolsMenu.add(new Separator());
toolsMenu.add(manager.getAction(NewTriggerAction.ID));
toolsMenu.add(new Separator());
toolsMenu.add(manager.getAction(AddFunctionAction.ID));
toolsMenu.add(manager.getAction(AddProcedureAction.ID));
toolsMenu.add(new Separator());
toolsMenu.add(manager.getAction(ExportWizardAction.ID));
toolsMenu.add(manager.getAction(ImportWizardAction.ID));
// toolsMenu.add(new Separator());
// fileMenu.add(manager.getAction(OpenSchemaEditorAction.ID));
fileMenu.add(new Separator());
IMenuManager perparedMenu = new MenuManager(com.cubrid.common.ui.spi.Messages.preparedTableDataMenuName);
toolsMenu.add(perparedMenu);
perparedMenu.add(manager.getAction(PstmtOneDataAction.ID));
perparedMenu.add(manager.getAction(PstmtMultiDataAction.ID));
toolsMenu.add(new Separator());
toolsMenu.add(manager.getAction(BrokerLogParserAction.ID));
toolsMenu.add(manager.getAction(BrokerLogTopMergeAction.ID));
toolsMenu.add(manager.getAction(BrokerConfOpenFileAction.ID));
toolsMenu.add(new Separator());
toolsMenu.add(manager.getAction(SchemaCommentInstallAction.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 com.cubrid.common.ui.spi.action.ActionManager in project cubrid-manager by CUBRID.
the class CubridHostNavigatorView method hookRetragetActions.
/**
* Hook the global actions in bars
*/
protected void hookRetragetActions() {
ActionManager manager = ActionManager.getInstance();
IActionBars bar = this.getViewSite().getActionBars();
bar.setGlobalActionHandler(ActionFactory.COPY.getId(), manager.getAction(CopyHostAction.ID));
bar.setGlobalActionHandler(ActionFactory.PASTE.getId(), manager.getAction(PasteHostAction.ID));
bar.updateActionBars();
}
use of com.cubrid.common.ui.spi.action.ActionManager in project cubrid-manager by CUBRID.
the class ServiceDashboardEditor method createPartControl.
public void createPartControl(Composite parent) {
Composite composite = new Composite(parent, SWT.None);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
composite.setLayout(layout);
Composite buttonComp = new Composite(composite, SWT.None);
buttonComp.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, 24));
Composite dataComp = new Composite(composite, SWT.None);
dataComp.setLayout(new FillLayout());
dataComp.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
/*Create button*/
createButtonComposite(buttonComp);
serviceTreeViewer = new TreeViewer(dataComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
serviceTreeViewer.getTree().setHeaderVisible(true);
serviceTreeViewer.getTree().setLinesVisible(true);
ColumnViewerToolTipSupport.enableFor(serviceTreeViewer, ToolTip.NO_RECREATE);
final TreeColumn hostColumn = new TreeColumn(serviceTreeViewer.getTree(), SWT.LEFT);
hostColumn.setText(Messages.columnGroupOrHost);
hostColumn.setWidth(200);
serviceTreeViewer.setSorter(ServiceDashboardEditorSorter.Name_ASC);
setColumnSorter(hostColumn, ServiceDashboardEditorSorter.Name_ASC, ServiceDashboardEditorSorter.Name_DESC);
/*TreeColumn statusColumn = new TreeColumn(serviceTreeViewer.getTree(), SWT.LEFT);
statusColumn.setText(Messages.columnStatus);
statusColumn.setWidth(100);*/
final TreeColumn ipColumn = new TreeColumn(serviceTreeViewer.getTree(), SWT.LEFT);
ipColumn.setText(Messages.columnAddress);
ipColumn.setWidth(100);
setColumnSorter(ipColumn, ServiceDashboardEditorSorter.Address_ASC, ServiceDashboardEditorSorter.Address_DESC);
TreeColumn portColumn = new TreeColumn(serviceTreeViewer.getTree(), SWT.LEFT);
portColumn.setText(Messages.columnPort);
portColumn.pack();
setColumnSorter(portColumn, ServiceDashboardEditorSorter.Port_ASC, ServiceDashboardEditorSorter.Port_DESC);
TreeColumn userColumn = new TreeColumn(serviceTreeViewer.getTree(), SWT.LEFT);
userColumn.setText(Messages.columnUser);
userColumn.pack();
setColumnSorter(userColumn, ServiceDashboardEditorSorter.User_ASC, ServiceDashboardEditorSorter.User_DESC);
TreeViewerColumn volumnColumnData = new TreeViewerColumn(serviceTreeViewer, SWT.LEFT);
volumnColumnData.getColumn().setText(Messages.columnData);
volumnColumnData.getColumn().setToolTipText(Messages.columnDataTip);
volumnColumnData.getColumn().pack();
setColumnSorter(volumnColumnData.getColumn(), ServiceDashboardEditorSorter.Data_ASC, ServiceDashboardEditorSorter.Data_DESC);
TreeViewerColumn volumnColumnIndex = new TreeViewerColumn(serviceTreeViewer, SWT.LEFT);
volumnColumnIndex.getColumn().setText(Messages.columnIndex);
volumnColumnIndex.getColumn().setToolTipText(Messages.columnIndexTip);
volumnColumnIndex.getColumn().pack();
setColumnSorter(volumnColumnIndex.getColumn(), ServiceDashboardEditorSorter.Index_ASC, ServiceDashboardEditorSorter.Index_DESC);
TreeViewerColumn volumnColumnTemp = new TreeViewerColumn(serviceTreeViewer, SWT.LEFT);
volumnColumnTemp.getColumn().setText(Messages.columnTemp);
volumnColumnTemp.getColumn().setToolTipText(Messages.columnTempTip);
volumnColumnTemp.getColumn().pack();
setColumnSorter(volumnColumnTemp.getColumn(), ServiceDashboardEditorSorter.Temp_ASC, ServiceDashboardEditorSorter.Temp_DESC);
TreeViewerColumn volumnColumnGeneric = new TreeViewerColumn(serviceTreeViewer, SWT.LEFT);
volumnColumnGeneric.getColumn().setText(Messages.columnGeneric);
volumnColumnGeneric.getColumn().setToolTipText(Messages.columnGenericTip);
volumnColumnGeneric.getColumn().pack();
setColumnSorter(volumnColumnGeneric.getColumn(), ServiceDashboardEditorSorter.Generic_ASC, ServiceDashboardEditorSorter.Generic_DESC);
TreeColumn tpsColumn = new TreeColumn(serviceTreeViewer.getTree(), SWT.LEFT);
tpsColumn.setText(Messages.columnTps);
tpsColumn.setWidth(50);
setColumnSorter(tpsColumn, ServiceDashboardEditorSorter.Tps_ASC, ServiceDashboardEditorSorter.Tps_DESC);
TreeColumn qpsColumn = new TreeColumn(serviceTreeViewer.getTree(), SWT.LEFT);
qpsColumn.setText(Messages.columnQps);
qpsColumn.setWidth(50);
setColumnSorter(qpsColumn, ServiceDashboardEditorSorter.Qps_ASC, ServiceDashboardEditorSorter.Qps_DESC);
TreeColumn errorColumn = new TreeColumn(serviceTreeViewer.getTree(), SWT.LEFT);
errorColumn.setText(Messages.columnErrorQ);
errorColumn.setWidth(50);
setColumnSorter(errorColumn, ServiceDashboardEditorSorter.ErrorQ_ASC, ServiceDashboardEditorSorter.ErrorQ_DESC);
TreeColumn memColumn = new TreeColumn(serviceTreeViewer.getTree(), SWT.LEFT);
memColumn.setText(Messages.columnMemory);
memColumn.setWidth(100);
setColumnSorter(memColumn, ServiceDashboardEditorSorter.Memory_ASC, ServiceDashboardEditorSorter.Memory_DESC);
TreeColumn diskColumn = new TreeColumn(serviceTreeViewer.getTree(), SWT.LEFT);
diskColumn.setText(Messages.columnDisk);
diskColumn.setWidth(60);
setColumnSorter(diskColumn, ServiceDashboardEditorSorter.Disk_ASC, ServiceDashboardEditorSorter.Disk_DESC);
TreeColumn cpuColumn = new TreeColumn(serviceTreeViewer.getTree(), SWT.LEFT);
cpuColumn.setText(Messages.columnCpu);
cpuColumn.pack();
setColumnSorter(cpuColumn, ServiceDashboardEditorSorter.Cpu_ASC, ServiceDashboardEditorSorter.Cpu_DESC);
TreeColumn dbColumn = new TreeColumn(serviceTreeViewer.getTree(), SWT.LEFT);
dbColumn.setText(Messages.columnDbOnOff);
dbColumn.setWidth(80);
setColumnSorter(dbColumn, ServiceDashboardEditorSorter.DbStatus_ASC, ServiceDashboardEditorSorter.DbStatus_DESC);
TreeColumn verColumn = new TreeColumn(serviceTreeViewer.getTree(), SWT.LEFT);
verColumn.setText(Messages.columnVersion);
verColumn.setWidth(70);
setColumnSorter(verColumn, ServiceDashboardEditorSorter.Version_ASC, ServiceDashboardEditorSorter.Version_DESC);
TreeColumn brokerPortColumn = new TreeColumn(serviceTreeViewer.getTree(), SWT.LEFT);
brokerPortColumn.setText(Messages.columnBrokerPort);
brokerPortColumn.setWidth(120);
setColumnSorter(brokerPortColumn, ServiceDashboardEditorSorter.BrokerPort_ASC, ServiceDashboardEditorSorter.BrokerPort_DESC);
serviceTreeViewer.setContentProvider(new ServiceDashboardContentProvider());
serviceTreeViewer.setLabelProvider(new ServiceDashboardLabelProvider());
addCellTip(volumnColumnData, 1);
addCellTip(volumnColumnIndex, 2);
addCellTip(volumnColumnTemp, 3);
addCellTip(volumnColumnGeneric, 4);
serviceTreeViewer.getTree().addMouseListener(new MouseListener() {
public void mouseUp(MouseEvent e) {
}
public void mouseDown(MouseEvent e) {
}
public void mouseDoubleClick(MouseEvent e) {
CubridServer[] servers = getSelectedServer();
if (servers.length == 1) {
if (!servers[0].isConnected()) {
ActionManager manager = ActionManager.getInstance();
final ConnectHostAction connectHostAction = (ConnectHostAction) manager.getAction(ConnectHostAction.ID);
connectHostAction.doRun(getSelectedServer());
loadAllData();
}
}
}
});
initMenu(serviceTreeViewer.getTree());
}
use of com.cubrid.common.ui.spi.action.ActionManager in project cubrid-manager by CUBRID.
the class CubridStatusLineContrItem method updateStatusLineForRestoreQueryEditor.
private void updateStatusLineForRestoreQueryEditor() {
final int countOfRestorableQueryEditors = ApplicationPersistUtil.getInstance().countOfRestorableQueryEditorsAtLastSession();
if (countOfRestorableQueryEditors <= 0) {
return;
}
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
StatusLineManager statusLineManager = null;
if (window instanceof WorkbenchWindow) {
statusLineManager = ((WorkbenchWindow) window).getStatusLineManager();
}
if (statusLineManager == null) {
return;
}
IContributionItem scaleItem = new ControlContribution(RESTORE_QUERY_EDITORS_CONTR_ID) {
protected Control createControl(Composite parent) {
Button btn = new Button(parent, SWT.None);
String buttonTitle = Messages.bind(Messages.restoreQueryEditorTitle, countOfRestorableQueryEditors);
btn.setText(buttonTitle);
btn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ActionManager manager = ActionManager.getInstance();
IAction action = manager.getAction(RestoreQueryEditorAction.ID);
if (action != null && action instanceof RestoreQueryEditorAction) {
((RestoreQueryEditorAction) action).run();
}
}
});
return btn;
}
;
};
statusLineManager.add(scaleItem);
}
use of com.cubrid.common.ui.spi.action.ActionManager in project cubrid-manager by CUBRID.
the class ActionAdvisor method init.
private void init() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
ActionManager manager = ActionManager.getInstance();
// standard actions provided by the workbench
closeAction = ActionFactory.CLOSE.create(window);
closeAction.setText(Messages.closeActionName);
// register(closeAction);
closeAllAction = ActionFactory.CLOSE_ALL.create(window);
closeAllAction.setText(Messages.closeAllActionName);
// register(closeAllAction);
saveAction = ActionFactory.SAVE.create(window);
saveAction.setText(Messages.saveActionName);
// register(saveAction);
saveasAction = ActionFactory.SAVE_AS.create(window);
saveasAction.setText(Messages.saveAsActionName);
// register(saveasAction);
saveAllAction = ActionFactory.SAVE_ALL.create(window);
saveAllAction.setText(Messages.saveAllActionName);
// register(saveAllAction);
// retarget actions provided by the workbench
undoRetargetAction = ActionFactory.UNDO.create(window);
undoRetargetAction.setText(com.cubrid.common.ui.spi.Messages.undoActionName);
// register(undoRetargetAction);
redoRetargetAction = ActionFactory.REDO.create(window);
redoRetargetAction.setText(com.cubrid.common.ui.spi.Messages.redoActionName);
// register(redoRetargetAction);
copyRetargetAction = ActionFactory.COPY.create(window);
copyRetargetAction.setText(com.cubrid.common.ui.spi.Messages.copyActionName);
// register(copyRetargetAction);
cutRetargetAction = ActionFactory.CUT.create(window);
cutRetargetAction.setText(com.cubrid.common.ui.spi.Messages.cutActionName);
// register(cutRetargetAction);
pasteRetargetAction = ActionFactory.PASTE.create(window);
pasteRetargetAction.setText(com.cubrid.common.ui.spi.Messages.pasteActionName);
// register(pasteRetargetAction);
findRetargetAction = ActionFactory.FIND.create(window);
findRetargetAction.setText(com.cubrid.common.ui.spi.Messages.findReplaceActionName);
// register(findRetargetAction);
serviceDashboardAction = (ServiceDashboardAction) manager.getAction(ServiceDashboardAction.ID);
if (serviceDashboardAction != null) {
serviceDashboardAction.setText(com.cubrid.common.ui.spi.Messages.serviceDashboardActionName);
// register(serviceDashboardAction);
}
// customized actions for CUBRID Manager
// common action
preferenceAction = new OpenPreferenceAction(window.getShell(), Messages.openPreferenceActionName, null);
// register(preferenceAction);
// It must be needed to use a
preferenceAction.setId("preferences");
// Preferences Menu of an
// Application Menu on Mac.
manager.registerAction(preferenceAction);
quitAction = new QuitAction(Messages.exitActionName);
reportBugAction = (ReportBugAction) manager.getAction(ReportBugAction.ID);
reportBugAction.setCurrentVersion(Version.buildVersionId);
}
}
Aggregations