public void follow(File sourceFile, Line sourceLine) { Line line = findLineForOccurrence(sourceFile, sourceLine); if (line == null) return; for (EditorIterator it = new EditorIterator(); it.hasNext(); ) { Editor ed = it.next(); if (ed.getBuffer() == this) { ed.moveDotTo(line, 0); ed.updateDisplay(); } } }
// Move dot to line (in all editors) and call findOccurrenceAtDot(). private void findOccurrence(Editor editor, Line line) { if (line instanceof OccurrenceLine) { for (EditorIterator it = new EditorIterator(); it.hasNext(); ) { Editor ed = it.next(); if (ed.getBuffer() == this) { ed.moveDotTo(line, 0); ed.updateDisplay(); } } findOccurrenceAtDot(editor, false); } }