Adding a separator to the Eclipse Outline view (like #pragma mark)

Viewed 7911

I know Xcode has a

#pragma mark 

feature where it allows you to insert arbitrary labels in outline views / method lists to document how code is segmented.

I haven't been able to find a similar feature for Eclipse. I can't help but feel that it's right under my nose, but searches on both SO and Google haven't been enlightening... anyone know how I might do this?

Or is there some hackish workaround? That would be awesome too.

5 Answers

Eclipse outline view supports categories (with @category in javadoc) for showing additional information on methods. See the following screenshots for an example of such usage.

Category definition in the editor

Category and filtering in the Outline view

Unfortunately grouping by categories has not been implemented yet. There is an open feature request for this, but it is nearly four years old and clearly stated that it needs community effort. Personally I do not know such plugin.

The horror:

@SuppressWarnings("unused")
private int _______________________________________;

Or if you prefer labels:

@SuppressWarnings("unused")
private int _______________Lifecycle_______________;

enter image description here

Bonus points for varying the number of underscores so you can have many separator lines.


My Android Studio Version

Use code regions:

//region

    ... your code here ... 

//endregion

Bonus points for making the folded presentation look like a comment:

//
//region // Lifecycle

   ... your code here ...

//endregion
//

enter image description here

Related