35 |
35 |
|
36 |
36 |
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
|
37 |
37 |
private final MediaDeletionConfigurator configurator;
|
38 |
|
private final Button btnDeleteIfUsedInTaxonDescription;
|
39 |
|
private final Button btnDeleteIfUsedInSpecimenDescription;
|
|
38 |
private Button btnDelete;
|
|
39 |
private Button btnDeleteIfUsedInTaxonDescription;
|
|
40 |
private Button btnDeleteIfUsedInSpecimenDescription;
|
40 |
41 |
private Button btnRemoveFromImageGallery;
|
|
42 |
|
|
43 |
private boolean inBulkEditor;
|
41 |
44 |
|
42 |
45 |
|
43 |
46 |
public DeleteMediaConfiguratorComposite(MediaDeletionConfigurator configurator, Composite parent, int style, boolean inBulkEditor) {
|
44 |
47 |
super(parent, style);
|
|
48 |
this.inBulkEditor = inBulkEditor;
|
45 |
49 |
this.configurator = configurator;
|
46 |
50 |
addDisposeListener(new DisposeListener() {
|
47 |
51 |
@Override
|
... | ... | |
52 |
56 |
toolkit.paintBordersFor(this);
|
53 |
57 |
setLayout(new RowLayout(SWT.VERTICAL));
|
54 |
58 |
setBackground(getBackground());
|
55 |
|
|
|
59 |
|
|
60 |
|
56 |
61 |
if (inBulkEditor){
|
57 |
62 |
btnDeleteIfUsedInTaxonDescription = new Button(this, SWT.CHECK);
|
58 |
63 |
btnDeleteIfUsedInTaxonDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInTaxonDescription);
|
|
64 |
btnDeleteIfUsedInTaxonDescription.setEnabled(true);
|
|
65 |
btnDeleteIfUsedInTaxonDescription.setSelection(configurator.isDeleteIfUsedInTaxonDescription());
|
|
66 |
btnDeleteIfUsedInSpecimenDescription = new Button(this, SWT.CHECK);
|
|
67 |
btnDeleteIfUsedInSpecimenDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInSpecimenDescription);
|
|
68 |
btnDeleteIfUsedInSpecimenDescription.setEnabled(true);
|
|
69 |
btnDeleteIfUsedInSpecimenDescription.setSelection(configurator.isDeleteIfUsedInSpecimenDescription());
|
59 |
70 |
}
|
60 |
71 |
else {
|
61 |
|
btnDeleteIfUsedInTaxonDescription = new Button(this, SWT.RADIO);
|
62 |
|
btnDeleteIfUsedInTaxonDescription.setText(Messages.DeleteConfiguration_media_delete);
|
63 |
|
|
|
72 |
|
|
73 |
btnDelete = new Button(this, SWT.RADIO);
|
|
74 |
btnDelete.setText(Messages.DeleteConfiguration_media_delete);
|
|
75 |
|
|
76 |
// btnDeleteIfUsedInSpecimenDescription = new Button(this, SWT.CHECK);
|
|
77 |
// btnDeleteIfUsedInSpecimenDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInSpecimenDescription);
|
|
78 |
// btnDeleteIfUsedInTaxonDescription = new Button(this, SWT.CHECK);
|
|
79 |
// btnDeleteIfUsedInTaxonDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInTaxonDescription);
|
|
80 |
// btnDelete.addListener(SWT.Selection, (Event e) -> {
|
|
81 |
// Button b = (Button) e.widget;
|
|
82 |
// btnDeleteIfUsedInSpecimenDescription.setEnabled(b.getSelection());
|
|
83 |
// btnDeleteIfUsedInTaxonDescription.setEnabled(b.getSelection());
|
|
84 |
// });
|
64 |
85 |
btnRemoveFromImageGallery = new Button(this, SWT.RADIO);
|
65 |
86 |
btnRemoveFromImageGallery.setText(Messages.DeleteConfiguration_media_removeFromGallery);
|
|
87 |
btnDelete.setSelection(!configurator.isOnlyRemoveFromGallery());
|
|
88 |
btnRemoveFromImageGallery.setSelection(configurator.isOnlyRemoveFromGallery());
|
66 |
89 |
}
|
67 |
90 |
|
68 |
|
btnDeleteIfUsedInSpecimenDescription = new Button(this, SWT.CHECK);
|
69 |
|
btnDeleteIfUsedInSpecimenDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInSpecimenDescription);
|
70 |
|
|
71 |
|
if(inBulkEditor){
|
72 |
|
btnDeleteIfUsedInSpecimenDescription.setEnabled(true);
|
73 |
|
}
|
74 |
|
else{
|
75 |
|
btnDeleteIfUsedInSpecimenDescription.setEnabled(false);
|
76 |
|
|
77 |
|
btnDeleteIfUsedInTaxonDescription.addListener(SWT.Selection, (Event e) -> {
|
78 |
|
Button b = (Button) e.widget;
|
79 |
|
btnDeleteIfUsedInSpecimenDescription.setEnabled(b.getSelection());
|
80 |
|
|
81 |
|
});
|
82 |
|
}
|
83 |
|
btnDeleteIfUsedInTaxonDescription.setSelection(true);
|
84 |
|
|
85 |
91 |
m_bindingContext = initDataBindings();
|
86 |
92 |
|
87 |
93 |
}
|
... | ... | |
89 |
95 |
protected DataBindingContext initDataBindings() {
|
90 |
96 |
DataBindingContext bindingContext = new DataBindingContext();
|
91 |
97 |
//
|
92 |
|
IObservableValue observeSelectionBtnDeleteIfUsedInTaxonDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInTaxonDescription);
|
93 |
|
IObservableValue deleteIfUsedInTaxonDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInTaxonDescription").observe(configurator);
|
94 |
|
bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInTaxonDescription, deleteIfUsedInTaxonDescriptionConfiguratorObserveValue, null, null);
|
95 |
|
|
96 |
|
if(btnRemoveFromImageGallery!=null){
|
|
98 |
if (inBulkEditor){
|
|
99 |
IObservableValue observeSelectionBtnDeleteIfUsedInTaxonDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInTaxonDescription);
|
|
100 |
IObservableValue deleteIfUsedInTaxonDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInTaxonDescription").observe(configurator);
|
|
101 |
bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInTaxonDescription, deleteIfUsedInTaxonDescriptionConfiguratorObserveValue, null, null);
|
|
102 |
|
|
103 |
IObservableValue observeSelectionBtnDeleteIfUsedInSpecimenDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInSpecimenDescription);
|
|
104 |
IObservableValue deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInSpecimenDescription").observe(configurator);
|
|
105 |
bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInSpecimenDescription, deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue, null, null);
|
|
106 |
} else{
|
|
107 |
|
|
108 |
IObservableValue observeSelectionBtnDelete = WidgetProperties.selection().observe(btnDelete);
|
|
109 |
IObservableValue deleteConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInTaxonDescription").observe(configurator);
|
|
110 |
bindingContext.bindValue(observeSelectionBtnDelete, deleteConfiguratorObserveValue, null, null);
|
|
111 |
|
97 |
112 |
IObservableValue observeSelectionBtnRemoveFromImageGallery = WidgetProperties.selection().observe(btnRemoveFromImageGallery);
|
98 |
113 |
IObservableValue removeFromImageGalleryConfiguratorObserveValue = PojoProperties.value("onlyRemoveFromGallery").observe(configurator);
|
99 |
114 |
bindingContext.bindValue(observeSelectionBtnRemoveFromImageGallery, removeFromImageGalleryConfiguratorObserveValue, null, null);
|
100 |
115 |
}
|
101 |
116 |
|
102 |
|
IObservableValue observeSelectionBtnDeleteIfUsedInSpecimenDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInSpecimenDescription);
|
103 |
|
IObservableValue deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInSpecimenDescription").observe(configurator);
|
104 |
|
bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInSpecimenDescription, deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue, null, null);
|
|
117 |
|
105 |
118 |
|
106 |
119 |
return bindingContext;
|
107 |
120 |
}
|
fix #6527: refactor media deletion configurator and the corresponding wizard