Refine search
public void run () { int definitionOffset = definition.getOffset (); try { DataObject dobj = DataObject.find (fo); EditorCookie ec = dobj.getCookie (EditorCookie.class); StyledDocument doc2 = ec.openDocument (); LineCookie lc = dobj.getCookie (LineCookie.class); Line.Set lineSet = lc.getLineSet (); Line line = lineSet.getCurrent (NbDocument.findLineNumber (doc2, definitionOffset)); int column = NbDocument.findLineColumn (doc2, definitionOffset); line.show (ShowOpenType.OPEN, ShowVisibilityType.FOCUS, column); } catch (IOException ex) { ex.printStackTrace (); } } };
@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 } } });
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(); }
DataObject dob = DataObject.find(file); EditorCookie ed = dob.getCookie(EditorCookie.class); if (ed != null && file == dob.getPrimaryFile()) { if (lineNum == -1) { ed.open(); ed.openDocument(); try { Line l = ed.getLineSet().getOriginal(lineNum - 1); if (! l.isDeleted()) { l.show(Line.SHOW_GOTO);
private void showLine(boolean openTab) { try { DataObject dob = DataObject.find(file); LineCookie lc = dob.getLookup().lookup(LineCookie.class); if (lc != null) { try { Line l = lc.getLineSet().getOriginal(line); if (!l.isDeleted()) { if (openTab) { l.show(Line.ShowOpenType.OPEN, Line.ShowVisibilityType.FOCUS); } else { l.show(Line.ShowOpenType.NONE, Line.ShowVisibilityType.NONE); if (dob.isValid()) { EditorCookie ec = dob.getLookup().lookup(EditorCookie.class); if (ec != null) {
EditorCookie editorCookie = DataObject.find(sourceFile).getCookie(EditorCookie.class); if (editorCookie != null) { lineObj = lineSet.getCurrent(line); Toolkit.getDefaultToolkit().beep(); } else { lineObj.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS);
DataObject dob = DataObject.find(fob); Lookup dobLookup = dob.getLookup(); EditorCookie ec = dobLookup.lookup(EditorCookie.class); LineCookie lc = dobLookup.lookup(LineCookie.class); int column = offset ? columnNo - NbDocument.findLineOffset(doc, line) : columnNo; if (line != -1) { Line l = lc.getLineSet().getCurrent(line); if (l != null) { l.show(Line.ShowOpenType.OPEN, Line.ShowVisibilityType.FOCUS, column); return true;
@Override public FileObject getFileObject() { if (line instanceof FutureLine) { URL url = getURL(); FileObject fo = URLMapper.findFileObject(url); if (fo != null) { try { DataObject dobj = DataObject.find(fo); LineCookie lineCookie = dobj.getLookup().lookup(LineCookie.class); if (lineCookie == null) { return null; } Line l = lineCookie.getLineSet().getCurrent(getLineNumber() - 1); setLine(l); } catch (DataObjectNotFoundException ex) { } } return fo; } else { return line.getLookup().lookup(FileObject.class); } }
DataObject dobj = DataObject.find(props); EditorCookie ec = dobj.getLookup().lookup(EditorCookie.class); try { ec.openDocument(); Exceptions.printStackTrace(ex); LineCookie lc = dobj.getLookup().lookup(LineCookie.class); if (lc != null) { Line.Set ls = lc.getLineSet(); for (Line line : ls.getLines()) { if (line.getText().contains(name + "=")) { return line;
DataObject dataObject; try { dataObject = DataObject.find(fo); } catch (DataObjectNotFoundException donfex) { donfex.printStackTrace(); return ; LineCookie lc = dataObject.getCookie(LineCookie.class); if (lc == null) return; List<DebuggerBreakpointAnnotation> annotations = new ArrayList<DebuggerBreakpointAnnotation>(); for (int l : lines) { try { Line line = lc.getLineSet().getCurrent(l - 1); DebuggerBreakpointAnnotation annotation = new DebuggerBreakpointAnnotation (annotationType, line, b); annotations.add(annotation);
String text = l.getText(); if (text.trim().length() == 0 && text.indexOf('\n') >= 0) { line.removePropertyChangeListener(this); if (dataObject == null) { return ; LineCookie lc = dobj.getLookup().lookup (LineCookie.class); Line newLine; try { int lineNumber = l.getLineNumber(); int newLineNumber = lc.getLineSet().getOriginal(lineNumber).getLineNumber(); for (int i = lineNumber + 1; i < newLineNumber; i++) { if (lc.getLineSet().getCurrent(i).getText().trim().length() != 0) { newLineNumber = i; break; newLine = lc.getLineSet().getCurrent(newLineNumber); LineCookie lc = dobj.getLookup().lookup (LineCookie.class); newLine = lc.getLineSet().getCurrent(lb.getLineNumber() - 1); newLine = lc.getLineSet().getCurrent(lb.getLineNumber() - 1);
private static boolean openFileAtOffset(DataObject dataObject, int offset) throws IOException { EditorCookie ec = dataObject.getCookie(EditorCookie.class); LineCookie lc = dataObject.getCookie(LineCookie.class); if (ec != null && lc != null) { StyledDocument doc = ec.openDocument(); if (doc != null) { int lineNumber = NbDocument.findLineNumber(doc, offset); if (lineNumber != -1) { Line line = lc.getLineSet().getCurrent(lineNumber); if (line != null) { int lineOffset = NbDocument.findLineOffset(doc, lineNumber); int column = offset - lineOffset; line.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS, column); return true; } } } } return false; }
dobj = this.dataObject; LineCookie lc = dobj.getLookup().lookup (LineCookie.class); if (lc == null) { return ; final Line lineNew = lc.getLineSet().getCurrent(lb.getLineNumber() - 1); synchronized (this) { if (line != null) { line.removePropertyChangeListener(this); lineNew.addPropertyChangeListener(this); StyledDocument document = NbDocument.getDocument(new Lookup.Provider() { @Override
boolean haveDocL = line != null; try { line = lc.getLineSet().getCurrent(lb.getLineNumber() - 1); if (!haveDocL) { line.addPropertyChangeListener(this); line.removePropertyChangeListener(this); line = null; line.removePropertyChangeListener(this); this.lc = dataObject.getCookie (LineCookie.class); try { this.line = lc.getLineSet().getCurrent(lb.getLineNumber() - 1); line.addPropertyChangeListener(this); } catch (IndexOutOfBoundsException ioobex) {
public synchronized void attach() throws IOException { this.lc = dataObject.getCookie (LineCookie.class); if (lc == null) return ; lb.addPropertyChangeListener(this); try { this.line = lc.getLineSet().getCurrent(lb.getLineNumber() - 1); line.addPropertyChangeListener(this); } catch (IndexOutOfBoundsException ioobex) { // ignore document changes for BP with bad line number } }
public @Override void run() { lineCookie.getLineSet().getCurrent(line.get() - 1).show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS); } });
LineCookie lc = dao.getCookie(LineCookie.class); if (lc == null) { Line.Set ls = lc.getLineSet(); if (ls == null) { Line l = ls.getCurrent(lineNumber-1); if (l != null) { return l;
/** 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); }
@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); }
Line l = ed.getLineSet().getOriginal(lineNum - 1); if (!l.isDeleted()) { if (columnNum != Integer.MIN_VALUE) { l.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS, columnNum); } else { l.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS);