There is no facility in 0.3.x to constrain/modify possible types at runtime. That’s something I am working on for 0.4 release. You cannot do this at the binding level. The binding is required to know how to handle all possible types and that list is static.
In 0.3.x, the only workaround is to flag types that are invalid for a given runtime condition using validation.
- Konstantin
From: sapphire-dev-bounces@xxxxxxxxxxx [mailto:sapphire-dev-bounces@xxxxxxxxxxx] On Behalf Of Shenxue Zhou
Sent: Friday, August 12, 2011 4:06 PM
To: Sapphire project
Subject: [sapphire-dev] Possible types of @CustomXmlListBinding
My custom list binding needs to have different possible types and element names based on certain condition. I do that by overriding initBindingMetadata inside my custom list binding which extends StandardXmlListBindingImpl.
Now when I click on the "+" next to the list property, instead of getting a list of all the possible element types, I'm getting the following exception:
java.lang.IllegalArgumentException
at org.eclipse.sapphire.modeling.util.MiscUtil.indexOf(MiscUtil.java:86)
at org.eclipse.sapphire.modeling.xml.StandardXmlListBindingImpl.addUnderlyingObject(StandardXmlListBindingImpl.java:163)
at org.eclipse.sapphire.modeling.LayeredListBindingImpl.add(LayeredListBindingImpl.java:58)
at org.eclipse.sapphire.modeling.ModelElementList.addNewElement(ModelElementList.java:247)
at org.eclipse.sapphire.ui.renderers.swt.DefaultListPropertyEditorRenderer$AddActionHandler.run(DefaultListPropertyEditorRenderer.java:1632)
at org.eclipse.sapphire.ui.SapphireActionHandler.execute(SapphireActionHandler.java:89)
at org.eclipse.sapphire.ui.swt.renderer.SapphireToolBarActionPresentation$1.widgetSelected(SapphireToolBarActionPresentation.java:109)
What other methods do I need to override in my custom list binding?
Thanks,
Shenxue