[hg] main-silver: #232012: File paths for LOB save dialogs shoul...

  • From: Libor Fischmeistr < >
  • To:
  • Subject: [hg] main-silver: #232012: File paths for LOB save dialogs shoul...
  • Date: Wed, 11 Dec 2013 22:54:22 +0000

changeset adf51eb51e16 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/adf51eb51e16
description:
        #232012: File paths for LOB save dialogs should be remembered

diffstat:

 
db.dataview/src/org/netbeans/modules/db/dataview/table/celleditor/BlobFieldTableCellEditor.java
 |  24 ++++--
 
db.dataview/src/org/netbeans/modules/db/dataview/table/celleditor/ClobFieldTableCellEditor.java
 |  33 ++++++---
 2 files changed, 35 insertions(+), 22 deletions(-)

diffs (122 lines):

diff --git 
a/db.dataview/src/org/netbeans/modules/db/dataview/table/celleditor/BlobFieldTableCellEditor.java
 
b/db.dataview/src/org/netbeans/modules/db/dataview/table/celleditor/BlobFieldTableCellEditor.java
--- 
a/db.dataview/src/org/netbeans/modules/db/dataview/table/celleditor/BlobFieldTableCellEditor.java
+++ 
b/db.dataview/src/org/netbeans/modules/db/dataview/table/celleditor/BlobFieldTableCellEditor.java
@@ -74,16 +74,18 @@
         ActionListener, AlwaysEnable {
     private static final Logger LOG = Logger.getLogger(
             BlobFieldTableCellEditor.class.getName());
+    private static final String EDIT = "edit";
 
-    protected static final String EDIT = "edit";
-    protected Blob currentValue;
-    protected JButton button;
-    protected JPopupMenu popup;
-    protected JTable table;
-    protected JMenuItem saveContentMenuItem;
-    protected JMenuItem miOpenImageMenuItem;
-    protected JMenuItem miLobLoadAction;
-    protected JMenuItem miLobNullAction;
+    private static File lastFile;
+
+    private Blob currentValue;
+    private JButton button;
+    private JPopupMenu popup;
+    private JTable table;
+    private JMenuItem saveContentMenuItem;
+    private JMenuItem miOpenImageMenuItem;
+    private JMenuItem miLobLoadAction;
+    private JMenuItem miLobNullAction;
 
     @SuppressWarnings("LeakingThisInConstructor")
     public BlobFieldTableCellEditor() {
@@ -208,9 +210,11 @@
             return;
         }
         JFileChooser c = new JFileChooser();
+        c.setCurrentDirectory(lastFile);
         int fileDialogState = c.showSaveDialog(table);
         if (fileDialogState == JFileChooser.APPROVE_OPTION) {
             File f = c.getSelectedFile();
+            lastFile = f;
             InputStream is;
             FileOutputStream fos;
             try {
@@ -231,10 +235,12 @@
 
     private Blob loadLobFromFile() {
         JFileChooser c = new JFileChooser();
+        c.setCurrentDirectory(lastFile);
         Blob result = null;
         int fileDialogState = c.showOpenDialog(table);
         if (fileDialogState == JFileChooser.APPROVE_OPTION) {
             File f = c.getSelectedFile();
+            lastFile = f;
             FileInputStream fis;
             try {
                 fis = new FileInputStream(f);
diff --git 
a/db.dataview/src/org/netbeans/modules/db/dataview/table/celleditor/ClobFieldTableCellEditor.java
 
b/db.dataview/src/org/netbeans/modules/db/dataview/table/celleditor/ClobFieldTableCellEditor.java
--- 
a/db.dataview/src/org/netbeans/modules/db/dataview/table/celleditor/ClobFieldTableCellEditor.java
+++ 
b/db.dataview/src/org/netbeans/modules/db/dataview/table/celleditor/ClobFieldTableCellEditor.java
@@ -95,19 +95,22 @@
     }
     private static final Logger LOG = Logger.getLogger(
             ClobFieldTableCellEditor.class.getName());
-    protected static final String EDIT = "edit";
-    protected Clob currentValue;
-    protected JButton button;
-    protected JPopupMenu popup;
-    protected JTable table;
-    protected int currentRow;
-    protected int currentColumn;
-    protected int currentModelRow;
-    protected int currentModelColumn;
-    protected JMenuItem saveContentMenuItem;
-    protected JMenuItem editContentMenuItem;
-    protected JMenuItem loadContentMenuItem;
-    protected JMenuItem nullContentMenuItem;
+    private static final String EDIT = "edit";
+    
+    private static File lastFile;
+    
+    private Clob currentValue;
+    private JButton button;
+    private JPopupMenu popup;
+    private JTable table;
+    private int currentRow;
+    private int currentColumn;
+    private int currentModelRow;
+    private int currentModelColumn;
+    private JMenuItem saveContentMenuItem;
+    private JMenuItem editContentMenuItem;
+    private JMenuItem loadContentMenuItem;
+    private JMenuItem nullContentMenuItem;
     
     @SuppressWarnings("LeakingThisInConstructor")
     public ClobFieldTableCellEditor() {
@@ -238,10 +241,12 @@
         }
         CharsetSelector charset = new CharsetSelector();
         JFileChooser c = new JFileChooser();
+        c.setCurrentDirectory(lastFile);
         c.setAccessory(charset);
         int fileDialogState = c.showSaveDialog(table);
         if (fileDialogState == JFileChooser.APPROVE_OPTION) {
             File f = c.getSelectedFile();
+            lastFile = f;
             Reader r;
             Writer w;
             try {
@@ -263,11 +268,13 @@
     private Clob loadLobFromFile() {
         CharsetSelector charset = new CharsetSelector();
         JFileChooser c = new JFileChooser();
+        c.setCurrentDirectory(lastFile);
         c.setAccessory(charset);
         Clob result = null;
         int fileDialogState = c.showOpenDialog(table);
         if (fileDialogState == JFileChooser.APPROVE_OPTION) {
             File f = c.getSelectedFile();
+            lastFile = f;
             Reader r;
             try {
                 result = new FileBackedClob();

[hg] main-silver: #232012: File paths for LOB save dialogs shoul...

Libor Fischmeistr 12/11/2013

Project Features

About this Project

DB was started in November 2009, is owned by Antonin Nebuzelsky, and has 113 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close