Search in sources :

Example 56 with IActionBars

use of org.eclipse.ui.IActionBars in project eclipse.platform.text by eclipse.

the class BasicTextEditorActionContributor method doSetActiveEditor.

/**
 * The method installs the global action handlers for the given text editor.
 * <p>
 * This method cannot be overridden by subclasses.</p>
 *
 * @param part the active editor part
 * @since 2.0
 */
private void doSetActiveEditor(IEditorPart part) {
    if (fActiveEditorPart == part)
        return;
    if (fActiveEditorPart instanceof ITextEditorExtension) {
        ITextEditorExtension extension = (ITextEditorExtension) fActiveEditorPart;
        for (int i = 0; i < STATUS_FIELD_DEFS.length; i++) extension.setStatusField(null, STATUS_FIELD_DEFS[i].category);
    }
    fActiveEditorPart = part;
    ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
    IActionBars actionBars = getActionBars();
    for (int i = 0; i < ACTIONS.length; i++) actionBars.setGlobalActionHandler(ACTIONS[i], getAction(editor, ACTIONS[i]));
    actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.SHOW_WHITESPACE_CHARACTERS, getAction(editor, ITextEditorActionConstants.SHOW_WHITESPACE_CHARACTERS));
    actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.BLOCK_SELECTION_MODE, getAction(editor, ITextEditorActionConstants.BLOCK_SELECTION_MODE));
    if (editor instanceof AbstractTextEditor && ((AbstractTextEditor) editor).isWordWrapSupported())
        actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.WORD_WRAP, getAction(editor, ITextEditorActionConstants.WORD_WRAP));
    fFindNext.setAction(getAction(editor, ITextEditorActionConstants.FIND_NEXT));
    fFindPrevious.setAction(getAction(editor, ITextEditorActionConstants.FIND_PREVIOUS));
    fIncrementalFind.setAction(getAction(editor, ITextEditorActionConstants.FIND_INCREMENTAL));
    fIncrementalFindReverse.setAction(getAction(editor, ITextEditorActionConstants.FIND_INCREMENTAL_REVERSE));
    fGotoLine.setAction(getAction(editor, ITextEditorActionConstants.GOTO_LINE));
    fHippieCompletion.setAction(getAction(editor, ITextEditorActionConstants.HIPPIE_COMPLETION));
    for (int i = 0; i < STATUS_FIELD_DEFS.length; i++) {
        if (fActiveEditorPart instanceof ITextEditorExtension) {
            StatusLineContributionItem statusField = fStatusFields.get(STATUS_FIELD_DEFS[i]);
            statusField.setActionHandler(getAction(editor, STATUS_FIELD_DEFS[i].actionId));
            ITextEditorExtension extension = (ITextEditorExtension) fActiveEditorPart;
            extension.setStatusField(statusField, STATUS_FIELD_DEFS[i].category);
        }
    }
}
Also used : IActionBars(org.eclipse.ui.IActionBars)

Example 57 with IActionBars

use of org.eclipse.ui.IActionBars in project eclipse.platform.text by eclipse.

the class AbstractTemplatesPage method setupActions.

/**
 * Setup the menu, context menu and toolbar actions.
 */
private void setupActions() {
    createActions();
    IActionBars actionBars = getSite().getActionBars();
    actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), fPasteAction);
    fPasteAction.setActionDefinitionId(ActionFactory.PASTE.getCommandId());
    fPasteAction.setText(TemplatesMessages.TemplatesPage_paste);
    actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), fCopyAction);
    fCopyAction.setActionDefinitionId(ActionFactory.COPY.getCommandId());
    fCopyAction.setText(TemplatesMessages.TemplatesPage_copy);
    fillToolbar(actionBars);
    fillMenu(actionBars);
}
Also used : IActionBars(org.eclipse.ui.IActionBars)

Example 58 with IActionBars

use of org.eclipse.ui.IActionBars in project eclipse.platform.text by eclipse.

the class AbstractTextSearchViewPage method fillToolbar.

/**
 * Fills the toolbar contribution for this page. Subclasses may override
 * this method.
 *
 * @param tbm the tool bar manager representing the view's toolbar
 */
