public Line.Set getLineSet() { return currentEditorCookie().getLineSet(); }
/** Called when some sort of action is performed on a line. * @param ev the event describing the line */ public void outputLineAction(OutputEvent ev) { cookie.getLineSet().getCurrent(line).show(Line.SHOW_GOTO); }
public Line getLine(EditorCookie editorCookie) { Line.Set lineSet = editorCookie.getLineSet(); int effectiveLineNumber = getLineNumber() <= 0 ? 1 : getLineNumber(); int index = Math.min(effectiveLineNumber, lineSet.getLines().size()) - 1; return lineSet.getCurrent(index); }
private static void attachAllInFile(EditorCookie cook, CompileAnnotation annot) { Set<CompileAnnotation> newSet = null; synchronized (hyperlinks) { newSet = new HashSet<CompileAnnotation>(hyperlinks); } Iterator it = newSet.iterator(); while (it.hasNext()) { CompileAnnotation ann = (CompileAnnotation)it.next(); if (ann.getFile().equals(annot.getFile())) { if (ann.getLine() != -1) { Line l = cook.getLineSet().getOriginal(ann.getLine() - 1); if (! l.isDeleted()) { ann.attachAsNeeded(l); } } } } }
@Override public void run() { try { EditorCookie ed = dob.getLookup().lookup(EditorCookie.class); if (ed != null && /* not true e.g. for *_ja.properties */ file == dob.getPrimaryFile()) { if (lineNum == -1) { // OK, just open it. ed.open(); } else { ed.openDocument();//XXX getLineSet doesn't do it for you try { Line l = ed.getLineSet().getOriginal(lineNum - 1); if (!l.isDeleted()) { l.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS); } } catch (IndexOutOfBoundsException ioobe) { // Probably harmless. Bogus line number. ed.open(); } } } else { java.awt.Toolkit.getDefaultToolkit().beep(); } } catch (Exception ex2) { // XXX see above, should not be necessary to call openDocument // at all } } });
Line.Set lineSet = editorCookie.getLineSet(); int line = doc.getParagraphElement(0).getParentElement().getElementIndex(position); lineObj = lineSet.getCurrent(line);
Line errorLine = null; try { errorLine = editorCookie.getLineSet().getCurrent(line - 1); } catch (IndexOutOfBoundsException iobe) { return;
Line l = ed.getLineSet().getOriginal(lineNum - 1); if (!l.isDeleted()) { if (columnNum != Integer.MIN_VALUE) {
ed.openDocument(); try { Line l = ed.getLineSet().getOriginal(lineNum - 1); if (! l.isDeleted()) { l.show(Line.ShowOpenType.REUSE, Line.ShowVisibilityType.FOCUS);
ed.openDocument(); try { Line l = ed.getLineSet().getOriginal(lineNum - 1); if (! l.isDeleted()) { l.show(Line.SHOW_GOTO);
public static Line getCurrentLine() { EditorCookie e = getCurrentEditorCookie(); if (e == null) return null; JEditorPane ep = getCurrentEditor(e); if (ep == null) return null; StyledDocument d = e.getDocument(); if (d == null) return null; int lineNo = NbDocument.findLineNumber(d, ep.getCaret().getDot()); // Editor numbers lines from 0! Line l = null; try { l = e.getLineSet().getCurrent(lineNo + 1); } catch (IndexOutOfBoundsException x) { // 6494346 } return l; }
Line errorLine = null; try { errorLine = editorCookie.getLineSet().getCurrent(line - 1); } catch (IndexOutOfBoundsException iobe) { return;