Revision: 5001
          http://sourceforge.net/p/jump-pilot/code/5001
Author:   michaudm
Date:     2016-08-14 14:54:45 +0000 (Sun, 14 Aug 2016)
Log Message:
-----------
Cleaning SaveToDataStorePanel

Modified Paths:
--------------
    
core/trunk/src/org/openjump/core/ui/plugin/datastore/DataStoreSaveDriverPanel.java
    
core/trunk/src/org/openjump/core/ui/plugin/datastore/SaveToDataStorePanel.java

Modified: 
core/trunk/src/org/openjump/core/ui/plugin/datastore/DataStoreSaveDriverPanel.java
===================================================================
--- 
core/trunk/src/org/openjump/core/ui/plugin/datastore/DataStoreSaveDriverPanel.java
  2016-07-30 19:39:37 UTC (rev 5000)
+++ 
core/trunk/src/org/openjump/core/ui/plugin/datastore/DataStoreSaveDriverPanel.java
  2016-08-14 14:54:45 UTC (rev 5001)
@@ -245,6 +245,10 @@
         return tableComboBox.getSelectedItem().toString();
     }
 
+    public void setTableName(String tableName) {
+        tableComboBox.setSelectedItem(tableName);
+    }
+
     public boolean isCreatePrimaryKeyColumnSelected() {
         return createPrimaryKeyCheckBox.isSelected();
     }

Modified: 
core/trunk/src/org/openjump/core/ui/plugin/datastore/SaveToDataStorePanel.java
===================================================================
--- 
core/trunk/src/org/openjump/core/ui/plugin/datastore/SaveToDataStorePanel.java  
    2016-07-30 19:39:37 UTC (rev 5000)
+++ 
core/trunk/src/org/openjump/core/ui/plugin/datastore/SaveToDataStorePanel.java  
    2016-08-14 14:54:45 UTC (rev 5001)
@@ -41,18 +41,7 @@
     if (connectionDescriptor != null) {
       setConnectionDescriptor((ConnectionDescriptor)connectionDescriptor);
     }
-
-//
-    //// reset selection
-    //setData(SaveFileWizard.DATAKEY_DATASOURCEQUERYCHOOSER, null);
-    //setData(SaveFileWizard.DATAKEY_FILE, null);
-    //setSelectedFile(new File(""));
-//
-    //// preset selected layer name, if set
-    //String dataSetName = (String) getData(SaveFileWizard.DATAKEY_LAYERNAME);
-    //if (dataSetName != null && !dataSetName.isEmpty()) {
-    //  setSelectedFile(new File(dataSetName));
-    //}
+    
setTableName(getData(SaveWizardPlugIn.DATAKEY_SIMPLIFIED_LAYERNAME).toString());
   }
 
   @Override
@@ -60,16 +49,8 @@
     if (!isInputValid())
       throw new CancelNextException();
 
-    //File file = (File) getData(SaveFileWizard.DATAKEY_FILE);
-    //// file overwriting is only checked when the selection is finally 
approved
-    //if (file.exists()) {
-    //  boolean overwrite = GUIUtil.showConfirmOverwriteDialog(getDialog(), 
file);
-    //  if (!overwrite)
-    //    throw new CancelNextException();
-    //}
-    //// save last folder visited
-    //Blackboard blackboard = PersistentBlackboardPlugIn.get(workbenchContext);
-    //blackboard.put(LASTFILE, file.getPath());
+    Blackboard blackboard = PersistentBlackboardPlugIn.get(workbenchContext);
+    blackboard.put(LASTCONNECTION, 
WritableDataStoreDataSource.CONNECTION_DESCRIPTOR_KEY);
   }
 
   @Override
@@ -107,52 +88,11 @@
     setData(WritableDataStoreDataSource.CREATE_PK, null);
     //setData(WritableDataStoreDataSource.DATAKEY_NORMALIZE_TABLE_NAME, null);
     setData(WritableDataStoreDataSource.NORMALIZED_COLUMN_NAMES, null);
-    //setData(SaveToDataStoreWizard.DATAKEY_DATASOURCEQUERYCHOOSER, null);
-    //setData(SaveToDataStoreWizard.DATAKEY_FILE, null);
 
-    // [2016.07 ede] the following runs the filechoosers own routine to fill up
-    // the internal selected files vars properly
-    //JFileChooser jfc = this;
-    //FileChooserUI fcui = jfc.getUI();
-    //if (!isInputValidApproveRun && fcui instanceof BasicFileChooserUI) {
-    //  BasicFileChooserUI bfcui = (BasicFileChooserUI) fcui;
-    //  // we insist on some filename in the textfield
-    //  String filename = bfcui.getFileName();
-    //  if (!(filename instanceof String) || filename.length() < 1)
-    //    return false;
-//
-    //  isInputValidApproveRun = true;
-    //  bfcui.getApproveSelectionAction().actionPerformed(
-    //          new ActionEvent(new JButton(), 0, "nix"));
-    //  isInputValidApproveRun = false;
-    //}
-//
-    //// no file selected
-    //File file = jfc.getSelectedFile();
-    //if (!(file instanceof File) || file.getName().isEmpty())
-    //  return false;
-//
-    //FileFilter filter = getFileFilter();
-    //// no valid filter selected
-    //if (!(filter instanceof FileDataSourceQueryChooserExtensionFilter))
-    //  return false;
-    //FileDataSourceQueryChooserExtensionFilter datasourcefilter = 
(FileDataSourceQueryChooserExtensionFilter) filter;
-    //String[] extensions = ((FileDataSourceQueryChooserExtensionFilter) 
filter)
-    //        .getExtensions();
-    //if (extensions.length > 0) {
-    //  // only treat files w/ missing extension here
-    //  if (!file.isDirectory() && !hasValidExtension(file, extensions)) {
-    //    file = new File(file.getPath() + "." + extensions[0]);
-    //  }
-    //}
-//
-    //if (file.isDirectory() || file.getName().isEmpty())
-    //  return false;
-//
-    //// save successful selection
-    //setData(SaveFileWizard.DATAKEY_DATASOURCEQUERYCHOOSER,
-    //        datasourcefilter.getFileDataSourceQueryChooser());
-    //setData(SaveFileWizard.DATAKEY_FILE, file);
+    if (getConnectionDescriptor() == null ||
+            getTableName() == null || getTableName().trim().length() == 0) {
+      return false;
+    }
 
     setData(WritableDataStoreDataSource.CONNECTION_DESCRIPTOR_KEY, 
getConnectionDescriptor());
     setData(WritableDataStoreDataSource.DATASET_NAME_KEY, 
getData(SaveWizardPlugIn.DATAKEY_SIMPLIFIED_LAYERNAME));


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to