// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import eu.etaxonomy.cdm.model.description.TextData;
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.element.CdmFormFactory.DetailType;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.taxeditor.ui.section.description.operation.ChangeDescriptionElementType;
*/
public class DescriptionElementDetailSection extends
AbstractCdmDetailSection<DescriptionElementBase> {
-
+
/**
* <p>Constructor for DescriptionElementDetailSection.</p>
*
ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
}
-
-
- protected Control createToolbar() {
+
+
+ @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 label = "Change to " + destinationString;
-
+
+ final String label = "Change to " + destinationString;
+
Action addAction = new Action("Change Type", Action.AS_PUSH_BUTTON) {
/* (non-Javadoc)
* @see org.eclipse.jface.action.Action#run()
+ destinationString + "? Current data will be lost.");
if (confirmed) {
// FIXME
- ChangeDescriptionElementType operation = new ChangeDescriptionElementType(label,
+ ChangeDescriptionElementType operation = new ChangeDescriptionElementType(label,
getEntity(), StoreUtil.getDetailsView(), StoreUtil.getUndoContext());
StoreUtil.executeOperation(operation);
}
}
};
- // TODO enable this once a proper icon has been found
+ // TODO enable this once a proper icon has been found
// addAction.setImageDescriptor(new ImageDescriptor() {
-//
+//
// @Override
// public ImageData getImageData() {
// return ImageResources.getImage(ImageResources.ADD_ICON).getImageData();
// }
// });
addAction.setToolTipText(label);
-
+
toolBarManager.add(addAction);
-
- ICdmFormElement parentElement = this.getParentElement();
-
-
+
return toolBarManager.createControl(this);
}
-
+
/** {@inheritDoc} */
@Override
public String getHeading() {
return "Description Element";
}
- /** {@inheritDoc} */
- @Override
- protected DetailType getDetailType() {
- return DetailType.DESCRIPTIONELEMENT;
- }
-
/** {@inheritDoc} */
@Override
protected void setSectionTitle() {
this.setText(getHeading() + ": " + getEntity().getFeature().getLabel(CdmStore.getDefaultLanguage()));
setTextClient(createToolbar());
}
-
+
private boolean hasSpecificElement(){
- return getEntity().getFeature().isSupportsCategoricalData()
+ return getEntity().getFeature().isSupportsCategoricalData()
|| getEntity().getFeature().isSupportsCommonTaxonName()
|| getEntity().getFeature().isSupportsDistribution()
|| getEntity().getFeature().isSupportsIndividualAssociation()
|| getEntity().getFeature().isSupportsQuantitativeData()
|| getEntity().getFeature().isSupportsTaxonInteraction();
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
+ */
+ @Override
+ protected AbstractCdmDetailElement<DescriptionElementBase> createCdmDetailElement(AbstractCdmDetailSection<DescriptionElementBase> parentElement, int style) {
+ return formFactory.createDescriptionElementDetailElement(parentElement, style);
+ }
}