Project

General

Profile

Revision 3dfb5304

ID3dfb53046a024a29a2550f83f5102134f109bb0b
Parent 6ab5c17a
Child c25ddfcf

Added by Cherian Mathew over 8 years ago

AnnotatedLineEditor : added check and code for the case when the creator also saves the entity
NewObjectHandler : removed popup for title cache
DynamicNewObjectMenu : menu item for SpecimenOrObservationType.FieldUnit disabled for the moment

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/AnnotatedLineEditor.java
24 24

  
25 25
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
26 26
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
27
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
28
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
27 29
import eu.etaxonomy.cdm.model.common.CdmBase;
28 30
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
29 31
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
32
import eu.etaxonomy.taxeditor.store.CdmStore;
30 33

  
31 34
/**
32 35
 * A list-based editor, where each line in the editor's document is associated with a domain object.
......
148 151
	 */
149 152
	public LineAnnotation createAnnotatedLineNewObject(Object key, String titleCache) {
150 153
		
154
		
155

  
151 156
		// Create new object
152 157
		Object entity = ((AnnotatedLineDocumentProvider) getDocumentProvider()).
153 158
							getEntityCreator(getEditorInput()).createEntity(key, titleCache);
154

  
159
		// checks if the creator also saves the entity (in a different conversation), in which case 
160
		// we need to bind back this editors conversation
161
		// we also need to reload the entity because the conversation used to
162
		// to create / save the entity may have been closed
163
		if(((AnnotatedLineDocumentProvider) getDocumentProvider()).getEntityCreator(getEditorInput()).savesEntity()) {		
164
			getConversationHolder().bind();
165
			Object object = CdmStore.getService(IOccurrenceService.class).load(((CdmBase)entity).getUuid());			
166
			entity = HibernateProxyHelper.deproxy(object);			
167
		}
168
		
169
		if(entity == null) {
170
			return null;
171
		}
155 172
		LineAnnotation annotation = createAnnotatedLine(entity);
156 173
		if (annotation != null) {
157 174
			annotation.markAsNew(true);
158 175
		}
176

  
159 177
		return annotation;
160 178
		
161 179
	}
162 180
	
181
	  @Override
182
	  public boolean isDirty() {
183
		return super.isDirty();		  
184
	  }
185
	
163 186
	/**
164 187
	 * Creates an annotated line at the end of the document. The annotation contains the entity.
165 188
	 *
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/handler/NewObjectHandler.java
44 44
			
45 45
			Object key = ((Event)event.getTrigger()).data;
46 46
			if (key != null) {
47
				
48
				
49
				String text = ((Event)event.getTrigger()).text;
50
				InputDialog dialog = new InputDialog(HandlerUtil.getActiveShell(event), "Create " + text, "Enter new " + text, "", null);
51
				if (dialog.open() != Window.CANCEL) {
52
					((AnnotatedLineEditor) editor).createAnnotatedLineNewObject(key, dialog.getValue());
53
				}
47

  
48
				((AnnotatedLineEditor) editor).createAnnotatedLineNewObject(key, "Untitled");
54 49
				
55 50
			} else {
56 51
				((AnnotatedLineEditor) editor).createAnnotatedLineNewObject();
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/DynamicNewObjectMenu.java
26 26
import org.eclipse.ui.actions.CompoundContributionItem;
27 27
import org.eclipse.ui.handlers.IHandlerService;
28 28

  
29
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
29 30
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
30 31
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
31 32
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
......
83 84
				}
84 85
			}				
85 86
		});
87
		
88
		//FIXME:3.3MC Need corresponding Details Viewer section for FieldUnit
89
		if(key == SpecimenOrObservationType.FieldUnit){
90
			menuItem.setEnabled(false);
91
		}
86 92
	}
87 93
	
88 94
	/**

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)