Revision 41e2f693
Added by Cherian Mathew over 9 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/ContextManager.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
import eu.etaxonomy.taxeditor.model.IContextListener; |
29 | 29 |
import eu.etaxonomy.taxeditor.model.MementoHelper; |
30 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
30 | 31 |
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin; |
31 | 32 |
|
32 | 33 |
/** |
... | ... | |
71 | 72 |
* <p>notifyContextStart</p> |
72 | 73 |
*/ |
73 | 74 |
public void notifyContextStart() { |
74 |
StoreUtil.info("Notifying context listeners, that the context has started.");
|
|
75 |
MessagingUtils.info("Notifying context listeners, that the context has started.");
|
|
75 | 76 |
ProgressMonitorDialog dialog = new ProgressMonitorDialog(StoreUtil.getShell()); |
76 | 77 |
|
77 | 78 |
try { |
... | ... | |
95 | 96 |
} |
96 | 97 |
}); |
97 | 98 |
} catch (InvocationTargetException e) { |
98 |
StoreUtil.error(getClass(), e);
|
|
99 |
MessagingUtils.error(getClass(), e);
|
|
99 | 100 |
} catch (InterruptedException e) { |
100 |
StoreUtil.error(getClass(), e);
|
|
101 |
MessagingUtils.error(getClass(), e);
|
|
101 | 102 |
} |
102 | 103 |
} |
103 | 104 |
|
... | ... | |
106 | 107 |
* |
107 | 108 |
*/ |
108 | 109 |
public void notifyContextRefresh() { |
109 |
StoreUtil.info("Notifying context listeners, that the context needs to be refreshed.");
|
|
110 |
MessagingUtils.info("Notifying context listeners, that the context needs to be refreshed.");
|
|
110 | 111 |
ProgressMonitorDialog dialog = new ProgressMonitorDialog(StoreUtil.getShell()); |
111 | 112 |
|
112 | 113 |
try { |
... | ... | |
127 | 128 |
} |
128 | 129 |
}); |
129 | 130 |
} catch (InvocationTargetException e) { |
130 |
StoreUtil.error(getClass(), e);
|
|
131 |
MessagingUtils.error(getClass(), e);
|
|
131 | 132 |
} catch (InterruptedException e) { |
132 |
StoreUtil.error(getClass(), e);
|
|
133 |
MessagingUtils.error(getClass(), e);
|
|
133 | 134 |
} |
134 | 135 |
} |
135 | 136 |
|
... | ... | |
164 | 165 |
IProgressMonitor subMonitor = StoreUtil.getSubProgressMonitor(monitor, 1); |
165 | 166 |
|
166 | 167 |
subMonitor.beginTask("Stoping context", contextListeners.size()); |
167 |
StoreUtil.info("Notifying context listeners, that the context has stopped.");
|
|
168 |
MessagingUtils.info("Notifying context listeners, that the context has stopped.");
|
|
168 | 169 |
|
169 | 170 |
for(Object listener : contextListeners.getListeners()){ |
170 | 171 |
((IContextListener) listener).contextStop(memento, subMonitor); |
... | ... | |
212 | 213 |
memento = MementoHelper.readMementoFromFile(getStateFileForCurrentDatabase()); |
213 | 214 |
} catch (FileNotFoundException e) { |
214 | 215 |
// no memento -> no previous state |
215 |
StoreUtil.info("No state file for datasource");
|
|
216 |
MessagingUtils.info("No state file for datasource");
|
|
216 | 217 |
} |
217 | 218 |
} |
218 | 219 |
|
... | ... | |
226 | 227 |
name = name.replace(" ", "_"); |
227 | 228 |
memento = XMLMemento.createWriteRoot(name); |
228 | 229 |
|
229 |
StoreUtil.info("DataSource found. Memento created.");
|
|
230 |
MessagingUtils.info("DataSource found. Memento created.");
|
|
230 | 231 |
} catch (Exception e) { |
231 | 232 |
// The memento could not be created, but a not closable editor is avoided for this case. |
232 |
StoreUtil.error(this.getClass(), "The memento could not be created", e);
|
|
233 |
MessagingUtils.error(this.getClass(), "The memento could not be created", e);
|
|
233 | 234 |
} |
234 | 235 |
} else { |
235 |
StoreUtil.info("Not storing state data, because no DataSource present.");
|
|
236 |
MessagingUtils.info("Not storing state data, because no DataSource present.");
|
|
236 | 237 |
} |
237 | 238 |
|
238 | 239 |
} |
Also available in: Unified diff
Moved all logging and dialog functionality to the new class MessagingUtils.
Refactoring code to adapt to above change.
Added new custom error dialog - CdmErrorDialog
Added runtime exception handling to the ApplicationWorkbenchAdvisor by adding a custom status handler