import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* A list-based editor, where each line in the editor's document is associated with a domain object.
*/
public LineAnnotation createAnnotatedLineNewObject(Object key, String titleCache) {
+
+
// Create new object
Object entity = ((AnnotatedLineDocumentProvider) getDocumentProvider()).
getEntityCreator(getEditorInput()).createEntity(key, titleCache);
-
+ // checks if the creator also saves the entity (in a different conversation), in which case
+ // we need to bind back this editors conversation
+ // we also need to reload the entity because the conversation used to
+ // to create / save the entity may have been closed
+ if(((AnnotatedLineDocumentProvider) getDocumentProvider()).getEntityCreator(getEditorInput()).savesEntity()) {
+ getConversationHolder().bind();
+ Object object = CdmStore.getService(IOccurrenceService.class).load(((CdmBase)entity).getUuid());
+ entity = HibernateProxyHelper.deproxy(object);
+ }
+
+ if(entity == null) {
+ return null;
+ }
LineAnnotation annotation = createAnnotatedLine(entity);
if (annotation != null) {
annotation.markAsNew(true);
}
+
return annotation;
}
+ @Override
+ public boolean isDirty() {
+ return super.isDirty();
+ }
+
/**
* Creates an annotated line at the end of the document. The annotation contains the entity.
*
Object key = ((Event)event.getTrigger()).data;
if (key != null) {
-
-
- String text = ((Event)event.getTrigger()).text;
- InputDialog dialog = new InputDialog(HandlerUtil.getActiveShell(event), "Create " + text, "Enter new " + text, "", null);
- if (dialog.open() != Window.CANCEL) {
- ((AnnotatedLineEditor) editor).createAnnotatedLineNewObject(key, dialog.getValue());
- }
+
+ ((AnnotatedLineEditor) editor).createAnnotatedLineNewObject(key, "Untitled");
} else {
((AnnotatedLineEditor) editor).createAnnotatedLineNewObject();
import org.eclipse.ui.actions.CompoundContributionItem;
import org.eclipse.ui.handlers.IHandlerService;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
}
}
});
+
+ //FIXME:3.3MC Need corresponding Details Viewer section for FieldUnit
+ if(key == SpecimenOrObservationType.FieldUnit){
+ menuItem.setEnabled(false);
+ }
}
/**