Revision: 6013
          http://sourceforge.net/p/jump-pilot/code/6013
Author:   ma15569
Date:     2018-12-06 14:31:07 +0000 (Thu, 06 Dec 2018)
Log Message:
-----------
Correct small bug on loading/saving styles if no file is load/save at all

Modified Paths:
--------------
    core/trunk/src/org/openjump/core/ui/plugin/style/LoadStylePlugIn.java
    core/trunk/src/org/openjump/core/ui/plugin/style/SaveStylePlugIn.java

Modified: core/trunk/src/org/openjump/core/ui/plugin/style/LoadStylePlugIn.java
===================================================================
--- core/trunk/src/org/openjump/core/ui/plugin/style/LoadStylePlugIn.java       
2018-12-02 15:37:12 UTC (rev 6012)
+++ core/trunk/src/org/openjump/core/ui/plugin/style/LoadStylePlugIn.java       
2018-12-06 14:31:07 UTC (rev 6013)
@@ -96,9 +96,12 @@
     public boolean execute(PlugInContext context) throws Exception {
         layer = context.getSelectedLayer(0);
 
-        fc.setCurrentDirectory(new File((String) PersistentBlackboardPlugIn
-                .get(context.getWorkbenchContext()).get(
-                        FILE_CHOOSER_DIRECTORY_KEY)));
+        if (PersistentBlackboardPlugIn.get(context.getWorkbenchContext()).get(
+                FILE_CHOOSER_DIRECTORY_KEY) != null) {
+            fc.setCurrentDirectory(new File((String) PersistentBlackboardPlugIn
+                    .get(context.getWorkbenchContext()).get(
+                            FILE_CHOOSER_DIRECTORY_KEY)));
+        }
         fc.setDialogTitle(name);
         fc.setDialogType(JFileChooser.OPEN_DIALOG);
         fc.setFileSelectionMode(JFileChooser.FILES_ONLY);

Modified: core/trunk/src/org/openjump/core/ui/plugin/style/SaveStylePlugIn.java
===================================================================
--- core/trunk/src/org/openjump/core/ui/plugin/style/SaveStylePlugIn.java       
2018-12-02 15:37:12 UTC (rev 6012)
+++ core/trunk/src/org/openjump/core/ui/plugin/style/SaveStylePlugIn.java       
2018-12-06 14:31:07 UTC (rev 6013)
@@ -98,11 +98,13 @@
 
         layer = context.getSelectedLayer(0);
 
-        fc.setCurrentDirectory(
+        if (PersistentBlackboardPlugIn.get(context.getWorkbenchContext()).get(
+                FILE_CHOOSER_DIRECTORY_KEY) != null) {
+            fc.setCurrentDirectory(new File((String) PersistentBlackboardPlugIn
+                    .get(context.getWorkbenchContext()).get(
+                            FILE_CHOOSER_DIRECTORY_KEY)));
+        }
 
-        new File((String) PersistentBlackboardPlugIn.get(
-                
context.getWorkbenchContext()).get(FILE_CHOOSER_DIRECTORY_KEY)));
-
         fc.setSelectedFile(new File(fc.getCurrentDirectory(), layer.getName()
                 .replaceAll("[/:\\\\><\\|]", "_")));
 



_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to