Search in sources :

Example 1 with EditorCookie

use of org.openide.cookies.EditorCookie in project enclojure by EricThorsen.

the class ClojureToolTipAnnotation method getShortDescription.

public String getShortDescription() {
    LOG.log(Level.FINEST, "ClojureTooltip: getShortDescription");
    toolTipText = null;
    DebuggerEngine currentEngine = DebuggerManager.getDebuggerManager().getCurrentEngine();
    if (currentEngine == null)
        return null;
    JPDADebugger d = (JPDADebugger) currentEngine.lookupFirst(null, JPDADebugger.class);
    if (d == null)
        return null;
    Line.Part lp = (Line.Part) getAttachedAnnotatable();
    if (lp != null) {
        Line line = lp.getLine();
        DataObject dob = DataEditorSupport.findDataObject(line);
        EditorCookie ec = (EditorCookie) dob.getCookie(EditorCookie.class);
        if (ec != null) {
            // Only for editable dataobjects
            try {
                doc = ec.openDocument();
                RequestProcessor.getDefault().post(this);
            } catch (IOException e) {
            }
        }
    }
    return toolTipText;
}
Also used : DataObject(org.openide.loaders.DataObject) EditorCookie(org.openide.cookies.EditorCookie)

Example 2 with EditorCookie

use of org.openide.cookies.EditorCookie in project enclojure by EricThorsen.

the class GotoDeclaration method performAction.

protected void performAction(Node[] activatedNodes) {
    try {
        EditorCookie editCookie = activatedNodes[0].getLookup().lookup(EditorCookie.class);
        gotoDeclarationFn.invoke();
    } catch (Exception ex) {
        Exceptions.printStackTrace(ex);
    }
}
Also used : EditorCookie(org.openide.cookies.EditorCookie)

Example 3 with EditorCookie

use of org.openide.cookies.EditorCookie in project enclojure by EricThorsen.

the class ToggleComment method performAction.

protected void performAction(Node[] activatedNodes) {
    try {
        EditorCookie editCookie = activatedNodes[0].getLookup().lookup(EditorCookie.class);
        toggleCommentFn.invoke(editCookie);
    } catch (Exception ex) {
        Exceptions.printStackTrace(ex);
    }
}
Also used : EditorCookie(org.openide.cookies.EditorCookie)

Example 4 with EditorCookie

use of org.openide.cookies.EditorCookie in project Universal-G-Code-Sender by winder.

the class EditGcodeFile method getCurrentlyOpenedEditors.

/**
 * Get all the windows in the "Editor" mode, then filter to just editors.
 */
private Collection<TopComponent> getCurrentlyOpenedEditors() {
    final ArrayList<TopComponent> result = new ArrayList<>();
    Collection<TopComponent> comps = TopComponent.getRegistry().getOpened();
    for (TopComponent tc : comps) {
        Node[] arr = tc.getActivatedNodes();
        for (int j = 0; arr != null && j < arr.length; j++) {
            EditorCookie ec = arr[j].getCookie(EditorCookie.class);
            if (ec != null) {
                result.add(tc);
            }
        }
    }
    return result;
}
Also used : Node(org.openide.nodes.Node) EditorCookie(org.openide.cookies.EditorCookie) ArrayList(java.util.ArrayList) TopComponent(org.openide.windows.TopComponent)

Aggregations

EditorCookie (org.openide.cookies.EditorCookie)4 ArrayList (java.util.ArrayList)1 DataObject (org.openide.loaders.DataObject)1 Node (org.openide.nodes.Node)1 TopComponent (org.openide.windows.TopComponent)1