use of org.eclipse.ui.IEditorActionBarContributor in project webtools.sourceediting by eclipse.
the class GotoAnnotationAction method getStatusLineManager.
private IStatusLineManager getStatusLineManager() {
// The original JavaEditor M7 implementation made use of an adapter,
// but that approach
// fails with a MultiPageEditorSite
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null)
return null;
IWorkbenchPage page = window.getActivePage();
if (page == null)
return null;
IEditorPart editor = page.getActiveEditor();
if (editor == null)
return null;
IEditorActionBarContributor contributor = editor.getEditorSite().getActionBarContributor();
if (contributor instanceof EditorActionBarContributor) {
return ((EditorActionBarContributor) contributor).getActionBars().getStatusLineManager();
}
return null;
}
use of org.eclipse.ui.IEditorActionBarContributor in project webtools.sourceediting by eclipse.
the class StructuredTextEditor method addExtendedContextMenuActions.
private void addExtendedContextMenuActions(IMenuManager menu) {
IEditorActionBarContributor c = getEditorSite().getActionBarContributor();
if (c instanceof IPopupMenuContributor) {
((IPopupMenuContributor) c).contributeToPopupMenu(menu);
} else {
ExtendedEditorActionBuilder builder = new ExtendedEditorActionBuilder();
IExtendedContributor pmc = builder.readActionExtensions(getConfigurationPoints());
if (pmc != null) {
pmc.setActiveEditor(this);
pmc.contributeToPopupMenu(menu);
}
}
}
use of org.eclipse.ui.IEditorActionBarContributor in project webtools.sourceediting by eclipse.
the class XMLMultiPageEditorPart method createPages.
/**
* Creates the pages of this multi-page editor.
* <p>
* Subclasses of <code>MultiPageEditor</code> must implement this method.
* </p>
*/
protected void createPages() {
try {
// source page MUST be created before design page, now
createSourcePage();
createAndAddDesignPage();
addSourcePage();
connectDesignPage();
// set the active editor in the action bar contributor first
// before setactivepage calls action bar contributor's
// setactivepage (bug141013 - remove when bug151488 is fixed)
IEditorActionBarContributor contributor = getEditorSite().getActionBarContributor();
if (contributor instanceof MultiPageEditorActionBarContributor) {
((MultiPageEditorActionBarContributor) contributor).setActiveEditor(this);
}
// $NON-NLS-1$;
int activePageIndex = getPreferenceStore().getInt(getEditorSite().getId() + "." + IXMLPreferenceNames.LAST_ACTIVE_PAGE);
if ((activePageIndex >= 0) && (activePageIndex < getPageCount())) {
setActivePage(activePageIndex);
} else {
setActivePage(fSourcePageIndex);
}
} catch (PartInitException e) {
Logger.logException(e);
throw new RuntimeException(e);
}
}
use of org.eclipse.ui.IEditorActionBarContributor in project eclipse-integration-commons by spring-projects.
the class EditorToolkit method getContributor.
protected ActionContributorProxy getContributor() {
if (contributor == null) {
IEditorActionBarContributor editorContributor = editorSite.getActionBarContributor();
if (editorContributor instanceof StsTaskEditorActionContributor) {
final StsTaskEditorActionContributor actionContributor = (StsTaskEditorActionContributor) editorContributor;
contributor = new ActionContributorProxy() {
@Override
public void contextMenuAboutToShow(IMenuManager manager, boolean addClipboard) {
actionContributor.contextMenuAboutToShow(manager, addClipboard);
}
@Override
public void forceActionsEnabled() {
actionContributor.forceActionsEnabled();
}
@Override
public ISelectionChangedListener getSelectionChangedListener() {
return actionContributor;
}
@Override
public void updateSelectableActions(ISelection selection) {
actionContributor.updateSelectableActions(selection);
}
};
} else if (editorContributor instanceof TaskEditorActionContributor) {
final TaskEditorActionContributor actionContributor = (TaskEditorActionContributor) editorContributor;
contributor = new ActionContributorProxy() {
@Override
public void contextMenuAboutToShow(IMenuManager manager, boolean addClipboard) {
actionContributor.contextMenuAboutToShow(manager, addClipboard);
}
@Override
public void forceActionsEnabled() {
actionContributor.forceActionsEnabled();
}
@Override
public ISelectionChangedListener getSelectionChangedListener() {
return actionContributor;
}
@Override
public void updateSelectableActions(ISelection selection) {
actionContributor.updateSelectableActions(selection);
}
};
} else {
contributor = new ActionContributorProxy();
}
}
return contributor;
}
use of org.eclipse.ui.IEditorActionBarContributor in project webtools.sourceediting by eclipse.
the class DebugTextEditor method editorContextMenuAboutToShow.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.texteditor.AbstractTextEditor#editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
*/
protected void editorContextMenuAboutToShow(IMenuManager menu) {
super.editorContextMenuAboutToShow(menu);
IEditorActionBarContributor c = getEditorSite().getActionBarContributor();
if (c instanceof IPopupMenuContributor) {
((IPopupMenuContributor) c).contributeToPopupMenu(menu);
} else {
ExtendedEditorActionBuilder builder = new ExtendedEditorActionBuilder();
IExtendedContributor pmc = builder.readActionExtensions(getConfigurationPoints());
if (pmc != null) {
pmc.setActiveEditor(this);
pmc.contributeToPopupMenu(menu);
}
}
}
Aggregations