import eu.etaxonomy.cdm.api.service.dto.TaxonRowWrapperDTO;
import eu.etaxonomy.cdm.model.common.MarkerType;
import eu.etaxonomy.cdm.model.description.DescriptiveDataSet;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.CharacterMatrixPart;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
/**
* @author pplitzner
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart, UISynchronize sync) {
CharacterMatrixPart matrixPart = (CharacterMatrixPart) activePart.getObject();
+ if(StoreUtil.promptCheckIsDirty(matrixPart)){
+ return;
+ }
DescriptiveDataSet descriptiveDataSet = matrixPart.getDescriptiveDataSet();
- TaxonNode node = (TaxonNode) matrixPart.getSelection().getFirstElement();
+ TaxonNodeDto node = (TaxonNodeDto) matrixPart.getSelection().getFirstElement();
TaxonRowWrapperDTO taxonRowWrapperDTO = CdmStore.getService(IDescriptiveDataSetService.class)
.createTaxonDescription(descriptiveDataSet.getUuid(), node.getUuid(), getMarkerType(), getMarkerFlag());
+ matrixPart.getMatrix().getCdmEntitiySession().load(taxonRowWrapperDTO.getDescription(), true);
matrixPart.getMatrix().getDescriptions().add(taxonRowWrapperDTO);
}
boolean canExecute = false;
IStructuredSelection selection = ((CharacterMatrixPart)activePart.getObject()).getSelection();
canExecute = selection.size()==1
- && selection.getFirstElement() instanceof TaxonNode;
+ && selection.getFirstElement() instanceof TaxonNodeDto;
menuItem.setVisible(canExecute);
return canExecute;
}