Search in sources :

Example 11 with IAction

use of org.eclipse.jface.action.IAction in project cubrid-manager by CUBRID.

the class SchemaContextMenuProvider method buildTableMenuItems.

/**
	 * Add menu items for table
	 * 
	 * @param menu
	 */
private void buildTableMenuItems(IMenuManager menu) {
    IAction action;
    action = getActionRegistry().getAction(EditTableAction.ID);
    menu.appendToGroup(AbstractSelectionAction.MANAGE_GROUP_ID, action);
    action = getActionRegistry().getAction(AddColumnAction.ID);
    menu.appendToGroup(AbstractSelectionAction.MANAGE_GROUP_ID, action);
    action = getActionRegistry().getAction(ModifyTableNameAction.ID);
    menu.appendToGroup(AbstractSelectionAction.MANAGE_GROUP_ID, action);
    action = getActionRegistry().getAction(DeleteAction.ID);
    action.setText(Messages.actionDeleteTable);
    // action.setImageDescriptor(CommonUIPlugin.getImageDescriptor("icons/action/schema_table_delete.png"));
    menu.appendToGroup(AbstractSelectionAction.MANAGE_GROUP_ID, action);
}
Also used : IAction(org.eclipse.jface.action.IAction)

Example 12 with IAction

use of org.eclipse.jface.action.IAction in project cubrid-manager by CUBRID.

the class UndoAction method run.

/**
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    Control control = getFocusProvider();
    if (!(control instanceof StyledText)) {
        return;
    }
    StyledText stext = (StyledText) control;
    Object obj = stext.getData(SQLEditorComposite.SQL_EDITOR_FLAG);
    if (obj instanceof TextViewer) {
        TextViewer viewer = (TextViewer) obj;
        if (viewer.getUndoManager() != null) {
            viewer.getUndoManager().undo();
        }
        IAction redoAction = ActionManager.getInstance().getAction(RedoAction.ID);
        FocusAction.changeActionStatus(redoAction, stext);
        FocusAction.changeActionStatus(this, stext);
    }
}
Also used : Control(org.eclipse.swt.widgets.Control) StyledText(org.eclipse.swt.custom.StyledText) IAction(org.eclipse.jface.action.IAction) TextViewer(org.eclipse.jface.text.TextViewer)

Example 13 with IAction

use of org.eclipse.jface.action.IAction in project cubrid-manager by CUBRID.

the class RedoAction method run.

/**
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    Control control = getFocusProvider();
    if (!(control instanceof StyledText)) {
        return;
    }
    StyledText stext = (StyledText) control;
    Object obj = stext.getData(SQLEditorComposite.SQL_EDITOR_FLAG);
    if (obj instanceof TextViewer) {
        TextViewer viewer = (TextViewer) obj;
        if (viewer.getUndoManager() != null) {
            viewer.getUndoManager().redo();
        }
        IAction undoAction = ActionManager.getInstance().getAction(UndoAction.ID);
        FocusAction.changeActionStatus(undoAction, stext);
        IAction copyAction = ActionManager.getInstance().getAction(CopyAction.ID);
        FocusAction.changeActionStatus(copyAction, stext);
        FocusAction.changeActionStatus(this, stext);
    }
}
Also used : Control(org.eclipse.swt.widgets.Control) StyledText(org.eclipse.swt.custom.StyledText) IAction(org.eclipse.jface.action.IAction) TextViewer(org.eclipse.jface.text.TextViewer)

Example 14 with IAction

use of org.eclipse.jface.action.IAction in project cubrid-manager by CUBRID.

the class QueryEditorPart method hookRetragetActions.

protected void hookRetragetActions() {
    ActionManager actionManager = ActionManager.getInstance();
    IActionBars bar = this.getEditorSite().getActionBars();
    bar.setGlobalActionHandler(UndoAction.ID, actionManager.getAction(UndoAction.ID));
    bar.setGlobalActionHandler(RedoAction.ID, actionManager.getAction(RedoAction.ID));
    IAction action = actionManager.getAction(CutAction.ID);
    action.setEnabled(true);
    bar.setGlobalActionHandler(CutAction.ID, action);
    IAction copyAction = actionManager.getAction(CopyAction.ID);
    bar.setGlobalActionHandler(CopyAction.ID, copyAction);
    copyAction.setEnabled(true);
    IAction pasteAction = actionManager.getAction(PasteAction.ID);
    bar.setGlobalActionHandler(PasteAction.ID, pasteAction);
    pasteAction.setEnabled(true);
    bar.setGlobalActionHandler(FindReplaceAction.ID, actionManager.getAction(FindReplaceAction.ID));
    bar.setGlobalActionHandler(QueryOpenAction.ID, actionManager.getAction(QueryOpenAction.ID));
    bar.updateActionBars();
}
Also used : ActionManager(com.cubrid.common.ui.spi.action.ActionManager) IAction(org.eclipse.jface.action.IAction) IActionBars(org.eclipse.ui.IActionBars)

Example 15 with IAction

use of org.eclipse.jface.action.IAction in project cubrid-manager by CUBRID.

the class ApplicationActionBarAdvisor method createItem.

/**
	 * Create action contribution item for action for show text and icon
	 *
	 * @param id action ID
	 * @return ActionContributionItem
	 */
private ActionContributionItem createItem(String id) {
    ActionManager manager = ActionManager.getInstance();
    IAction action = manager.getAction(id);
    if (action == null) {
        return null;
    }
    ActionContributionItem item = new ActionContributionItem(action);
    item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
    return item;
}
Also used : ActionManager(com.cubrid.common.ui.spi.action.ActionManager) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) IAction(org.eclipse.jface.action.IAction)

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