Mercurial > projects > dwt-addons
comparison dwtx/jface/text/templates/persistence/TemplateStore.d @ 148:b3dec671d1f7
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 22:40:25 +0200 |
parents | 75302ef3f92f |
children | f70d9508c95c |
comparison
equal
deleted
inserted
replaced
147:000f9136b8f7 | 148:b3dec671d1f7 |
---|---|
59 */ | 59 */ |
60 private ContextTypeRegistry fRegistry; | 60 private ContextTypeRegistry fRegistry; |
61 /** | 61 /** |
62 * Set to <code>true</code> if property change events should be ignored (e.g. during writing | 62 * Set to <code>true</code> if property change events should be ignored (e.g. during writing |
63 * to the preference store). | 63 * to the preference store). |
64 * | 64 * |
65 * @since 3.2 | 65 * @since 3.2 |
66 */ | 66 */ |
67 private bool fIgnorePreferenceStoreChanges= false; | 67 private bool fIgnorePreferenceStoreChanges= false; |
68 /** | 68 /** |
69 * The property listener, if any is registered, <code>null</code> otherwise. | 69 * The property listener, if any is registered, <code>null</code> otherwise. |
70 * | 70 * |
71 * @since 3.2 | 71 * @since 3.2 |
72 */ | 72 */ |
73 private IPropertyChangeListener fPropertyListener; | 73 private IPropertyChangeListener fPropertyListener; |
74 | 74 |
75 | 75 |
113 public void load() { | 113 public void load() { |
114 fTemplates.clear(); | 114 fTemplates.clear(); |
115 loadContributedTemplates(); | 115 loadContributedTemplates(); |
116 loadCustomTemplates(); | 116 loadCustomTemplates(); |
117 } | 117 } |
118 | 118 |
119 /** | 119 /** |
120 * Starts listening for property changes on the preference store. If the configured preference | 120 * Starts listening for property changes on the preference store. If the configured preference |
121 * key changes, the template store is {@link #load() reloaded}. Call | 121 * key changes, the template store is {@link #load() reloaded}. Call |
122 * {@link #stopListeningForPreferenceChanges()} to remove any listener and stop the | 122 * {@link #stopListeningForPreferenceChanges()} to remove any listener and stop the |
123 * auto-updating behavior. | 123 * auto-updating behavior. |
124 * | 124 * |
125 * @since 3.2 | 125 * @since 3.2 |
126 */ | 126 */ |
127 public final void startListeningForPreferenceChanges() { | 127 public final void startListeningForPreferenceChanges() { |
128 if (fPropertyListener is null) { | 128 if (fPropertyListener is null) { |
129 fPropertyListener= new class() IPropertyChangeListener { | 129 fPropertyListener= new class() IPropertyChangeListener { |
141 } | 141 } |
142 } | 142 } |
143 }; | 143 }; |
144 fPreferenceStore.addPropertyChangeListener(fPropertyListener); | 144 fPreferenceStore.addPropertyChangeListener(fPropertyListener); |
145 } | 145 } |
146 | 146 |
147 } | 147 } |
148 | 148 |
149 /** | 149 /** |
150 * Stops the auto-updating behavior started by calling | 150 * Stops the auto-updating behavior started by calling |
151 * {@link #startListeningForPreferenceChanges()}. | 151 * {@link #startListeningForPreferenceChanges()}. |
152 * | 152 * |
153 * @since 3.2 | 153 * @since 3.2 |
154 */ | 154 */ |
155 public final void stopListeningForPreferenceChanges() { | 155 public final void stopListeningForPreferenceChanges() { |
156 if (fPropertyListener !is null) { | 156 if (fPropertyListener !is null) { |
157 fPreferenceStore.removePropertyChangeListener(fPropertyListener); | 157 fPreferenceStore.removePropertyChangeListener(fPropertyListener); |
158 fPropertyListener= null; | 158 fPropertyListener= null; |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 /** | 162 /** |
163 * Handles an {@link IOException} thrown during reloading the preferences due to a preference | 163 * Handles an {@link IOException} thrown during reloading the preferences due to a preference |
164 * store update. The default is to write to stderr. | 164 * store update. The default is to write to stderr. |
165 * | 165 * |
166 * @param x the exception | 166 * @param x the exception |
167 * @since 3.2 | 167 * @since 3.2 |
168 */ | 168 */ |
169 protected void handleException(IOException x) { | 169 protected void handleException(IOException x) { |
170 x.printStackTrace(); | 170 x.printStackTrace(); |
261 /** | 261 /** |
262 * Removes a template from the store. | 262 * Removes a template from the store. |
263 * | 263 * |
264 * @param data the template to remove | 264 * @param data the template to remove |
265 */ | 265 */ |
266 public void delete(TemplatePersistenceData data) { | 266 public void delete_(TemplatePersistenceData data) { |
267 if (data.isUserAdded()) | 267 if (data.isUserAdded()) |
268 fTemplates.remove(data); | 268 fTemplates.remove(data); |
269 else | 269 else |
270 data.setDeleted(true); | 270 data.setDeleted(true); |
271 } | 271 } |