use of org.eclipse.jface.action.IAction in project cubrid-manager by CUBRID.
the class CubridMenuProvider method buildMenu.
/**
* Build the context menu and menubar menu according to the selected cubrid
* node
*
* @param manager the parent menu manager
* @param node the ICubridNode object
*/
public void buildMenu(IMenuManager manager, ICubridNode node) {
String type = node.getType();
if (NodeType.DATABASE.equals(type)) {
buildDatabaseMenu(manager);
} else if (NodeType.GROUP.equals(type)) {
addActionToManager(manager, getAction(NewQueryConnAction.ID));
addActionToManager(manager, getAction(OpenQueryConnAction.ID));
manager.add(new Separator());
super.buildMenu(manager, node);
} else if (NodeType.USER_FOLDER.equals(type)) {
addActionToManager(manager, getAction(AddUserAction.ID));
} else if (NodeType.USER.equals(type)) {
addActionToManager(manager, getAction(EditUserAction.ID));
addActionToManager(manager, getAction(DeleteUserAction.ID));
} else {
// addActionToManager(manager, getAction(OpenSchemaEditorAction.ID));
// manager.add(new Separator());
super.buildMenu(manager, node);
}
// ActionManager.getInstance().getAction(HiddenElementAction.ID));
if (node.isContainer() && ShowHiddenElementsAction.isSupportedNode(node)) {
manager.add(new Separator());
IAction action = getAction(ShowHiddenElementsAction.ID);
ActionManager.addActionToManager(manager, action);
}
manager.update(true);
}
use of org.eclipse.jface.action.IAction in project cubrid-manager by CUBRID.
the class CUBRIDTextEditor method createContextMenu.
/**
*
* Create the context menu
*
* @param manager IMenuManager
*
*/
protected void createContextMenu(IMenuManager manager) {
updateActions();
IAction undoAction = actions.get(ActionFactory.UNDO.getId());
if (undoAction != null) {
manager.add(undoAction);
}
IAction redoAction = actions.get(ActionFactory.REDO.getId());
if (redoAction != null) {
manager.add(redoAction);
}
manager.add(new Separator());
IAction cutAction = actions.get(ActionFactory.CUT.getId());
if (cutAction != null) {
manager.add(cutAction);
}
IAction copyAction = actions.get(ActionFactory.COPY.getId());
if (copyAction != null) {
manager.add(copyAction);
}
IAction pasteAction = actions.get(ActionFactory.PASTE.getId());
if (pasteAction != null) {
manager.add(pasteAction);
}
manager.add(new Separator());
IAction findAction = actions.get(ActionFactory.FIND.getId());
if (findAction != null) {
manager.add(findAction);
}
}
use of org.eclipse.jface.action.IAction in project cubrid-manager by CUBRID.
the class CUBRIDTextEditor method updateActions.
/**
* Update actions' status.
*
*/
protected void updateActions() {
IAction iAction = actions.get(ActionFactory.UNDO.getId());
if (iAction != null) {
iAction.setEnabled(undoManager.undoable());
}
iAction = actions.get(ActionFactory.REDO.getId());
if (iAction != null) {
iAction.setEnabled(undoManager.redoable());
}
iAction = actions.get(ActionFactory.CUT.getId());
if (iAction != null) {
iAction.setEnabled(textViewer.canDoOperation(ITextOperationTarget.CUT));
}
iAction = actions.get(ActionFactory.COPY.getId());
if (iAction != null) {
iAction.setEnabled(textViewer.canDoOperation(ITextOperationTarget.COPY));
}
iAction = actions.get(ActionFactory.PASTE.getId());
if (iAction != null) {
iAction.setEnabled(textViewer.canDoOperation(ITextOperationTarget.PASTE));
}
}
use of org.eclipse.jface.action.IAction in project cubrid-manager by CUBRID.
the class ActionAdvisor method createItem.
/**
*
* Create action contribution item for action for show text and icon
*
* @param id
* action ID
* @return ActionContributionItem
*/
private ActionContributionItem createItem(String id) {
IAction action = ActionManager.getInstance().getAction(id + ProxyAction.POSTFIX_ID);
if (action == null) {
return null;
}
ActionContributionItem item = new ActionContributionItem(action);
item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
return item;
}
use of org.eclipse.jface.action.IAction in project cubrid-manager by CUBRID.
the class XMLEditor method createContextMenu.
/**
* Add format action.
*
* @param manager IMenuManager
*/
protected void createContextMenu(IMenuManager manager) {
super.createContextMenu(manager);
manager.add(new Separator());
IAction formatAction = actions.get(ActionConstants.ACTION_FORMAT);
if (formatAction != null) {
manager.add(formatAction);
}
}
Aggregations