1
|
/**
|
2
|
* Copyright (C) 2020 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.ui.dialog.configurator.deleteConfigurator;
|
10
|
|
11
|
import org.eclipse.core.databinding.DataBindingContext;
|
12
|
import org.eclipse.core.databinding.beans.PojoProperties;
|
13
|
import org.eclipse.core.databinding.observable.value.IObservableValue;
|
14
|
import org.eclipse.jface.databinding.swt.WidgetProperties;
|
15
|
import org.eclipse.swt.SWT;
|
16
|
import org.eclipse.swt.events.DisposeEvent;
|
17
|
import org.eclipse.swt.events.DisposeListener;
|
18
|
import org.eclipse.swt.layout.RowLayout;
|
19
|
import org.eclipse.swt.widgets.Button;
|
20
|
import org.eclipse.swt.widgets.Composite;
|
21
|
import org.eclipse.swt.widgets.Display;
|
22
|
import org.eclipse.ui.forms.widgets.FormToolkit;
|
23
|
|
24
|
import eu.etaxonomy.cdm.api.service.config.RemoveDescriptionsFromDescriptiveDataSetConfigurator;
|
25
|
import eu.etaxonomy.taxeditor.l10n.Messages;
|
26
|
|
27
|
/**
|
28
|
* @author k.luther
|
29
|
* @since Jun 19, 2020
|
30
|
*/
|
31
|
public class DeleteDescriptionFromDescriptiveDatasetConfiguratorComposite extends Composite{
|
32
|
|
33
|
private final DataBindingContext m_bindingContext;
|
34
|
|
35
|
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
|
36
|
private final RemoveDescriptionsFromDescriptiveDataSetConfigurator configurator;
|
37
|
private Button btnOnlyRemoveFromDataset;
|
38
|
|
39
|
public DeleteDescriptionFromDescriptiveDatasetConfiguratorComposite(RemoveDescriptionsFromDescriptiveDataSetConfigurator configurator, Composite parent, int style) {
|
40
|
super(parent, style);
|
41
|
|
42
|
this.configurator = configurator;
|
43
|
addDisposeListener(new DisposeListener() {
|
44
|
@Override
|
45
|
public void widgetDisposed(DisposeEvent e) {
|
46
|
toolkit.dispose();
|
47
|
}
|
48
|
});
|
49
|
toolkit.paintBordersFor(this);
|
50
|
setLayout(new RowLayout(SWT.VERTICAL));
|
51
|
setBackground(getBackground());
|
52
|
|
53
|
|
54
|
|
55
|
|
56
|
btnOnlyRemoveFromDataset = new Button(this, SWT.CHECK);
|
57
|
btnOnlyRemoveFromDataset.setText(Messages.DeleteConfiguration_descriptionFromDescriptiveDataSet_onlyRemove);
|
58
|
btnOnlyRemoveFromDataset.setEnabled(true);
|
59
|
btnOnlyRemoveFromDataset.setSelection(configurator.isOnlyRemoveDescriptionsFromDataSet());
|
60
|
m_bindingContext = initDataBindings();
|
61
|
}
|
62
|
|
63
|
protected DataBindingContext initDataBindings() {
|
64
|
DataBindingContext bindingContext = new DataBindingContext();
|
65
|
|
66
|
IObservableValue observeSelectionBtnDeleteAllSpecimen = WidgetProperties.selection().observe(btnOnlyRemoveFromDataset);
|
67
|
IObservableValue deleteAllSpecimenConfiguratorObserveValue = PojoProperties.value("onlyRemoveDescriptionsFromDataSet").observe(configurator);
|
68
|
bindingContext.bindValue(observeSelectionBtnDeleteAllSpecimen, deleteAllSpecimenConfiguratorObserveValue, null, null);
|
69
|
return bindingContext;
|
70
|
}
|
71
|
|
72
|
}
|