Search in sources :

Example 1 with DiagramContentOutlinePage

use of org.jboss.tools.hibernate.ui.diagram.editors.DiagramContentOutlinePage in project jbosstools-hibernate by jbosstools.

the class DiagramBaseAction method getDiagramViewer.

protected DiagramViewer getDiagramViewer() {
    DiagramViewer res = editor;
    final IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (workbenchWindow == null) {
        return res;
    }
    final IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
    if (workbenchPage == null) {
        return res;
    }
    IWorkbenchPart part = workbenchPage.getActivePart();
    if (part instanceof DiagramViewer) {
        res = (DiagramViewer) part;
    } else if (part instanceof ContentOutline) {
        ContentOutline co = (ContentOutline) part;
        if (co.getCurrentPage() instanceof DiagramContentOutlinePage) {
            DiagramContentOutlinePage dcop = (DiagramContentOutlinePage) co.getCurrentPage();
            res = dcop.getEditor();
        }
    }
    return res;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) ContentOutline(org.eclipse.ui.views.contentoutline.ContentOutline) DiagramViewer(org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer) DiagramContentOutlinePage(org.jboss.tools.hibernate.ui.diagram.editors.DiagramContentOutlinePage)

Aggregations

IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 ContentOutline (org.eclipse.ui.views.contentoutline.ContentOutline)1 DiagramContentOutlinePage (org.jboss.tools.hibernate.ui.diagram.editors.DiagramContentOutlinePage)1 DiagramViewer (org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer)1