package eu.etaxonomy.taxeditor.ui.section.description;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.SWT;
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.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.taxeditor.ui.section.description.operation.ChangeDescriptionElementType;
+import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4;
/**
* <p>DescriptionElementDetailSection class.</p>
public class DescriptionElementDetailSection extends
AbstractCdmDetailSection<DescriptionElementBase> {
+
+
/**
* <p>Constructor for DescriptionElementDetailSection.</p>
*
final String label = "Change to " + destinationString;
- Action addAction = new Action("Change Type", Action.AS_PUSH_BUTTON) {
+ Action addAction = new Action("Change Type", IAction.AS_PUSH_BUTTON) {
/* (non-Javadoc)
* @see org.eclipse.jface.action.Action#run()
*/
boolean confirmed = MessagingUtils.confirmDialog("Confirmation", "Do you really want to change to "
+ destinationString + "? Current data will be lost.");
if (confirmed) {
- // FIXME
- ChangeDescriptionElementType operation = new ChangeDescriptionElementType(label,
- getEntity(), StoreUtil.getDetailsView(), StoreUtil.getUndoContext());
- StoreUtil.executeOperation(operation);
+ EPartService partService = formFactory.getContext().get(EPartService.class);
+ DetailsPartE4 detailsView = AbstractUtility.getDetailsView(partService);
+ ChangeDescriptionElementType operation = new ChangeDescriptionElementType(label,
+ getEntity(), detailsView, StoreUtil.getUndoContext());
+ AbstractUtility.executeOperation(operation, formFactory.getContext().get(UISynchronize.class));
}
}
};
/** {@inheritDoc} */
@Override
protected void setSectionTitle() {
- this.setText(getHeading() + ": " + getEntity().getFeature().getLabel(CdmStore.getDefaultLanguage()));
+ this.setText(getHeading() + ": " + getEntity().getFeature().getPreferredRepresentation(CdmStore.getDefaultLanguage()));
+ //getLabel(CdmStore.getDefaultLanguage()));
if(IsMoreThanOneTypeSupported()){
setTextClient(createToolbar());
protected AbstractCdmDetailElement<DescriptionElementBase> createCdmDetailElement(AbstractCdmDetailSection<DescriptionElementBase> parentElement, int style) {
return formFactory.createDescriptionElementDetailElement(parentElement, style);
}
+
+
}