3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.preference
.menu
;
12 import java
.util
.Collection
;
13 import java
.util
.List
;
16 import org
.eclipse
.jface
.preference
.PreferencePage
;
17 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
19 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
20 import eu
.etaxonomy
.taxeditor
.session
.ICdmEntitySession
;
21 import eu
.etaxonomy
.taxeditor
.session
.ICdmEntitySessionEnabled
;
22 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
29 public abstract class CdmPreferencePage
extends PreferencePage
implements ICdmEntitySessionEnabled
{
31 private ICdmEntitySession previousCdmEntitySession
;
32 private boolean isApply
;
34 public CdmPreferencePage() {
38 public CdmPreferencePage(String title
) {
43 public CdmPreferencePage(String title
, ImageDescriptor image
) {
48 private void initSession() {
49 previousCdmEntitySession
= CdmStore
.getCurrentSessionManager().getActiveSession();
53 private void bindNullSession() {
54 if(CdmStore
.isActive()) {
55 CdmStore
.getCurrentSessionManager().bindNullSession();
60 public boolean performOk() {
61 if(previousCdmEntitySession
!= null && !isApply
) {
62 previousCdmEntitySession
.bind();
64 return super.performOk();
68 public boolean performCancel() {
69 if(previousCdmEntitySession
!= null) {
70 previousCdmEntitySession
.bind();
72 return super.performCancel();
76 public void performApply() {
83 * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
86 public ICdmEntitySession
getCdmEntitySession() {
87 return CdmStore
.getCurrentSessionManager().getNullSession();
91 * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
94 public <T
extends CdmBase
> Collection
<T
> getRootEntities() {
99 * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
102 public Map
<Object
, List
<String
>> getPropertyPathsMap() {