git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@136 180e2...
[debian/openrocket] / src / net / sf / openrocket / document / OpenRocketDocument.java
index 02a91e82053d8d2f62a29013a750624434fc84f0..d0daa17a6a8ea5464b5201268c4d29e8129b8df5 100644 (file)
@@ -2,7 +2,6 @@ package net.sf.openrocket.document;
 
 import java.awt.event.ActionEvent;
 import java.io.File;
-import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -13,6 +12,7 @@ import net.sf.openrocket.document.events.DocumentChangeEvent;
 import net.sf.openrocket.document.events.DocumentChangeListener;
 import net.sf.openrocket.document.events.SimulationChangeEvent;
 import net.sf.openrocket.gui.main.ExceptionHandler;
+import net.sf.openrocket.l10n.Translator;
 import net.sf.openrocket.logging.LogHelper;
 import net.sf.openrocket.logging.TraceException;
 import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
@@ -20,6 +20,7 @@ import net.sf.openrocket.rocketcomponent.ComponentChangeListener;
 import net.sf.openrocket.rocketcomponent.Configuration;
 import net.sf.openrocket.rocketcomponent.Rocket;
 import net.sf.openrocket.startup.Application;
+import net.sf.openrocket.util.ArrayList;
 import net.sf.openrocket.util.BugException;
 import net.sf.openrocket.util.Icons;
 
@@ -31,7 +32,8 @@ import net.sf.openrocket.util.Icons;
  */
 public class OpenRocketDocument implements ComponentChangeListener {
        private static final LogHelper log = Application.getLogger();
-       
+       private static final Translator trans = Application.getTranslator();
+
        /**
         * The minimum number of undo levels that are stored.
         */
@@ -155,9 +157,8 @@ public class OpenRocketDocument implements ComponentChangeListener {
 
 
 
-       @SuppressWarnings("unchecked")
        public List<Simulation> getSimulations() {
-               return (ArrayList<Simulation>) simulations.clone();
+               return simulations.clone();
        }
        
        public int getSimulationCount() {
@@ -444,7 +445,11 @@ public class OpenRocketDocument implements ComponentChangeListener {
                        undoDescription.add(null);
                }
                
+               rocket.checkComponentStructure();
+               undoHistory.get(undoPosition).checkComponentStructure();
+               undoHistory.get(undoPosition).copyWithOriginalID().checkComponentStructure();
                rocket.loadFrom(undoHistory.get(undoPosition).copyWithOriginalID());
+               rocket.checkComponentStructure();
        }
        
        
@@ -531,6 +536,7 @@ public class OpenRocketDocument implements ComponentChangeListener {
                
                
                // Actual action to make
+               @Override
                public void actionPerformed(ActionEvent e) {
                        switch (type) {
                        case UNDO:
@@ -553,14 +559,16 @@ public class OpenRocketDocument implements ComponentChangeListener {
                        
                        switch (type) {
                        case UNDO:
-                               name = "Undo";
+                               //// Undo
+                               name = trans.get("OpenRocketDocument.Undo");
                                desc = getUndoDescription();
                                actionEnabled = isUndoAvailable();
                                this.putValue(SMALL_ICON, Icons.EDIT_UNDO);
                                break;
                        
                        case REDO:
-                               name = "Redo";
+                               ////Redo
+                               name = trans.get("OpenRocketDocument.Redo");
                                desc = getRedoDescription();
                                actionEnabled = isRedoAvailable();
                                this.putValue(SMALL_ICON, Icons.EDIT_REDO);