- Timestamp:
- 02/03/2020 05:42:22 PM (6 years ago)
- Location:
- trunk/src/scriptbuilder
- Files:
-
- 2 edited
-
gui/ScriptBuilderFrame.java (modified) (1 diff)
-
structures/SimulationScript.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java
r193 r207 1840 1840 script = new SimulationScript(); 1841 1841 script.loadScriptFromFile(fc.getSelectedFile()); 1842 script.saveFile = fc.getSelectedFile();1843 1842 } 1844 1843 -
trunk/src/scriptbuilder/structures/SimulationScript.java
r206 r207 18 18 import java.nio.file.Paths; 19 19 import java.util.TreeMap; 20 import javax.swing.JOptionPane; 20 21 import static scriptbuilder.structures.XMLBuilder.prettyPrintXML; 21 22 … … 176 177 * Load in an existing script from an XML file. 177 178 * 178 * @param fthe file containing the script179 */ 180 public void loadScriptFromFile(File f)179 * @param infile the file containing the script 180 */ 181 public void loadScriptFromFile(File infile) 181 182 { 182 183 try 183 184 { 184 185 185 SAXParserFactory.newInstance().newSAXParser().parse( f, sh);186 SAXParserFactory.newInstance().newSAXParser().parse(infile, sh); 186 187 187 188 Vector<ScriptIncident> inc = sh.getIncidents(); … … 191 192 addIncident(sci); 192 193 } 194 saveFile = infile; 195 193 196 } 194 197 catch (Exception ex) 195 198 { 196 System.out.println("ERROR LOADING SCRIPT"); 197 ex.printStackTrace(); 198 } 199 System.out.println("H"); 200 for(Unit testUnit : units){ 201 System.out.println(testUnit.toXML()); 199 String errMsg = ex.getMessage(); 200 if (ex.getMessage().endsWith(".dtd (No such file or directory)")) 201 { 202 errMsg += "\nThe required external DTD file must be placed in\n" 203 + " the same folder as the xml file."; 204 } 205 JOptionPane.showMessageDialog(null, errMsg, 206 "Unable to load xml file", 207 JOptionPane.INFORMATION_MESSAGE); 202 208 } 203 209 this.update();
Note: See TracChangeset
for help on using the changeset viewer.
