Moved all logging and dialog functionality to the new class MessagingUtils.
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / store / ContextManager.java
index 57cab784d77392bfb4a9e8700a791d309595179c..d7ca5a0d06d1916e81d7a0eaa801f7ea9874e362 100644 (file)
@@ -27,6 +27,7 @@ import org.eclipse.ui.XMLMemento;
 
 import eu.etaxonomy.taxeditor.model.IContextListener;
 import eu.etaxonomy.taxeditor.model.MementoHelper;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
 
 /**
@@ -71,7 +72,7 @@ public class ContextManager implements IWorkbenchListener{
         * <p>notifyContextStart</p>
         */
        public void notifyContextStart() {
-               StoreUtil.info("Notifying context listeners, that the context has started.");
+               MessagingUtils.info("Notifying context listeners, that the context has started.");
                ProgressMonitorDialog dialog = new ProgressMonitorDialog(StoreUtil.getShell());
                
                try {
@@ -95,9 +96,9 @@ public class ContextManager implements IWorkbenchListener{
                                }
                        });
                } catch (InvocationTargetException e) {
-                       StoreUtil.error(getClass(), e);
+                       MessagingUtils.error(getClass(), e);
                } catch (InterruptedException e) {
-                       StoreUtil.error(getClass(), e);
+                       MessagingUtils.error(getClass(), e);
                }
        }
        
@@ -106,7 +107,7 @@ public class ContextManager implements IWorkbenchListener{
         * 
         */
        public void notifyContextRefresh() {
-               StoreUtil.info("Notifying context listeners, that the context needs to be refreshed.");
+               MessagingUtils.info("Notifying context listeners, that the context needs to be refreshed.");
                ProgressMonitorDialog dialog = new ProgressMonitorDialog(StoreUtil.getShell());
                
                try {
@@ -127,9 +128,9 @@ public class ContextManager implements IWorkbenchListener{
                                }
                        });
                } catch (InvocationTargetException e) {
-                       StoreUtil.error(getClass(), e);
+                       MessagingUtils.error(getClass(), e);
                } catch (InterruptedException e) {
-                       StoreUtil.error(getClass(), e);
+                       MessagingUtils.error(getClass(), e);
                }
        }
        
@@ -164,7 +165,7 @@ public class ContextManager implements IWorkbenchListener{
                IProgressMonitor subMonitor = StoreUtil.getSubProgressMonitor(monitor, 1);
 
                subMonitor.beginTask("Stoping context", contextListeners.size());
-               StoreUtil.info("Notifying context listeners, that the context has stopped.");
+               MessagingUtils.info("Notifying context listeners, that the context has stopped.");
                                
                for(Object listener : contextListeners.getListeners()){
                        ((IContextListener) listener).contextStop(memento, subMonitor);
@@ -212,7 +213,7 @@ public class ContextManager implements IWorkbenchListener{
                        memento = MementoHelper.readMementoFromFile(getStateFileForCurrentDatabase());
                } catch (FileNotFoundException e) {
                        // no memento -> no previous state
-                       StoreUtil.info("No state file for datasource");
+                       MessagingUtils.info("No state file for datasource");
                }
        }
        
@@ -226,13 +227,13 @@ public class ContextManager implements IWorkbenchListener{
                                name = name.replace(" ", "_");
                                memento = XMLMemento.createWriteRoot(name);
                        
-                               StoreUtil.info("DataSource found. Memento created.");
+                               MessagingUtils.info("DataSource found. Memento created.");
                        } catch (Exception e) {
                                // The memento could not be created, but a not closable editor is avoided for this case.
-                               StoreUtil.error(this.getClass(), "The memento could not be created", e);
+                               MessagingUtils.error(this.getClass(), "The memento could not be created", e);
                        }
                } else {
-                       StoreUtil.info("Not storing state data, because no DataSource present.");
+                       MessagingUtils.info("Not storing state data, because no DataSource present.");
                }
                
        }