Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [DataBinding] How to report an error during databinding update
[DataBinding] How to report an error during databinding update [message #335672] Mon, 20 April 2009 19:56
VincentL is currently offline VincentLFriend
Messages: 88
Registered: July 2009
Member
Hi,

I would like to know what is the best way to report an error during a databinding update.

Suppose for example that I have a simple interface that is connected to a class using
databinding. This class use a database to store values.

Suppose now that for an unknown reason the database access failed when trying to get (or
set) the value of a field. How could I notify the user interface that the update failed
and how could I report the exception to the user interface?



1- My Person class is part of a second java plugin and is completely independant of the
user interface part and of the Eclipse plugins and I do not want to add dependencies to
other package or plugins.

2- I'm looking for a way to display the exception in an errorDialog (using IStatus
reference for example) or something similar in my user interface.

A) Is it possible to do this?

B) Are there alternatives to this approach?

C) Are there examples of this?

My example:


class Person extends ModelObject
{
...

public String getName() {
// This call will throw an exception
return readNameFromDataBase();
}

public void setName(String name) {
// This call will throw an exception
setNameInDataBase();
}
}

class MyUI extends ViewPart {

public void createPartControl(Composite parent){
...
Text nameText = new Text(parent, SWT.BORDER);
...

DataBindingContext bc = new DataBindingContext();
IObservableValue o1 = SWTObservables.observeText(nameText, SWT.FocusOut);
IObservableValue o2 = BeansObservables.observeValue(person, "name");
bc.bindValue(o1, o2, null, null);

...

bc.updateTargets();
...
}
}


Thanks

Vincent
Previous Topic:Properties Page behavior
Next Topic:Bug in saving file with same name as other open modified files
Goto Forum:
  


Current Time: Sat Nov 09 03:36:43 GMT 2024

Powered by FUDForum. Page generated in 0.02433 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top