Project

General

Profile

Revision 93682936

ID936829364b2913d9bd40ec3d5357e09f1ad50709
Parent aff7bab0
Child 7a572190, 00d02c3f

Added by Katja Luther almost 2 years ago

ref #7345: for common names only common name marked references are selectable now

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewCommonNameReferenceWizard.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.newWizard;
10

  
11
import eu.etaxonomy.cdm.api.service.IReferenceService;
12
import eu.etaxonomy.cdm.model.common.Marker;
13
import eu.etaxonomy.cdm.model.common.MarkerType;
14
import eu.etaxonomy.taxeditor.store.CdmStore;
15

  
16
/**
17
 * @author k.luther
18
 * @since 28.09.2018
19
 *
20
 */
21
public class NewCommonNameReferenceWizard extends NewReferenceWizard {
22

  
23

  
24
    @Override
25
    protected void saveEntity() {
26
        getEntity().addMarker(Marker.NewInstance(MarkerType.COMMON_NAME_REFERENCE(), true));
27
        CdmStore.getService(IReferenceService.class).save(getEntity());
28
    }
29
}
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();
70
    }
71

  
72
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java
45 45
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
46 46
import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
47 47
import eu.etaxonomy.taxeditor.ui.section.agent.TeamMemberElement;
48
import eu.etaxonomy.taxeditor.ui.section.description.CommonNameSourceElement;
48 49
import eu.etaxonomy.taxeditor.ui.section.name.AuthorshipDetailElement;
49 50
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailElement;
50 51
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailElement;
......
87 88
			return (T) NomenclaturalReferenceSelectionDialog.select(shell, //conversation,
88 89
			        (Reference) currentSelection, ((NomenclaturalReferenceDetailElement)parentElement).getEntity().getCombinationAuthorship());
89 90
		}
91
		if(clazz.equals(Reference.class) && parentElement instanceof CommonNameSourceElement){
92
            return (T) CommonNameReferenceSelectionDialog.select(shell, //conversation,
93
                    (Reference) currentSelection);
94
        }
90 95
		if(clazz.equals(Reference.class)){
91 96
		    if (parentElement instanceof ReferenceDetailElement){
92 97
		        return (T) ReferenceSelectionDialog.select(shell, //conversation,

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)