/** Runs this thread. */ public void run() { CommonFileChooser file_chooser = new CommonFileChooser(); file_chooser.setDialogTitle("Save package file."); file_chooser.setMultiSelectionEnabled(false); file_chooser.addChoosableFileFilter(new XmlFilter()); file_chooser.setSelectedFile(new File("package.xml")); if (file_chooser.showSaveDialog(pane) == JFileChooser.APPROVE_OPTION) { try { File file = file_chooser.getSelectedFile(); if (file.exists()) { String message = "Overwrite to " + file.getPath() + " ?"; if (0 != JOptionPane.showConfirmDialog( pane, message, "Confirmation", JOptionPane.YES_NO_OPTION)) { return; } } // Outputs the variability XML file. XmlVariabilityHolder holder = new XmlVariabilityHolder(); Variability[] records = getSelectedRecords(); for (int i = 0; i < records.length; i++) { XmlVariability variability = new XmlVariability(records[i]); holder.addVariability(variability); } holder.write(file); String message = "Completed."; JOptionPane.showMessageDialog(pane, message); } catch (IOException exception) { String message = "Failed."; JOptionPane.showMessageDialog(pane, message, "Error", JOptionPane.ERROR_MESSAGE); } } }