Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » [DataBinding] Error in impl of (C)ComboObservableValue?
[DataBinding] Error in impl of (C)ComboObservableValue? [message #447930] Tue, 18 April 2006 07:47 Go to next message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
The current implementation of (C)ComboObservableValue.setValue is as
follows:

....
} else if (attribute.equals(SWTProperties.SELECTION)) {
String items[] = combo.getItems();
int index = -1;
if (items != null && value != null) {
for (int i = 0; i < items.length; i++) {
if (value.equals(items[i])) {
index = i;
break;
}
}
if (index == -1) {
combo.setText((String) value);
} else {
combo.select(index); // -1 will not "unselect"
}
}
}
....

My assumption is, that the case value == null is not handled properly
and should have the effect, that the selection text is cleared, e.g.:

....
} else if (attribute.equals(SWTProperties.SELECTION)) {
String items[] = combo.getItems();
if (items != null && value != null) {
int index = -1;
for (int i = 0; i < items.length; i++) {
if (value.equals(items[i])) {
index = i;
break;
}
}
if (index == -1) {
combo.setText((String) value);
} else {
combo.select(index); // -1 will not "unselect"
}
} else if (value == null) {
combo.setText("");
}
}
....

Is this assumption correct? A further question is, whether in case of
null-items, any new value should be set or not (I assume, it should be
set). This would let to:

....
} else if (attribute.equals(SWTProperties.SELECTION)) {
String items[] = combo.getItems();
if (value != null) {
int index = -1;
if (items != null && value != null) {
for (int i = 0; i < items.length; i++) {
if (value.equals(items[i])) {
index = i;
break;
}
}
}
if (index == -1) {
combo.setText(value != null ? (String) value :

"");
} else {
combo.select(index); // -1 will not "unselect"
}
}
....

Greetings from Bremen,

Daniel Krügler
Re: [DataBinding] Error in impl of (C)ComboObservableValue? [message #448210 is a reply to message #447930] Wed, 19 April 2006 06:31 Go to previous message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
The corresponding entry is:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=137440

Greetings from Bremen,

Daniel Krügler
Previous Topic:[DataBinding] Inconsistent getValueType's
Next Topic:Product export fails
Goto Forum:
  


Current Time: Tue Dec 10 02:30:11 GMT 2024

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

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

Back to the top