Author: adietish
Date: 2011-01-13 05:55:47 -0500 (Thu, 13 Jan 2011)
New Revision: 28188
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
Log:
[JBIDE-8020] corrected architecture to be displayed when the page opens up (was:
architecture was only updated when chaning the image)
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2011-01-13
05:57:12 UTC (rev 28187)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2011-01-13
10:55:47 UTC (rev 28188)
@@ -21,6 +21,7 @@
import org.eclipse.core.databinding.Binding;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.UpdateListStrategy;
+import org.eclipse.core.databinding.UpdateSetStrategy;
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.beans.BeanProperties;
import org.eclipse.core.databinding.conversion.Converter;
@@ -29,8 +30,6 @@
import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.core.databinding.observable.value.IValueChangeListener;
-import org.eclipse.core.databinding.observable.value.ValueChangeEvent;
import org.eclipse.core.databinding.observable.value.WritableValue;
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.databinding.validation.ValidationStatus;
@@ -191,7 +190,8 @@
archLabel.setText(WizardMessages.getString(ARCH_LABEL));
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(archLabel);
arch = new Label(container, SWT.NULL);
- GridDataFactory.fillDefaults().span(2,1).align(SWT.FILL, SWT.CENTER).applyTo(arch);
+ arch.setBackground(arch.getDisplay().getSystemColor(SWT.COLOR_RED));
+ GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).applyTo(arch);
Label realmLabel = new Label(container, SWT.NULL);
realmLabel.setText(WizardMessages.getString(REALM_LABEL));
@@ -239,20 +239,20 @@
bindKey(keyText, dbc);
}
- private void bindArchLabel(final Label architecture, IObservableValue imageObservable,
DataBindingContext dbc) {
- DataBindingUtils.addValueChangeListener(new IValueChangeListener() {
-
- @Override
- public void handleValueChange(ValueChangeEvent event) {
- Object newValue = event.diff.getNewValue();
- if (newValue == null
- || !(newValue instanceof DeltaCloudImage)) {
- return;
- }
- DeltaCloudImage image = (DeltaCloudImage) newValue;
- architecture.setText(image.getArchitecture());
- }
- }, imageObservable, architecture);
+ private void bindArchLabel(final Label architectureLabel, IObservableValue
imageObservable, DataBindingContext dbc) {
+ dbc.bindValue(WidgetProperties.text().observe(architectureLabel),
+ imageObservable,
+ new UpdateValueStrategy(UpdateSetStrategy.POLICY_NEVER),
+ new UpdateValueStrategy().setConverter(new Converter(DeltaCloudImage.class,
String.class) {
+
+ @Override
+ public Object convert(Object fromObject) {
+ if (!(fromObject instanceof DeltaCloudImage)) {
+ return null;
+ }
+ return ((DeltaCloudImage) fromObject).getArchitecture();
+ }
+ }));
}
private void bindRealmCombo(final Combo realmCombo, DataBindingContext dbc) {
Show replies by date