From: <wu...@us...> - 2008-04-06 13:57:44
|
Revision: 107 http://davinspector.svn.sourceforge.net/davinspector/?rev=107&view=rev Author: wuest Date: 2008-04-06 06:57:37 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Corrected some flaws with path/file handling. Added comments. Modified Paths: -------------- trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/JCategoryTable.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingConfigurationPanel.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/ui/JRawTextPane.java Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/JCategoryTable.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/JCategoryTable.java 2008-04-06 13:54:38 UTC (rev 106) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/JCategoryTable.java 2008-04-06 13:57:37 UTC (rev 107) @@ -1,7 +1,8 @@ /* * JCategoryTable.java * - * TODO: wues_ha Enter comment! + * This class is an extension of JPanel and displays a table with + * a toggle button on top. The toggle button hides or shows the table. * * Created: 03.04.2008 Jochen Wuest <joc...@dl...> * Changed: @@ -40,7 +41,8 @@ /** - * TODO: wues_ha: Enter comment! + * This class is an extension of JPanel and displays a table with + * a toggle button on top. The toggle button hides or shows the table. * * @version $LastChangedRevision$ * @author Jochen Wuest Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingConfigurationPanel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingConfigurationPanel.java 2008-04-06 13:54:38 UTC (rev 106) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingConfigurationPanel.java 2008-04-06 13:57:37 UTC (rev 107) @@ -26,6 +26,7 @@ package de.dlr.davinspector.plugins.recordingplugin; import java.io.File; +import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; @@ -106,14 +107,19 @@ fileChooser.setSelectedFile(new File(myFilename)); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); - int returnValue = fileChooser.showSaveDialog(myParent.getUI()); - - if (returnValue == JFileChooser.APPROVE_OPTION) { - File file = fileChooser.getSelectedFile(); + if (fileChooser.showSaveDialog(myParent.getUI()) == JFileChooser.APPROVE_OPTION) { + File file = fileChooser.getSelectedFile(); + // if the file does not exist, create it + try { + file.createNewFile(); + } catch (IOException ioe) { + Util.showIOExceptionMessageDialog(ioe); + } myFilename = file.getAbsolutePath(); myParent.setRecordingFile(file); } - jTextFieldFilename.setText(myFilename); + + jTextFieldFilename.setText(myFilename); } /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingPlugin.java 2008-04-06 13:54:38 UTC (rev 106) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingPlugin.java 2008-04-06 13:57:37 UTC (rev 107) @@ -33,6 +33,7 @@ import javax.swing.JComponent; +import de.dlr.davinspector.common.Util; import de.dlr.davinspector.history.AMessage; import de.dlr.davinspector.plugin.IViewPlugin; import de.dlr.davinspector.plugin.PluginManager; @@ -166,8 +167,8 @@ try { myBufferedWriter.close(); } catch (IOException ioe) { - System.err.println(ioe.getMessage()); - } + Util.showIOExceptionMessageDialog(ioe); + } myBufferedWriter = null; } } @@ -204,8 +205,8 @@ try { myBufferedWriter.append(msg.getRawData()); } catch (IOException ioe) { - System.err.println(ioe.getMessage()); - } + Util.showIOExceptionMessageDialog(ioe); + } } } @@ -221,8 +222,8 @@ FileWriter fileWriter = new FileWriter(recordFile, true); myBufferedWriter = new BufferedWriter(fileWriter); } catch (IOException ioe) { - System.err.println(ioe.getMessage()); - } + Util.showIOExceptionMessageDialog(ioe); + } } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/JRawTextPane.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/JRawTextPane.java 2008-04-06 13:54:38 UTC (rev 106) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/JRawTextPane.java 2008-04-06 13:57:37 UTC (rev 107) @@ -44,7 +44,6 @@ import javax.swing.Action; import javax.swing.JFileChooser; import javax.swing.JMenuItem; -import javax.swing.JOptionPane; import javax.swing.JPopupMenu; import javax.swing.JTextPane; import javax.swing.text.BadLocationException; @@ -53,6 +52,7 @@ import de.dlr.davinspector.common.Constant.Direction; import de.dlr.davinspector.common.Internationalization; +import de.dlr.davinspector.common.Util; /** @@ -123,7 +123,7 @@ } } }; - + /** * Action: Copy selected text to the clip board. */ @@ -150,7 +150,7 @@ } } }; - + /** * Action: Cut. Selected text is copied to the clip board. */ @@ -220,11 +220,7 @@ out.flush(); out.close(); } catch (IOException ioe) { - JOptionPane.showMessageDialog(myRawTextPane, - Internationalization.getTranslation("dlg_ioerror_text") + "\n" - + ioe.getLocalizedMessage(), - Internationalization.getTranslation("dlg_ioerror_title"), - JOptionPane.ERROR_MESSAGE); + Util.showIOExceptionMessageDialog(ioe); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |