Skip to content
Snippets Groups Projects
Commit f6aed7e5 authored by Simon Barner's avatar Simon Barner
Browse files

SWTObservables.observeText() -> DataBindingUtils.observeText()

* SWTObservables is deprecated
* Add drop-in replacement of observeText() in DataBindingUtils that uses
  the new API

Issue-Ref: 3539
Issue-Url: https://af3-developer.fortiss.org/issues/3539



Signed-off-by: default avatarSimon Barner <barner@fortiss.org>
parent c2c021b5
No related branches found
No related tags found
1 merge request!273539
......@@ -7,7 +7,8 @@ Bundle-Activator: org.fortiss.tooling.kernel.ui.ToolingKernelUIActivator
Require-Bundle: org.fortiss.tooling.common.ui;bundle-version="2.14.0";visibility:=reexport,
org.fortiss.tooling.kernel;bundle-version="2.14.0";visibility:=reexport,
org.eclipse.core.resources;visibility:=reexport,
org.eclipse.emf.databinding;visibility:=reexport
org.eclipse.emf.databinding;visibility:=reexport,
org.eclipse.core.databinding.property;visibility:=reexport
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Vendor: fortiss GmbH
......
IdLabeledPropertySection.java 9a419c0aa35c0ab02b38ec769cbd69cea99e66ca RED
NamedCommentedPropertySection.java 0327480eb54090508758ce1d3a97da9fde93cf0f RED
IdLabeledPropertySection.java dcfb39d225391c87f47e29f6d1ba1cb22a3d3fe4 YELLOW
NamedCommentedPropertySection.java d15d490708e5c7362ebc4f30a04bccb0f6b64f39 YELLOW
PropertiesAdapterFactory.java edcf34766a60f21c9ba22a1ba73aa487c3d9a946 YELLOW
......@@ -15,8 +15,9 @@
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.ui.internal.properties;
import static org.fortiss.tooling.kernel.ui.util.DataBindingUtils.observeText;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
......@@ -61,6 +62,6 @@ public class IdLabeledPropertySection extends PropertySectionBase {
IObservableValue<?> modelObservable = ObservableUtils.observeValue(idLabeled,
FortissToolingKernelPackage.Literals.IID_LABELED__ID);
dbc.bindValue(SWTObservables.observeText(idText, SWT.None), modelObservable, null, null);
dbc.bindValue(observeText(idText, SWT.None), modelObservable, null, null);
}
}
......@@ -15,9 +15,10 @@
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.ui.internal.properties;
import static org.fortiss.tooling.kernel.ui.util.DataBindingUtils.observeText;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
......@@ -89,12 +90,10 @@ public class NamedCommentedPropertySection extends PropertySectionBase {
IObservableValue<?> modelObservable = ObservableUtils.observeValue(namedCommented,
FortissToolingKernelPackage.Literals.INAMED_ELEMENT__NAME);
dbc.bindValue(SWTObservables.observeText(nameText, SWT.Modify), modelObservable, null,
null);
dbc.bindValue(observeText(nameText, SWT.Modify), modelObservable, null, null);
modelObservable = ObservableUtils.observeValue(namedCommented,
FortissToolingKernelPackage.Literals.INAMED_COMMENTED_ELEMENT__COMMENT);
dbc.bindValue(SWTObservables.observeText(commentText, SWT.Modify), modelObservable, null,
null);
dbc.bindValue(observeText(commentText, SWT.Modify), modelObservable, null, null);
// Set focus on "name" text editor and pre-select everything in case a RenameAction is in
// progress.
......
ActionUtils.java 4553e487264e3d1f86f4767da4a7400cce4b9a5d GREEN
ConstraintsUIUtils.java 69d5e08bbf768baf2790380e36f1020ef826a33e GREEN
CopyPasteUtils.java bbc5cf9c9dc03ebf8dc75d42c919fe6eb60b388e GREEN
DataBindingUtils.java 4c2fc0bab9e9ea739411aa42f4a4393f1393396e RED
DataBindingUtils.java 6ae66457694227b69c13c092ef62babdd4a2a137 YELLOW
DragAndDropUtils.java 7aab91518aa12d76533a345bf6ed0be9ac7ff0e5 GREEN
EObjectSelectionUtils.java 128cf8f96c6b9478171dff3deda662d5934f5f44 YELLOW
KernelUIUtils.java 46d3279ef3523b104f89a6c526109f72d36f72f2 GREEN
......
......@@ -15,8 +15,6 @@
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.ui.util;
import static org.eclipse.jface.databinding.swt.SWTObservables.observeText;
import org.conqat.ide.commons.ui.databinding.JFaceObservables;
import org.eclipse.core.databinding.Binding;
import org.eclipse.core.databinding.DataBindingContext;
......@@ -26,6 +24,8 @@ import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Control;
......@@ -203,6 +203,23 @@ public final class DataBindingUtils {
return bindings;
}
/**
* Returns an {@link ISWTObservableValue} observing this value property on
* the given {@link Control}.
*
* @param event
* the SWT event type to register for change events. May be
* {@link SWT#None}, {@link SWT#Modify}, {@link SWT#FocusOut} or
* {@link SWT#DefaultSelection}.
* @param control
* the source {@link Control}
* @return an observable value observing this value property on the given
* widget
*/
public static ISWTObservableValue observeText(Control control, final int event) {
return WidgetProperties.text(event).observe(control);
}
/**
* Performs a complex binding of a cell editor control to a model element. The
* validation is performed on modification (i.e. always), while model
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment