Author: lemovice
Date: Tue Dec 10 22:09:57 2013
New Revision: 4737

Log:
improve undo in case of place edition Cancel

Modified:
   
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventsListPanel.java

Modified: 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventsListPanel.java
==============================================================================
--- 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventsListPanel.java
 (original)
+++ 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventsListPanel.java
 Tue Dec 10 22:09:57 2013
@@ -134,6 +134,10 @@
 
             if (eventEditorDialog.show() == DialogDescriptor.OK_OPTION) {
                 eventEditorPanel.commit();
+            } else {
+                while (mRoot.getGedcom().canUndo()) {
+                    mRoot.getGedcom().undoUnitOfWork(false);
+                }                
             }
         }
     }//GEN-LAST:event_editEventButtonActionPerformed
@@ -161,6 +165,10 @@
 
                 if (eventEditorDialog.show() == DialogDescriptor.OK_OPTION) {
                     eventEditorPanel.commit();
+                } else {
+                    while (mRoot.getGedcom().canUndo()) {
+                        mRoot.getGedcom().undoUnitOfWork(false);
+                    }
                 }
             }
         }
@@ -178,7 +186,7 @@
             }); // end of doUnitOfWork
         } catch (GedcomException ex) {
             Exceptions.printStackTrace(ex);
-        }  finally {
+        } finally {
             EventEditorPanel eventEditorPanel = new EventEditorPanel();
 
             eventEditorPanel.set(mRoot, mEvent);
@@ -191,7 +199,9 @@
             if (eventEditorDialog.show() == DialogDescriptor.OK_OPTION) {
                 mEventsTableModel.add(eventEditorPanel.commit());
             } else {
-                mRoot.getGedcom().undoUnitOfWork(false);
+                while (mRoot.getGedcom().canUndo()) {
+                    mRoot.getGedcom().undoUnitOfWork(false);
+                }
             }
         }
     }//GEN-LAST:event_eventTypeComboBoxActionPerformed

---------------------------------------------------------------------
Site Web Ancestris : http://www.ancestris.org

<*> Pour vous desinscrire de cette liste, envoyez un mail a :
              [email protected]
<*> Pour obtenir de l'aide sur les commandes de la liste :
              [email protected]

Pour obtenir tous les messages lies a ce fil de discussion, cliquez sur le 
lien ci-dessous, cela ouvrira votre logiciel de messagerie. Il vous suffira 
d'envoyer le message :
              [email protected]

Reply via email to