Home » Eclipse Projects » JFace » [DataBinding] WizardScreen not fully updated
[DataBinding] WizardScreen not fully updated [message #13026] |
Tue, 09 June 2009 10:04  |
Eclipse User |
|
|
|
Hi,
I studied the pages on
http://wiki.eclipse.org/index.php/JFace_Data_Binding and I have a good
perception of the JFace databinding.
I'm currently having a custom Eclipse plugin (which is an IWizard), where
I configured some databinding.
Have a look at the wizard: http://www.jochus.be/brol/databinding.png
I attached a listener to the list (above), to see if the databinding
worked great ... and it did :-). So great!
Now, I'm trying to change the datamodel from a service layer, which starts
running the moment I push finish.
And now comes my problem into play: there seems to be a delay in the
update of the screen. So "initial text" keeps on the screen for a very
long time (even if the service layer has sent updates). After a while, the
datamodel refreshes the view:
http://www.jochus.be/brol/databinding_finish.png
But as you can see, the line is not fully on the screen. It takes the
width of the "initial text".
So, my question is: how can I force my view to repaint faster? And make
the text fitting the screen?
Any idea's?
===================
= My view: =
===================
txtStatus = new Text(container, SWT.PUSH );
dataModel.setStatus("Initial textttttttttttttttttttttttttttttttttttt");
DataBindingContext dbc = new DataBindingContext();
IObservableValue modelObservable =
BeansObservables.observeValue(dataModel, "status");
dbc.bindValue(SWTObservables.observeText(txtStatus, SWT.Modify),
modelObservable, null, null);
===================
= My service =
===================
Iterator<IProjectConfigurer> projectConfigurerIterator =
projectConfigurers.iterator();
while (projectConfigurerIterator.hasNext()) {
IProjectConfigurer projectConfigurer = projectConfigurerIterator.next();
dataModel.setStatus(projectConfigurer.getClass().getName());
projectConfigurer.configure(project, monitor);
}
===================
= My datamodel =
===================
public class DataModel {
private PropertyChangeSupport changeSupport = new
PropertyChangeSupport(this);
public void addPropertyChangeListener(String propertyName,
PropertyChangeListener listener) {
changeSupport.addPropertyChangeListener(propertyName, listener);
}
public void removePropertyChangeListener(String propertyName,
PropertyChangeListener listener) {
changeSupport.removePropertyChangeListener(propertyName, listener);
}
private String status;
public void setStatus(String newStatus) {
String oldStatus = this.status;
this.status = newStatus;
changeSupport.firePropertyChange("status", oldStatus, newStatus);
}
public String getStatus() {
return status;
}
}
|
|
|
Re: [DataBinding] WizardScreen not fully updated [message #13196 is a reply to message #13026] |
Tue, 09 June 2009 18:22   |
Eclipse User |
|
|
|
Originally posted by: TheRealHawk.Freenet.de
If you call layout() for the parent-composite you should the the updated
values.
--> But theoretically your code should work without this.
Where do you set the status?
Maybe there is your problem.
To see the full text you have to tell the label to grab the whole horizontal
space - so you have to set the right LayoutData depending on your Layout.
Markus
"Jochen Hebbrecht" <jochenhebbrecht@gmail.com> schrieb im Newsbeitrag
news:c8913443c18f437c07da604c72877c9f$1@www.eclipse.org...
> Hi,
>
> I studied the pages on
> http://wiki.eclipse.org/index.php/JFace_Data_Binding and I have a good
> perception of the JFace databinding.
>
> I'm currently having a custom Eclipse plugin (which is an IWizard), where
> I configured some databinding.
>
> Have a look at the wizard: http://www.jochus.be/brol/databinding.png
>
> I attached a listener to the list (above), to see if the databinding
> worked great ... and it did :-). So great!
>
> Now, I'm trying to change the datamodel from a service layer, which starts
> running the moment I push finish.
>
> And now comes my problem into play: there seems to be a delay in the
> update of the screen. So "initial text" keeps on the screen for a very
> long time (even if the service layer has sent updates). After a while, the
> datamodel refreshes the view:
> http://www.jochus.be/brol/databinding_finish.png
> But as you can see, the line is not fully on the screen. It takes the
> width of the "initial text".
>
> So, my question is: how can I force my view to repaint faster? And make
> the text fitting the screen?
>
> Any idea's?
>
> ===================
> = My view: =
> ===================
> txtStatus = new Text(container, SWT.PUSH );
> dataModel.setStatus("Initial textttttttttttttttttttttttttttttttttttt");
>
> DataBindingContext dbc = new DataBindingContext();
> IObservableValue modelObservable =
> BeansObservables.observeValue(dataModel, "status");
> dbc.bindValue(SWTObservables.observeText(txtStatus, SWT.Modify),
> modelObservable, null, null);
>
> ===================
> = My service =
> ===================
> Iterator<IProjectConfigurer> projectConfigurerIterator =
> projectConfigurers.iterator();
> while (projectConfigurerIterator.hasNext()) {
> IProjectConfigurer projectConfigurer = projectConfigurerIterator.next();
> dataModel.setStatus(projectConfigurer.getClass().getName());
> projectConfigurer.configure(project, monitor);
> }
>
> ===================
> = My datamodel =
> ===================
> public class DataModel {
> private PropertyChangeSupport changeSupport = new
> PropertyChangeSupport(this);
>
> public void addPropertyChangeListener(String propertyName,
> PropertyChangeListener listener) {
> changeSupport.addPropertyChangeListener(propertyName, listener);
> }
> public void removePropertyChangeListener(String propertyName,
> PropertyChangeListener listener) {
> changeSupport.removePropertyChangeListener(propertyName, listener);
> }
>
> private String status;
>
> public void setStatus(String newStatus) {
> String oldStatus = this.status;
> this.status = newStatus;
> changeSupport.firePropertyChange("status", oldStatus, newStatus);
> }
> public String getStatus() {
> return status;
> }
> }
>
>
|
|
| | |
Re: [DataBinding] WizardScreen not fully updated [message #13413 is a reply to message #13353] |
Wed, 10 June 2009 09:03   |
Eclipse User |
|
|
|
Hi Tom,
Have a look at:
http://members.lycos.nl/jochus/brol/SampleNewWizard.java
http://members.lycos.nl/jochus/brol/SampleNewWizardPage.java
If I run this code, everything works perfect.
In SampleNewWizard, search the line:
> getContainer().run(false, true, op);
If you replace this line with this one:
> getContainer().run(true, true, op);
... you will get a NullPointerExceptoin at:
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage();
That's logical, because if you look at the API:
http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. platform.doc.isv/reference/api/org/eclipse/jface/operation/I RunnableContext.html,
you will see that for the fork boolean (true if the runnable should be run
in a separate thread, and false to run in the same thread), the value at
true will make it impossible to get the ActiveWorkbenchWindow.
How can I solve this problem?
I can't put it to false, because my datamodel doesn't update my view fast
enough.
Jochen
Tom Schindl wrote:
> Hi Jochen,
> Could you stripp down your code so that we can run it locally (=create a
> runnable snippet / OSGi plugin) and reproduce the problems you are having?
> Tom
|
|
|
Re: [DataBinding] WizardScreen not fully updated [message #14031 is a reply to message #13413] |
Wed, 10 June 2009 09:22   |
Eclipse User |
|
|
|
Hi Jochen,
Could you provide me with a complete plugin I can simply drop into my
Eclipse and click somewhere. I don't have enough time to make up a
running test case my own from the sources you publish.
I hope that's not a too big problem.
Tom
Jochen Hebbrecht schrieb:
> Hi Tom,
>
> Have a look at:
>
> http://members.lycos.nl/jochus/brol/SampleNewWizard.java
> http://members.lycos.nl/jochus/brol/SampleNewWizardPage.java
>
> If I run this code, everything works perfect.
>
> In SampleNewWizard, search the line:
>
>> getContainer().run(false, true, op);
>
> If you replace this line with this one:
>
>> getContainer().run(true, true, op);
>
> .. you will get a NullPointerExceptoin at:
>
>> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage();
>
> That's logical, because if you look at the API:
> http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. platform.doc.isv/reference/api/org/eclipse/jface/operation/I RunnableContext.html,
> you will see that for the fork boolean (true if the runnable should be
> run in a separate thread, and false to run in the same thread), the
> value at true will make it impossible to get the ActiveWorkbenchWindow.
>
> How can I solve this problem?
> I can't put it to false, because my datamodel doesn't update my view
> fast enough.
>
> Jochen
>
>
>
> Tom Schindl wrote:
>
>> Hi Jochen,
>
>> Could you stripp down your code so that we can run it locally (=create a
>> runnable snippet / OSGi plugin) and reproduce the problems you are
>> having?
>
>> Tom
>
>
|
|
| | |
Re: [DataBinding] WizardScreen not fully updated [message #14177 is a reply to message #14081] |
Thu, 11 June 2009 04:53  |
Eclipse User |
|
|
|
Thnx Tom, works like a charm! :-) !
Tom Schindl wrote:
> Hi,
> Ok now I see the problem. Please read the JavaDoc from
> IWorkbench#getActiveWorkbenchWindow()
> -----8<-----
> Returns the currently active window for this workbench (if any). Returns
> null if there is no active workbench window. Returns null if called from
> a non-UI thread.
> Returns:
> the active workbench window, or null if there is no active workbench
> window or if called from a non-UI thread
> -----8<-----
> If you are passing true the operation is running in the none display
> thread hence you get back null.
> Rewriting your doFinish like this:
>> private void doFinish(IProgressMonitor monitor) throws CoreException {
>> PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
>>
>> public void run() {
>> IWorkbenchPage p =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage();
>> System.err.println(p);
>> }
>> });
>>
>> }
> Should fix the problem.
> Tom
|
|
|
Goto Forum:
Current Time: Wed Apr 30 19:20:29 EDT 2025
Powered by FUDForum. Page generated in 0.07790 seconds
|