protected void fillToolbar(IToolBarManager tbm) {
    tbm.appendToGroup(IContextMenuConstants.GROUP_SHOW, fShowNextAction);
    tbm.appendToGroup(IContextMenuConstants.GROUP_SHOW, fShowPreviousAction);
    tbm.appendToGroup(IContextMenuConstants.GROUP_REMOVE_MATCHES, fRemoveSelectedMatches);
    tbm.appendToGroup(IContextMenuConstants.GROUP_REMOVE_MATCHES, fRemoveAllResultsAction);
    IActionBars actionBars = getSite().getActionBars();
    if (actionBars != null) {
        actionBars.setGlobalActionHandler(ActionFactory.NEXT.getId(), fShowNextAction);
        actionBars.setGlobalActionHandler(ActionFactory.PREVIOUS.getId(), fShowPreviousAction);
        actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), fRemoveSelectedMatches);
        actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), fCopyToClipboardAction);
        actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), fSelectAllAction);
    }
    if (getLayout() == FLAG_LAYOUT_TREE) {
        tbm.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, fExpandAllAction);
        tbm.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, fCollapseAllAction);
    }
}
Also used : IActionBars(org.eclipse.ui.IActionBars)

Example 59 with IActionBars

use of org.eclipse.ui.IActionBars in project eclipse.platform.text by eclipse.

the class SearchView method initPage.

@Override
protected void initPage(IPageBookViewPage page) {
    super.initPage(page);
    IActionBars actionBars = page.getSite().getActionBars();
    actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), fSearchAgainAction);
    actionBars.updateActionBars();
    fUndoRedoActionGroup.fillActionBars(actionBars);
    ISearchResultPage srPage = (ISearchResultPage) page;
    IMemento memento = null;
    if (fPageState != null) {
        IMemento[] mementos = fPageState.getChildren(MEMENTO_TYPE);
        for (IMemento memento2 : mementos) {
            if (memento2.getID().equals(srPage.getID())) {
                memento = memento2;
                break;
            }
        }
    }
    srPage.restoreState(memento);
}
Also used : ISearchResultPage(org.eclipse.search.ui.ISearchResultPage) IActionBars(org.eclipse.ui.IActionBars) IMemento(org.eclipse.ui.IMemento)

Example 60 with IActionBars

use of org.eclipse.ui.IActionBars in project linuxtools by eclipse.

the class RunConsolePageParticipant method init.

@Override
public void init(IPageBookViewPage page, IConsole console) {
    fPage = page;
    fConsole = (RunConsole) console;
    fRemove = new RunConsoleRemove(fConsole);
    // TODO Auto-generated method stub
    // contribute to toolbar
    IActionBars actionBars = fPage.getSite().getActionBars();
    configureToolBar(actionBars.getToolBarManager());
}
Also used : IActionBars(org.eclipse.ui.IActionBars)

Aggregations

IActionBars (org.eclipse.ui.IActionBars)65 IToolBarManager (org.eclipse.jface.action.IToolBarManager)21 Action (org.eclipse.jface.action.Action)19 IMenuManager (org.eclipse.jface.action.IMenuManager)8 RecordAction (com.cubrid.cubridmanager.ui.monitoring.editor.internal.RecordAction)6 IAction (org.eclipse.jface.action.IAction)6 Separator (org.eclipse.jface.action.Separator)6 TableLayout (org.eclipse.jface.viewers.TableLayout)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 ActionManager (com.cubrid.common.ui.spi.action.ActionManager)2 ApplyServerInfo (com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo)2 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)2 BrokerStatusSettingDlg (com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerStatusSettingDlg)2 ArrayList (java.util.ArrayList)2 MenuManager (org.eclipse.jface.action.MenuManager)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 Menu (org.eclipse.swt.widgets.Menu)2 Tree (org.eclipse.swt.widgets.Tree)2 CopyAction (org.talend.designer.runtime.visualization.internal.actions.CopyAction)2 HttpClient (aQute.bnd.http.HttpClient)1