Add SCL support for exporting subscription data as CSV
[simantics/platform.git] / bundles / org.simantics.charts / src / org / simantics / charts / ui / CSVExportPage.java
index 002884d98131a9c54b72817c609d1092817ba531..047376dbbd8e62d64ad56909bacbd645706a55ec 100644 (file)
@@ -410,7 +410,7 @@ public class CSVExportPage extends WizardPage {
             if(hasInitial) {
                model.select(i);
                item.removeAll();
-               exportModel.models.clear();
+               exportModel.items.clear();
                int index = 0;
                int firstIndex = 0;
                for(NamedResource nr : p.second) {
@@ -418,7 +418,7 @@ public class CSVExportPage extends WizardPage {
                        ti.setText(nr.getName());
                        ti.setData(nr);
                        if(selected.contains(nr)) {
-                               exportModel.models.add(nr);
+                               exportModel.items.add(nr.getResource());
                                ti.setChecked(true);
                                if(firstIndex == 0) firstIndex = index;
                        }
@@ -498,7 +498,7 @@ public class CSVExportPage extends WizardPage {
        Pair<NamedResource,List<NamedResource>> p = getModel(selectedModel);
        if(p != null) {
                
-               HashSet<NamedResource> checked = new HashSet<>();
+               Set<Resource> checked = new HashSet<>();
                
                NamedResource existing = (NamedResource)item.getData();
                if(!p.first.equals(existing)) {
@@ -514,10 +514,10 @@ public class CSVExportPage extends WizardPage {
                }
                
                for(TableItem ti : item.getItems()) {
-                       if(ti.getChecked()) checked.add((NamedResource)ti.getData());
+                       if(ti.getChecked()) checked.add(((NamedResource)ti.getData()).getResource());
                }
                
-               exportModel.models = checked;
+               exportModel.items = checked;
                
        }
 
@@ -545,7 +545,7 @@ public class CSVExportPage extends WizardPage {
 
        } else {
                
-               if(exportModel.models.size() > 1) {
+               if(exportModel.items.size() > 1) {
                 setErrorMessage("Recorded samples can only be exported for a single subscription item.");
                 setPageComplete(false);
                 return;
@@ -559,7 +559,7 @@ public class CSVExportPage extends WizardPage {
             return;
        }
        
-        if (exportModel.models.isEmpty()) {
+        if (exportModel.items.isEmpty()) {
             setErrorMessage("No items selected for export.");
             setPageComplete(false);
             return;