5

I have started working on eclipse recently. In eclipse xtext my grammar is:

regGrp:
    reg_type=reg_type1 "{" reg_definition+=reg_definition1+ "}"
    ;

reg_type1 :
    name="CONTROL_REGISTERS"
    ;

reg_definition1:
    name=ID '[' regSize=INT ']''{' (regFieldssss=regFieldsdefRule) '}'
    ;

regFieldsdefRule:
    name="DESCRIPTION" '=' descStr=STRING ';'
    ;

Then after Run_as -> Eclipse_application in final.sts file I can write a code as:

CONTROL_REGISTERS {
    reg [5] { 
        DESCRIPTION = "register" ;
    }
}

In the outline view I will get tree as below:

         ->final
           -> <unnamed>
             -> <unnamed>
               CONTROL_REGISTERS
             -> reg
               -> <unnamed>
                  DESCRIPTION

I wanted to remove those fields in outline tree. Finally outline tree should look something like:

                ->final
                  ->CONTROL_REGISTERS
                    ->reg
                      ->DESCRIPTION

Please anyone can tell me how to implement this?

A.H.
  • 63,967
  • 15
  • 92
  • 126
ziga
  • 109
  • 10

1 Answers1

6

The outline is computed by an IOutlineTreeProvider. The default Xtext project setup generates an empty stub for you in the *.ui project (named MydslnameOulineTreeProvider). This stub inherits inherits from DefaultOutlineTreeProvider. Inside the stub you can add customizations. Please refer to the documentation here at for the details of this customization.

Boris Brodski
  • 8,425
  • 4
  • 40
  • 55
A.H.
  • 63,967
  • 15
  • 92
  • 126