Project

General

Profile

« Previous | Next » 

Revision 52d76872

Added by Katja Luther about 3 years ago

ref #8124: adapt editor to be able to edit NameFacts

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/FactualDataPartE4.java
42 42
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
43 43
import eu.etaxonomy.cdm.model.description.IDescribable;
44 44
import eu.etaxonomy.cdm.model.description.TaxonDescription;
45
import eu.etaxonomy.cdm.model.name.TaxonName;
46 45
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
47 46
import eu.etaxonomy.cdm.model.taxon.Taxon;
48 47
import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
......
163 162
            }
164 163
            if(firstElement instanceof IDescribable<?>
165 164
                && partObject instanceof IPartContentHasFactualData
166
                    && !(firstElement instanceof SpecimenOrObservationBase && partObject instanceof BulkEditorE4)
167
                    && !(firstElement instanceof TaxonName && partObject instanceof BulkEditorE4)){
165
                    && !(firstElement instanceof SpecimenOrObservationBase && partObject instanceof BulkEditorE4)){
166
                   // && !(firstElement instanceof TaxonName && partObject instanceof BulkEditorE4)){
168 167

  
169 168
                featureNodeContainerCache.clear();
170 169
                showViewer(structuredSelection, activePart, viewer);
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/CreateDescriptionHandlerE4.java
17 17
import org.eclipse.e4.ui.services.IServiceConstants;
18 18
import org.eclipse.jface.viewers.TreeNode;
19 19

  
20
import eu.etaxonomy.cdm.model.name.TaxonName;
20 21
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
21 22
import eu.etaxonomy.cdm.model.taxon.Taxon;
22 23
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
23 24
import eu.etaxonomy.taxeditor.editor.EditorUtil;
24 25
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
26
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateNamedescriptionOperation;
25 27
//import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateNamedescriptionOperation;
26 28
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateSpecimenDescriptionOperation;
27 29
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateTaxonDescriptionOperation;
......
58 60
                AbstractUtility.executeOperation(operation, sync);
59 61
            }
60 62
        }
61
//        if(viewerInput instanceof TaxonName){
62
//            operation = new CreateNamedescriptionOperation(menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(), (TaxonName) viewerInput, factualDataPart);
63
//            if(operation!=null){
64
//                AbstractUtility.executeOperation(operation, sync);
65
//            }
66
//        }
63
        if(viewerInput instanceof TaxonName){
64
            operation = new CreateNamedescriptionOperation(menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(), (TaxonName) viewerInput, factualDataPart);
65
            if(operation!=null){
66
                AbstractUtility.executeOperation(operation, sync);
67
            }
68
        }
67 69
	}
68 70

  
69 71
    protected CreateTaxonDescriptionOperation createTaxonOperation(String eventLabel, Taxon taxon, IPostOperationEnabled postOperationEnabled) {
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/DynamicFeatureMenuE4.java
23 23
import org.eclipse.e4.ui.services.IServiceConstants;
24 24
import org.eclipse.jface.viewers.IStructuredSelection;
25 25

  
26
import eu.etaxonomy.cdm.api.service.IVocabularyService;
26 27
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
27 28
import eu.etaxonomy.cdm.model.common.Language;
29
import eu.etaxonomy.cdm.model.common.VocabularyEnum;
28 30
import eu.etaxonomy.cdm.model.description.DescriptionBase;
29 31
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
30 32
import eu.etaxonomy.cdm.model.description.Feature;
31 33
import eu.etaxonomy.cdm.model.description.FeatureNode;
32 34
import eu.etaxonomy.cdm.model.description.FeatureTree;
35
import eu.etaxonomy.cdm.model.description.TaxonNameDescription;
33 36
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
34 37
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateDescriptionElementOperation;
35 38
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
......
135 138
			featureTree = FeatureTree.NewInstance(CdmStore.getTermManager()
136 139
					.getPreferredTerms(Feature.class));
137 140
		}
141
		if (description instanceof TaxonNameDescription){
142
		    featureTree = FeatureTree.NewInstance(CdmStore.getTermManager().getPreferredTerms(CdmStore.getService(IVocabularyService.class).load(VocabularyEnum.NameFeature.getUuid())));
143
		}
138 144

  
139 145
		return featureTree;
140 146
	}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateNamedescriptionOperation.java
1
/**
2
* Copyright (C) 2019 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.editor.view.descriptive.operation;
10

  
11
import org.eclipse.core.commands.operations.IUndoContext;
12

  
13
import eu.etaxonomy.cdm.model.description.DescriptionBase;
14
import eu.etaxonomy.cdm.model.description.TaxonNameDescription;
15
import eu.etaxonomy.cdm.model.name.TaxonName;
16
import eu.etaxonomy.taxeditor.operation.AbstractDescriptionPostOperation;
17
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
18

  
19
/**
20
 * @author k.luther
21
 * @since 25 Jan 2019
22
 *
23
 */
