Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a 'Java Category' as referenced in the eclipse 'outline' window

Tags:

java

eclipse

Can anyone tell me why it's useful to use Java categories in Eclipse?

When looking in the 'outline' window, if I click the menu arrow in the top right and select visible categories I get an option to show certain Java categories, why would I ever want to do this?

Thanks

like image 812
Dori Avatar asked Jan 13 '11 12:01

Dori


1 Answers

Well lets not forget that eclipse is an IDE for Java (i am talking only for Java). A Java file could be a human written Java file or it could be a generated file.

If you have some experience with any rational software or JavaCC or Antlr or if you are using MDD (Model Driven Development) then what I am saying will be crystal clear :).

So at times the above mentioned tools generate some skeleton Java files and requiring developer to fill in the gap. Now it would be difficult to find your own method among the auto generated methods and variables (and for big models (MDA) they really generate a large amount of code). So a standard and well behaved generator will generate something like this:

/**
* This is generated method
* @category Generated
*/

public void generatedMethod()
{
     // do something fancy
}

/**
* This is not a generated method
* @author James Gosling
*/

public void notAGeneratedMethod()
{
     // do something fancy
}

Now from the menu arrow in the top right, you can select the visible categories.

Also in collaborative environment. Where two or more people are working on the same Java class; you can define a @category as author name or group name, to help developer(s) in quickly navigating.

Hope this will help.

like image 155
Favonius Avatar answered Oct 15 '22 14:10

Favonius