private void jMenuItemLoadLSAResultsActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jMenuItemLoadLSAResultsActionPerformed JFileChooser jfc = new JFileChooser(); int fileDialogReturnVal = jfc.showOpenDialog(this); if (fileDialogReturnVal == JFileChooser.APPROVE_OPTION) { try { File inputFile = jfc.getSelectedFile(); FileInputStream fis = new FileInputStream(inputFile); ObjectInputStream ois = new ObjectInputStream(fis); this.currentResults = (LSAResults) ois.readObject(); } catch (IOException e) { log.log(Log.ERROR, "Failed to load LSA results\n" + e.getMessage()); } catch (ClassNotFoundException e) { log.log(Log.ERROR, "Class not found : Error loading LSA results due to version mismatch"); } System.out.println(currentResults == null); } } // GEN-LAST:event_jMenuItemLoadLSAResultsActionPerformed
private void jMenuItemSaveProjectActionPerformed( java.awt.event.ActionEvent evt) // GEN-FIRST:event_jMenuItemSaveProjectActionPerformed { // GEN-HEADEREND:event_jMenuItemSaveProjectActionPerformed if (this.theProject != null) { JFileChooser jfc = new JFileChooser(); int fileDialogReturnVal = jfc.showSaveDialog(this); if (fileDialogReturnVal == JFileChooser.APPROVE_OPTION) { try { File outputFile = jfc.getSelectedFile(); FileOutputStream fos = new FileOutputStream(outputFile); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(this.theProject); if (this.currentResults != null) { oos.writeObject(this.currentResults); } } catch (IOException e) { log.log(Log.ERROR, "Failed to save file\n" + e.getMessage()); } } } } // GEN-LAST:event_jMenuItemSaveProjectActionPerformed
private void jMenuItemLoadProjectActionPerformed( java.awt.event.ActionEvent evt) // GEN-FIRST:event_jMenuItemLoadProjectActionPerformed { // GEN-HEADEREND:event_jMenuItemLoadProjectActionPerformed JFileChooser jfc = new JFileChooser(); if (lastPath != null) { jfc.setCurrentDirectory(lastPath); } int fileDialogReturnVal = jfc.showOpenDialog(this); if (fileDialogReturnVal == JFileChooser.APPROVE_OPTION) { try { File inputFile = jfc.getSelectedFile(); FileInputStream fis = new FileInputStream(inputFile); ObjectInputStream ois = new ObjectInputStream(fis); this.theProject = (Project) ois.readObject(); this.currentResults = (LSAResults) ois.readObject(); lastPath = new File(jfc.getSelectedFile().getPath()); } catch (IOException e) { if (this.theProject == null) { log.log(Log.ERROR, "Failed to load project"); } if (this.currentResults == null) { log.log(Log.WARNING, "Failed to load results"); } log.log(Log.WARNING, e.getMessage()); } catch (ClassNotFoundException e) { log.log(Log.ERROR, "Class not found error, version mismatch"); } } if (this.theProject != null) { jMenuItemViewDocuments.setEnabled(true); jMenuItemSaveProject.setEnabled(true); this.setTitle(theProject.getProjectName()); log.log(Log.INFO, "Project Loaded"); } if (this.currentResults != null) { log.log(Log.INFO, "Results loaded"); } } // GEN-LAST:event_jMenuItemLoadProjectActionPerformed