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
|
|
37
|
this.override = this.pref.isAllowOverride();
|
38
|
}
|
39
|
|
40
|
CdmPreference pref;
|
41
|
boolean override;
|
42
|
|
43
|
/**
|
44
|
* {@inheritDoc}
|
45
|
*/
|
46
|
|
47
|
protected void createAllowOverrideButton(Composite parent) {
|
48
|
final Button activateCheckButton = new Button(parent, SWT.CHECK);
|
49
|
if (localPref){
|
50
|
activateCheckButton.setText("Override");
|
51
|
}else{
|
52
|
activateCheckButton.setText("Allow Override");
|
53
|
}
|
54
|
activateCheckButton.setSelection(pref.isAllowOverride());
|
55
|
|
56
|
activateCheckButton.addSelectionListener(new SelectionAdapter(){
|
57
|
@Override
|
58
|
public void widgetSelected(SelectionEvent e) {
|
59
|
pref.setAllowOverride(activateCheckButton.getSelection());
|
60
|
|
61
|
}
|
62
|
});
|
63
|
}
|
64
|
|
65
|
public CdmPreference getPreference(){
|
66
|
return pref;
|
67
|
}
|
68
|
|
69
|
|
70
|
|
71
|
}
|