ref #7502 Save table settings when closing bulk editor
authorPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 8 Oct 2018 10:40:52 +0000 (12:40 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 8 Oct 2018 10:40:52 +0000 (12:40 +0200)
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4Composite.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorSearchE4.java

index c889f4c5c5d44c926e71ca399cecdafda87b7408..6bb6308aa850c9f17c417c9d4abe0423bc8c0288 100644 (file)
@@ -9,6 +9,9 @@
 
 package eu.etaxonomy.taxeditor.bulkeditor.e4;
 
+import java.io.FileOutputStream;
+import java.io.IOException;
+
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.inject.Inject;
@@ -147,6 +150,15 @@ public class BulkEditorE4 implements IPartContentHasDetails, IConversationEnable
                input.dispose();
            }
            dirty.setDirty(false);
+           //save table settings
+           if(bulkEditorComposite.getNatTableState()!=null){
+            try (FileOutputStream tableStateStream =
+                    new FileOutputStream(bulkEditorComposite.getStatePropertiesFile())) {
+                bulkEditorComposite.getNatTableState().store(tableStateStream, null);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+            }
+        }
        }
 
     @Optional
index 50a9eecbf684b2e813de2f2a901835bada4b7e5d..30d1fc5acf9f20056ecc51d8026d969f1834786a 100644 (file)
@@ -9,11 +9,13 @@
 
 package eu.etaxonomy.taxeditor.bulkeditor.e4;
 
+import java.io.File;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 
 import javax.inject.Inject;
 
@@ -446,4 +448,12 @@ public class BulkEditorE4Composite extends Composite {
         return natTable;
     }
 
+    public Properties getNatTableState() {
+        return bulkEditorSearch.getNatTableState();
+    }
+
+    File getStatePropertiesFile() {
+        return bulkEditorSearch.getStatePropertiesFile();
+    }
+
 }
index d385dfc72ccc3dca125b0002a92bf89ea4f82bff..4a704565b0dc1b4b8e92dc5582f78ae35a5af0cc 100644 (file)
@@ -130,10 +130,14 @@ public class BulkEditorSearchE4 {
         return displayPersistenceDialogCommandHandler;
     }
 
-    private File getStatePropertiesFile() {
+    File getStatePropertiesFile() {
         return new File(WorkbenchUtility.getBaseLocation(), "bulkeditor_tablestate.properties"); //$NON-NLS-1$
     }
 
+    Properties getNatTableState() {
+        return natTableState;
+    }
+
        /**
         * Handles focus changes for the textfield.
         */