comparison dwtx/text/undo/DocumentUndoManagerRegistry.d @ 130:b56e9be9fe88

ctors to this
author Frank Benoit <benoit@tionex.de>
date Sun, 24 Aug 2008 00:30:47 +0200
parents eb30df5ca28b
children c4fb132a086c
comparison
equal deleted inserted replaced
129:eb30df5ca28b 130:b56e9be9fe88
35 * 35 *
36 * @since 3.2 36 * @since 3.2
37 * @noinstantiate This class is not intended to be instantiated by clients. 37 * @noinstantiate This class is not intended to be instantiated by clients.
38 */ 38 */
39 public final class DocumentUndoManagerRegistry { 39 public final class DocumentUndoManagerRegistry {
40 40
41 private static final class Record { 41 private static final class Record {
42 public Record(IDocument document) { 42 public Record(IDocument document) {
43 count= 0; 43 count= 0;
44 undoManager= new DocumentUndoManager(document); 44 undoManager= new DocumentUndoManager(document);
45 } 45 }
46 private int count; 46 private int count;
47 private IDocumentUndoManager undoManager; 47 private IDocumentUndoManager undoManager;
48 } 48 }
49 49
50 private static Map fgFactory= new HashMap(); 50 private static Map fgFactory= new HashMap();
51 51
52 private DocumentUndoManagerRegistry() { 52 private this() {
53 // Do not instantiate 53 // Do not instantiate
54 } 54 }
55 55
56 56
57 /** 57 /**
58 * Connects the file at the given location to this manager. After that call 58 * Connects the file at the given location to this manager. After that call
59 * successfully completed it is guaranteed that each call to <code>getFileBuffer</code> 59 * successfully completed it is guaranteed that each call to <code>getFileBuffer</code>
60 * returns the same file buffer until <code>disconnect</code> is called. 60 * returns the same file buffer until <code>disconnect</code> is called.
61 * <p> 61 * <p>
82 Assert.isNotNull(document); 82 Assert.isNotNull(document);
83 Record record= (Record)fgFactory.get(document); 83 Record record= (Record)fgFactory.get(document);
84 record.count--; 84 record.count--;
85 if (record.count is 0) 85 if (record.count is 0)
86 fgFactory.remove(document); 86 fgFactory.remove(document);
87 87
88 } 88 }
89 89
90 /** 90 /**
91 * Returns the file buffer managed for the given location or <code>null</code> 91 * Returns the file buffer managed for the given location or <code>null</code>
92 * if there is no such file buffer. 92 * if there is no such file buffer.