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 if (CdmStore
.isActive()){
50 previousCdmEntitySession
= CdmStore
.getCurrentSessionManager().getActiveSession();
56 private void bindNullSession() {
57 if(CdmStore
.isActive()) {
58 CdmStore
.getCurrentSessionManager().bindNullSession();
63 public boolean performOk() {
64 if(previousCdmEntitySession
!= null && !isApply
) {
65 previousCdmEntitySession
.bind();
67 return super.performOk();
71 public boolean performCancel() {
72 if(previousCdmEntitySession
!= null) {
73 previousCdmEntitySession
.bind();
75 return super.performCancel();
79 public void performApply() {
86 * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
89 public ICdmEntitySession
getCdmEntitySession() {
90 return CdmStore
.getCurrentSessionManager().getNullSession();
94 * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
97 public <T
extends CdmBase
> Collection
<T
> getRootEntities() {
102 * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
105 public Map
<Object
, List
<String
>> getPropertyPathsMap() {