Base setup: I want to render a reference cell, however the reference type is an abstract concept.
klass : ParameterClass
concept IntegerParameterClass extends ParameterClass
min : IntegerLiteral[0..1]
max : IntegerLiteral[0..1]
default : IntegerLiteral[0..1]
I want to display certain parts of klass. For instance, if klass instanceof IntegerParameterClass, then I want to display editor for "min" children.
Basically (%klass% -> %min%) is not allowed since klass is not of IntegerParameterClass.
I want something like (%klass% =node:IntegerParameterClass=> %min%) or switch-case like editor.
As I tried (%klass% -> $custom cell$), it seems to be rather hard to get it right. I just want to "get default editor cell for %min%".
1) context.getCellFactory().createEditorCell(node.klass : IntegerParameterClass.min, false) does not work as it produces an EditorCell with pre-populated cellId. Later $cutomcell$ tries to call setCellId, and it fails due to assert in EditorCell_Basic.setCellId
getCellFactory().createEditorCell seems to be overcomplicated for simple cases like "just a simple cast/node traversal" is required.
It does not support usage of regular style language.
2) I found mbeddr's createCell operation. It is much better than createEditorCell, as it allows usage of regular editor to describe the desired result.
Unfortunately, it is not compatible with $custom cell$ as well due to setCellId assertion.
In order to workaround setCellId, I use reflection to reset myCellId field. It produces the desired effect, however, the editor configuration looks awkward:
2.1) AbstractCellProvider -> ... -> setAccessible is just ugly
2.2) Styling "-> %min%" is complicated, as it requires "inspecting" the node that is already located in inspector. It is doable, yet it is not convenient.
I wonder if switch-like CellModel can be added to enable (%klass% -> case when node.isInstanceOf(IntegerParameterKlass) then -> %min% when ... end) kind of editors.
Here's what I get at the moment (it does work and produce the desired results):
AbstractCellProvider + getCellFactory().createEditorCell() == assertion in EditorCell_Basic.setCellId