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);
}
}
}
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);
}
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);
}
}
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);
}
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());
}
Aggregations