2017-09-12 12:48:21 +02:00
|
|
|
/*
|
|
|
|
* generated by Xtext 2.12.0
|
|
|
|
*/
|
|
|
|
package com.minres.rdl.ui.outline
|
|
|
|
|
|
|
|
import com.minres.rdl.rdl.Root
|
|
|
|
import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider
|
|
|
|
import org.eclipse.xtext.ui.editor.outline.impl.DocumentRootNode
|
|
|
|
import com.minres.rdl.rdl.ComponentDefinition
|
|
|
|
import org.eclipse.xtext.ui.editor.outline.IOutlineNode
|
|
|
|
import com.minres.rdl.rdl.ExplicitPropertyAssignment
|
|
|
|
import com.minres.rdl.rdl.PostPropertyAssignment
|
|
|
|
import com.minres.rdl.rdl.PropertyAssignmentRhs
|
|
|
|
import com.minres.rdl.rdl.EnumDefinition
|
|
|
|
import com.minres.rdl.rdl.EnumEntry
|
2017-09-19 18:08:17 +02:00
|
|
|
import com.minres.rdl.rdl.Instantiation
|
|
|
|
import com.minres.rdl.rdl.ComponentInstance
|
2017-09-12 12:48:21 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Customization of the default outline structure.
|
|
|
|
*
|
|
|
|
* See https://www.eclipse.org/Xtext/documentation/310_eclipse_support.html#outline
|
|
|
|
*/
|
|
|
|
class RDLOutlineTreeProvider extends DefaultOutlineTreeProvider {
|
|
|
|
|
|
|
|
protected def _createChildren(DocumentRootNode parentNode, Root domainModel) {
|
|
|
|
domainModel.enumDefinitions.forEach[createNode(parentNode, it)]
|
|
|
|
domainModel.propertyDefinitions.forEach[createNode(parentNode, it)]
|
|
|
|
domainModel.componentDefinitions.forEach[createNode(parentNode, it)]
|
|
|
|
domainModel.propertyAssignments.forEach[createNode(parentNode, it)]
|
2017-09-19 18:08:17 +02:00
|
|
|
domainModel.instantiations.forEach[Instantiation instantiation |
|
|
|
|
if(instantiation.component!==null) createNode(parentNode, instantiation.component)
|
|
|
|
instantiation.componentInstances.forEach[createNode(parentNode, it)]
|
|
|
|
]
|
2017-09-12 12:48:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected def _createChildren(IOutlineNode parentNode, ComponentDefinition compDef) {
|
|
|
|
compDef.enumDefinitions.forEach[createNode(parentNode, it)]
|
|
|
|
compDef.componentDefinitions.forEach[createNode(parentNode, it)]
|
|
|
|
compDef.propertyAssignments.forEach[createNode(parentNode, it)]
|
2017-09-19 18:08:17 +02:00
|
|
|
compDef.instantiations.forEach[Instantiation instantiation |
|
|
|
|
if(instantiation.component!==null) createNode(parentNode, instantiation.component)
|
|
|
|
instantiation.componentInstances.forEach[createNode(parentNode, it)]
|
|
|
|
]
|
2017-09-12 12:48:21 +02:00
|
|
|
}
|
2017-09-19 18:08:17 +02:00
|
|
|
|
2017-09-12 12:48:21 +02:00
|
|
|
protected def _createChildren(IOutlineNode parentNode, EnumDefinition e) {
|
|
|
|
e.body.entries.forEach[createNode(parentNode, it)]
|
|
|
|
}
|
|
|
|
|
|
|
|
protected def _createChildren(IOutlineNode parentNode, PostPropertyAssignment p) {
|
|
|
|
createNode(parentNode, p.rhs)
|
|
|
|
}
|
|
|
|
|
|
|
|
protected def boolean _isLeaf(ExplicitPropertyAssignment feature) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-09-19 18:08:17 +02:00
|
|
|
protected def boolean _isLeaf(Instantiation feature) {
|
|
|
|
return feature.component===null && feature.componentInstances.size==0;
|
2017-09-12 12:48:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected def boolean _isLeaf(PropertyAssignmentRhs feature) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-09-19 18:08:17 +02:00
|
|
|
protected def boolean _isLeaf(ComponentInstance feature) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-09-12 12:48:21 +02:00
|
|
|
protected def boolean _isLeaf(EnumEntry feature) {
|
|
|
|
return feature.properties.size==0;
|
|
|
|
}
|
|
|
|
}
|