Skip to content

Commit

Permalink
Replace deprecated org.eclipse.jface.databinding.swt.WidgetProperties
Browse files Browse the repository at this point in the history
  • Loading branch information
HannesWell authored and sailingKieler committed Jan 9, 2023
1 parent cb363e3 commit cf32626
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.eclipse.core.databinding.observable.Realm;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.databinding.swt.typed.WidgetProperties;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
Expand Down Expand Up @@ -82,12 +82,12 @@ public static Group createContents(final Composite parent, final DataBindingCont
final IObservableValue<Object> centerHorValue =
BeanProperties.value(PrintOptions.class, PrintOptions.PROPERTY_CENTER_HORIZONTALLY)
.observe(realm, options);
ISWTObservableValue<Object> horObservation = WidgetProperties.selection().observe(centerHorizontally);
ISWTObservableValue<Object> horObservation = WidgetProperties.widgetSelection().observe(centerHorizontally);
bindings.bindValue(horObservation, centerHorValue);

final IObservableValue<Object> centerVerValue = BeanProperties.value(PrintOptions.class, PrintOptions.PROPERTY_CENTER_VERTICALLY)
.observe(realm, options);
ISWTObservableValue<Object> vertObservation = WidgetProperties.selection().observe(centerVertically);
ISWTObservableValue<Object> vertObservation = WidgetProperties.widgetSelection().observe(centerVertically);
bindings.bindValue(vertObservation, centerVerValue);

result.addListener(SWT.Dispose, event -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.eclipse.core.databinding.observable.Realm;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.databinding.swt.typed.WidgetProperties;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
Expand All @@ -42,7 +42,6 @@
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Spinner;
import org.eclipse.swt.widgets.Widget;

import de.cau.cs.kieler.klighd.Klighd;
import de.cau.cs.kieler.klighd.ui.KlighdUIPlugin;
Expand Down Expand Up @@ -103,7 +102,7 @@ public static Group createContents(final Composite parent, final DataBindingCont

final IObservableValue<Object> copiesValue =
BeanProperties.value(PrintOptions.class, PrintOptions.PROPERTY_COPIES).observe(realm, options);
ISWTObservableValue<Object> copiesObservation = WidgetProperties.selection().observe(copiesSpinner);
ISWTObservableValue<Object> copiesObservation = WidgetProperties.widgetSelection().observe(copiesSpinner);
bindings.bindValue(copiesObservation, copiesValue);

final Image collateOnImage = COLLATE_ON.createImage();
Expand All @@ -120,7 +119,7 @@ public static Group createContents(final Composite parent, final DataBindingCont

final IObservableValue<Object> collateValue =
BeanProperties.value(PrintOptions.class, PrintOptions.PROPERTY_COLLATE).observe(realm, options);
ISWTObservableValue<Object> collateObservation = WidgetProperties.selection().observe((Widget) collateCheck);
ISWTObservableValue<Object> collateObservation = WidgetProperties.widgetSelection().observe(collateCheck);
bindings.bindValue(collateObservation, collateValue);

collateValue.addValueChangeListener(event -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.SelectObservableValue;
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.databinding.swt.typed.WidgetProperties;
import org.eclipse.swt.SWT;
import org.eclipse.swt.printing.PrinterData;
import org.eclipse.swt.widgets.Button;
Expand Down Expand Up @@ -83,9 +83,9 @@ public static Group createContents(final Composite parent, final DataBindingCont

final SelectObservableValue<Integer> orientationGroupValue = new SelectObservableValue<>(realm);

ISWTObservableValue<Boolean> observerPortrait = WidgetProperties.selection().observe(portraitRadio);
ISWTObservableValue<Boolean> observerPortrait = WidgetProperties.<Button, Boolean> widgetSelection().observe(portraitRadio);
orientationGroupValue.addOption(PrinterData.PORTRAIT, observerPortrait);
ISWTObservableValue<Boolean> observeLandscape = WidgetProperties.selection().observe(landscapeRadio);
ISWTObservableValue<Boolean> observeLandscape = WidgetProperties.<Button, Boolean> widgetSelection().observe(landscapeRadio);
orientationGroupValue.addOption(PrinterData.LANDSCAPE, observeLandscape);

IObservableValue<Object> observeOrientation = BeanProperties.value(PrintOptions.class, PrintOptions.PROPERTY_ORIENTATION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.IValueChangeListener;
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.databinding.swt.typed.WidgetProperties;
import org.eclipse.jface.dialogs.DialogTray;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.eclipse.core.databinding.observable.Realm;
import org.eclipse.core.databinding.observable.value.ComputedValue;
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.databinding.swt.typed.WidgetProperties;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.printing.PrintDialog;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.eclipse.core.databinding.observable.value.ComputedValue;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.databinding.swt.typed.WidgetProperties;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
Expand Down Expand Up @@ -92,7 +92,7 @@ public static Group createContents(final Composite parent, final DataBindingCont

final IObservableValue<Object> allValue =
BeanProperties.value(PrintOptions.class, PrintOptions.PROPERTY_ALL_PAGES).observe(realm, options);
ISWTObservableValue<Object> observedAllPages = WidgetProperties.selection().observe(allRadio);
ISWTObservableValue<Object> observedAllPages = WidgetProperties.widgetSelection().observe(allRadio);
bindings.bindValue(observedAllPages, allValue);

// radio button for defining a print range
Expand All @@ -118,7 +118,7 @@ protected Boolean calculate() {
return ((Boolean) allValue.getValue()).booleanValue() ? Boolean.FALSE : Boolean.TRUE;
}
};
ISWTObservableValue<Object> selection = WidgetProperties.selection().observe(rangeRadio);
ISWTObservableValue<Object> selection = WidgetProperties.widgetSelection().observe(rangeRadio);
bindings.bindValue(selection, rangeValue);

// range from (label & textfield)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.eclipse.core.databinding.observable.Realm;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.databinding.swt.typed.WidgetProperties;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridLayout;
Expand Down Expand Up @@ -172,17 +172,17 @@ public static Group createContents(final Composite parent, final DataBindingCont

final IObservableValue<Object> scalePercent = BeanProperties.value(DiagramPrintOptions.class, PrintOptions.PROPERTY_SCALE_PERCENT)
.observe(realm, dOptions);
ISWTObservableValue<Object> observerScaleSpinner = WidgetProperties.selection().observe(scaleSpinner);
ISWTObservableValue<Object> observerScaleSpinner = WidgetProperties.widgetSelection().observe(scaleSpinner);
bindings.bindValue(observerScaleSpinner, scalePercent);

final IObservableValue<Object> pagesWide = BeanProperties.value(DiagramPrintOptions.class, PrintOptions.PROPERTY_PAGES_WIDE)
.observe(realm, dOptions);
ISWTObservableValue<Object> observerWideSpinner = WidgetProperties.selection().observe(spinnerWide);
ISWTObservableValue<Object> observerWideSpinner = WidgetProperties.widgetSelection().observe(spinnerWide);
bindings.bindValue(observerWideSpinner, pagesWide);

final IObservableValue<Object> pagesTall = BeanProperties.value(DiagramPrintOptions.class, PrintOptions.PROPERTY_PAGES_TALL)
.observe(realm, dOptions);
ISWTObservableValue<Object> observerTallSpinner = WidgetProperties.selection().observe(spinnerTall);
ISWTObservableValue<Object> observerTallSpinner = WidgetProperties.widgetSelection().observe(spinnerTall);
bindings.bindValue(observerTallSpinner, pagesTall);

result.addListener(SWT.Dispose, event -> {
Expand Down

0 comments on commit cf32626

Please sign in to comment.