/** Returns a set of line objects sorted by their * line numbers. This immutable list will contains all lines held by this * line set. * * @return list of element type {@link Line} */ public List<? extends Line> getLines() { if (delegate != null) { return delegate.getLines(); } // PENDING return new ArrayList<Line>(); }
/** Returns a set of line objects sorted by their * line numbers. This immutable list will contains all lines held by this * line set. * * @return list of element type {@link Line} */ public java.util.List getLines () { if (delegate != null) { return delegate.getLines(); } // PENDING return new java.util.ArrayList (); }
/** Returns a set of line objects sorted by their * line numbers. This immutable list will contains all lines held by this * line set. * * @return list of element type {@link Line} */ public java.util.List getLines () { if (delegate != null) { return delegate.getLines(); } // PENDING return new java.util.ArrayList (); }
if (lc != null) { Line.Set ls = lc.getLineSet(); for (Line line : ls.getLines()) { if (line.getText().contains(name + "=")) { return line;
return lineCookie.getLineSet().getCurrent(lineNumber); } catch (IndexOutOfBoundsException ioob) { List<? extends Line> lines = lineCookie.getLineSet().getLines(); if (lines.size() > 0) { return lines.get(lines.size() - 1);
@Override public void setLineNumber(int lineNumber) { lineNumber--; // Line works with 0-based lines. if (line.getLineNumber() == lineNumber) { return ; } LineCookie lineCookie = line.getLookup().lookup(LineCookie.class); Line.Set lineSet = lineCookie.getLineSet(); List<? extends Line> lines = lineSet.getLines(); if (lines.size() > 0) { int lastLineNumber = lines.get(lines.size() - 1).getLineNumber(); if (lineNumber > lastLineNumber) { lineNumber = lastLineNumber; } } Line cline; try { cline = lineSet.getCurrent(lineNumber); } catch (IndexOutOfBoundsException ioobex) { cline = lineSet.getCurrent(0); } setLine(cline); }
public static Line getLine(final FileObject fileObject, final int lineNumber) { if (fileObject != null) { LineCookie lineCookie = JSUtils.getLineCookie(fileObject); if (lineCookie != null) { Line.Set ls = lineCookie.getLineSet(); if (ls != null) { try { return ls.getCurrent(lineNumber - 1); } catch (IndexOutOfBoundsException ioob) { List<? extends Line> lines = ls.getLines(); if (lines.size() > 0) { return lines.get(lines.size() - 1); } else { return null; } } } } } return null; }
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); }
@Override public void run() { javax.swing.JEditorPane[] panes = support.getOpenedPanes(); if (panes != null) { if (lineNumber >= 0 && lineNumber < support.getLineSet().getLines().size()) { support.getLineSet().getCurrent(lineNumber).show(Line.ShowOpenType.NONE, Line.ShowVisibilityType.FRONT); } org.netbeans.modules.mercurial.ui.annotate.AnnotateAction.showAnnotations(panes[0], originalFile, revision.getRevisionNumber()); } } });
private boolean isFileOpen(FileObject fileObject) throws DataObjectNotFoundException { DataObject dataObject = DataObject.find(fileObject); Lookup lookup = dataObject.getLookup(); LineCookie lineCookie = lookup.lookup(LineCookie.class); Line.Set lineSet = lineCookie.getLineSet(); return !lineSet.getLines().isEmpty(); }