void open(){
  if (!mainFrame.canNavigateAway()) {
    return;
  }
  if (askToSave()) {
    return;
  }
  boolean loading=true;
  SaveType fileType;
  tryAgain:   while (loading) {
    int value=saveOpenFileChooser.showOpenDialog(mainFrame);
    if (value != JFileChooser.APPROVE_OPTION) {
      return;
    }
    loading=false;
    fileType=convertFilterToType(saveOpenFileChooser.getFileFilter());
    final File f=saveOpenFileChooser.getSelectedFile();
    if (!fileType.isValid(f)) {
      JOptionPane.showMessageDialog(saveOpenFileChooser,"That file is not compatible with the chosen file type","Invalid File",JOptionPane.WARNING_MESSAGE);
      loading=true;
      continue;
    }
switch (fileType) {
case XML_ANALYSIS:
      if (!f.getName().endsWith(".xml")) {
        JOptionPane.showMessageDialog(saveOpenFileChooser,L10N.getLocalString("dlg.not_xml_data_lbl","This is not a saved bug XML data file."));
        loading=true;
        continue tryAgain;
      }
    if (!mainFrame.openAnalysis(f,fileType)) {
      JOptionPane.showMessageDialog(saveOpenFileChooser,"An error occurred while trying to load the analysis.");
      loading=true;
      continue tryAgain;
    }
  break;
case FBP_FILE:
if (!openFBPFile(f)) {
  JOptionPane.showMessageDialog(saveOpenFileChooser,"An error occurred while trying to load the analysis.");
  loading=true;
  continue tryAgain;
}
break;
case FBA_FILE:
if (!openFBAFile(f)) {
JOptionPane.showMessageDialog(saveOpenFileChooser,"An error occurred while trying to load the analysis.");
loading=true;
continue tryAgain;
}
break;
default :
assert false;
}
}
}

void open ( ) { if ( ! mainFrame . canNavigateAway ( ) ) { return ; } if ( askToSave ( ) ) { return ; } boolean loading = true ; SaveType fileType ; tryAgain : while ( loading ) { int value = saveOpenFileChooser . showOpenDialog ( mainFrame ) ; if ( value != JFileChooser . APPROVE_OPTION ) { return ; } loading = false ; fileType = convertFilterToType ( saveOpenFileChooser . getFileFilter ( ) ) ; final File f = saveOpenFileChooser . getSelectedFile ( ) ; if ( ! fileType . isValid ( f ) ) { JOptionPane . showMessageDialog ( saveOpenFileChooser , "That file is not compatible with the chosen file type" , "Invalid File" , JOptionPane . WARNING_MESSAGE ) ; loading = true ; continue ; } switch ( fileType ) { case XML_ANALYSIS : if ( ! f . getName ( ) . endsWith ( ".xml" ) ) { JOptionPane . showMessageDialog ( saveOpenFileChooser , L10N . getLocalString ( "dlg.not_xml_data_lbl" , "This is not a saved bug XML data file." ) ) ; loading = true ; continue tryAgain ; } if ( ! mainFrame . openAnalysis ( f , fileType ) ) { JOptionPane . showMessageDialog ( saveOpenFileChooser , "An error occurred while trying to load the analysis." ) ; loading = true ; continue tryAgain ; } break ; case FBP_FILE : if ( ! openFBPFile ( f ) ) { JOptionPane . showMessageDialog ( saveOpenFileChooser , "An error occurred while trying to load the analysis." ) ; loading = true ; continue tryAgain ; } break ; case FBA_FILE : if ( ! openFBAFile ( f ) ) { JOptionPane . showMessageDialog ( saveOpenFileChooser , "An error occurred while trying to load the analysis." ) ; loading = true ; continue tryAgain ; } break ; default : assert false ; } } }
this method is for when the user wants to open a file .
