use of org.eclipse.jface.action.Separator in project cubrid-manager by CUBRID.
the class MenuProvider method buildSystemTableMenu.
/**
*
* Build the system table menu
*
* @param manager IMenuManager
*/
public void buildSystemTableMenu(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());
// addActionToManager(manager, getAction(ShowSchemaEditorAction.ID));
// manager.add(new Separator());
}
use of org.eclipse.jface.action.Separator 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++;
}
}
use of org.eclipse.jface.action.Separator in project cubrid-manager by CUBRID.
the class CubridNavigatorView method createPartControl.
/**
* Create the part control
*
* @param parent Composite
*/
public void createPartControl(Composite parent) {
ViewForm viewForm = new ViewForm(parent, SWT.NONE);
viewForm.setLayout(new GridLayout());
tv = new TreeViewer(viewForm, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
tv.setFilters(NodeFilterManager.getInstance().getViewerFilter());
//create the navigator
createNavigator();
//get the isShowGroup configuration
isShowGroup = savedIsShowGroup();
//set the tree view's input.
setTreeInput();
toolTip = new ToolTip(tv.getTree().getShell(), SWT.BALLOON);
toolTip.setAutoHide(true);
//Create the context menu
MenuManager contextMenuManager = new MenuManager("#PopupMenu", "navigatorContextMenu");
contextMenuManager.setRemoveAllWhenShown(true);
contextMenuManager.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
buildPopupMenu(manager);
}
});
Menu contextMenu = contextMenuManager.createContextMenu(tv.getControl());
tv.getControl().setMenu(contextMenu);
// register the context menu for providing extension by extension point
IWorkbenchPartSite site = getSite();
site.registerContextMenu(contextMenuManager, tv);
site.setSelectionProvider(tv);
//add the select the object text composite to top left of toolbar
ToolBar toolBar = new ToolBar(viewForm, SWT.FLAT);
ToolBarManager toolBarManager = new ToolBarManager(toolBar);
SelectTreeObjContrItem textContrItem = new SelectTreeObjContrItem(tv);
toolBarManager.add(textContrItem);
toolBarManager.update(true);
viewForm.setContent(tv.getControl());
viewForm.setTopLeft(toolBar);
//add the other actions to the top right of toolbar
toolBar = new ToolBar(viewForm, SWT.FLAT | SWT.CENTER);
toolBarManager = new ToolBarManager(toolBar);
buildToolBar(toolBarManager);
toolBarManager.update(true);
viewForm.setTopRight(toolBar);
//Add the actions to view menu bar, you can add them by extension point or code define
IActionBars actionBar = getViewSite().getActionBars();
final IMenuManager menuManager = actionBar.getMenuManager();
menuManager.addMenuListener(new IMenuListener2() {
//reserve these actions by code define,these codes rebuild every time.
//hence when hide, remove them not including these actions by extension point
private IMenuManager lastMenuManager = new MenuManager();
public void menuAboutToShow(IMenuManager manager) {
lastMenuManager.removeAll();
//build the code defined actions
buildViewMenu(lastMenuManager);
for (IContributionItem item : lastMenuManager.getItems()) {
manager.add(item);
}
}
public void menuAboutToHide(IMenuManager manager) {
for (IContributionItem item : lastMenuManager.getItems()) {
manager.remove(item);
}
}
});
menuManager.add(new Separator());
activeContext();
addListener();
setFocus();
}
use of org.eclipse.jface.action.Separator in project cubrid-manager by CUBRID.
the class SelectWorkspaceDialog method getWorkspaceMenu.
/**
*
* Get workspace menu
*
* @param productName String
* @param productVersion String
* @return MenuManager
*/
public static MenuManager getWorkspaceMenu(String productName, String productVersion) {
MenuManager workspaceMenu = new MenuManager(Messages.menuSwitchWorkspace);
String lastUsed = PREFERENCES.get(KEY_LAST_WORKSPACE, null);
String recentUsed = PREFERENCES.get(KEY_RECENT_WORKSPACES, null);
if (recentUsed != null) {
String[] all = recentUsed.split(WORKSPACE_SPLIT_CHAR);
for (String str : all) {
if (str.equals(lastUsed)) {
continue;
}
SwitchWorkspaceAction action = new SwitchWorkspaceAction(str, productName, productVersion, false);
workspaceMenu.add(action);
}
}
workspaceMenu.add(new Separator());
workspaceMenu.add(new SwitchWorkspaceAction(Messages.menuOther, productName, productVersion, true));
return workspaceMenu;
}
use of org.eclipse.jface.action.Separator in project cubrid-manager by CUBRID.
the class ApplicationActionBarAdvisor method fillMenuBar.
/**
* Fills the menu bar with the main menus for the window.
*
* @param menuBar the menu bar manager
*/
protected void fillMenuBar(IMenuManager menuManager) {
ActionManager manager = ActionManager.getInstance();
MenuManager helpMenu = new MenuManager(Messages.mnu_helpMneuName, IWorkbenchActionConstants.M_HELP);
helpMenu.add(manager.getAction(HelpDocumentAction.ID));
// fill in help menu
if ("ko".equals(Messages.language)) {
helpMenu.add(newFeatureAction);
}
helpMenu.add(new Separator());
helpMenu.add(reportBugAction);
helpMenu.add(new Separator());
helpMenu.add(cubridOnlineForumAction);
helpMenu.add(cubridProjectSiteAction);
helpMenu.add(new Separator());
helpMenu.add(new GroupMarker("updates"));
helpMenu.add(new Separator());
helpMenu.add(manager.getAction(ViewServerVersionAction.ID));
helpMenu.add(new Separator());
ActionContributionItem aboutActionItem = new ActionContributionItem(aboutAction);
helpMenu.add(aboutActionItem);
if (Util.isMac()) {
aboutActionItem.setVisible(false);
}
menuManager.add(helpMenu);
}
Aggregations