//TODO add context menu for deleting associations
Collection<TaxonBase<?>> associatedTaxa = CdmStore.getService(IOccurrenceService.class).listAssociatedTaxa(entity.innerDerivedUnit(), null, null, null, null);
- if(associatedTaxa.isEmpty()){
- Label associationsLabel = formFactory.createLabel(getLayoutComposite(), "Individuals Associations");
- associationsLabel.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ Collection<SpecimenTypeDesignation> typeDesignations = CdmStore.getService(IOccurrenceService.class).listTypeDesignations(entity.innerDerivedUnit(), null, null, null, null);
+ if(!associatedTaxa.isEmpty()){
associationsViewer = new TableViewer(getLayoutComposite(), SWT.FULL_SELECTION);
associationsViewer.getTable().setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
associationsViewer.setContentProvider(new ArrayContentProvider());
associationsViewer.setInput(associatedTaxa);
associationsViewer.addDoubleClickListener(this);
}
+ else{
+ Label label = formFactory.createLabel(getLayoutComposite(), "No associations");
+ label.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ }
- Collection<SpecimenTypeDesignation> typeDesignations = CdmStore.getService(IOccurrenceService.class).listTypeDesignations(entity.innerDerivedUnit(), null, null, null, null);
//TODO implement service method for this which is just used in the label provider
Collection<TaxonBase<?>> typedTaxa = new HashSet<TaxonBase<?>>();
for (SpecimenTypeDesignation specimenTypeDesignation : typeDesignations) {
//empty
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
- */
@Override
public void doubleClick(DoubleClickEvent event) {
if(event.getSelection() instanceof IStructuredSelection){
FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
addPart(fieldUnitDetailSection);
}
+ else{
+ if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS)){
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ addPart(taxonAssociationDetailSection);
+ }
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ IdentifierDetailSection identifierDetailSection = formFactory.createIdentifierDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+ addPart(identifierDetailSection);
+ }
if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
addPart(determinationDetailSection);
}
- if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS)){
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- addPart(taxonAssociationDetailSection);
- }
-
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- IdentifierDetailSection identifierDetailSection = formFactory.createIdentifierDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
- addPart(identifierDetailSection);
}