01: /*
02: * XmlErrorBuffer.java
03: *
04: * Copyright (C) 2003 Peter Graves
05: * $Id: XmlErrorBuffer.java,v 1.4 2003/06/18 23:36:46 piso Exp $
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * as published by the Free Software Foundation; either version 2
10: * of the License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20: */
21:
22: package org.armedbear.j;
23:
24: public final class XmlErrorBuffer extends CompilationErrorBuffer {
25: private File file;
26:
27: public XmlErrorBuffer(File file, String text) {
28: super ();
29: this .file = file;
30: setText(text);
31: }
32:
33: public void recycle(File file, String text) {
34: if (!Editor.getBufferList().contains(this ))
35: relink();
36: empty();
37: setCurrentError(null);
38: this .file = file;
39: setText(text);
40: for (EditorIterator it = new EditorIterator(); it.hasNext();) {
41: Editor ed = it.nextEditor();
42: if (ed.getBuffer() == this ) {
43: ed.setMark(null);
44: ed.setDot(getFirstLine(), 0);
45: ed.updateDisplay();
46: }
47: }
48: }
49:
50: public String toString() {
51: if (file != null) {
52: FastStringBuffer sb = new FastStringBuffer();
53: sb.append(file.getName());
54: sb.append(" (errors)");
55: return sb.toString();
56: }
57: return "Errors";
58: }
59: }
|