Search in sources :

Example 1 with EditorActionBarContributor

use of org.eclipse.ui.part.EditorActionBarContributor 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;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorActionBarContributor(org.eclipse.ui.IEditorActionBarContributor) EditorActionBarContributor(org.eclipse.ui.part.EditorActionBarContributor) IEditorPart(org.eclipse.ui.IEditorPart) IEditorActionBarContributor(org.eclipse.ui.IEditorActionBarContributor)

Example 2 with EditorActionBarContributor

use of org.eclipse.ui.part.EditorActionBarContributor in project dbeaver by serge-rider.

the class ActionBars method extractActionBars.

public static IActionBars extractActionBars(IWorkbenchSite site) {
    if (site == null) {
        return null;
    }
    IWorkbenchPage page = site.getPage();
    IWorkbenchPart activePart = page.getActivePart();
    if (activePart instanceof IViewPart) {
        IViewPart activeViewPart = (IViewPart) activePart;
        IViewSite activeViewSite = activeViewPart.getViewSite();
        return activeViewSite.getActionBars();
    }
    if (activePart instanceof IEditorPart) {
        IEditorPart activeEditorPart = (IEditorPart) activePart;
        IEditorActionBarContributor contributor = activeEditorPart.getEditorSite().getActionBarContributor();
        if (contributor instanceof EditorActionBarContributor) {
            return ((EditorActionBarContributor) contributor).getActionBars();
        }
    }
    if (site instanceof IViewSite) {
        IViewSite viewSite = (IViewSite) site;
        return viewSite.getActionBars();
    }
    if (site instanceof IEditorSite) {
        IEditorSite editorSite = (IEditorSite) site;
        return editorSite.getActionBars();
    }
    if (site instanceof IIntroSite) {
        IIntroSite introSite = (IIntroSite) site;
        return introSite.getActionBars();
    }
    // OMG, what is it?
    return null;
}
Also used : EditorActionBarContributor(org.eclipse.ui.part.EditorActionBarContributor) IIntroSite(org.eclipse.ui.intro.IIntroSite)

Example 3 with EditorActionBarContributor

use of org.eclipse.ui.part.EditorActionBarContributor in project webtools.sourceediting by eclipse.

the class AbstractSection method getStatusLineManager.

protected static IStatusLineManager getStatusLineManager(IEditorPart editorPart) {
    IStatusLineManager result = null;
    try {
        EditorActionBarContributor contributor = (EditorActionBarContributor) editorPart.getEditorSite().getActionBarContributor();
        result = contributor.getActionBars().getStatusLineManager();
    } catch (Exception e) {
    }
    return result;
}
Also used : IStatusLineManager(org.eclipse.jface.action.IStatusLineManager) EditorActionBarContributor(org.eclipse.ui.part.EditorActionBarContributor)

Example 4 with EditorActionBarContributor

use of org.eclipse.ui.part.EditorActionBarContributor in project core by jcryptool.

the class HexEditor method getStatusLineManager.

/**
 * Returns the status line manager of this editor.
 * @return the status line manager of this editor
 */
private IStatusLineManager getStatusLineManager() {
    IEditorActionBarContributor contributor = getEditorSite().getActionBarContributor();
    if (!(contributor instanceof EditorActionBarContributor))
        return null;
    IActionBars actionBars = ((EditorActionBarContributor) contributor).getActionBars();
    if (actionBars == null)
        return null;
    return actionBars.getStatusLineManager();
}
Also used : IEditorActionBarContributor(org.eclipse.ui.IEditorActionBarContributor) EditorActionBarContributor(org.eclipse.ui.part.EditorActionBarContributor) IEditorActionBarContributor(org.eclipse.ui.IEditorActionBarContributor) IActionBars(org.eclipse.ui.IActionBars)

Example 5 with EditorActionBarContributor

use of org.eclipse.ui.part.EditorActionBarContributor in project dbeaver by dbeaver.

the class ActionBars method extractActionBars.

public static IActionBars extractActionBars(IWorkbenchSite site) {
    if (site == null) {
        return null;
    }
    IWorkbenchPage page = site.getPage();
    IWorkbenchPart activePart = page.getActivePart();
    if (activePart instanceof IViewPart) {
        IViewPart activeViewPart = (IViewPart) activePart;
        IViewSite activeViewSite = activeViewPart.getViewSite();
        return activeViewSite.getActionBars();
    }
    if (activePart instanceof IEditorPart) {
        IEditorPart activeEditorPart = (IEditorPart) activePart;
        IEditorActionBarContributor contributor = activeEditorPart.getEditorSite().getActionBarContributor();
        if (contributor instanceof EditorActionBarContributor) {
            return ((EditorActionBarContributor) contributor).getActionBars();
        }
    }
    if (site instanceof IViewSite) {
        IViewSite viewSite = (IViewSite) site;
        return viewSite.getActionBars();
    }
    if (site instanceof IEditorSite) {
        IEditorSite editorSite = (IEditorSite) site;
        return editorSite.getActionBars();
    }
    if (site instanceof IIntroSite) {
        IIntroSite introSite = (IIntroSite) site;
        return introSite.getActionBars();
    }
    // OMG, what is it?
    return null;
}
Also used : EditorActionBarContributor(org.eclipse.ui.part.EditorActionBarContributor) IIntroSite(org.eclipse.ui.intro.IIntroSite)

Aggregations

EditorActionBarContributor (org.eclipse.ui.part.EditorActionBarContributor)5 IEditorActionBarContributor (org.eclipse.ui.IEditorActionBarContributor)2 IIntroSite (org.eclipse.ui.intro.IIntroSite)2 IStatusLineManager (org.eclipse.jface.action.IStatusLineManager)1 IActionBars (org.eclipse.ui.IActionBars)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1