Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove <unnamed> fields in outline view of xtext eclipse

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?

like image 473
ziga Avatar asked Mar 04 '13 06:03

ziga


1 Answers

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.

like image 194
A.H. Avatar answered Oct 08 '22 11:10

A.H.