24
public class CreateNamedescriptionOperation extends AbstractDescriptionPostOperation<TaxonName, DescriptionBase> {
25

  
26
    public CreateNamedescriptionOperation(String label, IUndoContext undoContext, TaxonName describable, IPostOperationEnabled postOperationEnabled) {
27
        super(label, undoContext, describable, null, postOperationEnabled);
28
    }
29

  
30

  
31
    /**
32
     * {@inheritDoc}
33
     */
34
    @Override
35
    protected void initDescription() {
36
        description = TaxonNameDescription.NewInstance(element);
37

  
38
    }
39

  
40
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/MoveDescriptionElementsOperation.java
102 102
		    result = service.moveDescriptionElementsToDescription(descriptionElementsUuid, targetDescriptionUuid, isCopy);
103 103

  
104 104
		}
105
		return postExecute(targetDescription);
105
		return postExecute(null);
106 106
	}
107 107

  
108 108
	/* (non-Javadoc)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/NaturalLanguageDetailElement.java
20 20
import org.eclipse.swt.widgets.Display;
21 21

  
22 22
import eu.etaxonomy.cdm.api.service.NaturalLanguageGenerator;
23
import eu.etaxonomy.cdm.model.description.DescriptionBase;
23 24
import eu.etaxonomy.cdm.model.description.FeatureTree;
24
import eu.etaxonomy.cdm.model.description.TaxonDescription;
25 25
import eu.etaxonomy.cdm.model.description.TextData;
26 26
import eu.etaxonomy.taxeditor.model.AbstractUtility;
27 27
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
......
38 38
 * @created Sep 16, 2010
39 39
 * @version 1.0
40 40
 */
41
public class NaturalLanguageDetailElement extends AbstractCdmDetailElement<TaxonDescription> {
41
public class NaturalLanguageDetailElement extends AbstractCdmDetailElement<DescriptionBase> {
42 42

  
43 43

  
44 44
	private static final Logger logger = Logger
......
59 59
	/** {@inheritDoc} */
60 60
	@Override
61 61
	protected void createControls(ICdmFormElement formElement,
62
			TaxonDescription entity, int style) {
62
			DescriptionBase entity, int style) {
63 63
		label = formFactory.createLabel(formElement, "Generating Natural Language Description ...");
64 64

  
65 65
		if(entity.hasStructuredData()){
......
81 81

  
82 82
	private class FetchNaturalLanguageDescriptionJob extends Job {
83 83

  
84
		private TaxonDescription entity;
84
		private DescriptionBase entity;
85 85
		private NaturalLanguageGenerator generator = new NaturalLanguageGenerator();
86 86
		private FeatureTree featureTree = PreferencesUtil.getDefaultFeatureTreeForStructuredDescription();
87 87
		private Display display = Display.getCurrent();
88 88

  
89
		public FetchNaturalLanguageDescriptionJob(String jobName, TaxonDescription entity){
89
		public FetchNaturalLanguageDescriptionJob(String jobName, DescriptionBase entity){
90 90
			super(jobName);
91 91
			this.entity = entity;
92 92
		}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/NaturalLanguageSection.java
12 12
import org.eclipse.jface.viewers.ISelectionProvider;
13 13

  
14 14
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
15
import eu.etaxonomy.cdm.model.description.TaxonDescription;
15
import eu.etaxonomy.cdm.model.description.DescriptionBase;
16 16
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
17 17
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
18 18
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
......
25 25
 * @created Sep 16, 2010
26 26
 * @version 1.0
27 27
 */
28
public class NaturalLanguageSection extends AbstractCdmDetailSection<TaxonDescription> {
28
public class NaturalLanguageSection extends AbstractCdmDetailSection<DescriptionBase> {
29 29

  
30 30
	/**
31 31
	 * <p>Constructor for NaturalLanguageSection.</p>
......
55 55
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
56 56
	 */
57 57
	@Override
58
	protected AbstractCdmDetailElement<TaxonDescription> createCdmDetailElement(AbstractCdmDetailSection<TaxonDescription> parentElement, int style) {
58
	protected AbstractCdmDetailElement<DescriptionBase> createCdmDetailElement(AbstractCdmDetailSection<DescriptionBase> parentElement, int style) {
59 59
	    return formFactory.createNaturalLanguageDetailElement(parentElement);
60 60
	}
61 61
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java
43 43
import eu.etaxonomy.cdm.model.description.FeatureTree;
44 44
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
45 45
import eu.etaxonomy.cdm.model.description.SpecimenDescription;
46
import eu.etaxonomy.cdm.model.description.TaxonDescription;
46 47
import eu.etaxonomy.cdm.model.media.Media;
47 48
import eu.etaxonomy.cdm.model.molecular.DnaSample;
48 49
import eu.etaxonomy.cdm.model.molecular.Sequence;
......
269 270

  
270 271
                } else if (isUseDescription) {
271 272
                    createUseDescriptionSection(rootElement);
272
                } else {
273
                } else if (input instanceof TaxonDescription){
273 274
                    createTaxonDescriptionSection(rootElement);
274 275

  
276
                } else{
277
                    createDescriptionSection(rootElement, false);
275 278
                }
276 279
            }
277 280
        } else if (input instanceof DescriptionElementBase){

Also available in: Unified diff