mirror of https://github.com/Minres/RDL-Editor.git
65 lines
2.3 KiB
Plaintext
65 lines
2.3 KiB
Plaintext
|
/*
|
||
|
* 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.PropertyAssignment
|
||
|
import com.minres.rdl.rdl.NamedInstantiation
|
||
|
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
|
||
|
|
||
|
/**
|
||
|
* 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)]
|
||
|
domainModel.namedInstantiations.forEach[createNode(parentNode, it)]
|
||
|
}
|
||
|
|
||
|
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)]
|
||
|
compDef.namedInstantiations.forEach[createNode(parentNode, it)]
|
||
|
}
|
||
|
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
protected def boolean _isLeaf(NamedInstantiation feature) {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
protected def boolean _isLeaf(PropertyAssignmentRhs feature) {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
protected def boolean _isLeaf(EnumEntry feature) {
|
||
|
return feature.properties.size==0;
|
||
|
}
|
||
|
}
|