import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
public static void openEditor(UuidAndTitleCache uuidAndTitleCache, Shell shell, EModelService modelService, EPartService partService, MApplication application){
Class<?> type = uuidAndTitleCache.getType();
ICdmBase cdmBase = null;
- if(type.equals(Classification.class)){
+ if(uuidAndTitleCache instanceof TaxonNodeDto){
+ EditorUtil.openTaxonNodeE4(uuidAndTitleCache.getUuid(), modelService, partService, application);
+ return;
+ }
+ else if(type.equals(Classification.class)){
cdmBase = CdmStore.getService(IClassificationService.class).load(uuidAndTitleCache.getUuid());
}
else if(type.equals(TaxonNode.class)){
* @param taxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
* @return a boolean.
*/
- public static boolean isDirty(TaxonNode taxonNode, EPartService partService){
+ public static boolean isDirty(TaxonNodeDto taxonNode, EPartService partService){
Collection<MPart> dirtyParts = partService.getDirtyParts();
for (MPart part : dirtyParts) {
if(part.getObject() instanceof TaxonNameEditorE4){
TaxonEditorInputE4 input = ((TaxonNameEditorE4) part.getObject()).getEditorInput();
- if(input.getTaxonNode().equals(taxonNode)){
+ if(input.getTaxonNode().getUuid().equals(taxonNode.getUuid())){
return true;
}
}
return false;
}
+ /**
+ * Whether a taxonNode has unsaved changes.
+ *
+ * @param taxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
+ * @return a boolean.
+ */
+ public static boolean isDirty(TaxonNode taxonNode, EPartService partService){
+
+ Collection<MPart> dirtyParts = partService.getDirtyParts();
+ for (MPart part : dirtyParts) {
+ if(part.getObject() instanceof TaxonNameEditorE4){
+ TaxonEditorInputE4 input = ((TaxonNameEditorE4) part.getObject()).getEditorInput();
+ if(input.getTaxonNode().equals(taxonNode)){
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
/**
* <p>openSearch</p>
*