import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
+import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.TextData;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
@Override
protected Control createToolbar() {
- if(! hasSpecificElement()){
- return null;
- }
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
- final String destinationString = (getEntity() instanceof TextData) ? "the specific element" : "free text";
+ final String destinationString = (getEntity().isInstanceOf(TextData.class)) ? "the specific element" : "free text";
final String label = "Change to " + destinationString;
}
};
// TODO enable this once a proper icon has been found
+ // ticket #5043
// addAction.setImageDescriptor(new ImageDescriptor() {
//
// @Override
@Override
protected void setSectionTitle() {
this.setText(getHeading() + ": " + getEntity().getFeature().getLabel(CdmStore.getDefaultLanguage()));
- setTextClient(createToolbar());
+
+ if(IsMoreThanOneTypeSupported()){
+ setTextClient(createToolbar());
+ }
}
- private boolean hasSpecificElement(){
- return getEntity().getFeature().isSupportsCategoricalData()
- || getEntity().getFeature().isSupportsCommonTaxonName()
- || getEntity().getFeature().isSupportsDistribution()
- || getEntity().getFeature().isSupportsIndividualAssociation()
- || getEntity().getFeature().isSupportsQuantitativeData()
- || getEntity().getFeature().isSupportsTaxonInteraction();
+ private boolean IsMoreThanOneTypeSupported(){
+ int count = 0;
+ Feature feature = getEntity().getFeature();
+ if(feature.isSupportsCategoricalData()){count++;}
+ if(feature.isSupportsCommonTaxonName()){count++;}
+ if(feature.isSupportsDistribution()){count++;}
+ if(feature.isSupportsIndividualAssociation()){count++;}
+ if(feature.isSupportsQuantitativeData()){count++;}
+ if(feature.isSupportsTaxonInteraction()){count++;}
+ if(feature.isSupportsTextData()){count++;}
+ return count > 1;
}
/* (non-Javadoc)