1
|
/**
|
2
|
* Copyright (C) 2011 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.view.e4.details;
|
10
|
|
11
|
import java.util.Collection;
|
12
|
import java.util.EnumSet;
|
13
|
import java.util.HashSet;
|
14
|
import java.util.Set;
|
15
|
|
16
|
import javax.inject.Inject;
|
17
|
|
18
|
import org.eclipse.e4.core.di.annotations.Optional;
|
19
|
import org.eclipse.e4.ui.di.UIEventTopic;
|
20
|
import org.eclipse.jface.viewers.ISelection;
|
21
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
22
|
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
23
|
import org.eclipse.jface.viewers.TreeNode;
|
24
|
import org.eclipse.swt.SWT;
|
25
|
import org.eclipse.ui.forms.IFormPart;
|
26
|
import org.eclipse.ui.forms.widgets.Section;
|
27
|
import org.springframework.security.core.GrantedAuthority;
|
28
|
|
29
|
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
|
30
|
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
|
31
|
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
|
32
|
import eu.etaxonomy.cdm.model.agent.Person;
|
33
|
import eu.etaxonomy.cdm.model.agent.Team;
|
34
|
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
|
35
|
import eu.etaxonomy.cdm.model.common.Marker;
|
36
|
import eu.etaxonomy.cdm.model.description.CategoricalData;
|
37
|
import eu.etaxonomy.cdm.model.description.Character;
|
38
|
import eu.etaxonomy.cdm.model.description.DescriptionBase;
|
39
|
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
|
40
|
import eu.etaxonomy.cdm.model.description.Distribution;
|
41
|
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
|
42
|
import eu.etaxonomy.cdm.model.description.SpecimenDescription;
|
43
|
import eu.etaxonomy.cdm.model.description.TaxonDescription;
|
44
|
import eu.etaxonomy.cdm.model.media.Media;
|
45
|
import eu.etaxonomy.cdm.model.molecular.DnaSample;
|
46
|
import eu.etaxonomy.cdm.model.molecular.Sequence;
|
47
|
import eu.etaxonomy.cdm.model.molecular.SingleRead;
|
48
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
49
|
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
|
50
|
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
|
51
|
import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
|
52
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
|
53
|
import eu.etaxonomy.cdm.model.permission.CRUD;
|
54
|
import eu.etaxonomy.cdm.model.permission.Group;
|
55
|
import eu.etaxonomy.cdm.model.permission.User;
|
56
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
57
|
import eu.etaxonomy.cdm.model.taxon.Synonym;
|
58
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
59
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
60
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
61
|
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
|
62
|
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
|
63
|
import eu.etaxonomy.cdm.model.term.TermNode;
|
64
|
import eu.etaxonomy.cdm.model.term.TermTree;
|
65
|
import eu.etaxonomy.cdm.model.term.TermType;
|
66
|
import eu.etaxonomy.cdm.model.term.TermVocabulary;
|
67
|
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
|
68
|
import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
|
69
|
import eu.etaxonomy.taxeditor.editor.IBulkEditor;
|
70
|
import eu.etaxonomy.taxeditor.editor.IDistributionEditorPart;
|
71
|
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
|
72
|
import eu.etaxonomy.taxeditor.l10n.Messages;
|
73
|
import eu.etaxonomy.taxeditor.model.AbstractUtility;
|
74
|
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
|
75
|
import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
|
76
|
import eu.etaxonomy.taxeditor.model.MessagingUtils;
|
77
|
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
|
78
|
import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
|
79
|
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
80
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
81
|
import eu.etaxonomy.taxeditor.store.StoreUtil;
|
82
|
import eu.etaxonomy.taxeditor.store.UsageTermCollection;
|
83
|
import eu.etaxonomy.taxeditor.termtree.e4.ICharacterEditor;
|
84
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
85
|
import eu.etaxonomy.taxeditor.ui.element.RootElement;
|
86
|
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
|
87
|
import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
|
88
|
import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
|
89
|
import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
|
90
|
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
|
91
|
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailElement;
|
92
|
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
|
93
|
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
|
94
|
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
|
95
|
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
|
96
|
import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
|
97
|
import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
|
98
|
import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
|
99
|
import eu.etaxonomy.taxeditor.ui.section.description.detail.DistributionDetailElement;
|
100
|
import eu.etaxonomy.taxeditor.ui.section.feature.CharacterDetailSection;
|
101
|
import eu.etaxonomy.taxeditor.ui.section.feature.CharacterNodeDetailSection;
|
102
|
import eu.etaxonomy.taxeditor.ui.section.feature.CharacterNodeDtoDetailSection;
|
103
|
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
|
104
|
import eu.etaxonomy.taxeditor.ui.section.feature.TermNodeDetailSection;
|
105
|
import eu.etaxonomy.taxeditor.ui.section.feature.TermTreeDetailSection;
|
106
|
import eu.etaxonomy.taxeditor.ui.section.feature.TermTreeDetailSectionForNode;
|
107
|
import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
|
108
|
import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
|
109
|
import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
|
110
|
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
|
111
|
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
|
112
|
import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
|
113
|
import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
|
114
|
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
|
115
|
import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
|
116
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
|
117
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailSection;
|
118
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
|
119
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitFacadeDetailSection;
|
120
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitFacadeGeneralDetailSection;
|
121
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
|
122
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.association.DerivedUnitTypeDesignationSection;
|
123
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
|
124
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailSection;
|
125
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailSection;
|
126
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSamplePreparationPreservationSection;
|
127
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailSection;
|
128
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceContigFileCollectionDetailSection;
|
129
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailSection;
|
130
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollectionDetailSection;
|
131
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailSection;
|
132
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
|
133
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
|
134
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
|
135
|
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalSourceDetailSection;
|
136
|
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
|
137
|
import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection;
|
138
|
import eu.etaxonomy.taxeditor.ui.section.supplemental.identifier.DerivedUnitFacadeIdentifierSection;
|
139
|
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
|
140
|
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
|
141
|
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
|
142
|
import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
|
143
|
import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
|
144
|
import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
|
145
|
import eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailSection;
|
146
|
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermMediaSection;
|
147
|
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
|
148
|
import eu.etaxonomy.taxeditor.view.detail.CdmSectionPart;
|
149
|
import eu.etaxonomy.taxeditor.view.e4.AbstractCdmDataViewer;
|
150
|
|
151
|
/**
|
152
|
* The DetailsViewer handles the content of the details view (
|
153
|
* {@link DetailsPartE4}).<br>
|
154
|
* Depending on the type of the selected element the section of the details view
|
155
|
* are created.
|
156
|
*
|
157
|
* @author pplitzner
|
158
|
* @date 18.07.2017
|
159
|
*/
|
160
|
public class DetailsViewerE4 extends AbstractCdmDataViewer {
|
161
|
|
162
|
private ISelection selection;
|
163
|
private boolean detailsEnabled = true;
|
164
|
private Object activePart;
|
165
|
|
166
|
public boolean isDetailsEnabled() {
|
167
|
return detailsEnabled;
|
168
|
}
|
169
|
|
170
|
public void setDetailsEnabled(boolean detailsEnabled) {
|
171
|
this.detailsEnabled = detailsEnabled;
|
172
|
}
|
173
|
|
174
|
public void setInput(Object input, Object activePart) {
|
175
|
this.activePart = activePart;
|
176
|
setInput(input);
|
177
|
|
178
|
}
|
179
|
// START HACK TO MAKE THE DERIVED UNIT FACADE WORK
|
180
|
// since we are getting implementations of DerivedUnitBase from the bulk
|
181
|
// editor and not derived unit facade objects,
|
182
|
@Override
|
183
|
public void setInput(Object input) {
|
184
|
|
185
|
if(input instanceof TreeNode){
|
186
|
input = ((TreeNode) input).getValue();
|
187
|
}
|
188
|
if(input instanceof GbifResponse){
|
189
|
input = ((GbifResponse) input).getDerivedUnitFacade();
|
190
|
}
|
191
|
if (input instanceof DerivedUnit) {
|
192
|
DerivedUnit derivedUnit = (DerivedUnit)input;
|
193
|
if ((derivedUnit instanceof MediaSpecimen
|
194
|
|| (derivedUnit instanceof DnaSample && derivedUnit.getRecordBasis() == SpecimenOrObservationType.DnaSample ))
|
195
|
&& !(this.activePart instanceof IBulkEditor)){
|
196
|
//do nothing
|
197
|
}else{
|
198
|
try {
|
199
|
input = DerivedUnitFacade.NewInstance(derivedUnit,
|
200
|
PreferencesUtil.getDerivedUnitConfigurator());
|
201
|
} catch (DerivedUnitFacadeNotSupportedException e) {
|
202
|
MessagingUtils.error(getClass(), e); //nothing should happen, later on the Details View will show an according information that it is not possible to open this data
|
203
|
}
|
204
|
}
|
205
|
}
|
206
|
else if(input instanceof FieldUnit){
|
207
|
input = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) input);
|
208
|
}
|
209
|
super.setInput(input);
|
210
|
}
|
211
|
|
212
|
@Override
|
213
|
protected void markViewPartDirty() {
|
214
|
if (getInput() instanceof DerivedUnitFacade) {
|
215
|
if(part instanceof IDerivedUnitFacadePart){
|
216
|
part.changed(getInput());
|
217
|
}
|
218
|
else{
|
219
|
DerivedUnitFacade facade = (DerivedUnitFacade) getInput();
|
220
|
if(facade.innerDerivedUnit()!=null){
|
221
|
part.changed(facade.innerDerivedUnit());
|
222
|
}
|
223
|
else if(facade.innerFieldUnit()!=null){
|
224
|
part.changed(facade.innerFieldUnit());
|
225
|
}
|
226
|
}
|
227
|
}
|
228
|
else{
|
229
|
super.markViewPartDirty();
|
230
|
}
|
231
|
}
|
232
|
|
233
|
@Override
|
234
|
protected void showParts() {
|
235
|
// FIXME (CM) : Need to clean out this code.
|
236
|
// Too much type checking to decide which detail view to display.
|
237
|
// Need to build in a mechanism where navigators / editors are 'aware'
|
238
|
// of the corresponding detail viewer.
|
239
|
|
240
|
Object input = getInput();
|
241
|
if (input == null){
|
242
|
return;
|
243
|
}
|
244
|
destroySections();
|
245
|
if (input instanceof TaxonBase) {
|
246
|
if(((TaxonBase<?>) input).getName()==null){
|
247
|
createEmptySection(Messages.DetailsViewerE4_TAXON_HAS_NO_NAME, rootElement);
|
248
|
}
|
249
|
else{
|
250
|
createTaxonSections(rootElement);
|
251
|
}
|
252
|
} else if (input instanceof TaxonName) {
|
253
|
createNameSections(rootElement);
|
254
|
} else if (input instanceof Reference) {
|
255
|
createReferenceSections(rootElement);
|
256
|
|
257
|
} else if (input instanceof Team) {
|
258
|
createTeamDetailSection(rootElement);
|
259
|
|
260
|
} else if (input instanceof Person) {
|
261
|
createPersonDetailSection(rootElement);
|
262
|
|
263
|
} else if (input instanceof TeamOrPersonBase) {
|
264
|
createTeamOrPersonBaseDetailSection(rootElement);
|
265
|
|
266
|
} else if (input instanceof DescriptionBase) {
|
267
|
if ((((DescriptionBase<?>)input).isComputed() || ((DescriptionBase<?>)input).isCloneForSource())&& PreferencesUtil.isComputedDesciptionHandlingDisabled()){
|
268
|
this.setDetailsEnabled(false);
|
269
|
}
|
270
|
if(input instanceof SpecimenDescription){
|
271
|
//TODO: add more sections to DetailsView for SpecimenDescription
|
272
|
createSpecimenDescriptionSection(rootElement);
|
273
|
}
|
274
|
else{
|
275
|
Set<Marker> descriptionMarkers = ((DescriptionBase<?>) input).getMarkers();
|
276
|
|
277
|
Boolean isUseDescription = false;
|
278
|
for (Marker marker : descriptionMarkers) {
|
279
|
if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
|
280
|
isUseDescription = true;
|
281
|
}
|
282
|
}
|
283
|
if (((DescriptionBase<?>) input).isImageGallery()) {
|
284
|
createImageGallerySection(rootElement);
|
285
|
|
286
|
} else if (isUseDescription) {
|
287
|
createUseDescriptionSection(rootElement);
|
288
|
} else if (input instanceof TaxonDescription){
|
289
|
createTaxonDescriptionSection(rootElement, !(((DescriptionBase<?>) input).isComputed() && PreferencesUtil.isComputedDesciptionHandlingDisabled()));
|
290
|
|
291
|
} else{
|
292
|
createDescriptionSection(rootElement, false, !(((DescriptionBase<?>) input).isComputed() && PreferencesUtil.isComputedDesciptionHandlingDisabled()));
|
293
|
}
|
294
|
}
|
295
|
} else if (input instanceof DescriptionElementBase){
|
296
|
Set<Marker> descriptionMarkers = new HashSet<>();
|
297
|
if(((DescriptionElementBase) input).getInDescription()!=null) {
|
298
|
descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
|
299
|
}
|
300
|
|
301
|
Boolean isUseDescription = false;
|
302
|
for (Marker marker : descriptionMarkers) {
|
303
|
if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
|
304
|
isUseDescription = true;
|
305
|
}
|
306
|
}
|
307
|
if (((DescriptionElementBase)input).getInDescription() != null && ((DescriptionElementBase)input).getInDescription().isComputed() && PreferencesUtil.isComputedDesciptionHandlingDisabled()){
|
308
|
this.setDetailsEnabled(false);
|
309
|
}
|
310
|
if (isUseDescription == true && input instanceof CategoricalData) {
|
311
|
createUseRecordSection(rootElement);
|
312
|
} else {
|
313
|
createDescriptionElementSection(rootElement, activePart);
|
314
|
}
|
315
|
|
316
|
} else if (input instanceof Media) {
|
317
|
createMediaElementSection(rootElement);
|
318
|
}
|
319
|
//FIXME hack to show more informative message to the user when
|
320
|
//DerivedUnit has more than one FieldUnit #4363
|
321
|
else if (input instanceof DerivedUnit && !(input instanceof MediaSpecimen) && !(input instanceof DnaSample)) {
|
322
|
DerivedUnit derivedUnit = (DerivedUnit)input;
|
323
|
try {
|
324
|
input = DerivedUnitFacade.NewInstance(derivedUnit,
|
325
|
PreferencesUtil.getDerivedUnitConfigurator());
|
326
|
} catch (DerivedUnitFacadeNotSupportedException e) {
|
327
|
createEmptySection(e.getMessage(), rootElement);
|
328
|
}
|
329
|
} else if (input instanceof DerivedUnitFacade) {
|
330
|
DerivedUnitFacade facade = (DerivedUnitFacade) input;
|
331
|
if(facade.getType() == SpecimenOrObservationType.FieldUnit){
|
332
|
if(facade.innerFieldUnit() == null){
|
333
|
MessagingUtils.error(DetailsViewerE4.class, "FieldUnit of facade is null", null); //$NON-NLS-1$
|
334
|
}
|
335
|
else{
|
336
|
createFieldUnitFacadeSection(rootElement);
|
337
|
}
|
338
|
}
|
339
|
else if(facade.getType() == SpecimenOrObservationType.PreservedSpecimen){
|
340
|
if(facade.innerDerivedUnit() == null){
|
341
|
MessagingUtils.error(DetailsViewerE4.class, "DerivedUnit of facade is null", null); //$NON-NLS-1$
|
342
|
}
|
343
|
else{
|
344
|
createDerivedUnitBaseElementSection(rootElement);
|
345
|
}
|
346
|
}
|
347
|
else if(facade.getType() == SpecimenOrObservationType.TissueSample){
|
348
|
//TissueSample should only be created by using it's own class
|
349
|
//in future using only one class with different SpecimenOrObservationTypes is desired
|
350
|
createTissueSampleSection(rootElement);
|
351
|
}else if (facade.innerDerivedUnit() instanceof DnaSample){
|
352
|
createEmptySection("DNA sample not supported by specimen list editor", rootElement);
|
353
|
}else if (facade.innerDerivedUnit() instanceof MediaSpecimen){
|
354
|
createEmptySection("Image specimen not supported by specimen list editor", rootElement);
|
355
|
}else if(facade.getType()==SpecimenOrObservationType.DnaSample){
|
356
|
|
357
|
if(facade.innerDerivedUnit().getRecordBasis()==SpecimenOrObservationType.TissueSample){
|
358
|
//this case seems to be very unlikely as innerDerivedUnit in real cases should more or less always have the same type
|
359
|
createTissueSampleSection(rootElement);
|
360
|
}
|
361
|
else if(facade.innerDerivedUnit().getRecordBasis()==SpecimenOrObservationType.DnaSample){
|
362
|
createDnaSampleSection(rootElement);
|
363
|
}
|
364
|
}else{
|
365
|
createDerivedUnitBaseElementSection(rootElement);
|
366
|
}
|
367
|
} else if (input instanceof DnaSample){
|
368
|
DnaSample dnaSample = (DnaSample)input;
|
369
|
if(dnaSample.getRecordBasis()==SpecimenOrObservationType.TissueSample){
|
370
|
createTissueSampleSection(rootElement);
|
371
|
}
|
372
|
else if(dnaSample.getRecordBasis()==SpecimenOrObservationType.DnaSample){
|
373
|
createDnaSampleSection(rootElement);
|
374
|
}
|
375
|
} else if (input instanceof MediaSpecimen){
|
376
|
createMediaSpecimenSection(rootElement);
|
377
|
}
|
378
|
else if(input instanceof Sequence){
|
379
|
createSequenceSection(rootElement);
|
380
|
}
|
381
|
else if(input instanceof SingleRead){
|
382
|
createSingleReadSection(rootElement);
|
383
|
}
|
384
|
else if (input instanceof FeatureNodeContainer) {
|
385
|
createFeatureDistributionSection(rootElement);
|
386
|
|
387
|
} else if (input instanceof TermNode) {
|
388
|
TermType type= ((TermNode<?>) input).getTermType();
|
389
|
if(type.equals(TermType.Character) ){
|
390
|
createCharacterNodeSection(rootElement);
|
391
|
}
|
392
|
else if(type.equals(TermType.Feature)){
|
393
|
createFeatureNodeSection(rootElement);
|
394
|
}
|
395
|
|
396
|
} else if (input instanceof TermTree) {
|
397
|
createFeatureTreeSection(rootElement);
|
398
|
} else if (input instanceof TermNodeDto) {
|
399
|
TermType type= ((TermNodeDto) input).getTerm().getTermType();
|
400
|
if(type.equals(TermType.Character) && activePart instanceof ICharacterEditor){
|
401
|
createCharacterNodeDtoSection(rootElement);
|
402
|
}
|
403
|
else if(type.equals(TermType.Feature) || type.equals(TermType.Character)){
|
404
|
createFeatureNodeSection(rootElement);
|
405
|
}
|
406
|
|
407
|
} else if (input instanceof TermTreeDto) {
|
408
|
createFeatureTreeSectionForDto(rootElement);
|
409
|
|
410
|
} else if (input instanceof Character) {
|
411
|
createCharacterSection(rootElement);
|
412
|
|
413
|
}else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
|
414
|
createPolytomousKeyNodeSection(rootElement);
|
415
|
} else if (input instanceof User) {
|
416
|
createUserSection(rootElement);
|
417
|
} else if (input instanceof Group) {
|
418
|
createGroupSection(rootElement);
|
419
|
} else if (input instanceof TaxonRelationship && ((TaxonRelationship)input).getType()!=null
|
420
|
&& (((TaxonRelationship)input).getType().isAnyMisappliedName() || ((TaxonRelationship)input).getType().isAnySynonym() || ((TaxonRelationship)input).getType().isMisappliedName())){
|
421
|
createMisappliedNameSection(rootElement);
|
422
|
}else if (input instanceof TaxonRelationship ) {
|
423
|
createTaxonRelationshipSection(rootElement);
|
424
|
} else if (input instanceof TermVocabulary) {
|
425
|
createTermVocabularySection(rootElement);
|
426
|
} else if (input instanceof DefinedTermBase) {
|
427
|
createDefinedTermSection(rootElement);
|
428
|
|
429
|
} else if (input instanceof SelectionChangedEvent ) {
|
430
|
IStructuredSelection sel =(IStructuredSelection) ((SelectionChangedEvent)input).getSelection();
|
431
|
if (sel.getFirstElement()instanceof Distribution){
|
432
|
createDescriptionElementSection(rootElement);
|
433
|
}
|
434
|
|
435
|
// createDescriptionElementSection(rootElement);
|
436
|
|
437
|
}else {
|
438
|
createEmptySection(null, rootElement);
|
439
|
}
|
440
|
layout();
|
441
|
}
|
442
|
|
443
|
private void createGroupSection(RootElement parent) {
|
444
|
GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(parent, this, StoreUtil.getSectionStyle(GroupDetailSection.class, getInput().getClass().getCanonicalName()));
|
445
|
MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(parent, StoreUtil.getSectionStyle(MemberDetailSection.class, getInput().getClass().getCanonicalName()));
|
446
|
GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(parent,StoreUtil.getSectionStyle(GrantedAuthorityDetailSection.class, getInput().getClass().getCanonicalName()));
|
447
|
|
448
|
addPart(groupDetailSection);
|
449
|
addPart(memberDetailSection);
|
450
|
addPart(grantedAuthorityDetailSection);
|
451
|
}
|
452
|
|
453
|
@Override
|
454
|
public ISelection getSelection() {
|
455
|
return selection;
|
456
|
}
|
457
|
|
458
|
@Override
|
459
|
public void setSelection(ISelection selection, boolean reveal) {
|
460
|
|
461
|
this.selection = selection;
|
462
|
if(this.selection!=null){
|
463
|
SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
|
464
|
fireSelectionChanged(selectionChangedEvent);
|
465
|
}
|
466
|
}
|
467
|
|
468
|
private void createTaxonSections(RootElement parent) {
|
469
|
NameDetailsConfigurator config = PreferencesUtil.getPreferredNameDetailsConfiguration();
|
470
|
EnumSet<CRUD> requiredCrud;
|
471
|
if(getInput() == null || StoreUtil.getCdmEntity(getInput()).getId() == 0) {
|
472
|
// new entity, not yet saved
|
473
|
requiredCrud = EnumSet.of(CRUD.CREATE);
|
474
|
} else {
|
475
|
requiredCrud = EnumSet.of(CRUD.UPDATE);
|
476
|
}
|
477
|
boolean hasPermission = CdmStore.currentAuthentiationHasPermission(StoreUtil.getCdmEntity(getInput()), requiredCrud);
|
478
|
TaxonBase<?> taxonBase = (TaxonBase<?>)getInput();
|
479
|
if (hasPermission){
|
480
|
// check for subtree permissions as well.
|
481
|
|
482
|
Taxon acceptedTaxon = null;
|
483
|
if (taxonBase instanceof Taxon){
|
484
|
acceptedTaxon = (Taxon)taxonBase;
|
485
|
}else{
|
486
|
acceptedTaxon = ((Synonym)taxonBase).getAcceptedTaxon();
|
487
|
}
|
488
|
if (acceptedTaxon != null){ //needs discussion if synonyms without accepted taxon should never be filtered by subtree permission(current implementation). See also #8849
|
489
|
Set<TaxonNode> nodes = acceptedTaxon.getTaxonNodes();
|
490
|
for (TaxonNode node: nodes){
|
491
|
hasPermission &= CdmStore.currentAuthentiationHasPermission(node, requiredCrud);
|
492
|
if (!hasPermission){
|
493
|
//check whether there are explicit TaxonNode rights
|
494
|
boolean taxonnodePermissionExists = false;
|
495
|
Collection<? extends GrantedAuthority> authorities = CdmStore.getCurrentAuthentiation().getAuthorities();
|
496
|
for (GrantedAuthority grantedAuthority: authorities){
|
497
|
if (grantedAuthority.getAuthority().startsWith("TAXONNODE")){
|
498
|
taxonnodePermissionExists = true;
|
499
|
}
|
500
|
}
|
501
|
if (!taxonnodePermissionExists){
|
502
|
hasPermission = true;
|
503
|
}
|
504
|
}
|
505
|
}
|
506
|
}
|
507
|
}
|
508
|
detailsEnabled = hasPermission;
|
509
|
ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(parent, this,
|
510
|
StoreUtil.getSectionStyle(ParsingMessagesSection.class, getInput().getClass().getCanonicalName(), true));
|
511
|
if (config == null){
|
512
|
TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(parent, this,
|
513
|
StoreUtil.getSectionStyle(TaxonBaseDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
514
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
515
|
// boolean hasPermission = CdmStore.currentAuthentiationHasPermission(getInput(), Operation.UPDATE);
|
516
|
taxonBaseDetailSection.setEnabled(detailsEnabled);
|
517
|
addPart(taxonBaseDetailSection);
|
518
|
}else{
|
519
|
if (config.isTaxonSectionActivated()){
|
520
|
TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(parent, this,
|
521
|
StoreUtil.getSectionStyle(TaxonBaseDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
522
|
taxonBaseDetailSection.setEnabled(detailsEnabled);
|
523
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
524
|
addPart(taxonBaseDetailSection);
|
525
|
}
|
526
|
}
|
527
|
//TODO: test code for secundum source section
|
528
|
// formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
529
|
// addPart(sourceSection);
|
530
|
// if (taxonBase.getSecSource() == null){
|
531
|
// SecundumSource source = SecundumSource.NewSecundumInstance(taxonBase);
|
532
|
// taxonBase.setSecSource(source);
|
533
|
// sourceSection.setEntity(taxonBase);
|
534
|
// }else{
|
535
|
// sourceSection.setEntity(taxonBase);
|
536
|
// }
|
537
|
//
|
538
|
// if (config != null && !config.isSecEnabled()){
|
539
|
// sourceSection.setEnabled(false);
|
540
|
// }
|
541
|
NonViralNameDetailSection nonViralNameSection = formFactory
|
542
|
.createNonViralNameDetailSection(parent, this, true,
|
543
|
StoreUtil.getSectionStyle(NonViralNameDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
544
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
545
|
nonViralNameSection.setEnabled(detailsEnabled);
|
546
|
if (config == null || config.isNomenclaturalReferenceSectionActivated()){
|
547
|
NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(parent, this,
|
548
|
StoreUtil.getSectionStyle(NomenclaturalSourceDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
549
|
referenceDetailSection.setEnabled(detailsEnabled);
|
550
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
551
|
addPart(referenceDetailSection);
|
552
|
|
553
|
}
|
554
|
if ( config == null || config.isNomenclaturalStatusSectionActivated()){
|
555
|
NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(parent,
|
556
|
StoreUtil.getSectionStyle(NomenclaturalStatusSection.class, getInput().getClass().getCanonicalName(), true));
|
557
|
nomenclaturalStatusSection.setEnabled(detailsEnabled);
|
558
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
559
|
addPart(nomenclaturalStatusSection);
|
560
|
}
|
561
|
|
562
|
if (config == null || config.isTypeDesignationSectionActivated()){
|
563
|
TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(parent, StoreUtil.getSectionStyle(TypeDesignationSection.class, getInput().getClass().getCanonicalName()));
|
564
|
typeDesignationSection.setEnabled(detailsEnabled);
|
565
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
566
|
addPart(typeDesignationSection);
|
567
|
}
|
568
|
|
569
|
if (config == null || config.isNameRelationsSectionActivated()){
|
570
|
NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(parent, StoreUtil.getSectionStyle(NameRelationshipDetailSection.class, getInput().getClass().getCanonicalName()));
|
571
|
nameRelationshipSection.setEnabled(detailsEnabled);
|
572
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
573
|
addPart(nameRelationshipSection);
|
574
|
}
|
575
|
|
576
|
addPart(parsingMessagesSection);
|
577
|
addPart(nonViralNameSection);
|
578
|
}
|
579
|
|
580
|
private void createNameSections(RootElement parent) {
|
581
|
NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(
|
582
|
parent, this, false, StoreUtil.getSectionStyle(NonViralNameDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
583
|
|
584
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
585
|
|
586
|
NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(parent, this,
|
587
|
StoreUtil.getSectionStyle(NomenclaturalSourceDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
588
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
589
|
|
590
|
NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(parent,
|
591
|
StoreUtil.getSectionStyle(NomenclaturalStatusSection.class, getInput().getClass().getCanonicalName(), true));
|
592
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
593
|
|
594
|
addPart(nonViralNameSection);
|
595
|
addPart(nomenclaturalStatusSection);
|
596
|
addPart(referenceDetailSection);
|
597
|
|
598
|
TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(parent, StoreUtil.getSectionStyle(TypeDesignationSection.class, getInput().getClass().getCanonicalName()));
|
599
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
600
|
|
601
|
NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(parent, StoreUtil.getSectionStyle(NameRelationshipDetailSection.class, getInput().getClass().getCanonicalName()));
|
602
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
603
|
// addPart(protologSection);
|
604
|
addPart(typeDesignationSection);
|
605
|
addPart(nameRelationshipSection);
|
606
|
}
|
607
|
|
608
|
private void createReferenceSections(RootElement parent) {
|
609
|
ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(parent, this,
|
610
|
StoreUtil.getSectionStyle(ReferenceDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
611
|
|
612
|
addPart(referenceDetailSection);
|
613
|
}
|
614
|
|
615
|
private void createTeamOrPersonBaseDetailSection(RootElement parent) {
|
616
|
TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(parent, this, StoreUtil.getSectionStyle(TeamOrPersonBaseDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
617
|
|
618
|
addPart(teamOrPersonBaseDetailSection);
|
619
|
}
|
620
|
|
621
|
private void createTeamDetailSection(RootElement parent) {
|
622
|
TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(parent, StoreUtil.getSectionStyle(TeamDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
623
|
|
624
|
addPart(teamDetailSection);
|
625
|
}
|
626
|
|
627
|
private void createPersonDetailSection(RootElement parent) {
|
628
|
PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(parent, StoreUtil.getSectionStyle(PersonDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
629
|
addPart(personDetailSection);
|
630
|
}
|
631
|
|
632
|
private void createDescriptionElementSection(RootElement parent) {
|
633
|
createDescriptionElementSection(parent, null);
|
634
|
}
|
635
|
|
636
|
private void createDescriptionElementSection(RootElement parent, Object activePart) {
|
637
|
DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(parent, this, StoreUtil.getSectionStyle(DescriptionElementDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
638
|
|
639
|
|
640
|
// IntextReferenceSection intextReferenceSection = formFactory.createIntextReferenceSection(parent, getSectionStyle(.class, getInput().getClass().getCanonicalName()));
|
641
|
|
642
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
643
|
DescriptionElementSourceSection descriptionElementSourceSection;
|
644
|
if (activePart != null && activePart instanceof IDistributionEditorPart){
|
645
|
Reference defaultSource =((IDistributionEditorPart)activePart).getEditor().getDefaultSource();
|
646
|
descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(parent, defaultSource, StoreUtil.getSectionStyle(DescriptionElementSourceSection.class, getInput().getClass().getCanonicalName()));
|
647
|
|
648
|
}else{
|
649
|
descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(parent, StoreUtil.getSectionStyle(DescriptionElementSourceSection.class, getInput().getClass().getCanonicalName()) );
|
650
|
descriptionElementSourceSection.setEnabled(this.detailsEnabled);
|
651
|
|
652
|
}
|
653
|
|
654
|
|
655
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
656
|
|
657
|
DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(
|
658
|
parent, StoreUtil.getSectionStyle(DescriptionElementMediaSection.class, getInput().getClass().getCanonicalName()));
|
659
|
|
660
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
661
|
|
662
|
addPart(descriptionElementDetailSection);
|
663
|
addPart(descriptionElementSourceSection);
|
664
|
addPart(descriptionElementMediaSection);
|
665
|
}
|
666
|
|
667
|
private void createDescriptionSection(RootElement parent, boolean isTaxonDescription, boolean isEnabled) {
|
668
|
DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(parent, this, StoreUtil.getSectionStyle(DescriptionDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
669
|
descriptionDetailSection.setEnabled(isEnabled);
|
670
|
addPart(descriptionDetailSection);
|
671
|
|
672
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
673
|
|
674
|
if(isTaxonDescription) {
|
675
|
NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(
|
676
|
parent, this, StoreUtil.getSectionStyle(NaturalLanguageSection.class, getInput().getClass().getCanonicalName(), true));
|
677
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
678
|
naturalLanguageSection.setEnabled(isEnabled);
|
679
|
addPart(naturalLanguageSection);
|
680
|
}
|
681
|
DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(
|
682
|
parent, StoreUtil.getSectionStyle(DescriptionSourceSection.class, getInput().getClass().getCanonicalName(), true));
|
683
|
descriptionSourceSection.setEnabled(isEnabled);
|
684
|
addPart(descriptionSourceSection);
|
685
|
|
686
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
687
|
|
688
|
if(isTaxonDescription) {
|
689
|
ScopeSection scopeSection = formFactory.createScopeSection(parent, StoreUtil.getSectionStyle(ScopeSection.class, getInput().getClass().getCanonicalName()));
|
690
|
scopeSection.setEnabled(isEnabled);
|
691
|
addPart(scopeSection);
|
692
|
}
|
693
|
}
|
694
|
|
695
|
private void createTaxonDescriptionSection(RootElement parent, boolean isEnabled) {
|
696
|
createDescriptionSection(parent, true, isEnabled);
|
697
|
}
|
698
|
|
699
|
private void createSpecimenDescriptionSection(RootElement parent) {
|
700
|
createDescriptionSection(parent, false, true);
|
701
|
}
|
702
|
|
703
|
private void createUseDescriptionSection(RootElement parent) {
|
704
|
DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(parent, this, StoreUtil.getSectionStyle(DescriptionDetailSection.class, getInput().getClass().getCanonicalName()));
|
705
|
|
706
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
707
|
|
708
|
DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(parent, StoreUtil.getSectionStyle(DescriptionSourceSection.class, getInput().getClass().getCanonicalName()));
|
709
|
|
710
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
711
|
|
712
|
addPart(descriptionDetailSection);
|
713
|
addPart(descriptionSourceSection);
|
714
|
}
|
715
|
|
716
|
private void createImageGallerySection(RootElement parent) {
|
717
|
DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(parent, this, StoreUtil.getSectionStyle(DescriptionDetailSection.class, getInput().getClass().getCanonicalName()));
|
718
|
|
719
|
addPart(descriptionDetailSection);
|
720
|
}
|
721
|
|
722
|
private void createMediaElementSection(RootElement parent) {
|
723
|
MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(parent, this, StoreUtil.getSectionStyle(MediaDetailsSection.class, getInput().getClass().getCanonicalName(), true));
|
724
|
|
725
|
addPart(mediaDetailSection);
|
726
|
}
|
727
|
|
728
|
private void createDerivedUnitBaseElementSection(RootElement parent) {
|
729
|
DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(parent, this, StoreUtil.getSectionStyle(DerivedUnitGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
730
|
//TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
|
731
|
if(!(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart)){
|
732
|
derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true);
|
733
|
}
|
734
|
addPart(derivedUnitGeneralDetailSection);
|
735
|
|
736
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
737
|
|
738
|
DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(parent, this, StoreUtil.getSectionStyle(DerivedUnitBaseDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
739
|
addPart(derivedUnitBaseDetailSection);
|
740
|
|
741
|
//for editors working with facades
|
742
|
if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart){
|
743
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
744
|
GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(parent, this, StoreUtil.getSectionStyle(GatheringEventDetailSection.class, getInput().getClass().getCanonicalName()));
|
745
|
addPart(gatheringEventDetailSection);
|
746
|
|
747
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
748
|
FieldUnitFacadeDetailSection fieldUnitDetailSection = formFactory.createFieldUnitFacadeDetailSection(parent, this, StoreUtil.getSectionStyle(FieldUnitFacadeDetailSection.class, getInput().getClass().getCanonicalName()));
|
749
|
addPart(fieldUnitDetailSection);
|
750
|
}
|
751
|
else{
|
752
|
|
753
|
if(PreferencesUtil.isShowTaxonAssociations()){
|
754
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
755
|
TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(parent, this, StoreUtil.getSectionStyle(TaxonAssociationDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
756
|
addPart(taxonAssociationDetailSection);
|
757
|
}
|
758
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
759
|
DerivedUnitFacadeIdentifierSection identifierDetailSection = formFactory.createDerivedUnitFacadeIdentifierSection(parent, StoreUtil.getSectionStyle(DerivedUnitFacadeIdentifierSection.class, getInput().getClass().getCanonicalName()));
|
760
|
addPart(identifierDetailSection);
|
761
|
}
|
762
|
if(!PreferencesUtil.isDeterminationOnlyForFieldUnits()){
|
763
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
764
|
DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(parent, this, StoreUtil.getSectionStyle(DeterminationDetailSection.class, getInput().getClass().getCanonicalName()));
|
765
|
addPart(determinationDetailSection);
|
766
|
}
|
767
|
|
768
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
769
|
DerivedUnitTypeDesignationSection derivedUnitTypeDesignationSection = formFactory.createDerivedUnitTypeDesignationSection(parent, this, StoreUtil.getSectionStyle(DerivedUnitTypeDesignationSection.class, getInput().getClass().getCanonicalName()));
|
770
|
addPart(derivedUnitTypeDesignationSection);
|
771
|
}
|
772
|
|
773
|
private void createFieldUnitFacadeSection(RootElement parent) {
|
774
|
FieldUnitFacadeGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitFacadeGeneralDetailSection(parent, this, StoreUtil.getSectionStyle(FieldUnitFacadeGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
775
|
|
776
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
777
|
|
778
|
GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(parent, this, StoreUtil.getSectionStyle(GatheringEventDetailSection.class, getInput().getClass().getCanonicalName()));
|
779
|
|
780
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
781
|
|
782
|
FieldUnitFacadeDetailSection fieldUnitDetailSection = formFactory.createFieldUnitFacadeDetailSection(parent, this, StoreUtil.getSectionStyle(FieldUnitFacadeDetailSection.class, getInput().getClass().getCanonicalName()));
|
783
|
|
784
|
addPart(fielUnitGeneralDetailSection);
|
785
|
addPart(gatheringEventDetailSection);
|
786
|
addPart(fieldUnitDetailSection);
|
787
|
|
788
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
789
|
DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(parent, this, StoreUtil.getSectionStyle(DeterminationDetailSection.class, getInput().getClass().getCanonicalName()));
|
790
|
addPart(determinationDetailSection);
|
791
|
}
|
792
|
|
793
|
private void createTissueSampleSection(RootElement parent) {
|
794
|
TissueSampleGeneralDetailSection section = formFactory.createTissueSampleGeneralDetailSection(parent, this, StoreUtil.getSectionStyle(TissueSampleGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
795
|
|
796
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
797
|
|
798
|
SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(parent, this, StoreUtil.getSectionStyle(SampleDesignationDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
799
|
|
800
|
addPart(section);
|
801
|
addPart(sampleDesignationDetailSection);
|
802
|
}
|
803
|
|
804
|
private void createDnaSampleSection(RootElement parent) {
|
805
|
DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(parent, this, StoreUtil.getSectionStyle(DnaSampleGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
806
|
|
807
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
808
|
|
809
|
DnaSamplePreparationPreservationSection preparationPreservationSection = formFactory.createDnaSamplePreparationPreservationSection(parent, this, StoreUtil.getSectionStyle(DnaSamplePreparationPreservationSection.class, getInput().getClass().getCanonicalName(), true));
|
810
|
|
811
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
812
|
|
813
|
DnaQualityDetailSection qualitySection = formFactory.createDnaQualityDetailSection(parent, this, StoreUtil.getSectionStyle(DnaQualityDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
814
|
|
815
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
816
|
|
817
|
SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(parent, this, StoreUtil.getSectionStyle(SampleDesignationDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
818
|
|
819
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
820
|
DeterminationDetailSection determinationDetailSection = null;
|
821
|
if(!PreferencesUtil.isDeterminationOnlyForFieldUnits()){
|
822
|
determinationDetailSection = formFactory.createDeterminationDetailSection(parent, this, StoreUtil.getSectionStyle(DeterminationDetailSection.class, getInput().getClass().getCanonicalName()));
|
823
|
}
|
824
|
addPart(section);
|
825
|
addPart(preparationPreservationSection);
|
826
|
addPart(qualitySection);
|
827
|
addPart(sampleDesignationDetailSection);
|
828
|
if(!PreferencesUtil.isDeterminationOnlyForFieldUnits()){
|
829
|
addPart(determinationDetailSection);
|
830
|
}
|
831
|
}
|
832
|
|
833
|
private void createSequenceSection(RootElement parent) {
|
834
|
SequenceGeneralDetailSection section = formFactory.createSequenceGeneralDetailSection(parent, this, StoreUtil.getSectionStyle(SequenceGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
835
|
|
836
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
837
|
|
838
|
SequenceReferenceCollectionDetailSection referenceSection = formFactory.createSequenceReferenceCollectionDetailSection(parent, StoreUtil.getSectionStyle(SequenceReferenceCollectionDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
839
|
|
840
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
841
|
|
842
|
SequenceContigFileCollectionDetailSection contigFileSection = formFactory.createSequenceContigFileCollectionDetailSection(parent, StoreUtil.getSectionStyle(SequenceContigFileCollectionDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
843
|
|
844
|
addPart(section);
|
845
|
addPart(referenceSection);
|
846
|
addPart(contigFileSection);
|
847
|
}
|
848
|
|
849
|
private void createSingleReadSection(RootElement parent) {
|
850
|
SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(parent, this, StoreUtil.getSectionStyle(SingleReadGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
851
|
addPart(section);
|
852
|
|
853
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
854
|
|
855
|
SingleReadPherogramCollectionDetailSection pherogramSection = formFactory.createSingleReadPherogramCollectionDetailSection(parent, StoreUtil.getSectionStyle(SingleReadPherogramCollectionDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
856
|
addPart(pherogramSection);
|
857
|
}
|
858
|
|
859
|
private void createMediaSpecimenSection(RootElement parent) {
|
860
|
MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(parent, this, StoreUtil.getSectionStyle(MediaSpecimenGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
861
|
addPart(generalSection);
|
862
|
|
863
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
864
|
|
865
|
RightsSection rightsSection = formFactory.createRightsSection(parent, StoreUtil.getSectionStyle(RightsSection.class, getInput().getClass().getCanonicalName()));
|
866
|
// rightsSection.setEntity(generalSection.getEntity().innerDerivedUnit());
|
867
|
addPart(rightsSection);
|
868
|
}
|
869
|
|
870
|
private void createFeatureTreeSectionForDto(RootElement parent) {
|
871
|
TermTreeDetailSection section = formFactory.createFeatureTreeDetailSection(parent, this, StoreUtil.getSectionStyle(TermTreeDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
872
|
|
873
|
addPart(section);
|
874
|
}
|
875
|
private void createFeatureTreeSection(RootElement parent) {
|
876
|
TermTreeDetailSectionForNode section = formFactory.createFeatureTreeDetailSectionForTree(parent, this, StoreUtil.getSectionStyle(TermTreeDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
877
|
addPart(section);
|
878
|
}
|
879
|
|
880
|
private void createFeatureNodeSection(RootElement parent) {
|
881
|
TermNodeDetailSection featureDistributionSection = formFactory.createFeatureNodeDetailSection(parent, this, StoreUtil.getSectionStyle(TermNodeDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
882
|
addPart(featureDistributionSection);
|
883
|
}
|
884
|
|
885
|
private void createFeatureDistributionSection(RootElement parent) {
|
886
|
FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(parent, this, StoreUtil.getSectionStyle(FeatureDistributionDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
887
|
addPart(featureDistributionSection);
|
888
|
}
|
889
|
|
890
|
private void createCharacterNodeSection(RootElement parent) {
|
891
|
CharacterNodeDetailSection featureDistributionSection = formFactory.createCharacterNodeDetailSection(parent, this, StoreUtil.getSectionStyle(CharacterDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
892
|
addPart(featureDistributionSection);
|
893
|
}
|
894
|
|
895
|
private void createCharacterNodeDtoSection(RootElement parent) {
|
896
|
CharacterNodeDtoDetailSection featureDistributionSection = formFactory.createCharacterNodeDtoDetailSection(parent, this, StoreUtil.getSectionStyle(CharacterDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
897
|
addPart(featureDistributionSection);
|
898
|
}
|
899
|
|
900
|
private void createCharacterSection(RootElement parent) {
|
901
|
CharacterDetailSection featureDistributionSection = formFactory.createCharacterDetailSection(parent, this, StoreUtil.getSectionStyle(CharacterDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
902
|
addPart(featureDistributionSection);
|
903
|
}
|
904
|
|
905
|
private void createPolytomousKeyNodeSection(RootElement parent) {
|
906
|
PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(parent, this, StoreUtil.getSectionStyle(PolytomousKeyDetailSection.class, getInput().getClass().getCanonicalName()));
|
907
|
|
908
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
909
|
|
910
|
PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(parent, this, StoreUtil.getSectionStyle(PolytomousKeyNodeDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
911
|
|
912
|
addPart(polytomousKeyDetailSection);
|
913
|
addPart(polytomousKeyNodeDetailSection);
|
914
|
|
915
|
}
|
916
|
|
917
|
private void createUseRecordSection(RootElement parent) {
|
918
|
UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(parent, this,StoreUtil.getSectionStyle(UseRecordDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
919
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
920
|
addPart(descriptionUseRecordSection);
|
921
|
}
|
922
|
|
923
|
private void createUserSection(RootElement parent) {
|
924
|
UserDetailSection userDetailSection = formFactory.createUserDetailSection(parent, this, StoreUtil.getSectionStyle(UserDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
925
|
|
926
|
GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(parent, StoreUtil.getSectionStyle(GroupsByUserDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
927
|
|
928
|
addPart(userDetailSection);
|
929
|
addPart(groupByUserDetailSection);
|
930
|
}
|
931
|
|
932
|
private void createMisappliedNameSection(RootElement parent) {
|
933
|
TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(parent, this,
|
934
|
StoreUtil.getSectionStyle(TaxonRelationshipDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
935
|
addPart(taxonRelationshipDetailSection);
|
936
|
|
937
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
938
|
|
939
|
NonViralNameDetailSection nonViralNameSection = formFactory
|
940
|
.createNonViralNameDetailSection(parent, this, true,
|
941
|
StoreUtil.getSectionStyle(NonViralNameDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
942
|
addPart(nonViralNameSection);
|
943
|
|
944
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
945
|
|
946
|
NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(parent, this,
|
947
|
StoreUtil.getSectionStyle(NomenclaturalSourceDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
948
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
949
|
addPart(referenceDetailSection);
|
950
|
|
951
|
NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(parent,
|
952
|
StoreUtil.getSectionStyle(NomenclaturalStatusSection.class, getInput().getClass().getCanonicalName(), true));
|
953
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
954
|
addPart(nomenclaturalStatusSection);
|
955
|
|
956
|
TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(parent, StoreUtil.getSectionStyle(TypeDesignationSection.class, getInput().getClass().getCanonicalName()));
|
957
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
958
|
addPart(typeDesignationSection);
|
959
|
|
960
|
NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(parent, StoreUtil.getSectionStyle(NameRelationshipDetailSection.class, getInput().getClass().getCanonicalName()));
|
961
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
962
|
addPart(nameRelationshipSection);
|
963
|
}
|
964
|
|
965
|
private void createTaxonRelationshipSection(RootElement parent) {
|
966
|
TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(parent, this, StoreUtil.getSectionStyle(TaxonRelationshipDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
967
|
|
968
|
ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(parent, this, StoreUtil.getSectionStyle(ReferencedEntityDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
969
|
addPart(taxonRelationshipDetailSection);
|
970
|
addPart(referencedEntityBaseDetailSection);
|
971
|
}
|
972
|
private void createTermVocabularySection(RootElement parent) {
|
973
|
TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(parent, this, StoreUtil.getSectionStyle(TermVocabularyDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
974
|
addPart(termVocabularyDetailSection);
|
975
|
}
|
976
|
|
977
|
private void createDefinedTermSection(RootElement parent) {
|
978
|
DefinedTermDetailSection<?> definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), parent, this, StoreUtil.getSectionStyle(DefinedTermDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
979
|
addPart(definedTermDetailSection);
|
980
|
TermMediaSection termMediaSection = formFactory.createTermMediaSection(parent, StoreUtil.getSectionStyle(DefinedTermDetailSection.class, getInput().getClass().getCanonicalName(), true));
|
981
|
addPart(termMediaSection);
|
982
|
}
|
983
|
|
984
|
|
985
|
@Inject
|
986
|
@Optional
|
987
|
private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_DETAILS)boolean refresh){
|
988
|
if(refresh){
|
989
|
//refresh_withoutnew_build(); this would use the update without creation of all fields
|
990
|
refresh();
|
991
|
}
|
992
|
}
|
993
|
|
994
|
@Inject
|
995
|
@Optional
|
996
|
private void blockView(@UIEventTopic(WorkbenchEventConstants.ENABLE_TAXON_DETAILS)boolean enable){
|
997
|
for (IFormPart part :this.managedForm.getParts()) {
|
998
|
if (part instanceof CdmSectionPart) {
|
999
|
((CdmSectionPart)part).getSection().setEnabled(enable);
|
1000
|
}
|
1001
|
}
|
1002
|
|
1003
|
|
1004
|
}
|
1005
|
|
1006
|
@Inject
|
1007
|
@Optional
|
1008
|
private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_DETAILS_DISTRIBUTION)String nameCache){
|
1009
|
if(nameCache != null && getInput() instanceof Distribution && this.activePart instanceof IDistributionEditorPart){
|
1010
|
if (part instanceof CdmSectionPart && ((CdmSectionPart<?>)part).getSection() instanceof DescriptionElementDetailSection){
|
1011
|
for (ICdmFormElement element: ((DescriptionElementDetailSection)((CdmSectionPart<?>)part).getSection()).getElements()){
|
1012
|
if (element instanceof DescriptionElementDetailElement){
|
1013
|
for(ICdmFormElement descriptionElement:((DescriptionElementDetailElement)element).getElements()){
|
1014
|
if (descriptionElement instanceof DistributionDetailElement){
|
1015
|
((DistributionDetailElement) descriptionElement).setName(nameCache);
|
1016
|
}
|
1017
|
}
|
1018
|
}
|
1019
|
}
|
1020
|
}
|
1021
|
}
|
1022
|
}
|
1023
|
}
|