Project

General

Profile

« Previous | Next » 

Revision ec23f5f4

Added by Cherian Mathew over 8 years ago

#5301 Fix null session issues, Add remoting session for feature tree editor

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/CdmPreferencePage.java
14 14
import java.util.Map;
15 15

  
16 16
import org.eclipse.jface.preference.PreferencePage;
17
import org.eclipse.jface.resource.ImageDescriptor;
17 18

  
18 19
import eu.etaxonomy.cdm.model.common.CdmBase;
19 20
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
......
27 28
 */
28 29
public abstract class CdmPreferencePage extends PreferencePage implements ICdmEntitySessionEnabled {
29 30

  
31
    private ICdmEntitySession previousCdmEntitySession;
32
    private boolean isApply;
33

  
30 34
    public CdmPreferencePage() {
31
        bindNullSession();
35
        initSession();
32 36
    }
33 37

  
34 38
    public CdmPreferencePage(String title) {
35 39
        super(title);
40
        initSession();
41
    }
42

  
43
    public CdmPreferencePage(String title, ImageDescriptor image) {
44
        super(title, image);
45
        initSession();
46
    }
47

  
48
    private void initSession() {
49
        previousCdmEntitySession = CdmStore.getCurrentSessionManager().getActiveSession();
36 50
        bindNullSession();
37 51
    }
38 52

  
......
42 56
        }
43 57
    }
44 58

  
45
    protected void disposeNullSession() {
46
        if(CdmStore.isActive()) {
47
            CdmStore.getCurrentSessionManager().disposeNullSession();
48
        }
49
    }
50

  
51 59
    @Override
52 60
    public boolean performOk() {
53
        disposeNullSession();
61
        if(previousCdmEntitySession != null && !isApply) {
62
            previousCdmEntitySession.bind();
63
        }
54 64
        return super.performOk();
55 65
    }
56 66

  
57 67
    @Override
58 68
    public boolean performCancel() {
59
        disposeNullSession();
69
        if(previousCdmEntitySession != null) {
70
            previousCdmEntitySession.bind();
71
        }
60 72
        return super.performCancel();
61 73
    }
62 74

  
63
       /* (non-Javadoc)
75
    @Override
76
    public void performApply() {
77
        isApply = true;
78
        super.performApply();
79
        isApply = false;
80
    }
81

  
82
    /* (non-Javadoc)
64 83
     * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
65 84
     */
66 85
    @Override

Also available in: Unified diff