Project

General

Profile

« Previous | Next » 

Revision 49d3c2dd

Added by Katja Luther over 1 year ago

ref #10186: remove conversation holder

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/termtree/e4/TermTreeEditor.java
46 46
import org.eclipse.swt.widgets.Composite;
47 47
import org.eclipse.ui.IMemento;
48 48

  
49
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
50
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
51 49
import eu.etaxonomy.cdm.api.service.ITermNodeService;
52 50
import eu.etaxonomy.cdm.api.service.ITermTreeService;
53 51
import eu.etaxonomy.cdm.api.service.UpdateResult;
......
86 84
public class TermTreeEditor<T extends DefinedTermBase>
87 85
		implements ITermTreeEditor, ISelectionChangedListener,
88 86
        	IE4ViewerPart, IPartContentHasDetails, IPartContentHasSupplementalData,
89
        	IContextListener, IConversationEnabled, IDirtyMarkable {
87
        	IContextListener, IDirtyMarkable {
90 88

  
91 89
    public static final String OPEN_COMMAND_ID = "eu.etaxonomy.taxeditor.store.openTermTreeEditor";
92 90

  
......
101 99
            "root.children.onlyApplicableIf.state", //$NON-NLS-1$
102 100
    });
103 101

  
104
    private ConversationHolder conversation;
105

  
106 102
    private ICdmEntitySession cdmEntitySession;
107 103

  
108 104
    @Inject
......
219 215
    }
220 216

  
221 217
    private void initSession(){
222
        if(conversation == null){
223
            conversation = CdmStore.createConversation();
224
        }
225 218
        if(cdmEntitySession==null){
226 219
            cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
227 220
        }
228 221
    }
229 222

  
230 223
    private void clearSession() {
231
        if(conversation!=null){
232
            conversation.close();
233
            conversation = null;
234
        }
235 224
        if(cdmEntitySession != null) {
236 225
            cdmEntitySession.dispose();
237 226
            cdmEntitySession = null;
......
262 251
	    if(viewer!=null){
263 252
	        viewer.getControl().setFocus();
264 253
	    }
265
        if(conversation!=null && !conversation.isBound()){
266
            conversation.bind();
267
        }
268 254
        if(cdmEntitySession != null) {
269 255
            cdmEntitySession.bind();
270 256
        }
......
288 274
	    return (IStructuredSelection) viewer.getSelection();
289 275
	}
290 276

  
291
	@Override
292
	public ConversationHolder getConversationHolder() {
293
	    return conversation;
294
	}
277
	
295 278

  
296 279
	@Override
297 280
    @Persist
298 281
	public void save(IProgressMonitor monitor){
299
        if (!conversation.isBound()) {
300
            conversation.bind();
301
        }
302

  
303
        // commit the conversation and start a new transaction immediately
282
        
283
        
304 284
        ISelection sel = this.viewer.getSelection();
305
        conversation.commit(true);
285
        
306 286
        if (createOperationList != null && !createOperationList.isEmpty()){
307 287
            for (CreateFeatureTreeOperation operation: createOperationList.values()){
308 288
                TermTreeDto termDto = getTreeDtoForUuid(operation.getElementUuid());
......
326 306
        listToUpdate.clear();
327 307
        List<TermTreeDto> rootEntities = getRootEntities();
328 308
        UpdateResult result = CdmStore.getService(ITermTreeService.class).saveOrUpdateTermTreeDtoList(rootEntities);
329
        conversation.commit(true);
309
       
330 310
        this.setDirty(false);
331 311
        initializeTrees();
332 312
        this.viewer.setSelection(sel);
......
396 376
    public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
397 377
    }
398 378

  
399
    @Override
400
    public void update(CdmDataChangeMap arg0) {
401
    }
402

  
403 379
    @Override
404 380
    public void changed(Object element) {
405 381
        dirty.setDirty(true);

Also available in: Unified diff