Revision 41e2f693
Added by Cherian Mathew over 9 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/CdmDataSourceRepository.java | ||
---|---|---|
34 | 34 |
import eu.etaxonomy.cdm.remote.CdmRemoteSourceException; |
35 | 35 |
import eu.etaxonomy.cdm.remote.ICdmRemoteSource; |
36 | 36 |
import eu.etaxonomy.taxeditor.model.MementoHelper; |
37 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
37 | 38 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
38 | 39 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
39 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
|
40 | 40 |
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin; |
41 | 41 |
public class CdmDataSourceRepository{ |
42 | 42 |
|
... | ... | |
96 | 96 |
try { |
97 | 97 |
remoteSources.add(CdmPersistentDataSource.NewInstance(dataSource.getName())); |
98 | 98 |
} catch (DataSourceNotFoundException e) { |
99 |
StoreUtil.error(CdmDataSourceRepository.class, "Could not find dataSource", e);
|
|
99 |
MessagingUtils.error(CdmDataSourceRepository.class, "Could not find dataSource", e);
|
|
100 | 100 |
} |
101 | 101 |
} |
102 | 102 |
|
... | ... | |
105 | 105 |
remoteSources.add(remoteSource); |
106 | 106 |
} |
107 | 107 |
} catch (CdmRemoteSourceException e) { |
108 |
StoreUtil.error(CdmDataSourceRepository.class, "Error retrieving remote sources", e);
|
|
108 |
MessagingUtils.error(CdmDataSourceRepository.class, "Error retrieving remote sources", e);
|
|
109 | 109 |
} |
110 | 110 |
|
111 | 111 |
// TODO sort by database name |
... | ... | |
127 | 127 |
return CdmPersistentDataSource.NewInstance(dataSource.getName()); |
128 | 128 |
} |
129 | 129 |
} catch (DataSourceNotFoundException e) { |
130 |
StoreUtil.error(CdmDataSourceRepository.class, "Could not find dataSource", e);
|
|
130 |
MessagingUtils.error(CdmDataSourceRepository.class, "Could not find dataSource", e);
|
|
131 | 131 |
} |
132 | 132 |
} |
133 | 133 |
|
... | ... | |
182 | 182 |
|
183 | 183 |
if( dataSourceNomenclaturalCode != null && ! dataSourceNomenclaturalCode.equals(applicationNomenclaturalCode)){ |
184 | 184 |
PreferencesUtil.setPreferredNomenclaturalCode(dataSourceNomenclaturalCode); |
185 |
StoreUtil.informationDialog("Nomenclatural Code Change", "The Datasource that was just " +
|
|
185 |
MessagingUtils.informationDialog("Nomenclatural Code Change", "The Datasource that was just " +
|
|
186 | 186 |
"loaded has a different nomenclatural code than the one stored in Preferences. " + |
187 | 187 |
"The nomenclatural code was changed in the application."); |
188 | 188 |
} |
... | ... | |
237 | 237 |
try { |
238 | 238 |
return CdmPersistentDataSource.update(strCdmSourceName, cdmSource); |
239 | 239 |
} catch (Exception e) { |
240 |
StoreUtil.error(CdmDataSourceRepository.class, "Error updating CDM Source", e);
|
|
240 |
MessagingUtils.error(CdmDataSourceRepository.class, "Error updating CDM Source", e);
|
|
241 | 241 |
} |
242 | 242 |
return null; |
243 | 243 |
} |
... | ... | |
246 | 246 |
try { |
247 | 247 |
return CdmPersistentDataSource.replace(strCdmSourceName, cdmSource); |
248 | 248 |
} catch (Exception e) { |
249 |
StoreUtil.error(CdmDataSourceRepository.class, "Error updating CDM Source", e);
|
|
249 |
MessagingUtils.error(CdmDataSourceRepository.class, "Error updating CDM Source", e);
|
|
250 | 250 |
} |
251 | 251 |
return null; |
252 | 252 |
} |
... | ... | |
262 | 262 |
try { |
263 | 263 |
return CdmPersistentRemoteSource.update(strCdmSourceName, cdmSource); |
264 | 264 |
} catch (Exception e) { |
265 |
StoreUtil.error(CdmDataSourceRepository.class, "Error updating CDM Source", e);
|
|
265 |
MessagingUtils.error(CdmDataSourceRepository.class, "Error updating CDM Source", e);
|
|
266 | 266 |
|
267 | 267 |
} |
268 | 268 |
return null; |
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