01: /*
02: * DiffOutputBuffer.java
03: *
04: * Copyright (C) 1998-2003 Peter Graves
05: * $Id: DiffOutputBuffer.java,v 1.3 2003/04/04 16:02:02 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 DiffOutputBuffer extends Buffer {
25: private final File directory;
26: private final int vcType;
27:
28: public DiffOutputBuffer(Buffer parentBuffer, String output,
29: int vcType) {
30: super ();
31: this .parentBuffer = parentBuffer;
32: directory = (parentBuffer == null) ? null : parentBuffer
33: .getCurrentDirectory();
34: this .vcType = vcType;
35: init();
36: setText(output);
37: }
38:
39: public DiffOutputBuffer(File directory, String output, int vcType) {
40: super ();
41: this .directory = directory;
42: this .vcType = vcType;
43: init();
44: setText(output);
45: }
46:
47: public final File getCurrentDirectory() {
48: return directory;
49: }
50:
51: private void init() {
52: supportsUndo = false;
53: type = TYPE_OUTPUT;
54: mode = DiffMode.getMode();
55: formatter = new DiffFormatter(this );
56: lineSeparator = System.getProperty("line.separator");
57: readOnly = true;
58: setProperty(Property.VERTICAL_RULE, 0);
59: setProperty(Property.SHOW_LINE_NUMBERS, false);
60: setTransient(true);
61: setInitialized(true);
62: }
63:
64: public final File getDirectory() {
65: return directory;
66: }
67:
68: public final int getVCType() {
69: return vcType;
70: }
71:
72: public String getFileNameForDisplay() {
73: return title != null ? title : "";
74: }
75: }
|