public void gotoMarker(Editor editor) { if (buffer == editor.getBuffer() || (file != null && file.equals(editor.getBuffer().getFile()))) { // Marker is in current buffer. editor.addUndo(SimpleEdit.MOVE); editor.unmark(); editor.updateDotLine(); if (pos != null && editor.getBuffer().contains(pos.getLine())) { editor.getDot().moveTo(pos); } else { editor.gotoline(lineNumber); editor.getDot().setOffset(offset); } if (editor.getDotOffset() > editor.getDotLine().length()) editor.getDot().setOffset(editor.getDotLine().length()); editor.moveCaretToDotCol(); editor.updateDotLine(); editor.setUpdateFlag(REFRAME); } else { // Marker is not in current buffer. BufferList buffer_list = Editor.getBufferList(); Buffer buf = null; if (file != null) buf = buffer_list.findBuffer(file); else if (buffer_list.contains(buffer)) buf = buffer; if (buf != null) { editor.makeNext(buf); editor.activate(buf); editor.addUndo(SimpleEdit.MOVE); editor.updateDotLine(); if (pos != null && buf.contains(pos.getLine())) { editor.getDot().moveTo(pos); } else { editor.gotoline(lineNumber); editor.getDot().setOffset(offset); } if (editor.getDotOffset() > editor.getDotLine().length()) editor.getDot().setOffset(editor.getDotLine().length()); editor.moveCaretToDotCol(); editor.updateDotLine(); } else if (file != null) { buf = Buffer.createBuffer(file); editor.makeNext(buf); editor.activate(buf); editor.gotoline(lineNumber); editor.getDot().setOffset(offset); if (editor.getDotOffset() > editor.getDotLine().length()) editor.getDot().setOffset(editor.getDotLine().length()); editor.moveCaretToDotCol(); } else return; } pos = new Position(editor.getDot()); buffer = editor.getBuffer(); }
private void selectToMarker(Editor editor) { if (buffer == editor.getBuffer() || (file != null && file.equals(editor.getBuffer().getFile()))) { // Marker is in current buffer. editor.addUndo(SimpleEdit.MOVE); editor.unmark(); editor.setMarkAtDot(); editor.updateDotLine(); if (pos != null && editor.getBuffer().contains(pos.getLine())) { editor.getDot().moveTo(pos); } else { editor.gotoline(lineNumber); editor.getDot().setOffset(offset); } if (editor.getDotOffset() > editor.getDotLine().length()) editor.getDot().setOffset(editor.getDotLine().length()); editor.moveCaretToDotCol(); editor.updateDotLine(); editor.setUpdateFlag(REFRAME | REPAINT); } else { // Marker is not in current buffer. MessageDialog.showMessageDialog(editor, "Marker is not in this buffer.", "Select To Marker"); } }