public DeleteConfiguratorDialog(DeleteConfiguratorBase configurator, Shell parentShell, String dialogTitle,
Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
- super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
- this.configurator = configurator;
- this.fromBulkEditor = false;
+ this(configurator, parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex, false);
}
@Override
} else if(configurator instanceof NameDeletionConfigurator){
composite.addConfiguratorComposite(new DeleteNameConfiguratorComposite((NameDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE));
} else if(configurator instanceof MediaDeletionConfigurator){
- if (!fromBulkEditor){
- composite.addConfiguratorComposite(new DeleteMediaConfiguratorComposite((MediaDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE, fromBulkEditor));
- }else{
- composite.addConfiguratorComposite(new DeleteMediaConfiguratorComposite((MediaDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE));
- }
+ composite.addConfiguratorComposite(new DeleteMediaConfiguratorComposite((MediaDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE, fromBulkEditor));
}
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.forms.widgets.FormToolkit;
import eu.etaxonomy.cdm.api.service.config.MediaDeletionConfigurator;
private final MediaDeletionConfigurator configurator;
private final Button btnDeleteIfUsedInTaxonDescription;
private final Button btnDeleteIfUsedInSpecimenDescription;
- private final Button btnRemoveFromImageGallery;
- private final boolean isInBulkEditor;
+ private Button btnRemoveFromImageGallery;
- /**
- * Create the composite.
- * @param parent
- * @param style
- */
- public DeleteMediaConfiguratorComposite(MediaDeletionConfigurator configurator, Composite parent, int style) {
- super(parent, style);
- this.configurator = configurator;
- this.isInBulkEditor = false;
- addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- toolkit.dispose();
- }
- });
- toolkit.paintBordersFor(this);
- setLayout(new RowLayout(SWT.VERTICAL));
- setBackground(getBackground());
-
- btnRemoveFromImageGallery = null;
-
- btnDeleteIfUsedInTaxonDescription = new Button(this, SWT.CHECK);
- btnDeleteIfUsedInTaxonDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInTaxonDescription);
- btnDeleteIfUsedInTaxonDescription.setSelection(false);
-
- btnDeleteIfUsedInSpecimenDescription = new Button(this, SWT.CHECK);
- btnDeleteIfUsedInSpecimenDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInSpecimenDescription);
- btnDeleteIfUsedInSpecimenDescription.setSelection(false);
-
-
- m_bindingContext = initDataBindings();
-
- }
-
public DeleteMediaConfiguratorComposite(MediaDeletionConfigurator configurator, Composite parent, int style, boolean inBulkEditor) {
super(parent, style);
this.configurator = configurator;
- this.isInBulkEditor = inBulkEditor;
addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
}
});
toolkit.paintBordersFor(this);
- setLayout(new GridLayout());
+ setLayout(new RowLayout(SWT.VERTICAL));
setBackground(getBackground());
-
-
-
- if (!inBulkEditor){
- btnRemoveFromImageGallery = new Button(this, SWT.RADIO);
- btnRemoveFromImageGallery.setText(Messages.DeleteConfiguration_media_removeFromGallery);
-
- btnRemoveFromImageGallery.setSelection(true);
- btnRemoveFromImageGallery.setVisible(true);
- btnDeleteIfUsedInTaxonDescription = new Button(this, SWT.RADIO);
- btnDeleteIfUsedInTaxonDescription.setSelection(false);
- btnDeleteIfUsedInTaxonDescription.setVisible(true);
- btnDeleteIfUsedInTaxonDescription.setText(Messages.DeleteConfiguration_media_delete);
- btnDeleteIfUsedInSpecimenDescription = new Button(this, SWT.CHECK);
- btnDeleteIfUsedInSpecimenDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInSpecimenDescription);
- btnDeleteIfUsedInSpecimenDescription.setVisible(false);
- btnDeleteIfUsedInTaxonDescription.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event e) {
- Button b = (Button) e.widget;
- GridData data = (GridData) btnDeleteIfUsedInTaxonDescription.getLayoutData();
- data.exclude = b.getSelection();
- btnDeleteIfUsedInSpecimenDescription.setVisible(data.exclude);
-
- }
- });
-
-
-
-
- } else{
- btnRemoveFromImageGallery =null;
+ if (inBulkEditor){
btnDeleteIfUsedInTaxonDescription = new Button(this, SWT.CHECK);
- btnDeleteIfUsedInTaxonDescription.setSelection(false);
btnDeleteIfUsedInTaxonDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInTaxonDescription);
- btnDeleteIfUsedInTaxonDescription.setVisible(true);
-
- btnDeleteIfUsedInSpecimenDescription = new Button(this, SWT.CHECK);
- btnDeleteIfUsedInSpecimenDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInSpecimenDescription);
- btnDeleteIfUsedInSpecimenDescription.setVisible(true);
}
+ else {
+ btnDeleteIfUsedInTaxonDescription = new Button(this, SWT.RADIO);
+ btnDeleteIfUsedInTaxonDescription.setText(Messages.DeleteConfiguration_media_delete);
+ btnRemoveFromImageGallery = new Button(this, SWT.RADIO);
+ btnRemoveFromImageGallery.setText(Messages.DeleteConfiguration_media_removeFromGallery);
+ }
+ btnDeleteIfUsedInSpecimenDescription = new Button(this, SWT.CHECK);
+ btnDeleteIfUsedInSpecimenDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInSpecimenDescription);
+ if(inBulkEditor){
+ btnDeleteIfUsedInSpecimenDescription.setEnabled(true);
+ }
+ else{
+ btnDeleteIfUsedInSpecimenDescription.setEnabled(false);
+ btnDeleteIfUsedInTaxonDescription.addListener(SWT.Selection, (Event e) -> {
+ Button b = (Button) e.widget;
+ btnDeleteIfUsedInSpecimenDescription.setEnabled(b.getSelection());
-
+ });
+ }
+ btnDeleteIfUsedInTaxonDescription.setSelection(true);
m_bindingContext = initDataBindings();
IObservableValue observeSelectionBtnDeleteIfUsedInTaxonDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInTaxonDescription);
IObservableValue deleteIfUsedInTaxonDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInTaxonDescription").observe(configurator);
bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInTaxonDescription, deleteIfUsedInTaxonDescriptionConfiguratorObserveValue, null, null);
- if (isInBulkEditor){
- IObservableValue observeSelectionBtnDeleteIfUsedInSpecimenDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInSpecimenDescription);
- IObservableValue deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInSpecimenDescription").observe(configurator);
- bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInSpecimenDescription, deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue, null, null);
- }else{
+
+ if(btnRemoveFromImageGallery!=null){
IObservableValue observeSelectionBtnRemoveFromImageGallery = WidgetProperties.selection().observe(btnRemoveFromImageGallery);
IObservableValue removeFromImageGalleryConfiguratorObserveValue = PojoProperties.value("onlyRemoveFromGallery").observe(configurator);
bindingContext.bindValue(observeSelectionBtnRemoveFromImageGallery, removeFromImageGalleryConfiguratorObserveValue, null, null);
-
- IObservableValue observeSelectionBtnDeleteIfUsedInSpecimenDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInSpecimenDescription);
- IObservableValue deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInSpecimenDescription").observe(configurator);
- bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInSpecimenDescription, deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue, null, null);
}
+ IObservableValue observeSelectionBtnDeleteIfUsedInSpecimenDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInSpecimenDescription);
+ IObservableValue deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInSpecimenDescription").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInSpecimenDescription, deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue, null, null);
+
return bindingContext;
}