public void openTests(File file) throws DataException { form.setTitle(L.get("ui.title.file", file.getName())); currentFile = file.getAbsolutePath(); try { InputStream in = new BufferedInputStream(new FileInputStream(currentFile)); try { form.resetEditor(); tests.clear(); reader.read(in, tests, actions); form.selectionChanged(); } finally { in.close(); } } catch (IOException e) { throw new DataException(e); } }
public void saveTests() throws DataException { if (currentFile == null) { File file = form.showSaveDialog(); if (file == null) return; form.setTitle(L.get("ui.title.file", file.getName())); currentFile = file.toString(); } try { OutputStream out = new BufferedOutputStream(new FileOutputStream(currentFile)); try { writer.write(out, tests); } finally { out.close(); } } catch (IOException e) { throw new DataException(e); } }
public void newTests() { currentFile = null; form.setTitle(L.get("ui.title")); tests.clear(); form.selectionChanged(); }