ref #7849: remove OVERRIDE constants from IPreferenceKeys and handle it by method
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / preference / wizard / AbstractAdminTermSelectionWizardPage.java
1 /**
2 * Copyright (C) 2018 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
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.
8 */
9 package eu.etaxonomy.taxeditor.preference.wizard;
10
11 import org.eclipse.swt.SWT;
12 import org.eclipse.swt.events.SelectionAdapter;
13 import org.eclipse.swt.events.SelectionEvent;
14 import org.eclipse.swt.widgets.Button;
15 import org.eclipse.swt.widgets.Composite;
16
17 import eu.etaxonomy.cdm.model.common.TermType;
18 import eu.etaxonomy.cdm.model.metadata.CdmPreference;
19 import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
20
21 /**
22 * @author k.luther
23 * @since 22.11.2018
24 *
25 */
26 public abstract class AbstractAdminTermSelectionWizardPage extends AbstractTermSelectionWizardPage
27 implements ICdmEntitySessionEnabled {
28
29 /**
30 * @param pageName
31 * @param type
32 */
33 protected AbstractAdminTermSelectionWizardPage(String pageName, TermType type, CdmPreference pref) {
34 super(pageName, type);
35 this.pref = pref;
36 this.allowOverride = pref.isAllowOverride();
37 }
38
39 CdmPreference pref;
40 boolean allowOverride;
41
42 /**
43 * {@inheritDoc}
44 */
45
46 protected void createAllowOverrideButton(Composite parent) {
47 final Button activateCheckButton = new Button(parent, SWT.CHECK);
48 activateCheckButton.setText("Allow Override");
49 activateCheckButton.setSelection(pref.isAllowOverride());
50 activateCheckButton.addSelectionListener(new SelectionAdapter(){
51 @Override
52 public void widgetSelected(SelectionEvent e) {
53 pref.setAllowOverride(activateCheckButton.getSelection());
54 }
55 });
56 }
57
58 public CdmPreference getPreference(){
59 return pref;
60 }
61
62
63
64 }