use of org.eclipse.jface.action.Separator in project cubrid-manager by CUBRID.
the class ActionBuilder method buildMenu.
/**
* Build CUBRID Manager Menu
*
* @param parentMenu the parent menu manager
* @return the menu manager
*/
public IMenuManager[] buildMenu(IMenuManager parentMenu) {
IMenuManager cubridMenuMgr = new MenuManager(Messages.cubridMenu, IActionConstants.MENU_CUBRID);
cubridMenuMgr.add(ActionManager.getInstance().getAction(EditHostAction.ID));
cubridMenuMgr.add(ActionManager.getInstance().getAction(DisConnectHostAction.ID));
cubridMenuMgr.add(new Separator());
cubridMenuMgr.add(ActionManager.getInstance().getAction(StartServiceAction.ID));
cubridMenuMgr.add(ActionManager.getInstance().getAction(StopServiceAction.ID));
cubridMenuMgr.add(ActionManager.getInstance().getAction(StartDatabaseAction.ID));
cubridMenuMgr.add(ActionManager.getInstance().getAction(StopDatabaseAction.ID));
cubridMenuMgr.add(new Separator());
cubridMenuMgr.add(ActionManager.getInstance().getAction(EditDatabaseLoginAction.ID));
cubridMenuMgr.add(ActionManager.getInstance().getAction(LogoutDatabaseAction.ID));
cubridMenuMgr.add(new Separator());
cubridMenuMgr.add(ActionManager.getInstance().getAction(AddHostAction.ID));
cubridMenuMgr.add(ActionManager.getInstance().getAction(CreateDatabaseAction.ID));
cubridMenuMgr.add(ActionManager.getInstance().getAction(QueryNewAction.ID));
cubridMenuMgr.add(ActionManager.getInstance().getAction(AddUserAction.ID));
cubridMenuMgr.add(ActionManager.getInstance().getAction(NewTableAction.ID));
cubridMenuMgr.add(new Separator());
// cubridMenuMgr.add(ActionManager.getInstance().getAction(
// OpenSchemaEditorAction.ID));
// cubridMenuMgr.add(new Separator());
cubridMenuMgr.add(ActionManager.getInstance().getAction(UserManagementAction.ID));
cubridMenuMgr.add(new Separator());
cubridMenuMgr.add(ActionManager.getInstance().getAction(PropertyAction.ID));
parentMenu.insertBefore(IWorkbenchActionConstants.M_WINDOW, cubridMenuMgr);
return new IMenuManager[] { cubridMenuMgr };
}
use of org.eclipse.jface.action.Separator in project cubrid-manager by CUBRID.
the class MenuProvider method buildUserViewMenu.
/**
* Construct the user view related actions
*
* @param manager the parent IMenuManager
*/
public void buildUserViewMenu(IMenuManager manager) {
addActionToManager(manager, getAction(DatabaseQueryNewAction.ID));
manager.add(new Separator());
addActionToManager(manager, getAction(TableSelectAllAction.ID));
addActionToManager(manager, getAction(TableSelectCountAction.ID));
manager.add(new Separator());
IAction renameTableAction = getAction(RenameTableAction.ID);
renameTableAction.setText(com.cubrid.common.ui.spi.Messages.viewRenameActionName);
renameTableAction.setImageDescriptor(CommonUIPlugin.getImageDescriptor("icons/action/view_rename.png"));
addActionToManager(manager, renameTableAction);
addActionToManager(manager, getAction(EditViewAction.ID));
IAction viewDropAction = getAction(DropViewAction.ID);
addActionToManager(manager, viewDropAction);
manager.add(new Separator());
// addActionToManager(manager, getAction(ShowSchemaEditorAction.ID));
// manager.add(new Separator());
}
use of org.eclipse.jface.action.Separator in project cubrid-manager by CUBRID.
the class MenuProvider method buildUserTableMenu.
/**
* Construct user table related actions
*
* @param manager the parent IMenuManager
* @param node The ICubridNode object
*/
public void buildUserTableMenu(IMenuManager manager, ICubridNode node) {
DatabaseInfo dbInfo = ((ISchemaNode) node).getDatabase().getDatabaseInfo();
// SELECT GROUP
IMenuManager selectSqlMenu = new MenuManager(Messages.lblMakeSelectQueryGrp);
manager.add(selectSqlMenu);
// SELECT
addActionToManager(selectSqlMenu, getAction(MakeSelectQueryAction.ID));
// Parameterized SELECT
addActionToManager(selectSqlMenu, getAction(MakeSelectPstmtQueryAction.ID));
// Parameterized INSERT
addActionToManager(manager, getAction(MakeInsertQueryAction.ID));
// Parameterized UPDATE
addActionToManager(manager, getAction(MakeUpdateQueryAction.ID));
// Parameterized DELETE
addActionToManager(manager, getAction(MakeDeleteQueryAction.ID));
// CREATE GROUP
IMenuManager createSqlMenu = new MenuManager(Messages.lblMakeCreateQueryGrp);
manager.add(createSqlMenu);
addActionToManager(createSqlMenu, getAction(MakeCreateQueryAction.ID));
addActionToManager(createSqlMenu, getAction(MakeCloneQueryAction.ID));
manager.add(new Separator());
// Schema to Code Actions
addActionToManager(manager, getAction(TableToJavaCodeAction.ID));
addActionToManager(manager, getAction(TableToPhpCodeAction.ID));
addActionToManager(manager, getAction(ExportTableDefinitionAction.ID));
manager.add(new Separator());
// Install Schema Comment
addActionToManager(manager, getAction(SchemaCommentInstallAction.ID));
manager.add(new Separator());
// View data
IMenuManager viewDataMenu = new MenuManager(Messages.viewDataMenuName);
manager.add(viewDataMenu);
addActionToManager(viewDataMenu, getAction(TableSelectAllAction.ID));
addActionToManager(viewDataMenu, getAction(SelectByOnePstmtDataAction.ID));
addActionToManager(viewDataMenu, getAction(SelectByMultiPstmtDataAction.ID));
viewDataMenu.add(new Separator());
addActionToManager(viewDataMenu, getAction(TableSelectCountAction.ID));
// Input data
IMenuManager inputDataMenu = new MenuManager(Messages.inputDataMenuName);
manager.add(inputDataMenu);
addActionToManager(inputDataMenu, getAction(InsertOneByPstmtAction.ID));
addActionToManager(inputDataMenu, getAction(ImportDataFromFileAction.ID));
// addActionToManager(manager, getAction(RunSQLFileAction.ID));
manager.add(new Separator());
// Export & Import Actions
addActionToManager(manager, getAction(ExportWizardAction.ID));
addActionToManager(manager, getAction(ImportWizardAction.ID));
manager.add(new Separator());
// Manage table
addActionToManager(manager, getAction(EditTableAction.ID));
IAction renameTableAction = getAction(RenameTableAction.ID);
renameTableAction.setText(com.cubrid.common.ui.spi.Messages.tableRenameActionName);
renameTableAction.setImageDescriptor(CommonUIPlugin.getImageDescriptor("icons/action/table_rename.png"));
addActionToManager(manager, renameTableAction);
IMenuManager moreMenu = new MenuManager(Messages.tableMoreName);
addActionToManager(moreMenu, getAction(DeleteTableAction.ID));
IAction action = getAction(DeleteTableAction.ID);
if (CompatibleUtil.isSupportTruncateTable(dbInfo)) {
if (action != null) {
action.setText(Messages.deleteAllRecordsActionName);
}
addActionToManager(moreMenu, getAction(TruncateTableAction.ID));
} else {
if (action != null) {
action.setText(Messages.tableDeleteAllActionName);
}
}
IAction tableDropAction = getAction(DropTableAction.ID);
addActionToManager(moreMenu, tableDropAction);
moreMenu.add(new Separator());
if (CompatibleUtil.isSupportCreateTableLike(dbInfo)) {
addActionToManager(moreMenu, getAction(CreateLikeTableAction.ID));
}
manager.add(moreMenu);
}
use of org.eclipse.jface.action.Separator in project MonjaDB by Kanatoko.
the class MActionView method init2.
//--------------------------------------------------------------------------------
public void init2() {
parent.setLayout(new FormLayout());
sashForm = new SashForm(parent, SWT.SMOOTH | SWT.VERTICAL);
FormData fd_sashForm1 = new FormData();
fd_sashForm1.top = new FormAttachment(0, 1);
fd_sashForm1.left = new FormAttachment(0, 1);
fd_sashForm1.right = new FormAttachment(100, -1);
fd_sashForm1.bottom = new FormAttachment(100, -1);
sashForm.setLayoutData(fd_sashForm1);
table = new Table(sashForm, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
table.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
onTableStateChange();
}
});
table.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.keyCode == 13) {
e.doit = false;
if (//Shift + Enter
(e.stateMask & SWT.SHIFT) != 0) {
repeatActionsOnTable();
} else {
editActions();
}
}
}
});
FormData fd_table = new FormData();
fd_table.top = new FormAttachment(0, 0);
fd_table.bottom = new FormAttachment(100, 0);
fd_table.left = new FormAttachment(0, 0);
fd_table.right = new FormAttachment(100, 0);
table.setLayoutData(fd_table);
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableColumn actionColumn = new TableColumn(table, SWT.NONE);
actionColumn.setWidth(100);
actionColumn.setText("Action");
TableColumn dateColumn = new TableColumn(table, SWT.NONE);
dateColumn.setWidth(100);
dateColumn.setText("Date");
editorComposite = new Composite(sashForm, SWT.BORDER);
editorComposite.setLayout(new FormLayout());
text = new Text(editorComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
onTextStateChange();
}
});
FormData fd_text = new FormData();
fd_text.bottom = new FormAttachment(100, -40);
fd_text.right = new FormAttachment(100);
fd_text.top = new FormAttachment(0);
fd_text.left = new FormAttachment(0);
text.setLayoutData(fd_text);
executeButton = new Button(editorComposite, SWT.NONE);
executeButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
executeActionsOnText();
}
});
executeButton.setEnabled(false);
FormData fd_executeButton = new FormData();
fd_executeButton.top = new FormAttachment(text, 6);
fd_executeButton.left = new FormAttachment(text, -120, SWT.RIGHT);
fd_executeButton.right = new FormAttachment(100, -10);
executeButton.setLayoutData(fd_executeButton);
executeButton.setText("Execute");
editorComposite.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
onSashResize();
}
});
MSwtUtil.getTableColumnWidthFromProperties("actionListTable", table, prop, new int[] { 200, 100 });
MSwtUtil.addListenerToTableColumns2(table, this);
//table.addListener( SWT.KeyDown, this );
table.addListener(SWT.MouseDoubleClick, this);
menuManager = new MenuManager();
Menu contextMenu = menuManager.createContextMenu(table);
table.setMenu(contextMenu);
//executeTableAction
{
redoAction = new Action() {
public void run() {
//------------
repeatActionsOnTable();
}
};
//------------
redoAction.setToolTipText("Redo Selected Actions");
redoAction.setText("Redo\tShift+Enter");
initAction(redoAction, "table_go.png", menuManager);
redoAction.setEnabled(false);
}
//editAction
{
editAction = new Action() {
public void run() {
//------------
editActions();
}
};
//------------
editAction.setToolTipText("Edit Actions on The Text Editor");
editAction.setText("Edit\tEnter");
initAction(editAction, "pencil.png", menuManager);
editAction.setEnabled(false);
}
dropDownMenu.add(new Separator());
menuManager.add(new Separator());
//executeAction
{
executeAction = new Action() {
public void run() {
//------------
executeActionsOnText();
}
};
//------------
executeAction.setToolTipText("Execute Actions on the Textarea");
executeAction.setText("Execute");
setActionImage(executeAction, "bullet_go.png");
addActionToToolBar(executeAction);
executeAction.setEnabled(false);
dropDownMenu.add(executeAction);
}
dropDownMenu.add(new Separator());
menuManager.add(new Separator());
//copyAction
{
copyAction = new Action() {
public void run() {
//------------
copyActions();
}
};
//------------
copyAction.setToolTipText("Copy Actions to Clipboard");
copyAction.setText("Copy");
setActionImage(copyAction, "page_copy.png");
addActionToToolBar(copyAction);
copyAction.setEnabled(false);
dropDownMenu.add(copyAction);
menuManager.add(copyAction);
}
dropDownMenu.add(new Separator());
menuManager.add(new Separator());
//clearAction
{
clearAction = new Action() {
public void run() {
//------------
clearActions();
}
};
//------------
clearAction.setToolTipText("Clear All");
clearAction.setText("Clear All");
initAction(clearAction, "table_delete.png", menuManager);
clearAction.setEnabled(false);
}
//saveAction
{
saveAction = new Action() {
public void run() {
//------------
saveActions();
}
};
//------------
saveAction.setToolTipText("Save Action");
saveAction.setText("Save");
initAction(saveAction, "cog_add.png", menuManager);
saveAction.setEnabled(false);
}
//load actionLogList
if (prop.containsKey(ACTION_LOG_LIST)) {
String savedStr = prop.getProperty(ACTION_LOG_LIST);
actionLogList = (java.util.List) JSON.parse(savedStr);
for (int i = 0; i < actionLogList.size(); ++i) {
Map actionLog = (Map) actionLogList.get(i);
addActionToTable(actionLog);
}
} else {
actionLogList = new LinkedList();
}
if (prop.containsKey(ACTIONLOG_COMPOSITE_WEIGHT)) {
(new Thread() {
public void run() {
MSystemUtil.sleep(0);
shell.getDisplay().asyncExec(new Runnable() {
public void run() {
//----
sashForm.setWeights(prop.getIntArrayProperty(ACTIONLOG_COMPOSITE_WEIGHT));
}
});
//----
}
}).start();
} else {
sashForm.setWeights(new int[] { 70, 30 });
}
initializedTime = System.currentTimeMillis();
}
use of org.eclipse.jface.action.Separator 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);
}
Aggregations