updates
[debian/openrocket] / src / net / sf / openrocket / gui / main / DocumentSelectionModel.java
index 94bc39dfbaedc3ee9671c5dafc0fa5ed63e2c741..746a2341fd9c43a1372816a913941988bf1c3fe9 100644 (file)
@@ -55,6 +55,19 @@ public class DocumentSelectionModel {
        public Simulation[] getSelectedSimulations() {
                return Arrays.copyOf(simulationSelection, simulationSelection.length);
        }
+       
+       public void setSelectedSimulations(Simulation[] sims) {
+               simulationSelection = sims;
+               clearComponentSelection();
+
+               simulationListSelectionModel.clearSelection();
+               for (Simulation s: sims) {
+                       int index = document.getSimulationIndex(s);
+                       if (index >= 0) {
+                               simulationListSelectionModel.addSelectionInterval(index, index);
+                       }
+               }
+       }
 
        /**
         * Return the currently selected rocket component.  Returns <code>null</code>
@@ -65,6 +78,14 @@ public class DocumentSelectionModel {
        public RocketComponent getSelectedComponent() {
                return componentSelection;
        }
+       
+       public void setSelectedComponent(RocketComponent component) {
+               componentSelection = component;
+               clearSimulationSelection();
+       
+               TreePath path = ComponentTreeModel.makeTreePath(component);
+               componentTreeSelectionModel.setSelectionPath(path);
+       }