Search in sources :

Example 61 with Separator

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());
}
Also used : Separator(org.eclipse.jface.action.Separator)

Example 62 with 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++;
    }
}
Also used : IAction(org.eclipse.jface.action.IAction) ShowToolTipAction(com.cubrid.common.ui.common.action.ShowToolTipAction) FilterSettingAction(com.cubrid.common.ui.common.action.FilterSettingAction) NodeFilterAction(com.cubrid.common.ui.common.action.NodeFilterAction) GroupSettingAction(com.cubrid.common.ui.common.action.GroupSettingAction) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) Point(org.eclipse.swt.graphics.Point) ActionManager(com.cubrid.common.ui.spi.action.ActionManager) TopGroupAction(com.cubrid.common.ui.common.action.TopGroupAction) CollapseAllAction(com.cubrid.common.ui.common.action.CollapseAllAction) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) TopGroupItemAction(com.cubrid.common.ui.common.action.TopGroupItemAction) List(java.util.List) ArrayList(java.util.ArrayList) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator)

Example 63 with Separator

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();
}
Also used : ToolTip(org.eclipse.swt.widgets.ToolTip) TreeViewer(org.eclipse.jface.viewers.TreeViewer) IContributionItem(org.eclipse.jface.action.IContributionItem) IMenuListener(org.eclipse.jface.action.IMenuListener) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ToolBarManager(org.eclipse.jface.action.ToolBarManager) IWorkbenchPartSite(org.eclipse.ui.IWorkbenchPartSite) ViewForm(org.eclipse.swt.custom.ViewForm) GridLayout(org.eclipse.swt.layout.GridLayout) IMenuListener2(org.eclipse.jface.action.IMenuListener2) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) ToolBar(org.eclipse.swt.widgets.ToolBar) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu) IActionBars(org.eclipse.ui.IActionBars) Separator(org.eclipse.jface.action.Separator)

Example 64 with Separator

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;
}
Also used : SwitchWorkspaceAction(com.cubrid.common.ui.common.action.SwitchWorkspaceAction) MenuManager(org.eclipse.jface.action.MenuManager) Separator(org.eclipse.jface.action.Separator)

Example 65 with Separator

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);
}
Also used : ActionManager(com.cubrid.common.ui.spi.action.ActionManager) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

Aggregations

Separator (org.eclipse.jface.action.Separator)89 MenuManager (org.eclipse.jface.action.MenuManager)39 IMenuManager (org.eclipse.jface.action.IMenuManager)37 IAction (org.eclipse.jface.action.IAction)14 Menu (org.eclipse.swt.widgets.Menu)10 Action (org.eclipse.jface.action.Action)9 IMenuListener (org.eclipse.jface.action.IMenuListener)9 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 ActionManager (com.cubrid.common.ui.spi.action.ActionManager)7 IToolBarManager (org.eclipse.jface.action.IToolBarManager)7 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)6 GroupMarker (org.eclipse.jface.action.GroupMarker)6 IContributionManager (org.eclipse.jface.action.IContributionManager)5 TreeViewer (org.eclipse.jface.viewers.TreeViewer)5 IActionBars (org.eclipse.ui.IActionBars)5 DBAServerSession (org.jkiss.dbeaver.model.admin.sessions.DBAServerSession)5 DBAServerSessionManager (org.jkiss.dbeaver.model.admin.sessions.DBAServerSessionManager)5 SessionManagerViewer (org.jkiss.dbeaver.ui.views.session.SessionManagerViewer)5 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)4 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)4