comparison dwtx/jface/text/templates/persistence/TemplateReaderWriter.d @ 168:cef27f663573

jface.text ...
author Frank Benoit <benoit@tionex.de>
date Tue, 09 Sep 2008 17:44:11 +0200
parents 1a5b8f8129df
children
comparison
equal deleted inserted replaced
167:862b05e0334a 168:cef27f663573
17 import dwtx.jface.text.templates.persistence.TemplateStore; // packageimport 17 import dwtx.jface.text.templates.persistence.TemplateStore; // packageimport
18 18
19 19
20 import dwt.dwthelper.utils; 20 import dwt.dwthelper.utils;
21 import dwt.dwthelper.InputStream; 21 import dwt.dwthelper.InputStream;
22 import dwt.dwthelper.OutputStream;
22 import dwtx.dwtxhelper.Collection; 23 import dwtx.dwtxhelper.Collection;
23 import dwt.dwthelper.ResourceBundle; 24 import dwt.dwthelper.ResourceBundle;
24 25
25 /+ 26 /+
26 import javax.xml.parsers.DocumentBuilder; 27 import javax.xml.parsers.DocumentBuilder;
100 * <code>TemplatePersistenceData</code> 101 * <code>TemplatePersistenceData</code>
101 * @throws IOException if reading from the stream fails 102 * @throws IOException if reading from the stream fails
102 * @since 3.1 103 * @since 3.1
103 */ 104 */
104 public TemplatePersistenceData readSingle(Reader reader, String id) { 105 public TemplatePersistenceData readSingle(Reader reader, String id) {
105 TemplatePersistenceData[] datas= read(new InputSource(reader), null, id); 106 implMissing(__FILE__,__LINE__);
107 /+ TemplatePersistenceData[] datas= read(new InputSource(reader), null, id);
106 if (datas.length > 0) 108 if (datas.length > 0)
107 return datas[0]; 109 return datas[0];+/
108 return null; 110 return null;
109 } 111 }
110 112
111 /** 113 /**
112 * Reads templates from a stream and adds them to the templates. 114 * Reads templates from a stream and adds them to the templates.
115 * @param bundle a resource bundle to use for translating the read templates, or <code>null</code> if no translation should occur 117 * @param bundle a resource bundle to use for translating the read templates, or <code>null</code> if no translation should occur
116 * @return the read templates, encapsulated in instances of <code>TemplatePersistenceData</code> 118 * @return the read templates, encapsulated in instances of <code>TemplatePersistenceData</code>
117 * @throws IOException if reading from the stream fails 119 * @throws IOException if reading from the stream fails
118 */ 120 */
119 public TemplatePersistenceData[] read(Reader reader, ResourceBundle bundle) { 121 public TemplatePersistenceData[] read(Reader reader, ResourceBundle bundle) {
120 return read(new InputSource(reader), bundle, null); 122 implMissing(__FILE__,__LINE__);
123 return null;
124 // return read(new InputSource(reader), bundle, null);
121 } 125 }
122 126
123 /** 127 /**
124 * Reads templates from a stream and adds them to the templates. 128 * Reads templates from a stream and adds them to the templates.
125 * 129 *
127 * @param bundle a resource bundle to use for translating the read templates, or <code>null</code> if no translation should occur 131 * @param bundle a resource bundle to use for translating the read templates, or <code>null</code> if no translation should occur
128 * @return the read templates, encapsulated in instances of <code>TemplatePersistenceData</code> 132 * @return the read templates, encapsulated in instances of <code>TemplatePersistenceData</code>
129 * @throws IOException if reading from the stream fails 133 * @throws IOException if reading from the stream fails
130 */ 134 */
131 public TemplatePersistenceData[] read(InputStream stream, ResourceBundle bundle) { 135 public TemplatePersistenceData[] read(InputStream stream, ResourceBundle bundle) {
132 return read(new InputSource(stream), bundle, null); 136 implMissing(__FILE__,__LINE__);
133 } 137 return null;
134 138 // return read(new InputSource(stream), bundle, null);
139 }
140 /++
135 /** 141 /**
136 * Reads templates from an <code>InputSource</code> and adds them to the templates. 142 * Reads templates from an <code>InputSource</code> and adds them to the templates.
137 * 143 *
138 * @param source the input source 144 * @param source the input source
139 * @param bundle a resource bundle to use for translating the read templates, or <code>null</code> if no translation should occur 145 * @param bundle a resource bundle to use for translating the read templates, or <code>null</code> if no translation should occur
217 throw new IOException(e.getMessage()); 223 throw new IOException(e.getMessage());
218 } 224 }
219 225
220 return null; // dummy 226 return null; // dummy
221 } 227 }
222 228 ++/
223 /** 229 /**
224 * Saves the templates as XML, encoded as UTF-8 onto the given byte stream. 230 * Saves the templates as XML, encoded as UTF-8 onto the given byte stream.
225 * 231 *
226 * @param templates the templates to save 232 * @param templates the templates to save
227 * @param stream the byte output to write the templates to in XML 233 * @param stream the byte output to write the templates to in XML
228 * @throws IOException if writing the templates fails 234 * @throws IOException if writing the templates fails
229 */ 235 */
230 public void save(TemplatePersistenceData[] templates, OutputStream stream) { 236 public void save(TemplatePersistenceData[] templates, OutputStream stream) {
231 save(templates, new StreamResult(stream)); 237 implMissing(__FILE__,__LINE__);
238 // save(templates, new StreamResult(stream));
232 } 239 }
233 240
234 /** 241 /**
235 * Saves the templates as XML. 242 * Saves the templates as XML.
236 * 243 *
237 * @param templates the templates to save 244 * @param templates the templates to save
238 * @param writer the writer to write the templates to in XML 245 * @param writer the writer to write the templates to in XML
239 * @throws IOException if writing the templates fails 246 * @throws IOException if writing the templates fails
240 */ 247 */
241 public void save(TemplatePersistenceData[] templates, Writer writer) { 248 public void save(TemplatePersistenceData[] templates, Writer writer) {
242 save(templates, new StreamResult(writer)); 249 implMissing(__FILE__,__LINE__);
243 } 250 // save(templates, new StreamResult(writer));
244 251 }
252
253 /++
245 /** 254 /**
246 * Saves the templates as XML. 255 * Saves the templates as XML.
247 * 256 *
248 * @param templates the templates to save 257 * @param templates the templates to save
249 * @param result the stream result to write to 258 * @param result the stream result to write to
384 return '!' + key + '!'; 393 return '!' + key + '!';
385 } 394 }
386 } 395 }
387 return TemplatePersistenceMessages.getString(key); // default messages 396 return TemplatePersistenceMessages.getString(key); // default messages
388 } 397 }
398 ++/
389 } 399 }
390 400