Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 364069

Summary: [CSS] "composite" attribute for property handlers is poorly defined
Product: [Eclipse Project] Platform Reporter: Brian de Alwis <bsd>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: remy.suen
Version: 4.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Brian de Alwis CLA 2011-11-17 12:57:40 EST
In seeking to extend "padding" support (bug XXXXXX), I realized I had no idea what the "composite" attribute meant when defining a property handler in a plugin.xml.  The schema definition has no details, and the code in CSSSWTEngineImpl#initializeCSSPropertyHandlers() seems to have a subtle bug:

			for (IConfigurationElement ce : e.getConfigurationElements()) {  // line 100
				if (ce.getName().equals("handler")) {
					String name = ce.getAttribute("composite");
					String adapter = ce.getAttribute("adapter");
//					if (className.equals(adapter)) {
						IConfigurationElement[] children = ce.getChildren();
						String[] names = new String[children.length];
						for (int i = 0; i < children.length; i++) {
							if (children[i].getName().equals("property-name"))
								names[i] =  children[i].getAttribute("name");
						}
						try {
							if (handlersMap.containsKey(adapter)) {
								HashMap adapterMap = (HashMap) handlersMap.get(adapter);
								if (!adapterMap.containsKey(name)){ // 114

"composite" is defined (and used) as an optional boolean value — not a name as on line 102.  On line 114, this "composite" boolean value (possibly blank, or "true" or "false") is looked up in the adapterMap, which is actually keyed by adapter class names, and so this conditional expression is always true.

Some of the handlers defined in org.eclipse.e4.ui.css.swt do set composite=false.  I suspect it was an attempt to define a composite property using other property handlers?
Comment 1 Brian de Alwis CLA 2011-11-17 13:01:11 EST
(In reply to comment #0)
> In seeking to extend "padding" support (bug XXXXXX), I realized I had no idea

Oops, submitted that is for bug 364070.
Comment 2 Lars Vogel CLA 2019-11-14 03:14:55 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.