Exemple #1
0
 private void startGUI() {
   if (d_curFilename == null) {
     showWelcome();
   } else {
     try {
       loadDomainFromXMLFile(d_curFilename);
     } catch (Exception e) {
       ErrorDialog.showDialog(e, "Could not load file.", e.getMessage(), false);
     } finally {
       showMainWindow();
     }
   }
 }
Exemple #2
0
 private boolean loadDomainFromXMLFile(String fileName) {
   File f = new File(fileName);
   if (f.exists() && f.isFile()) {
     try {
       FileInputStream in = new FileInputStream(f);
       d_xmlType = loadDomainFromInputStream(in);
     } catch (Exception e) {
       ErrorDialog.showDialog(
           e, "Error loading file", "Error loading data from \"" + fileName + "\"", false);
       return false;
     }
     if (!d_xmlType.isValid()) {
       JOptionPane.showMessageDialog(
           s_window,
           "The file you are attempting to load is not formatted as a valid ADDIS XML file.",
           "Error loading file",
           JOptionPane.ERROR_MESSAGE);
       return false;
     } else if (d_xmlType.isFuture()) {
       JOptionPane.showMessageDialog(
           s_window,
           "The XML file was created with a newer version of ADDIS than you are using. Please download the new version to read it.",
           "Error loading file",
           JOptionPane.ERROR_MESSAGE);
       return false;
     } else if (d_xmlType.isLegacy()) {
       askToConvertToNew(fileName);
       return true;
     } else {
       setFileNameAndReset(fileName);
       return true;
     }
   } else {
     JOptionPane.showMessageDialog(
         s_window,
         "File \"" + fileName + "\" not found.",
         "Error loading file",
         JOptionPane.ERROR_MESSAGE);
     return false;
   }
 }