Search in sources :

Example 1 with IIntroSite

use of org.eclipse.ui.intro.IIntroSite 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 2 with IIntroSite

use of org.eclipse.ui.intro.IIntroSite 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

IIntroSite (org.eclipse.ui.intro.IIntroSite)2 EditorActionBarContributor (org.eclipse.ui.part.EditorActionBarContributor)2