Search in sources :

Example 1 with RetargetTextEditorAction

use of org.eclipse.ui.texteditor.RetargetTextEditorAction in project eclipse.platform.text by eclipse.

the class EncodingActionGroup method fillActionBars.

@Override
public void fillActionBars(IActionBars actionBars) {
    IMenuManager menuManager = actionBars.getMenuManager();
    IMenuManager editMenu = menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
    if (editMenu != null && fRetargetActions.size() > 0) {
        MenuManager subMenu = new MenuManager(TextEditorMessages.Editor_ConvertEncoding_submenu_label);
        subMenu.addMenuListener(new IMenuListener() {

            @Override
            public void menuAboutToShow(IMenuManager manager) {
                update();
            }
        });
        Iterator<RetargetTextEditorAction> e = fRetargetActions.iterator();
        subMenu.add(e.next());
        subMenu.add(new Separator());
        while (e.hasNext()) subMenu.add(e.next());
        editMenu.add(subMenu);
    }
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) RetargetTextEditorAction(org.eclipse.ui.texteditor.RetargetTextEditorAction) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuListener(org.eclipse.jface.action.IMenuListener) Separator(org.eclipse.jface.action.Separator)

Example 2 with RetargetTextEditorAction

use of org.eclipse.ui.texteditor.RetargetTextEditorAction in project eclipse.platform.text by eclipse.

the class EncodingActionGroup method retarget.

/**
 * Retargets this action group to the given editor.
 *
 * @param editor the text editor to which the group should be retargeted
 */
public void retarget(ITextEditor editor) {
    fTextEditor = editor;
    Iterator<RetargetTextEditorAction> e = fRetargetActions.iterator();
    while (e.hasNext()) {
        RetargetTextEditorAction a = e.next();
        a.setAction(editor == null ? null : editor.getAction(a.getId()));
    }
}
Also used : RetargetTextEditorAction(org.eclipse.ui.texteditor.RetargetTextEditorAction)

Example 3 with RetargetTextEditorAction

use of org.eclipse.ui.texteditor.RetargetTextEditorAction in project dbeaver by dbeaver.

the class SQLEditorContributor method createActions.

private void createActions() {
    // Init custom actions
    ResourceBundle bundle = DBeaverActivator.getCoreResourceBundle();
    contentAssistProposal = new RetargetTextEditorAction(bundle, getActionResourcePrefix(ACTION_CONTENT_ASSIST_PROPOSAL));
    contentAssistProposal.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    contentFormatProposal = new RetargetTextEditorAction(bundle, getActionResourcePrefix(ACTION_CONTENT_FORMAT_PROPOSAL));
    contentFormatProposal.setActionDefinitionId(CoreCommands.CMD_CONTENT_FORMAT);
    contentAssistTip = new RetargetTextEditorAction(bundle, getActionResourcePrefix(ACTION_CONTENT_ASSIST_TIP));
    contentAssistTip.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
    contentAssistInformation = new RetargetTextEditorAction(bundle, getActionResourcePrefix(ACTION_CONTENT_ASSIST_INFORMATION));
    contentAssistInformation.setActionDefinitionId(ITextEditorActionDefinitionIds.SHOW_INFORMATION);
}
Also used : RetargetTextEditorAction(org.eclipse.ui.texteditor.RetargetTextEditorAction) ResourceBundle(java.util.ResourceBundle)

Example 4 with RetargetTextEditorAction

use of org.eclipse.ui.texteditor.RetargetTextEditorAction in project dbeaver by serge-rider.

the class SQLEditorContributor method createActions.

private void createActions() {
    // Init custom actions
    ResourceBundle bundle = ResourceBundle.getBundle(SQLEditorMessages.BUNDLE_NAME);
    contentAssistProposal = new RetargetTextEditorAction(bundle, getActionResourcePrefix(ACTION_CONTENT_ASSIST_PROPOSAL));
    contentAssistProposal.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    contentFormatProposal = new RetargetTextEditorAction(bundle, getActionResourcePrefix(ACTION_CONTENT_FORMAT_PROPOSAL));
    contentFormatProposal.setActionDefinitionId(BaseTextEditorCommands.CMD_CONTENT_FORMAT);
    contentAssistTip = new RetargetTextEditorAction(bundle, getActionResourcePrefix(ACTION_CONTENT_ASSIST_TIP));
    contentAssistTip.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
    contentAssistInformation = new RetargetTextEditorAction(bundle, getActionResourcePrefix(ACTION_CONTENT_ASSIST_INFORMATION));
    contentAssistInformation.setActionDefinitionId(ITextEditorActionDefinitionIds.SHOW_INFORMATION);
}
Also used : RetargetTextEditorAction(org.eclipse.ui.texteditor.RetargetTextEditorAction) ResourceBundle(java.util.ResourceBundle)

Aggregations

RetargetTextEditorAction (org.eclipse.ui.texteditor.RetargetTextEditorAction)4 ResourceBundle (java.util.ResourceBundle)2 IMenuListener (org.eclipse.jface.action.IMenuListener)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1 Separator (org.eclipse.jface.action.Separator)1