use of com.cubrid.common.ui.spi.action.ActionManager in project cubrid-manager by CUBRID.
the class ServiceDashboardEditor method createButtonComposite.
private void createButtonComposite(Composite parent) {
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 2;
layout.marginWidth = 5;
parent.setLayout(layout);
ToolBar toolbar = new ToolBar(parent, SWT.RIGHT | SWT.WRAP | SWT.FLAT);
toolbar.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
refreshItem = new ToolItem(toolbar, SWT.PUSH);
refreshItem.setText(Messages.btnRefresh);
refreshItem.setImage(CubridManagerUIPlugin.getImage("icons/action/refresh.png"));
refreshItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
if (!CommonUITool.openConfirmBox(Messages.msgRefreshConfirm)) {
return;
}
loadAllData();
}
});
ActionManager manager = ActionManager.getInstance();
final CubridServerImportAction importAction = (CubridServerImportAction) manager.getAction(CubridServerImportAction.ID);
importItem = new ToolItem(toolbar, SWT.PUSH);
importItem.setText(Messages.btnImport);
importItem.setImage(importAction.getImageDescriptor().createImage());
importItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
importAction.run();
}
});
final CubridServerExportAction exportAction = (CubridServerExportAction) manager.getAction(CubridServerExportAction.ID);
exportItem = new ToolItem(toolbar, SWT.PUSH);
exportItem.setText(Messages.btnExport);
exportItem.setImage(exportAction.getImageDescriptor().createImage());
exportItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
exportAction.run();
}
});
// infoLabel = new Label(parent, SWT.None);
// infoLabel.setLayoutData(CommonUITool.createGridData(
// GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
}
use of com.cubrid.common.ui.spi.action.ActionManager in project cubrid-manager by CUBRID.
the class ServiceDashboardEditor method initMenu.
private void initMenu(Tree tree) {
ActionManager manager = ActionManager.getInstance();
Menu menu = new Menu(this.getSite().getShell(), SWT.POP_UP);
tree.setMenu(menu);
refreshMenuItem = new MenuItem(menu, SWT.PUSH);
refreshMenuItem.setText(Messages.btnRefresh);
refreshMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/refresh.png"));
refreshMenuItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
loadAllData();
}
});
new MenuItem(menu, SWT.SEPARATOR);
final ConnectHostAction connectHostAction = (ConnectHostAction) manager.getAction(ConnectHostAction.ID);
connectMenuItem = new MenuItem(menu, SWT.PUSH);
connectMenuItem.setText(connectHostAction.getText());
connectMenuItem.setImage(connectHostAction.getImageDescriptor().createImage());
connectMenuItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
connectHostAction.doRun(getSelectedServer());
loadAllData();
}
});
final DisConnectHostAction disConnectHostAction = (DisConnectHostAction) manager.getAction(DisConnectHostAction.ID);
disConnectMenuItem = new MenuItem(menu, SWT.PUSH);
disConnectMenuItem.setText(disConnectHostAction.getText());
disConnectMenuItem.setImage(disConnectHostAction.getImageDescriptor().createImage());
disConnectMenuItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
disConnectHostAction.doRun(getSelectedServer());
loadAllData();
}
});
new MenuItem(menu, SWT.SEPARATOR);
final AddHostAction addHostAction = (AddHostAction) manager.getAction(AddHostAction.ID);
addHostMenuItem = new MenuItem(menu, SWT.PUSH);
addHostMenuItem.setText(addHostAction.getText());
addHostMenuItem.setImage(addHostAction.getImageDescriptor().createImage());
addHostMenuItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
addHostAction.doRun(getSelectedServer());
loadAllData();
}
});
final EditHostAction editHostAction = (EditHostAction) manager.getAction(EditHostAction.ID);
editHostMenuItem = new MenuItem(menu, SWT.PUSH);
editHostMenuItem.setText(editHostAction.getText());
editHostMenuItem.setImage(editHostAction.getImageDescriptor().createImage());
editHostMenuItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
editHostAction.doRun(getSelectedServer(), false);
loadAllData();
}
});
final DeleteHostAction deleteHostAction = (DeleteHostAction) manager.getAction(DeleteHostAction.ID);
deleteHostMenuItem = new MenuItem(menu, SWT.PUSH);
deleteHostMenuItem.setText(deleteHostAction.getText());
deleteHostMenuItem.setImage(deleteHostAction.getImageDescriptor().createImage());
deleteHostMenuItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
deleteHostAction.doRun(getSelectedServer());
loadAllData();
}
});
new MenuItem(menu, SWT.SEPARATOR);
final StartServiceAction startServiceAction = (StartServiceAction) manager.getAction(StartServiceAction.ID);
startServiceMenuItem = new MenuItem(menu, SWT.PUSH);
startServiceMenuItem.setText(startServiceAction.getText());
startServiceMenuItem.setImage(startServiceAction.getImageDescriptor().createImage());
startServiceMenuItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
startServiceAction.doRun(getSelectedServer());
loadAllData();
}
});
final StopServiceAction stopServiceAction = (StopServiceAction) manager.getAction(StopServiceAction.ID);
stopServiceMenuItem = new MenuItem(menu, SWT.PUSH);
stopServiceMenuItem.setText(stopServiceAction.getText());
stopServiceMenuItem.setImage(stopServiceAction.getImageDescriptor().createImage());
stopServiceMenuItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
stopServiceAction.doRun(getSelectedServer());
loadAllData();
}
});
menu.addMenuListener(new MenuListener() {
public void menuShown(MenuEvent e) {
updateMenuItems();
}
public void menuHidden(MenuEvent e) {
}
});
}
use of com.cubrid.common.ui.spi.action.ActionManager in project cubrid-manager by CUBRID.
the class ActionAdvisor method showToolbar.
public void showToolbar(ICoolBarManager coolBarManager) {
IToolBarManager newToolbarManager = getToolbarManaeger(coolBarManager);
ActionManager manager = ActionManager.getInstance();
String insertPoint = getToolbarInsertPoint(coolBarManager);
newToolbarManager.insertBefore(insertPoint, createItem(NewQueryConnAction.ID));
newToolbarManager.insertBefore(insertPoint, (createItem(QueryNewAction.ID)));
newToolbarManager.insertBefore(insertPoint, (new Separator()));
newToolbarManager.insertBefore(insertPoint, (createItem(RefreshAction.ID)));
newToolbarManager.insertBefore(insertPoint, (new Separator()));
newToolbarManager.insertBefore(insertPoint, (createItem(NewTableAction.ID)));
newToolbarManager.insertBefore(insertPoint, (createItem(CreateViewAction.ID)));
newToolbarManager.insertBefore(insertPoint, (new Separator()));
newToolbarManager.insertBefore(insertPoint, (createItem(ImportWizardAction.ID)));
newToolbarManager.insertBefore(insertPoint, (createItem(ExportWizardAction.ID)));
newToolbarManager.insertBefore(insertPoint, (new Separator()));
DropDownAction toolsDropAction = new DropDownAction(com.cubrid.common.ui.spi.Messages.toolsActionName, IAction.AS_DROP_DOWN_MENU, Activator.getImageDescriptor("icons/toolbar/qb_tools_on.png"));
toolsDropAction.setDisabledImageDescriptor(Activator.getImageDescriptor("icons/toolbar/qb_tools_off.png"));
MenuManager toolsActionManager = toolsDropAction.getMenuManager();
toolsActionManager.add(manager.getAction(SchemaCompareWizardAction.ID));
toolsActionManager.add(manager.getAction(DataCompareWizardAction.ID));
toolsActionManager.add(new Separator());
toolsActionManager.add(manager.getAction(OpenSchemaEditorAction.ID));
toolsActionManager.add(new Separator());
toolsActionManager.add(manager.getAction(ExportERwinAction.ID));
toolsActionManager.add(manager.getAction(ImportERwinAction.ID));
toolsActionManager.add(new Separator());
toolsActionManager.add(manager.getAction(QueryTunerAction.ID));
ActionContributionItem toolsItem = new ActionContributionItem(toolsDropAction);
toolsItem.setMode(ActionContributionItem.MODE_FORCE_TEXT);
newToolbarManager.insertBefore(insertPoint, toolsItem);
newToolbarManager.insertBefore(insertPoint, new Separator());
newToolbarManager.update(true);
coolBarManager.update(true);
}
use of com.cubrid.common.ui.spi.action.ActionManager in project cubrid-manager by CUBRID.
the class ActionAdvisor method showToolbar.
public void showToolbar(ICoolBarManager coolBarManager) {
IToolBarManager newToolbarManager = getToolbarManaeger(coolBarManager);
ActionManager manager = ActionManager.getInstance();
String insertPoint = getToolbarInsertPoint(coolBarManager);
// Add host action
newToolbarManager.insertBefore(insertPoint, createItem(AddHostAction.ID_BIG));
newToolbarManager.insertBefore(insertPoint, new Separator());
// Start action
newToolbarManager.insertBefore(insertPoint, createItem(StartRetargetAction.ID_BIG));
newToolbarManager.insertBefore(insertPoint, new Separator());
// Open queryEditor
newToolbarManager.insertBefore(insertPoint, createItem(DatabaseQueryNewAction.ID_BIG));
// Schema actions
newToolbarManager.insertBefore(insertPoint, new Separator());
DropDownAction schemaDropAction = new DropDownAction(Messages.schemaActionNameBig, IAction.AS_DROP_DOWN_MENU, Activator.getImageDescriptor("icons/toolbar/schema_big.png"));
schemaDropAction.setDisabledImageDescriptor(Activator.getImageDescriptor("icons/toolbar/schema_big.png"));
MenuManager schemaActionManager = schemaDropAction.getMenuManager();
schemaActionManager.add(manager.getAction(NewTableAction.ID));
schemaActionManager.add(manager.getAction(CreateViewAction.ID));
schemaActionManager.add(manager.getAction(CreateSerialAction.ID));
schemaActionManager.add(manager.getAction(NewTriggerAction.ID));
ActionContributionItem schemaItems = new ActionContributionItem(schemaDropAction);
schemaItems.setMode(ActionContributionItem.MODE_FORCE_TEXT);
newToolbarManager.insertBefore(insertPoint, schemaItems);
newToolbarManager.insertBefore(insertPoint, new Separator());
// Import and export
DropDownAction dataDropAction = new DropDownAction(Messages.dataActionNameBig, IAction.AS_DROP_DOWN_MENU, Activator.getImageDescriptor("icons/toolbar/data_big.png"));
dataDropAction.setDisabledImageDescriptor(Activator.getImageDescriptor("icons/toolbar/data_big.png"));
MenuManager dataActionManager = dataDropAction.getMenuManager();
dataActionManager.add(manager.getAction(ExportWizardAction.ID));
dataActionManager.add(manager.getAction(ImportWizardAction.ID));
ActionContributionItem dataItems = new ActionContributionItem(dataDropAction);
dataItems.setMode(ActionContributionItem.MODE_FORCE_TEXT);
newToolbarManager.insertBefore(insertPoint, dataItems);
newToolbarManager.insertBefore(insertPoint, new Separator());
DropDownAction toolsDropAction = new DropDownAction(com.cubrid.common.ui.spi.Messages.toolsActionName, IAction.AS_DROP_DOWN_MENU, Activator.getImageDescriptor("icons/toolbar/qb_tools_on.png"));
toolsDropAction.setDisabledImageDescriptor(Activator.getImageDescriptor("icons/toolbar/qb_tools_off.png"));
MenuManager toolsActionManager = toolsDropAction.getMenuManager();
toolsActionManager.add(ActionManager.getInstance().getAction(SchemaCompareWizardAction.ID));
toolsActionManager.add(ActionManager.getInstance().getAction(DataCompareWizardAction.ID));
toolsActionManager.add(new Separator());
toolsActionManager.add(manager.getAction(OpenSchemaEditorAction.ID));
toolsActionManager.add(new Separator());
toolsActionManager.add(ActionManager.getInstance().getAction(ExportERwinAction.ID));
toolsActionManager.add(ActionManager.getInstance().getAction(ImportERwinAction.ID));
toolsActionManager.add(new Separator());
// toolsActionManager.add(ActionManager.getInstance().getAction(RunSQLFileAction.ID));
toolsActionManager.add(ActionManager.getInstance().getAction(UnifyHostConfigAction.ID));
toolsActionManager.add(ActionManager.getInstance().getAction(QueryTunerAction.ID));
toolsActionManager.add(new Separator());
// toolsActionManager.add(ActionManager.getInstance().getAction(
// LaunchBrowserAction.ID));
// Action for CM service analysis
// toolsActionManager.add(ActionManager.getInstance().getAction(CMServiceAnalysisAction.ID));
ActionContributionItem toolsItem = new ActionContributionItem(toolsDropAction);
toolsItem.setMode(ActionContributionItem.MODE_FORCE_TEXT);
newToolbarManager.insertBefore(insertPoint, toolsItem);
newToolbarManager.insertBefore(insertPoint, new Separator());
// User Management
DropDownAction usersDropAction = new DropDownAction(Messages.userActionNameBig, IAction.AS_DROP_DOWN_MENU, Activator.getImageDescriptor("icons/toolbar/user_big.png"));
usersDropAction.setDisabledImageDescriptor(Activator.getImageDescriptor("icons/toolbar/user_big.png"));
MenuManager userActionManager = usersDropAction.getMenuManager();
userActionManager.add(manager.getAction(UserManagementAction.ID));
userActionManager.add(manager.getAction(ChangeManagerPasswordAction.ID));
userActionManager.add(new Separator());
userActionManager.add(manager.getAction(AddUserAction.ID));
userActionManager.add(manager.getAction(EditUserAction.ID));
userActionManager.add(manager.getAction(DeleteUserAction.ID));
ActionContributionItem usersItems = new ActionContributionItem(usersDropAction);
usersItems.setMode(ActionContributionItem.MODE_FORCE_TEXT);
newToolbarManager.insertBefore(insertPoint, usersItems);
// Management actions
DropDownAction manageAction = new DropDownAction(Messages.manageActionNameBig, IAction.AS_DROP_DOWN_MENU, Activator.getImageDescriptor("icons/toolbar/db_management_big.png"));
manageAction.setDisabledImageDescriptor(Activator.getImageDescriptor("icons/toolbar/db_management_big.png"));
MenuManager manageActionManager = manageAction.getMenuManager();
manageActionManager.add(manager.getAction(UnloadDatabaseAction.ID));
manageActionManager.add(manager.getAction(LoadDatabaseAction.ID));
manageActionManager.add(manager.getAction(BackupDatabaseAction.ID));
manageActionManager.add(manager.getAction(RestoreDatabaseAction.ID));
manageActionManager.add(manager.getAction(OptimizeAction.ID));
manageActionManager.add(manager.getAction(CheckDatabaseAction.ID));
manageActionManager.add(new Separator());
manageActionManager.add(manager.getAction(TransactionInfoAction.ID));
manageActionManager.add(manager.getAction(LockInfoAction.ID));
ActionContributionItem manageItems = new ActionContributionItem(manageAction);
manageItems.setMode(ActionContributionItem.MODE_FORCE_TEXT);
newToolbarManager.insertBefore(insertPoint, manageItems);
newToolbarManager.insertBefore(insertPoint, new Separator());
newToolbarManager.update(true);
coolBarManager.update(true);
}
use of com.cubrid.common.ui.spi.action.ActionManager in project cubrid-manager by CUBRID.
the class CubridNavigatorView method buildViewMenu.
/**
* Build the view menu
*
* @param menuManager IMenuManager
*/
protected void buildViewMenu(final IMenuManager menuManager) {
ActionManager actionManager = ActionManager.getInstance();
if (isSupportGroup()) {
IMenuManager topLevel = new MenuManager(Messages.topLevelElements);
menuManager.add(topLevel);
{
TopGroupItemAction groupAction = (TopGroupItemAction) actionManager.getAction(TopGroupItemAction.ID);
if (groupAction == null) {
LOGGER.warn("The groupAction is a null.");
return;
}
groupAction.setNavigatorView(this);
topLevel.add(groupAction);
TopGroupAction connAction = (TopGroupAction) actionManager.getAction(TopGroupAction.ID);
if (connAction == null) {
LOGGER.warn("The connAction is a null.");
return;
}
connAction.setNavigatorView(this);
topLevel.add(connAction);
}
menuManager.add(new Separator());
GroupSettingAction gsAction = (GroupSettingAction) actionManager.getAction(GroupSettingAction.ID);
if (gsAction == null) {
LOGGER.warn("The gsAction is a null.");
return;
}
gsAction.setNavigatorView(this);
menuManager.add(gsAction);
}
//add the showTooTip action
menuManager.add(new Separator());
ShowToolTipAction showToolTipAction = new ShowToolTipAction(Messages.showToolTipActionName, null);
menuManager.add(showToolTipAction);
menuManager.add(new Separator());
CollapseAllAction collapseAllAction = (CollapseAllAction) actionManager.getAction(CollapseAllAction.ID);
if (collapseAllAction == null) {
LOGGER.warn("The collapseAllAction is a null.");
return;
}
collapseAllAction.setTargetTreeViewer(tv);
menuManager.add(collapseAllAction);
//add the root node filter action
menuManager.add(new Separator());
//add filter setting action
IAction action = actionManager.getAction(FilterSettingAction.ID);
if (action instanceof FilterSettingAction) {
((FilterSettingAction) action).setTv(tv);
menuManager.add(action);
}
Object inputObj = tv.getInput();
if (!(inputObj instanceof List<?>)) {
return;
}
List<?> list = (List<?>) inputObj;
int i = 1;
for (Object obj : list) {
if (!(obj instanceof ICubridNode)) {
continue;
}
ICubridNode node = (ICubridNode) obj;
String label = "&" + i + " " + node.getLabel();
if (node.getLabel().indexOf("@") >= 0) {
//if text have @ character, the sub string of the last @ will be as accelerator, hence add @
label += "@";
}
NodeFilterAction nodeFilterAction = new NodeFilterAction(label, null, tv, node);
nodeFilterAction.setChecked(NodeFilterManager.getInstance().isExistIdFilter(node.getId()));
menuManager.add(nodeFilterAction);
i++;
}
}
Aggregations