Search in sources :

Example 1 with GroupSettingAction

use of com.cubrid.common.ui.common.action.GroupSettingAction in project cubrid-manager by CUBRID.

the class CubridHostNavigatorView method buildToolBar.

/**
	 * Build the view toolbar
	 *
	 * @param toolBarManager IToolBarManager
	 */
protected void buildToolBar(IToolBarManager toolBarManager) {
    ActionManager manager = ActionManager.getInstance();
    RefreshAction refreshAction = (RefreshAction) ActionManager.getInstance().getAction(RefreshAction.ID);
    toolBarManager.add(refreshAction);
    OpenTargetAction openObjectTabAction = (OpenTargetAction) manager.getAction(OpenTargetAction.ID);
    toolBarManager.add(openObjectTabAction);
    SwitchGroupModeAction grpSwitchAction = (SwitchGroupModeAction) manager.getAction(SwitchGroupModeAction.ID);
    grpSwitchAction.setNavigatorView(this);
    grpSwitchAction.init();
    toolBarManager.add(grpSwitchAction);
    GroupSettingAction groupSettingAction = (GroupSettingAction) manager.getAction(GroupSettingAction.ID);
    groupSettingAction.setNavigatorView(this);
    toolBarManager.add(groupSettingAction);
    ExpandTreeItemAction expandAction = (ExpandTreeItemAction) manager.getAction(ExpandTreeItemAction.ID);
    expandAction.setTargetTreeViewer(tv);
    toolBarManager.add(expandAction);
    UnExpandTreeItemAction unexpandAction = (UnExpandTreeItemAction) manager.getAction(UnExpandTreeItemAction.ID);
    unexpandAction.setTv(tv);
    toolBarManager.add(unexpandAction);
}
Also used : ActionManager(com.cubrid.common.ui.spi.action.ActionManager) RefreshAction(com.cubrid.cubridmanager.ui.common.action.RefreshAction) UnExpandTreeItemAction(com.cubrid.common.ui.common.action.UnExpandTreeItemAction) ExpandTreeItemAction(com.cubrid.common.ui.common.action.ExpandTreeItemAction) SwitchGroupModeAction(com.cubrid.common.ui.common.action.SwitchGroupModeAction) GroupSettingAction(com.cubrid.common.ui.common.action.GroupSettingAction) OpenTargetAction(com.cubrid.common.ui.common.action.OpenTargetAction) UnExpandTreeItemAction(com.cubrid.common.ui.common.action.UnExpandTreeItemAction)

Example 2 with GroupSettingAction

use of com.cubrid.common.ui.common.action.GroupSettingAction 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 3 with GroupSettingAction

use of com.cubrid.common.ui.common.action.GroupSettingAction in project cubrid-manager by CUBRID.

the class CubridQueryNavigatorView method buildToolBar.

/**
	 * Build the view toolbar
	 *
	 * @param toolBarManager IToolBarManager
	 */
protected void buildToolBar(IToolBarManager toolBarManager) {
    OpenTargetAction openObjectTabAction = (OpenTargetAction) ActionManager.getInstance().getAction(OpenTargetAction.ID);
    toolBarManager.add(openObjectTabAction);
    SwitchGroupModeAction grpSwitchAction = (SwitchGroupModeAction) ActionManager.getInstance().getAction(SwitchGroupModeAction.ID);
    grpSwitchAction.setNavigatorView(this);
    grpSwitchAction.init();
    toolBarManager.add(grpSwitchAction);
    GroupSettingAction groupSettingAction = (GroupSettingAction) ActionManager.getInstance().getAction(GroupSettingAction.ID);
    groupSettingAction.setNavigatorView(this);
    toolBarManager.add(groupSettingAction);
    ExpandTreeItemAction expandAction = (ExpandTreeItemAction) ActionManager.getInstance().getAction(ExpandTreeItemAction.ID);
    expandAction.setTargetTreeViewer(tv);
    toolBarManager.add(expandAction);
    UnExpandTreeItemAction unexpandAction = (UnExpandTreeItemAction) ActionManager.getInstance().getAction(UnExpandTreeItemAction.ID);
    unexpandAction.setTv(tv);
    toolBarManager.add(unexpandAction);
}
Also used : UnExpandTreeItemAction(com.cubrid.common.ui.common.action.UnExpandTreeItemAction) ExpandTreeItemAction(com.cubrid.common.ui.common.action.ExpandTreeItemAction) SwitchGroupModeAction(com.cubrid.common.ui.common.action.SwitchGroupModeAction) GroupSettingAction(com.cubrid.common.ui.common.action.GroupSettingAction) OpenTargetAction(com.cubrid.common.ui.common.action.OpenTargetAction) UnExpandTreeItemAction(com.cubrid.common.ui.common.action.UnExpandTreeItemAction)

Aggregations

GroupSettingAction (com.cubrid.common.ui.common.action.GroupSettingAction)3 ExpandTreeItemAction (com.cubrid.common.ui.common.action.ExpandTreeItemAction)2 OpenTargetAction (com.cubrid.common.ui.common.action.OpenTargetAction)2 SwitchGroupModeAction (com.cubrid.common.ui.common.action.SwitchGroupModeAction)2 UnExpandTreeItemAction (com.cubrid.common.ui.common.action.UnExpandTreeItemAction)2 ActionManager (com.cubrid.common.ui.spi.action.ActionManager)2 CollapseAllAction (com.cubrid.common.ui.common.action.CollapseAllAction)1 FilterSettingAction (com.cubrid.common.ui.common.action.FilterSettingAction)1 NodeFilterAction (com.cubrid.common.ui.common.action.NodeFilterAction)1 ShowToolTipAction (com.cubrid.common.ui.common.action.ShowToolTipAction)1 TopGroupAction (com.cubrid.common.ui.common.action.TopGroupAction)1 TopGroupItemAction (com.cubrid.common.ui.common.action.TopGroupItemAction)1 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)1 RefreshAction (com.cubrid.cubridmanager.ui.common.action.RefreshAction)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 IAction (org.eclipse.jface.action.IAction)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1 Separator (org.eclipse.jface.action.Separator)1