Refactoring of property change handling. Also fixes #2363
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / selection / ReferenceSelectionElement.java
1 /**
2 *
3 */
4 package eu.etaxonomy.taxeditor.ui.selection;
5
6 import org.eclipse.swt.events.SelectionEvent;
7
8 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
9 import eu.etaxonomy.cdm.api.service.IReferenceService;
10 import eu.etaxonomy.cdm.model.reference.Reference;
11 import eu.etaxonomy.taxeditor.store.CdmStore;
12 import eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.ReferenceSelectionDialog;
13 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
14 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
15
16 /**
17 * <p>
18 * ReferenceSelectionElement class.
19 * </p>
20 *
21 * @author n.hofmann
22 * @version $Id: $
23 */
24 public class ReferenceSelectionElement extends
25 AbstractSelectionElement<Reference> {
26
27 public static final int DEFAULT = EDITABLE | SELECTABLE | DELETABLE;
28
29 /**
30 * <p>
31 * Constructor for ReferenceSelectionElement.
32 * </p>
33 *
34 * @param labelString
35 * a {@link java.lang.String} object.
36 * @param selection
37 * a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase}
38 * object.
39 * @param style
40 * a int.
41 * @param toolkit
42 * a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory}
43 * object.
44 * @param conversation
45 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
46 * object.
47 * @param parentElement
48 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
49 * object.
50 */
51 public ReferenceSelectionElement(CdmFormFactory toolkit,
52 ConversationHolder conversation, ICdmFormElement parentElement,
53 String labelString, Reference selection, int mode, int style) {
54 super(toolkit, conversation, parentElement, labelString, selection,
55 mode, style);
56 }
57
58 /*
59 * (non-Javadoc)
60 *
61 * @see
62 * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt
63 * .events.SelectionEvent)
64 */
65 /** {@inheritDoc} */
66 @Override
67 public void widgetSelected(SelectionEvent e) {
68 Reference newSelection = ReferenceSelectionDialog.select(getShell(),
69 getConversationHolder(), entity);
70
71 setSelectionInternal(newSelection);
72
73 // Reference freshlyLoadedSelection = null;
74 // if (newSelection != null)
75 // freshlyLoadedSelection = CdmStore.getService(
76 // IReferenceService.class).load(newSelection.getUuid());
77 //
78 // setSelectionInternal(freshlyLoadedSelection);
79 }
80 }