Search in sources :

Example 1 with DiagramDocumentEditor

use of org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor in project statecharts by Yakindu.

the class IHighlightingSupportAdapterFactory method getAdapter.

@SuppressWarnings("unchecked")
public Object getAdapter(Object adaptableObject, Class adapterType) {
    if (adapterType == IHighlightingSupport.class) {
        if (adaptableObject instanceof DiagramDocumentEditor) {
            IHighlightingSupport supportFromCache = cache.get((DiagramDocumentEditor) adaptableObject);
            if (supportFromCache != null)
                return supportFromCache;
            supportFromCache = new HighlightingSupportAdapter((DiagramDocumentEditor) adaptableObject);
            cache.put((DiagramDocumentEditor) adaptableObject, supportFromCache);
            return supportFromCache;
        }
    }
    return null;
}
Also used : IHighlightingSupport(org.yakindu.base.gmf.runtime.highlighting.IHighlightingSupport) HighlightingSupportAdapter(org.yakindu.base.gmf.runtime.highlighting.HighlightingSupportAdapter) DiagramDocumentEditor(org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor)

Example 2 with DiagramDocumentEditor

use of org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor in project statecharts by Yakindu.

the class NavigatorLinkHelper method findSelection.

public IStructuredSelection findSelection(IEditorInput anInput) {
    IEditorPart activeEditor = ActiveEditorTracker.getLastActiveEditor();
    if (activeEditor instanceof DiagramDocumentEditor) {
        Diagram diagram = ((DiagramDocumentEditor) activeEditor).getDiagram();
        IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
        if (file != null) {
            DomainNavigatorItem item = new DomainNavigatorItem(diagram, file, myAdapterFctoryContentProvier);
            return new StructuredSelection(item);
        }
    }
    return StructuredSelection.EMPTY;
}
Also used : IFile(org.eclipse.core.resources.IFile) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IEditorPart(org.eclipse.ui.IEditorPart) DiagramDocumentEditor(org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor) Diagram(org.eclipse.gmf.runtime.notation.Diagram)

Example 3 with DiagramDocumentEditor

use of org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor in project statecharts by Yakindu.

the class UIUtils method getActiveEditor.

public static DiagramDocumentEditor getActiveEditor() {
    final IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    final IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
    if (workbenchPage != null) {
        final IEditorPart editor = workbenchPage.getActiveEditor();
        if (editor instanceof DiagramDocumentEditor) {
            return (DiagramDocumentEditor) editor;
        }
    }
    return null;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) DiagramDocumentEditor(org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor)

Aggregations

DiagramDocumentEditor (org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor)3 IEditorPart (org.eclipse.ui.IEditorPart)2 IFile (org.eclipse.core.resources.IFile)1 Diagram (org.eclipse.gmf.runtime.notation.Diagram)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 HighlightingSupportAdapter (org.yakindu.base.gmf.runtime.highlighting.HighlightingSupportAdapter)1 IHighlightingSupport (org.yakindu.base.gmf.runtime.highlighting.IHighlightingSupport)1