Skip to content
Snippets Groups Projects
Commit 50bb33d9 authored by Simon Barner's avatar Simon Barner
Browse files

- Avoid data loss / display error in case the user cancels the dialog

refs 1841
parent 55d6bdc7
No related branches found
No related tags found
No related merge requests found
......@@ -99,7 +99,7 @@ public class MultiSelectionCellEditor extends DialogCellEditor {
private class MultiSelectionDialog extends Dialog {
/** Element selection dialog */
DualList dl = null;
private DualList dl = null;
/** Constructs a new {@link MultiSelectionDialog}. */
public MultiSelectionDialog(Shell parentShell) {
......@@ -181,13 +181,5 @@ public class MultiSelectionCellEditor extends DialogCellEditor {
super.okPressed();
}
/** {@inheritDoc} */
@Override
protected void cancelPressed() {
selectedElements = null;
super.cancelPressed();
}
}
}
......@@ -17,6 +17,7 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.annotation.editingsupport;
import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.jface.viewers.CellEditor;
......@@ -81,7 +82,13 @@ public class MultiSelectionEditingSupport extends AnnotationEditingSupportBase {
new LabelValueMapping(eStructuralFeatureDescriptor, specification,
((AnnotationEntry)element).getModelElement(), null);
multiSelectionEditDialog.updateData(labelValueMapping, (Collection<?>)value);
// Values need to be copied since during the set operation in setValue(), the original
// reference will be cleared. Hence, in case the user canceled the edit (in
// MultiSelectionCellEditor), the original set of values (that is passed to setValue())
// would be lost
ArrayList<Object> valuesCopy = new ArrayList<Object>();
valuesCopy.addAll((Collection<?>)value);
multiSelectionEditDialog.updateData(labelValueMapping, valuesCopy);
return multiSelectionEditDialog;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment