X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/blobdiff_plain/d748f4f475ed1a7a94d900b8ac5273d73a3fcf98..b30eea31f8a303f00f7c1d3e3f23fe8181576d47:/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementDetailSection.java diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementDetailSection.java index 6414310fd..c66e67a93 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementDetailSection.java @@ -18,11 +18,13 @@ import org.eclipse.swt.widgets.Control; 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; import eu.etaxonomy.taxeditor.store.StoreUtil; -import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; +import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; import eu.etaxonomy.taxeditor.ui.section.description.operation.ChangeDescriptionElementType; @@ -54,13 +56,10 @@ public class DescriptionElementDetailSection extends @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; @@ -70,7 +69,7 @@ public class DescriptionElementDetailSection extends */ @Override public void run() { - boolean confirmed = StoreUtil.confirmDialog("Confirmation", "Do you really want to change to " + boolean confirmed = MessagingUtils.confirmDialog("Confirmation", "Do you really want to change to " + destinationString + "? Current data will be lost."); if (confirmed) { // FIXME @@ -81,6 +80,7 @@ public class DescriptionElementDetailSection extends } }; // TODO enable this once a proper icon has been found + // ticket #5043 // addAction.setImageDescriptor(new ImageDescriptor() { // // @Override @@ -105,16 +105,23 @@ public class DescriptionElementDetailSection extends @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)