Mercurial > projects > dwt-addons
comparison dwtx/jface/text/templates/persistence/TemplateStore.d @ 170:284c2e810329
compile of JFace.Text is ok now
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 09 Sep 2008 18:46:06 +0200 |
parents | 1a5b8f8129df |
children |
comparison
equal
deleted
inserted
replaced
169:3b8f773f35e4 | 170:284c2e810329 |
---|---|
16 import dwtx.jface.text.templates.persistence.TemplateReaderWriter; // packageimport | 16 import dwtx.jface.text.templates.persistence.TemplateReaderWriter; // packageimport |
17 import dwtx.jface.text.templates.persistence.TemplatePersistenceMessages; // packageimport | 17 import dwtx.jface.text.templates.persistence.TemplatePersistenceMessages; // packageimport |
18 | 18 |
19 import dwt.dwthelper.utils; | 19 import dwt.dwthelper.utils; |
20 import dwtx.dwtxhelper.Collection; | 20 import dwtx.dwtxhelper.Collection; |
21 import dwtx.dwtxhelper.StringWriter; | |
22 import dwtx.dwtxhelper.StringReader; | |
21 | 23 |
22 import dwtx.core.runtime.Assert; | 24 import dwtx.core.runtime.Assert; |
23 import dwtx.jface.preference.IPersistentPreferenceStore; | 25 import dwtx.jface.preference.IPersistentPreferenceStore; |
24 import dwtx.jface.preference.IPreferenceStore; | 26 import dwtx.jface.preference.IPreferenceStore; |
25 import dwtx.jface.text.templates.ContextTypeRegistry; | 27 import dwtx.jface.text.templates.ContextTypeRegistry; |
35 * | 37 * |
36 * @since 3.0 | 38 * @since 3.0 |
37 */ | 39 */ |
38 public class TemplateStore { | 40 public class TemplateStore { |
39 /** The stored templates. */ | 41 /** The stored templates. */ |
40 private const List fTemplates= new ArrayList(); | 42 private const List fTemplates; |
41 /** The preference store. */ | 43 /** The preference store. */ |
42 private IPreferenceStore fPreferenceStore; | 44 private IPreferenceStore fPreferenceStore; |
43 /** | 45 /** |
44 * The key into <code>fPreferenceStore</code> the value of which holds custom templates | 46 * The key into <code>fPreferenceStore</code> the value of which holds custom templates |
45 * encoded as XML. | 47 * encoded as XML. |
72 * under <code>key</code> | 74 * under <code>key</code> |
73 * @param key the key into <code>store</code> where to store custom | 75 * @param key the key into <code>store</code> where to store custom |
74 * templates | 76 * templates |
75 */ | 77 */ |
76 public this(IPreferenceStore store, String key) { | 78 public this(IPreferenceStore store, String key) { |
77 Assert.isNotNull(store); | 79 fTemplates= new ArrayList(); |
80 | |
81 Assert.isNotNull(cast(Object)store); | |
78 Assert.isNotNull(key); | 82 Assert.isNotNull(key); |
79 fPreferenceStore= store; | 83 fPreferenceStore= store; |
80 fKey= key; | 84 fKey= key; |
81 } | 85 } |
82 | 86 |
157 * | 161 * |
158 * @param x the exception | 162 * @param x the exception |
159 * @since 3.2 | 163 * @since 3.2 |
160 */ | 164 */ |
161 protected void handleException(IOException x) { | 165 protected void handleException(IOException x) { |
162 x.printStackTrace(); | 166 ExceptionPrintStackTrace(x); |
163 } | 167 } |
164 | 168 |
165 /** | 169 /** |
166 * Hook method to load contributed templates. Contributed templates are superseded | 170 * Hook method to load contributed templates. Contributed templates are superseded |
167 * by customized versions of user added templates stored in the preferences. | 171 * by customized versions of user added templates stored in the preferences. |
285 } | 289 } |
286 try { | 290 try { |
287 load(); | 291 load(); |
288 } catch (IOException x) { | 292 } catch (IOException x) { |
289 // can't log from jface-text | 293 // can't log from jface-text |
290 x.printStackTrace(); | 294 ExceptionPrintStackTrace(x); |
291 } | 295 } |
292 } | 296 } |
293 | 297 |
294 /** | 298 /** |
295 * Returns all enabled templates. | 299 * Returns all enabled templates. |