javadslxtextxtend

xtext, modify outline tree string


this is my xtext outline:

enter image description here

I would like to name by my self the unnamed fields.

this is my outline tree provider code, it's not a final version :

class MyDslOutlineTreeProvider extends DefaultOutlineTreeProvider {

  def _createChildren(DocumentRootNode parentNode, Script test) {
       test.includes.forEach[v| createNode(parentNode,v)] 

       //test.assignments.forEach[a | createNode(parentNode,a)]
       test.tests.forEach[t|createNode(parentNode,t)]
  }
  def _createNode(IOutlineNode parentNode, Include modelElement) {      

  }
  def _createNode(IOutlineNode parentNode, Test modelElement) {
      // print ("RUN")
  }
}

Solution

  • You can customize the displayed texts not in your OutLineTreeProvider, but in your LabelProvider.
    You can find examples in the Xtext documentation about LabelProvider (see at Xtext Documentation -> Eclipse Support -> Label Provider).