Reusing a propertyTester outside expressions [message #333264] |
Tue, 02 December 2008 16:44  |
Eclipse User |
|
|
|
Hi,
is there a way / a common pattern for the following scenario:
I have defined a (EMF-)Object (basically a Bean with several getters and
setters).
Also I have defined a propertyTester which evaluates several of the
bean's properties and then returns a derived flag depending on the
properties' values. This works nicely if the propertyTester is used in
command handler enablement expressions.
Now I want to create a view including a TableViewer which lists several
of those objects and I want to use an italic font, if the propertyTester
evaluates to true. So far, I have duplicated the evaluation code for the
tester to the LabelProvider of the TableViewer to return the appropriate
font. I just wondered, if there is a way of calling the propertyTester
instead, such that I could write
public Font getFont(Object element) {
if ( callToPropertyTester(element) ) {
return italicFont;
}
return JFaceResources.getDefaultFont();
}
Thanks for any hint.
Cheers,
Stefan
|
|
|
|
Powered by
FUDForum. Page generated in 0.03275 seconds