Author: lemovice
Date: Tue Dec 10 23:15:20 2013
New Revision: 4739
Log:
Implement Undo
Modified:
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/GenealogyEditorCreateFamilyAction.java
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/GenealogyEditorCreateIndividualAction.java
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/GenealogyEditorCreateNoteAction.java
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/GenealogyEditorEditAction.java
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/TreeViewOpenGenealogyEditorAction.java
Modified:
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/GenealogyEditorCreateFamilyAction.java
==============================================================================
---
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/GenealogyEditorCreateFamilyAction.java
(original)
+++
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/GenealogyEditorCreateFamilyAction.java
Tue Dec 10 23:15:20 2013
@@ -58,9 +58,10 @@
if (editorDialog.show() == DialogDescriptor.OK_OPTION) {
familyEditorPanel.commit();
} else {
- gedcom.undoUnitOfWork(false);
+ while (gedcom.canUndo()) {
+ gedcom.undoUnitOfWork(false);
+ }
}
-
} catch (GedcomException ex) {
Exceptions.printStackTrace(ex);
}
Modified:
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/GenealogyEditorCreateIndividualAction.java
==============================================================================
---
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/GenealogyEditorCreateIndividualAction.java
(original)
+++
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/GenealogyEditorCreateIndividualAction.java
Tue Dec 10 23:15:20 2013
@@ -3,15 +3,14 @@
import ancestris.modules.editors.genealogyeditor.panels.IndividualEditorPanel;
import ancestris.util.swing.DialogManager;
import genj.gedcom.*;
-import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import org.openide.DialogDescriptor;
-import org.openide.loaders.DataObject;
-
-import org.openide.awt.ActionRegistration;
+import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
-import org.openide.awt.ActionID;
+import org.openide.awt.ActionRegistration;
+import org.openide.loaders.DataObject;
import org.openide.util.Exceptions;
import org.openide.util.NbBundle;
import org.openide.util.NbBundle.Messages;
@@ -62,7 +61,9 @@
if (editorDialog.show() == DialogDescriptor.OK_OPTION) {
individualEditorPanel.commit();
} else {
- gedcom.undoUnitOfWork(false);
+ while (gedcom.canUndo()) {
+ gedcom.undoUnitOfWork(false);
+ }
}
} catch (GedcomException ex) {
Exceptions.printStackTrace(ex);
Modified:
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/GenealogyEditorCreateNoteAction.java
==============================================================================
---
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/GenealogyEditorCreateNoteAction.java
(original)
+++
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/GenealogyEditorCreateNoteAction.java
Tue Dec 10 23:15:20 2013
@@ -1,18 +1,16 @@
package ancestris.modules.editors.genealogyeditor.actions;
-import ancestris.modules.editors.genealogyeditor.panels.IndividualEditorPanel;
import ancestris.modules.editors.genealogyeditor.panels.NoteEditorPanel;
import ancestris.util.swing.DialogManager;
import genj.gedcom.*;
-import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import org.openide.DialogDescriptor;
-import org.openide.loaders.DataObject;
-
-import org.openide.awt.ActionRegistration;
+import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
-import org.openide.awt.ActionID;
+import org.openide.awt.ActionRegistration;
+import org.openide.loaders.DataObject;
import org.openide.util.Exceptions;
import org.openide.util.NbBundle;
import org.openide.util.NbBundle.Messages;
@@ -61,7 +59,9 @@
if (noteEditorDialog.show() == DialogDescriptor.OK_OPTION) {
noteEditorPanel.commit();
} else {
- gedcom.undoUnitOfWork(false);
+ while (gedcom.canUndo()) {
+ gedcom.undoUnitOfWork(false);
+ }
}
}
}
Modified:
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/GenealogyEditorEditAction.java
==============================================================================
---
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/GenealogyEditorEditAction.java
(original)
+++
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/GenealogyEditorEditAction.java
Tue Dec 10 23:15:20 2013
@@ -47,6 +47,11 @@
editorDialog.setDialogId(IndividualEditorPanel.class.getName());
if (editorDialog.show() == DialogDescriptor.OK_OPTION) {
individualEditorPanel.commit();
+ } else {
+ Gedcom gedcom = entity.getGedcom();
+ while (gedcom.canUndo()) {
+ gedcom.undoUnitOfWork(false);
+ }
}
} else if (entity instanceof Fam) {
FamilyEditorPanel familyEditorPanel = new FamilyEditorPanel();
@@ -58,6 +63,11 @@
editorDialog.setDialogId(FamilyEditorPanel.class.getName());
if (editorDialog.show() == DialogDescriptor.OK_OPTION) {
familyEditorPanel.commit();
+ } else {
+ Gedcom gedcom = entity.getGedcom();
+ while (gedcom.canUndo()) {
+ gedcom.undoUnitOfWork(false);
+ }
}
} else if (entity instanceof Note) {
NoteEditorPanel noteEditorPanel = new NoteEditorPanel();
@@ -69,6 +79,11 @@
editorDialog.setDialogId(NoteEditorPanel.class.getName());
if (editorDialog.show() == DialogDescriptor.OK_OPTION) {
noteEditorPanel.commit();
+ } else {
+ Gedcom gedcom = entity.getGedcom();
+ while (gedcom.canUndo()) {
+ gedcom.undoUnitOfWork(false);
+ }
}
} else if (entity instanceof Source) {
SourceEditorPanel sourceEditorPanel = new SourceEditorPanel();
@@ -80,6 +95,11 @@
editorDialog.setDialogId(SourceEditorPanel.class.getName());
if (editorDialog.show() == DialogDescriptor.OK_OPTION) {
sourceEditorPanel.commit();
+ } else {
+ Gedcom gedcom = entity.getGedcom();
+ while (gedcom.canUndo()) {
+ gedcom.undoUnitOfWork(false);
+ }
}
} else if (entity instanceof Repository) {
RepositoryEditorPanel repositoryEditorPanel = new
RepositoryEditorPanel();
@@ -92,6 +112,11 @@
if (editorDialog.show() == DialogDescriptor.OK_OPTION) {
repositoryEditorPanel.commit();
+ } else {
+ Gedcom gedcom = entity.getGedcom();
+ while (gedcom.canUndo()) {
+ gedcom.undoUnitOfWork(false);
+ }
}
}
}
Modified:
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/TreeViewOpenGenealogyEditorAction.java
==============================================================================
---
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/TreeViewOpenGenealogyEditorAction.java
(original)
+++
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/TreeViewOpenGenealogyEditorAction.java
Tue Dec 10 23:15:20 2013
@@ -32,8 +32,8 @@
@NbBundle.Messages("OpenInEditor.title=Edit with genealogyeditor")
public class TreeViewOpenGenealogyEditorAction extends AbstractAction
implements ContextAwareAction {
- Gedcom myGedcom = null;
- Entity entity = null;
+ private Gedcom gedcom = null;
+ private Entity entity = null;
@Override
public void actionPerformed(ActionEvent ae) {
@@ -70,6 +70,11 @@
editorDialog.setDialogId(IndividualEditorPanel.class.getName());
if (editorDialog.show() == DialogDescriptor.OK_OPTION) {
individualEditorPanel.commit();
+ } else {
+ Gedcom gedcom = entity.getGedcom();
+ while (gedcom.canUndo()) {
+ gedcom.undoUnitOfWork(false);
+ }
}
} else if (entity instanceof Fam) {
FamilyEditorPanel familyEditorPanel = new FamilyEditorPanel();
@@ -81,6 +86,11 @@
editorDialog.setDialogId(FamilyEditorPanel.class.getName());
if (editorDialog.show() == DialogDescriptor.OK_OPTION) {
familyEditorPanel.commit();
+ } else {
+ Gedcom gedcom = entity.getGedcom();
+ while (gedcom.canUndo()) {
+ gedcom.undoUnitOfWork(false);
+ }
}
}
---------------------------------------------------------------------
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]