2 * Copyright (C) 2015 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.preference
.menu
;
11 import java
.util
.Collection
;
12 import java
.util
.List
;
15 import org
.eclipse
.jface
.preference
.PreferencePage
;
16 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
18 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
19 import eu
.etaxonomy
.taxeditor
.session
.ICdmEntitySession
;
20 import eu
.etaxonomy
.taxeditor
.session
.ICdmEntitySessionEnabled
;
21 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
28 public abstract class CdmPreferencePage
extends PreferencePage
implements ICdmEntitySessionEnabled
{
30 private ICdmEntitySession previousCdmEntitySession
;
31 private boolean isApply
;
33 public CdmPreferencePage() {
37 public CdmPreferencePage(String title
) {
42 public CdmPreferencePage(String title
, ImageDescriptor image
) {
47 private void initSession() {
48 if (CdmStore
.isActive()){
49 previousCdmEntitySession
= CdmStore
.getCurrentSessionManager().getActiveSession();
55 private void bindNullSession() {
56 if(CdmStore
.isActive()) {
57 CdmStore
.getCurrentSessionManager().bindNullSession();
62 public boolean performOk() {
63 if(previousCdmEntitySession
!= null && !isApply
) {
64 previousCdmEntitySession
.bind();
66 return super.performOk();
70 public boolean performCancel() {
71 if(previousCdmEntitySession
!= null) {
72 previousCdmEntitySession
.bind();
74 return super.performCancel();
78 public void performApply() {
85 * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
88 public ICdmEntitySession
getCdmEntitySession() {
89 return CdmStore
.getCurrentSessionManager().getNullSession();
93 * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
96 public <T
extends CdmBase
> Collection
<T
> getRootEntities() {
101 * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
104 public Map
<Object
, List
<String
>> getPropertyPathsMap() {