1
|
/**
|
2
|
* Copyright (C) 2015 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.menu;
|
10
|
|
11
|
import org.eclipse.jface.preference.PreferencePage;
|
12
|
import org.eclipse.jface.resource.ImageDescriptor;
|
13
|
import org.eclipse.swt.SWT;
|
14
|
import org.eclipse.swt.layout.GridData;
|
15
|
import org.eclipse.swt.layout.GridLayout;
|
16
|
import org.eclipse.swt.widgets.Composite;
|
17
|
|
18
|
import eu.etaxonomy.taxeditor.preference.IE4PreferencePage;
|
19
|
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
20
|
|
21
|
/**
|
22
|
* @author cmathew
|
23
|
* @date 30 Jul 2015
|
24
|
*
|
25
|
*/
|
26
|
public abstract class CdmPreferencePage extends PreferencePage implements IE4PreferencePage {
|
27
|
|
28
|
private boolean isApply;
|
29
|
|
30
|
protected boolean isAdminPreference = false;
|
31
|
|
32
|
public CdmPreferencePage() {
|
33
|
this(null, null);
|
34
|
}
|
35
|
|
36
|
public CdmPreferencePage(String title) {
|
37
|
this(title, null);
|
38
|
}
|
39
|
|
40
|
public CdmPreferencePage(String title, ImageDescriptor image) {
|
41
|
super(title, image);
|
42
|
|
43
|
init();
|
44
|
}
|
45
|
|
46
|
public void init() {
|
47
|
setPreferenceStore(PreferencesUtil.getPreferenceStore());
|
48
|
}
|
49
|
|
50
|
@Override
|
51
|
public boolean performOk() {
|
52
|
|
53
|
return super.performOk();
|
54
|
}
|
55
|
|
56
|
@Override
|
57
|
public boolean performCancel() {
|
58
|
|
59
|
return super.performCancel();
|
60
|
}
|
61
|
|
62
|
@Override
|
63
|
public void performApply() {
|
64
|
isApply = true;
|
65
|
super.performApply();
|
66
|
isApply = false;
|
67
|
}
|
68
|
|
69
|
protected Composite createComposite(Composite composite) {
|
70
|
Composite activateComp = new Composite(composite, SWT.NULL);
|
71
|
GridLayout layout = new GridLayout();
|
72
|
if (isAdminPreference){
|
73
|
layout.numColumns = 2;
|
74
|
}
|
75
|
activateComp.setLayout(layout);
|
76
|
GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
|
77
|
activateComp.setLayoutData(gridData);
|
78
|
return activateComp;
|
79
|
}
|
80
|
|
81
|
|
82
|
|
83
|
}
|