fix #4657
authorKatja Luther <k.luther@bgbm.org>
Thu, 17 Mar 2016 11:39:38 +0000 (12:39 +0100)
committerKatja Luther <k.luther@bgbm.org>
Thu, 17 Mar 2016 11:39:38 +0000 (12:39 +0100)
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchAdvisor.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java

index 51828f268ee501e954946b6871e1ad57dd755393..ff5c2cd94cb1f5ef9aa220520c4e1b5b312f3118 100644 (file)
@@ -12,6 +12,7 @@ import org.springframework.remoting.RemoteAccessException;
 import org.springframework.remoting.RemoteConnectFailureException;
 
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 
 
 
@@ -112,6 +113,9 @@ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
                        return;
                    }
                        previousT = t;
+
+
+
                        // NOTE : Currently we only allow RuntimeExceptions since
                        //        allowing all kinds of exceptions would also include
                        //        those in generated status objects coming from from logging triggers
@@ -130,6 +134,13 @@ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
                                    t,
                                    true);
 
+                       } else if (t != null && ("Widget is disposed".equals(t.getMessage()))){
+                    MessagingUtils.warn(this.getClass(), t.getMessage());
+                    if (PreferencesUtil.isDebugMode()){
+                        MessagingUtils.warningDialog("Widget is disposed", null, status);
+                    }
+                }{
+
                        }
                    }
                }
index 4b493063ca641cf4ade4b7ad4335b2c060d44b05..d5f75d80740b9b00821dab5772d8d1b3ecde427d 100644 (file)
@@ -155,6 +155,8 @@ public interface IPreferenceKeys {
 
     public static final String DEFAULT_LANGUAGE_EDITOR = "eu.etaxonomy.taxeditor.default.language";
 
+    public static final String IS_DEBUG_MODE = "eu.etaxonomy.taxeditor.idDebugMode";
+
     /**
      * Key for the saved P2 repositories
      */
index 3ece8622d92a934d7d8d3e96f5a4f08283b3e2c4..54a90627b7b88694e3d77fb485a2abf204a5eef0 100644 (file)
@@ -247,7 +247,7 @@ public class PreferencesUtil implements IPreferenceKeys {
         * @return
         */
        private static String getPreferenceKey(ICdmBase cdmBase) {
-               cdmBase = (ICdmBase) HibernateProxyHelper.deproxy(cdmBase);
+               cdmBase = HibernateProxyHelper.deproxy(cdmBase);
 
                String key = cdmBase.getClass().getName().concat(".")
                                .concat(cdmBase.getUuid().toString());
@@ -264,7 +264,7 @@ public class PreferencesUtil implements IPreferenceKeys {
         * @return
         */
        public static String getPreferenceKey(ISimpleTerm simpleTerm) {
-               simpleTerm = (ISimpleTerm) HibernateProxyHelper.deproxy(simpleTerm);
+               simpleTerm = HibernateProxyHelper.deproxy(simpleTerm);
                String key = simpleTerm.getClass().getName().concat(".")
                                .concat(simpleTerm.getUuid().toString());
                if (key.contains("javassist")) {
@@ -283,7 +283,7 @@ public class PreferencesUtil implements IPreferenceKeys {
         * @return
         */
        public static String getPreferenceKey(IDefinedTerm definedTerm) {
-               definedTerm = (IDefinedTerm) HibernateProxyHelper.deproxy(definedTerm);
+               definedTerm = HibernateProxyHelper.deproxy(definedTerm);
                String key = definedTerm.getClass().getName().concat(".")
                                .concat(definedTerm.getUuid().toString());
                if (key.contains("javassist")) {
@@ -588,7 +588,7 @@ public class PreferencesUtil implements IPreferenceKeys {
 
        private static String getMarkerTypeEditingPreferenceKey(
                        MarkerType markerType) {
-               markerType = (MarkerType) HibernateProxyHelper.deproxy(markerType);
+               markerType = HibernateProxyHelper.deproxy(markerType);
                return markerType.getClass().getName() + EDIT_MARKER_TYPE_PREFIX;
        }
 
@@ -751,7 +751,7 @@ public class PreferencesUtil implements IPreferenceKeys {
             ctrl.setEnabled(enabled);
         }
     }
-    
+
     /**
         * <p>
         * getSortRanksNaturally
@@ -762,7 +762,7 @@ public class PreferencesUtil implements IPreferenceKeys {
        public static boolean getSortNodesNaturally() {
                return getPreferenceStore().getBoolean(SORT_NODES_NATURALLY);
        }
-       
+
        /**
         * <p>
         * setSortRanksNaturally
@@ -775,7 +775,7 @@ public class PreferencesUtil implements IPreferenceKeys {
                getPreferenceStore().setValue(SORT_NODES_NATURALLY, selection);
        }
 
-       
+
        /**
         * <p>
         * getSortRanksNaturally
@@ -786,7 +786,7 @@ public class PreferencesUtil implements IPreferenceKeys {
        public static boolean getSortNodesStrictlyAlphabetically() {
                return getPreferenceStore().getBoolean(SORT_NODES_ALPHABETICALLY);
        }
-       
+
        /**
         * <p>
         * setSortRanksNaturally
@@ -809,9 +809,9 @@ public class PreferencesUtil implements IPreferenceKeys {
         */
        public static boolean isStoreNavigatorState() {
                return getPreferenceStore().getBoolean(RESTORE_NAVIGATOR_STATE);
-               
+
        }
-       
+
        /**
         * <p>
         * setStoreNavigatorState
@@ -822,7 +822,16 @@ public class PreferencesUtil implements IPreferenceKeys {
         */
        public static void setStoreNavigatorState(boolean selection) {
                getPreferenceStore().setValue(RESTORE_NAVIGATOR_STATE, selection);
-               
+
        }
-       
+
+    /**
+     * @return
+     */
+    public static boolean isDebugMode() {
+       return getPreferenceStore().getBoolean(IS_DEBUG_MODE);
+    }
+    public static void setDebugMode(boolean selection) {
+        getPreferenceStore().setValue(IS_DEBUG_MODE, selection);
+    }
 }
index 62b86e423d5acbaafacff3ba303bb7bb56d3666f..e6535e0a88070e062a79ac3649d9ba14cbc24269 100644 (file)
@@ -66,6 +66,9 @@ public class TaxonomicEditorGeneralPreferences extends
              addField(new BooleanFieldEditor(IPreferenceKeys.RESTORE_NAVIGATOR_STATE,
                        "Restore the last Taxon Navigator state.",
                        getFieldEditorParent()));
+             addField(new BooleanFieldEditor(IPreferenceKeys.IS_DEBUG_MODE,
+                  "Run Taxonomic Editor in Debug Mode.",
+                  getFieldEditorParent()));
        }
 
        /*