Updates to preferences
Modified filter selection to maintain previous selections
diff --git a/cda/plugins/org.eclipse.mdht.uml.cda.ui/src/org/eclipse/mdht/uml/cda/ui/editors/MDHTPreferences.java b/cda/plugins/org.eclipse.mdht.uml.cda.ui/src/org/eclipse/mdht/uml/cda/ui/editors/MDHTPreferences.java
index f5972f2..fc47833 100644
--- a/cda/plugins/org.eclipse.mdht.uml.cda.ui/src/org/eclipse/mdht/uml/cda/ui/editors/MDHTPreferences.java
+++ b/cda/plugins/org.eclipse.mdht.uml.cda.ui/src/org/eclipse/mdht/uml/cda/ui/editors/MDHTPreferences.java
@@ -76,7 +76,7 @@
/**
* @TODO
- * Column Selection for reports needs to become more robust
+ * Column Selection for reports needs to become more robust
* This is currently overloaded to omit or keep both patient DOB and name
* The store value was kept the same to avoid storage issues
*/
@@ -134,7 +134,6 @@
super.createButtonsForButtonBar(parent);
getButton(IDialogConstants.CANCEL_ID).setText(CLEAR_FILTER);
getButton(IDialogConstants.OK_ID).setText(SET_FILTER);
-
}
}
@@ -233,12 +232,18 @@
filterSelectionDialog.setMessage(SELECT_FILTER);
- HashMap<EClass, HashSet<EClass>> theSectionCache = new HashMap<EClass, HashSet<EClass>>();
+ final HashMap<EClass, HashSet<EClass>> theSectionCache = new HashMap<EClass, HashSet<EClass>>();
getFilterHash(theSectionCache);
filterSelectionDialog.setElements(theSectionCache.keySet().toArray());
filterSelectionDialog.setMultipleSelection(true);
+ String currentSelections = cdaReportFilterText.getText();
+
+ // currentSelections.split("\\s*,\\s*"));
+
+ // filterSelectionDialog.setInitialElementSelections(selectedElements);
+
Button button = new Button(group, SWT.PUSH | SWT.LEFT);
button.setText(label);
button.setToolTipText(toolTip);
@@ -249,15 +254,31 @@
@Override
public void handleEvent(Event event) {
- cdaReportfilters.clear();
- if (filterSelectionDialog.open() != Window.OK) {
- cdaReportFilterText.setText(NONE);
- return;
+ String currentSelections = cdaReportFilterText.getText();
+
+ final List<EClass> l = new ArrayList<EClass>();
+
+ for (Object x : theSectionCache.keySet().toArray()) {
+ EClass eClass = (EClass) x;
+ if (currentSelections.contains(formatFilterName(eClass.getName()))) {
+ l.add(eClass);
+ }
+
}
- for (Object object : filterSelectionDialog.getResult()) {
- cdaReportfilters.add(((EClass) object).getName());
+ filterSelectionDialog.setInitialElementSelections(l);
+
+ switch (filterSelectionDialog.open()) {
+ case Window.OK:
+ for (Object object : filterSelectionDialog.getResult()) {
+ cdaReportfilters.add(((EClass) object).getName());
+ }
+ cdaReportFilterText.setText(formatFilterNames(cdaReportfilters));
+ break;
+ case Window.CANCEL:
+ cdaReportfilters.clear();
+ cdaReportFilterText.setText(NONE);
+ break;
}
- cdaReportFilterText.setText(formatFilterNames(cdaReportfilters));
}
});
return button;