1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.ui.dialog.selection;
|
11
|
|
12
|
import java.util.UUID;
|
13
|
|
14
|
import org.eclipse.swt.widgets.Shell;
|
15
|
|
16
|
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
|
17
|
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
|
18
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
|
19
|
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
|
20
|
import eu.etaxonomy.taxeditor.newWizard.NewDerivedUnitBaseWizard;
|
21
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
22
|
|
23
|
/**
|
24
|
* @author pplitzner
|
25
|
*/
|
26
|
public class SpecimenOrObservationBaseSelectionDialog extends
|
27
|
AbstractFilteredCdmResourceSelectionDialog<SpecimenOrObservationBase> {
|
28
|
|
29
|
public static SpecimenOrObservationBase select(Shell shell, //ConversationHolder conversation,
|
30
|
SpecimenOrObservationBase observation){
|
31
|
SpecimenOrObservationBaseSelectionDialog dialog = new SpecimenOrObservationBaseSelectionDialog(shell, //conversation,
|
32
|
"Choose field unit or derived unit", false, SpecimenOrObservationBaseSelectionDialog.class.getCanonicalName(), observation);
|
33
|
return getSelectionFromDialog(dialog);
|
34
|
}
|
35
|
|
36
|
protected SpecimenOrObservationBaseSelectionDialog(Shell shell, //ConversationHolder conversation,
|
37
|
String title, boolean multi, String settings,
|
38
|
SpecimenOrObservationBase cdmObject) {
|
39
|
super(shell, //conversation,
|
40
|
title, multi, settings, cdmObject);
|
41
|
}
|
42
|
|
43
|
/** {@inheritDoc} */
|
44
|
@Override
|
45
|
protected SpecimenOrObservationBase getPersistentObject(UUID uuid) {
|
46
|
Object object = CdmStore.getService(IOccurrenceService.class).load(uuid);
|
47
|
return HibernateProxyHelper.deproxy(object, SpecimenOrObservationBase.class);
|
48
|
}
|
49
|
|
50
|
/** {@inheritDoc} */
|
51
|
@Override
|
52
|
protected void callService(String pattern) {
|
53
|
model =CdmStore.getService(IOccurrenceService.class).getUuidAndTitleCache(limitOfInitialElements,pattern);
|
54
|
}
|
55
|
|
56
|
/** {@inheritDoc} */
|
57
|
@Override
|
58
|
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
|
59
|
return new NewDerivedUnitBaseWizard();
|
60
|
}
|
61
|
|
62
|
/** {@inheritDoc} */
|
63
|
@Override
|
64
|
protected String[] getNewWizardText() {
|
65
|
return new String[]{"New Field Unit/Derived Unit"};
|
66
|
}
|
67
|
}
|