| Summary: | [CSS] "Useless" Dependency on org.apache.commons.beanutils | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] e4 | Reporter: | Thomas Schindl <tom.schindl> | ||||||||
| Component: | UI | Assignee: | Thomas Schindl <tom.schindl> | ||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | azerr, bokowski, gheorghe, john.arthorne, pwebster | ||||||||
| Version: | 0.9 | ||||||||||
| Target Milestone: | 1.0 RC0 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
|
Description
Thomas Schindl
Angelo, I guess you know best what property types can get passed in there. If they are simply none-nested types then we can replace it through a very very simple property lookup. Hi Tom,
I think we can remove this dependency and manage PropertyUtils#getproperty wich use reflection to retrieve the value of a getter of a POJO. As you said, PropertyUtils from Apache Beanutils is used into the only method SWTElement#getAttribute like this :
---------------------------------------------
public String getAttribute(String attr) {
Widget widget = getWidget();
if (attr.equals("style")) {
return swtStyles;
}
Object o = widget.getData(attr.toLowerCase());
if (o != null)
return o.toString();
try {
o = PropertyUtils.getProperty(widget, attr);
if (o != null)wxx
return o.toString();
} catch (Exception e) {
// e.printStackTrace();
}
return "";
}
---------------------------------------------
This method is used to get attribute value of the widget. So you can write this CSS :
---------------------------------------------
Text[enabled=true] {
color:red;
}
---------------------------------------------
SWTElement#getAttribute is called with enabled attr parameter. Code o = PropertyUtils.getProperty(widget, attr); will return the value of 'enabled' property of the SWT Widget (Widget#isEnabled()).
Hope my explanation will help you.
Regards Angelo
(In reply to comment #1)
> Angelo, I guess you know best what property types can get passed in there. If
> they are simply none-nested types then we can replace it through a very very
> simple property lookup.
Created attachment 171021 [details]
Patch + TestCase
Thanks Angelo that's what I expected it is doing. Attached is an implementation which even supports nested beans.
released the patch and test case to HEAD Paul, John if not completely mistaken this means we don't need org.apache.commons.beanutils anymore because the only dependency was in css.swt. I think we can remove it from our css.feature, .product-Files, ... Created attachment 171036 [details]
Patch to remove bean utils from build
Created attachment 171037 [details]
Remove beanutils and commons.logging
Without beanutils, there is nobody in e4 using commons.logging.
|