Hey,
I'm trying to implement a list storing different types. The gallery examples presents a running implementation. I copied the example and adjusted it for my requirements that slightly differ. My sub types do not have any attributes in common. So my base type does not contain any property, as it is for IChildElement interface. IChildElement contains the StringValue property that is inherited to all subtypes and used to shown in the UI (table).
@GenerateImpl
public interface Base extends IModelElement {
ModelElementType TYPE = new ModelElementType(Empty.class);
}
Text, Image and Pdf extend Base.
@Type(base = Base.class, possible = { Text.class, Image.class, Pdf.class })
@XmlListBinding
(
path = "description",
mappings =
{
@XmlListBinding.Mapping(element = "text", type = Text.class),
@XmlListBinding.Mapping(element = "image", type = Image.class),
@XmlListBinding.Mapping(element = "pdf", type = Pdf.class)
}
)
ListProperty PROP_DESCRIPTION = new ListProperty(TYPE, "Description");
ModelElementList<Empty> getDescription();
The table that shows the types in the UI just executes the toString() method from java.lang.Object and prints the memory address from org.eclipse.sapphire.ui.renderers.swt.DefaultListPropertyEditorRenderer$TableRow. Is there a straightforward way I could provide a label/content provider? I provided editing support in the detail area, but it would be nice if the user could directly change one property of a certain subtype in the table (that I would had to define per type e.g. for Image the URI and for Text the content). Is that possible?
Thank you!
Kon