From 6b9eae6c5a6f302406fcbf5caf03c081453ba31b Mon Sep 17 00:00:00 2001 From: "antonio.fabio" Date: Mon, 2 Jul 2007 12:52:35 +0200 Subject: [PATCH] fixed err. mess. popup when no data associated to current chart --- src/java/org/tsho/dmc2/ui/AbstractPlotComponent.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/java/org/tsho/dmc2/ui/AbstractPlotComponent.java b/src/java/org/tsho/dmc2/ui/AbstractPlotComponent.java index a7b1355..bc8963a 100644 --- a/src/java/org/tsho/dmc2/ui/AbstractPlotComponent.java +++ b/src/java/org/tsho/dmc2/ui/AbstractPlotComponent.java @@ -1188,22 +1188,21 @@ ManagerListener2, PlotComponent { * Saves current dataset to a user picked file * */ public void saveDataAs() throws IOException { + if(dataobject==null) { + JOptionPane.showMessageDialog(null, "No data associated to current chart", "Error", JOptionPane.ERROR_MESSAGE); + return; + } JFileChooser fileChooser = new JFileChooser(); int option = fileChooser.showSaveDialog(this); if (option == JFileChooser.APPROVE_OPTION) { String filename = fileChooser.getSelectedFile().getPath(); try { - if(dataobject!=null) - dataobject.save(new File(filename)); -//TODO: popup an error message box - else throw new RuntimeException("No data associated to current chart"); + dataobject.save(new File(filename)); } catch (IOException e) { -// TODO: popup an error message box - System.err.println("Can't save file"); - throw e; + JOptionPane.showMessageDialog(null, "Can't save file", "Error", JOptionPane.ERROR_MESSAGE); } - } - } + } + } protected void finalize() { System.out.println("finalizing: " + getClass()); -- 2.11.4.GIT