Search in sources :

Example 1 with MMDEditorSupport

use of com.igormaznitsa.nbmindmap.nb.editor.MMDEditorSupport in project netbeans-mmd-plugin by raydac.

the class MMDNavigator method extractDataFromContextAndUpdate.

private void extractDataFromContextAndUpdate() {
    final Lookup.Result<? extends MMDEditorSupport> ctx = this.context;
    if (ctx == null) {
        this.currentSupport = null;
    } else {
        Collection<? extends MMDEditorSupport> clct = ctx.allInstances();
        if (clct.isEmpty()) {
            final TopComponent active = TopComponent.getRegistry().getActivated();
            if (active != null) {
                clct = active.getLookup().lookupAll(MMDEditorSupport.class);
            }
        }
        if (clct.isEmpty()) {
            this.currentSupport = null;
        } else {
            this.currentSupport = clct.iterator().next();
            if (this.currentSupport != null) {
                this.currentSupport.getDataObject().getPrimaryFile().removeFileChangeListener(this);
                this.currentSupport.getDataObject().getPrimaryFile().addFileChangeListener(this);
            }
        }
    }
    updateContent();
}
Also used : MMDEditorSupport(com.igormaznitsa.nbmindmap.nb.editor.MMDEditorSupport) Lookup(org.openide.util.Lookup) TopComponent(org.openide.windows.TopComponent)

Example 2 with MMDEditorSupport

use of com.igormaznitsa.nbmindmap.nb.editor.MMDEditorSupport in project netbeans-mmd-plugin by raydac.

the class MMDNavigator method getDocumentText.

private String getDocumentText() {
    String result = null;
    if (this.currentSupport != null) {
        final MMDEditorSupport editor = this.currentSupport;
        result = editor.getDocumentText();
    }
    return result;
}
Also used : MMDEditorSupport(com.igormaznitsa.nbmindmap.nb.editor.MMDEditorSupport)

Aggregations

MMDEditorSupport (com.igormaznitsa.nbmindmap.nb.editor.MMDEditorSupport)2 Lookup (org.openide.util.Lookup)1 TopComponent (org.openide.windows.TopComponent)1