@Override public void run() { JEditorPane pane = NbDocument.findRecentEditorPane(editorCookie); if(pane != null) { // editor is oen, though we havent found a multiview => open the LH top component openLocalHistoryTC(files); } } };
@Override public void run() { panes[0] = NbDocument.findRecentEditorPane(ec); } });
public static JEditorPane findRecentEditorPaneInEQ(final EditorCookie ec) { assert ec != null; final JEditorPane[] panes = {null}; if (SwingUtilities.isEventDispatchThread()) { panes[0] = NbDocument.findRecentEditorPane(ec); } else { try { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { panes[0] = NbDocument.findRecentEditorPane(ec); } }); } catch (InterruptedException ex) { Exceptions.printStackTrace(ex); } catch (InvocationTargetException ex) { Exceptions.printStackTrace(ex); } } return panes[0]; }
public void run() { JumpList.checkAddEntry(); JEditorPane pane = NbDocument.findRecentEditorPane(ec); boolean opened = true; if (pane == null) { ec.open(); opened = false; JEditorPane[] panes = ec.getOpenedPanes(); pane = panes != null && panes.length > 0? panes[0] : null ; } if (pane != null){ jumpToLine(pane, lineInfo, !opened); } } });
JEditorPane pane = NbDocument.findRecentEditorPane(cookie); boolean hasEditorPanes = false; if(pane == null) { pane = NbDocument.findRecentEditorPane(cookie); if(pane != null) { hasEditorPanes = true;
static boolean canHandle(Node activatedNode) { FileObject fo = getFileObjectFromNode(activatedNode); if (fo != null) { if (!isGroovyFile(fo)) { return false; } EditorCookie ec = activatedNode.getLookup().lookup(EditorCookie.class); if (ec != null) { JEditorPane pane = NbDocument.findRecentEditorPane(ec); if (pane != null) { SingleMethod sm = getTestMethod(pane.getDocument(), pane.getCaret().getDot()); if(sm != null) { return true; } } } } return false; }
/*package*/ static void navigateToOccurrence(boolean next) { final Node[] activatedNodes = TopComponent.getRegistry().getActivatedNodes(); // check whether current file is C/C++ DataObject dobj = activatedNodes[0].getLookup().lookup(DataObject.class); FileObject fo = (dobj == null) ? null : dobj.getPrimaryFile(); String mime = (fo == null) ? "" : fo.getMIMEType(); if (MIMENames.isHeaderOrCppOrC(mime)) { EditorCookie ec = dobj.getLookup().lookup(EditorCookie.class); Document doc = ec.getDocument(); int position = CaretAwareCsmFileTaskFactory.getLastPosition(dobj.getPrimaryFile()); int goTo = findOccurrencePosition(next, doc, position); if (goTo > 0) { JEditorPane pane = NbDocument.findRecentEditorPane(ec); pane.setCaretPosition(goTo); } else { StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(SemanticUtils.class, "cpp-no-marked-occurrence")); } } } }