Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 115962 Details for
Bug 237856
[Wizards] [DataBinding] WizardPageSupport class should track the staleness state of relevant observables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Ovidio's patch merged with HEAD
clipboard.txt (text/plain), 7.32 KB, created by
Matthew Hall
on 2008-10-23 13:45:23 EDT
(
hide
)
Description:
Ovidio's patch merged with HEAD
Filename:
MIME Type:
Creator:
Matthew Hall
Created:
2008-10-23 13:45:23 EDT
Size:
7.32 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jface.databinding >Index: src/org/eclipse/jface/databinding/wizard/WizardPageSupport.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/wizard/WizardPageSupport.java,v >retrieving revision 1.8 >diff -u -r1.8 WizardPageSupport.java >--- src/org/eclipse/jface/databinding/wizard/WizardPageSupport.java 17 Oct 2008 17:36:36 -0000 1.8 >+++ src/org/eclipse/jface/databinding/wizard/WizardPageSupport.java 23 Oct 2008 17:44:45 -0000 >@@ -10,7 +10,7 @@ > * Boris Bokowski - bug 218269 > * Matthew Hall - bug 218269, 240444, 239900 > * Ashley Cambrell - bug 199179 >- * Ovidio Mallo - bug 235195 >+ * Ovidio Mallo - bug 235195, 237856 > *******************************************************************************/ > package org.eclipse.jface.databinding.wizard; > >@@ -24,6 +24,17 @@ > * given wizard page, updating the wizard page's completion state and its error > * message accordingly. > * >+ * <p> >+ * The completion state of the wizard page will only be set to <code>true</code> >+ * if <i>all</i> of the following conditions are met: >+ * <ul> >+ * <li>The validation result from the data binding context has none of the >+ * severities {@link IStatus#ERROR} or {@link IStatus#CANCEL}.</li> >+ * <li>None of the validation status observables of the data binding context is >+ * stale.</li> >+ * </ul> >+ * </p> >+ * > * @noextend This class is not intended to be subclassed by clients. > * > * @since 1.1 >Index: src/org/eclipse/jface/databinding/dialog/DialogPageSupport.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/dialog/DialogPageSupport.java,v >retrieving revision 1.1 >diff -u -r1.1 DialogPageSupport.java >--- src/org/eclipse/jface/databinding/dialog/DialogPageSupport.java 17 Oct 2008 17:36:36 -0000 1.1 >+++ src/org/eclipse/jface/databinding/dialog/DialogPageSupport.java 23 Oct 2008 17:44:45 -0000 >@@ -9,6 +9,8 @@ > * IBM Corporation - initial API and implementation > * (through WizardPageSupport.java) > * Matthew Hall - initial API and implementation (bug 239900) >+ * Matthew Hall - bug 237856 >+ * Ovidio Mallo - bug 237856 > ******************************************************************************/ > > package org.eclipse.jface.databinding.dialog; >@@ -21,6 +23,8 @@ > import org.eclipse.core.databinding.observable.ChangeEvent; > import org.eclipse.core.databinding.observable.IChangeListener; > import org.eclipse.core.databinding.observable.IObservable; >+import org.eclipse.core.databinding.observable.IStaleListener; >+import org.eclipse.core.databinding.observable.StaleEvent; > import org.eclipse.core.databinding.observable.list.IListChangeListener; > import org.eclipse.core.databinding.observable.list.IObservableList; > import org.eclipse.core.databinding.observable.list.ListChangeEvent; >@@ -148,7 +152,14 @@ > handleStatusChanged(); > } > }); >+ aggregateStatus.addStaleListener(new IStaleListener() { >+ public void handleStale(StaleEvent staleEvent) { >+ currentStatusStale = true; >+ handleStatusChanged(); >+ } >+ }); > currentStatus = (IStatus) aggregateStatus.getValue(); >+ currentStatusStale = aggregateStatus.isStale(); > handleStatusChanged(); > dbc.getValidationStatusProviders().addListChangeListener( > validationStatusProvidersListener); >#P org.eclipse.jface.tests.databinding >Index: src/org/eclipse/jface/tests/databinding/wizard/WizardPageSupportTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface.tests.databinding/src/org/eclipse/jface/tests/databinding/wizard/WizardPageSupportTest.java,v >retrieving revision 1.1 >diff -u -r1.1 WizardPageSupportTest.java >--- src/org/eclipse/jface/tests/databinding/wizard/WizardPageSupportTest.java 31 Jul 2008 19:00:02 -0000 1.1 >+++ src/org/eclipse/jface/tests/databinding/wizard/WizardPageSupportTest.java 23 Oct 2008 17:44:46 -0000 >@@ -7,17 +7,23 @@ > * > * Contributors: > * Ovidio Mallo - initial API and implementation (bug 235195) >+ * Ovidio Mallo - bug 237856 > ******************************************************************************/ > > package org.eclipse.jface.tests.databinding.wizard; > > import org.eclipse.core.databinding.DataBindingContext; > import org.eclipse.core.databinding.ValidationStatusProvider; >+import org.eclipse.core.databinding.observable.Diffs; >+import org.eclipse.core.databinding.observable.ObservableTracker; > import org.eclipse.core.databinding.observable.Observables; >+import org.eclipse.core.databinding.observable.Realm; > import org.eclipse.core.databinding.observable.list.IObservableList; >+import org.eclipse.core.databinding.observable.value.AbstractObservableValue; > import org.eclipse.core.databinding.observable.value.IObservableValue; > import org.eclipse.core.databinding.observable.value.WritableValue; > import org.eclipse.core.databinding.validation.ValidationStatus; >+import org.eclipse.core.internal.commands.util.Util; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.jface.databinding.wizard.WizardPageSupport; > import org.eclipse.jface.tests.databinding.AbstractSWTTestCase; >@@ -69,6 +75,32 @@ > loadWizardPage(page); > } > >+ public void testPageCompleteOnValidationStaleness() { >+ IWizardPage page = new WizardPage("Page") { >+ public void createControl(Composite parent) { >+ setControl(parent); >+ >+ ValidationObservable validation = new ValidationObservable(); >+ >+ DataBindingContext dbc = new DataBindingContext(); >+ dbc.addValidationStatusProvider(new ValidationProvider( >+ validation)); >+ >+ WizardPageSupport.create(this, dbc); >+ >+ assertTrue(isPageComplete()); >+ >+ validation.setStale(true); >+ assertFalse(isPageComplete()); >+ >+ validation.setStale(false); >+ assertTrue(isPageComplete()); >+ } >+ }; >+ >+ loadWizardPage(page); >+ } >+ > private void loadWizardPage(IWizardPage page) { > Wizard wizard = new Wizard() { > public boolean performFinish() { >@@ -81,7 +113,50 @@ > dialog.create(); > } > >- private class ValidationProvider extends ValidationStatusProvider { >+ private static class ValidationObservable extends AbstractObservableValue { >+ >+ private Object value = ValidationStatus.ok(); >+ >+ private boolean stale = false; >+ >+ public ValidationObservable() { >+ super(Realm.getDefault()); >+ } >+ >+ protected Object doGetValue() { >+ return value; >+ } >+ >+ protected void doSetValue(Object value) { >+ Object oldValue = this.value; >+ this.value = value; >+ if (!Util.equals(oldValue, value)) { >+ fireValueChange(Diffs.createValueDiff(oldValue, value)); >+ } >+ } >+ >+ public boolean isStale() { >+ ObservableTracker.getterCalled(this); >+ return stale; >+ } >+ >+ public void setStale(boolean stale) { >+ if (this.stale != stale) { >+ this.stale = stale; >+ if (stale) { >+ fireStale(); >+ } else { >+ fireValueChange(Diffs.createValueDiff(value, value)); >+ } >+ } >+ } >+ >+ public Object getValueType() { >+ return IStatus.class; >+ } >+ } >+ >+ private static class ValidationProvider extends ValidationStatusProvider { > > private final IObservableValue validation; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 237856
:
105654
| 115962