Every DSL object has a BackPointer to a DSL node implementation. This allows the CheckNode() and DisableNodeCheckbox() operations from the DSL object.
At the initialisation, FillUpTreeOfGongObjects()
Parses all DSL objects and
creates a DSL object node
creates a DSL object node implementation of the DSL object node
links the DSL object node implementation to the DSL object
set a back pointer from the DSL object to the DSL object node implementation
Given a classdiagram, computeDSLNodesConfiguration()
Computes for all DSL object , is DSL shape is present in the diagram
Parses all DSL objects and computes if disabling the DSL object node is necessary (to decide if the DSL object can be added to the diagram). If so, it perfoms DisableNodeCheckbox() on the DSL object back pointer
Parses all DSL shapes, get the DSL object from the DSL shape and performs CheckNode() on the back pointer of the DSL object
Problem:
Step 2 of computeDSLNodesConfiguration seems overcomplicated
Alternative:
in step 2 of computeDSLNodesConfiguration()`,
parses all DSL object node,
for _, _node := range nodeCb.treeOfGongObjects.RootNodes {
...
}
get their implementation
get the DSL object, computes if disabling he checkbox is necessay , performs DisableNodeCheckbox on the DSL object node
No need for back pointers anymore
One problem is that DSL object node are just nodes, getting DSL information requires getting info from the DSL node implementation
Steps:
[ ] Parses all DSL object nodes and according to the DSL node implementation type, performs the thing
for _, _node := range nodeCb.treeOfGongObjects.RootNodes {
for _, _node := range _node.Children {
for _, _node := range _node.Children {
switch nodeImpl := _node.Impl.(type) {
case *FieldImpl:
gongField := nodeImpl.field
switch fieldReal := gongField.(type) {
case *gong_models.PointerToGongStructField:
if ok := namesOfDisplayedGongstructs[fieldReal.GongStruct.Name]; !ok {
nodeImpl.DisableNodeCheckbox()
}
case *gong_models.SliceOfPointerToGongStructField:
if ok := namesOfDisplayedGongstructs[fieldReal.GongStruct.Name]; !ok {
nodeImpl.DisableNodeCheckbox()
}
default:
}
case *GongEnumValueImpl:
case *GongLinkImpl:
default:
_ = nodeImpl
log.Panic("No known implementation")
}
}
}
}
Situation:
DSL = gong
Every DSL object has a BackPointer to a DSL node implementation. This allows the
CheckNode()
andDisableNodeCheckbox()
operations from the DSL object.At the initialisation,
FillUpTreeOfGongObjects()
Given a classdiagram,
computeDSLNodesConfiguration()
DisableNodeCheckbox()
on the DSL object back pointerCheckNode()
on the back pointer of the DSL objectProblem:
Step 2 of computeDSLNodesConfiguration seems overcomplicated
Alternative:
in step 2 of computeDSLNodesConfiguration()`,
No need for back pointers anymore
One problem is that DSL object node are just nodes, getting DSL information requires getting info from the DSL node implementation
Steps: