Search in sources :

Example 26 with IAction

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

Example 27 with IAction

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

Example 28 with IAction

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

Example 29 with IAction

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

Example 30 with IAction

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

Aggregations

IAction (org.eclipse.jface.action.IAction)406 Action (org.eclipse.jface.action.Action)153 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)79 IWorkbenchAction (org.eclipse.ui.actions.ActionFactory.IWorkbenchAction)57 Separator (org.eclipse.jface.action.Separator)54 WebLaunchAction (com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction)50 MenuManager (org.eclipse.jface.action.MenuManager)39 ArrayList (java.util.ArrayList)38 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)37 IMenuManager (org.eclipse.jface.action.IMenuManager)37 IContributionItem (org.eclipse.jface.action.IContributionItem)33 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)27 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)22 ActionRegistry (org.eclipse.gef.ui.actions.ActionRegistry)19 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)18 IToolBarManager (org.eclipse.jface.action.IToolBarManager)17 Iterator (java.util.Iterator)15 Point (org.eclipse.swt.graphics.Point)15 IEditorPart (org.eclipse.ui.IEditorPart)15 List (java.util.List)14