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