merge
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / selection / EntitySelectionElement.java
index 0b0f89b2c13c9d93d4053110713f79a791161a8d..6f87d5e634a1e55e677a1b44656a0b7b0657b89b 100644 (file)
@@ -238,7 +238,7 @@ public class EntitySelectionElement<T extends ICdmBase> extends
 
        @Override
     public void widgetSelected(SelectionEvent e) {
-               T selection = SelectionDialogFactory.getSelectionFromDialog(clazz, getShell(), getConversationHolder(), getEntity());
+               T selection = SelectionDialogFactory.getSelectionFromDialog(clazz, getShell(), getConversationHolder(), getEntity(), getParentElement());
                setSelectionInternal(selection);
        }
 
@@ -465,7 +465,7 @@ public class EntitySelectionElement<T extends ICdmBase> extends
                            service = (IService<T>) CdmStore.getService(IAmplificationService.class);
                        }
                        //check if original already exists in data base. If not then do not clone and all changes will be persisted directly -> Warning to user.
-                if(service !=null && service.find(originalEntity.getUuid())==null){
+                if(service !=null && service.find(originalEntity.getUuid())==null && originalEntity.getId() != 0){
                     if(MessagingUtils.confirmDialog(TRANSIENT_EDITING_WARNING_TITLE, "["+originalEntity.getClass().getSimpleName()+"]"+originalEntity + " has to be saved before it can be edited. Save now?")){
                         service.save(originalEntity);
                         AbstractUtility.getActiveEditor().doSave(new NullProgressMonitor());
@@ -477,12 +477,13 @@ public class EntitySelectionElement<T extends ICdmBase> extends
                     }
                 }
                 else{
-                    try {
-                        //clone original
-                        clonedEntity = (T) ((CdmBase) originalEntity).clone();
-                    } catch (CloneNotSupportedException e1) {
-                        MessagingUtils.warningDialog(TRANSIENT_EDITING_WARNING_TITLE, this, TRANSIENT_EDITING_WARNING_TEXT);
-                    }
+                    //FIXME temporarily disabled cloning re-opening bug #2645 (EditFromSelectionWizard persists data even when canceled)
+//                    try {
+//                        //clone original
+//                        clonedEntity = (T) ((CdmBase) originalEntity).clone();
+//                    } catch (CloneNotSupportedException e1) {
+//                        MessagingUtils.warningDialog(TRANSIENT_EDITING_WARNING_TITLE, this, TRANSIENT_EDITING_WARNING_TEXT);
+//                    }
                 }
 
                    }
@@ -507,6 +508,7 @@ public class EntitySelectionElement<T extends ICdmBase> extends
                        }
                        //be sure to reset to original in all cases
                        selectionElement.setEntity(originalEntity);
+                       selectionElement.refresh();
                }
        }