Search in sources :

Example 1 with IHighlightingSupport

use of org.yakindu.base.gmf.runtime.highlighting.IHighlightingSupport 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 IHighlightingSupport

use of org.yakindu.base.gmf.runtime.highlighting.IHighlightingSupport in project statecharts by Yakindu.

the class SCTSourceDisplay method displaySource.

public void displaySource(IEditorPart editor) {
    IDynamicNotationHandler notationHandler = handler.get(editor);
    IHighlightingSupport support = (IHighlightingSupport) editor.getAdapter(IHighlightingSupport.class);
    if (support == null)
        return;
    if (notationHandler == null) {
        notationHandler = new DefaultDynamicNotationHandler();
        handler.put(editor, notationHandler);
    } else {
        notationHandler.setHighlightingSupport(new IHighlightingSupport.HighlightingSupportNullImpl());
    }
    if (support.isLocked()) {
        support.releaseEditor();
    }
    support.lockEditor();
    notationHandler.setHighlightingSupport(support);
    notationHandler.display(container.getExecutionContext());
}
Also used : IHighlightingSupport(org.yakindu.base.gmf.runtime.highlighting.IHighlightingSupport)

Aggregations

IHighlightingSupport (org.yakindu.base.gmf.runtime.highlighting.IHighlightingSupport)2 DiagramDocumentEditor (org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor)1 HighlightingSupportAdapter (org.yakindu.base.gmf.runtime.highlighting.HighlightingSupportAdapter)1