Merge branch 'release/5.18.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / dialog / selection / CommonNameReferenceSelectionDialog.java
1 /**
2 * Copyright (C) 2018 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 package eu.etaxonomy.taxeditor.ui.dialog.selection;
10
11 import org.eclipse.swt.widgets.Shell;
12
13 import eu.etaxonomy.cdm.api.service.IReferenceService;
14 import eu.etaxonomy.cdm.model.common.MarkerType;
15 import eu.etaxonomy.cdm.model.reference.Reference;
16 import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
17 import eu.etaxonomy.taxeditor.newWizard.NewCommonNameReferenceWizard;
18 import eu.etaxonomy.taxeditor.store.CdmStore;
19
20 /**
21 * @author k.luther
22 * @since 26.09.2018
23 *
24 */
25 public class CommonNameReferenceSelectionDialog extends ReferenceSelectionDialog {
26
27 /**
28 * @param shell
29 * @param title
30 * @param multi
31 * @param reference
32 */
33 protected CommonNameReferenceSelectionDialog(Shell shell, String title, boolean multi, Reference reference) {
34 super(shell, title, multi, reference);
35
36 }
37
38
39 /* (non-Javadoc)
40 * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#search
41 */
42 /** {@inheritDoc} */
43 @Override
44 protected void callService(String pattern) {
45
46 model = CdmStore.getService(IReferenceService.class).findUuidAndTitleCacheByMarker(100, pattern, MarkerType.COMMON_NAME_REFERENCE());
47
48
49 }
50
51 /**
52 * <p>select</p>
53 *
54 * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
55 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
56 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
57 * @return a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
58 */
59
60 public static Reference select(Shell shell, //ConversationHolder conversation,
61 Reference reference) {
62 CommonNameReferenceSelectionDialog dialog = new CommonNameReferenceSelectionDialog(shell,// conversation,
63 "Choose a common name reference", isInReference, reference);
64 return getSelectionFromDialog(dialog);
65 }
66
67 @Override
68 protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
69 return new NewCommonNameReferenceWizard(null);
70 }
71
72 }