Bug 100512

Summary: [navigation] show init and const values in Java Outline view
Product: [Eclipse Project] JDT Reporter: Will Hains <william.hains>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: martinae
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Will Hains CLA 2005-06-17 01:28:09 EDT
If I have a class with some fields, like this:

public class Foo
{
    private static final String _BLAH = "blah blah blah";
    public static final int DEFAULT_NUM = 300;
    private final List<Integer> _values = new ArrayList<Integer>();
    private int _currentVal = DEFAULT_NUM;
}

The Outline View currently displays these fields as just their name and type, 
like this:

_BLAH : String
DEFAULT_NUM : int
_values : List<Integer>
_currentVal : int

I think it would be handy if it showed some information about the values 
initialised in the declaration, like this:

_BLAH : String ["blah blah blah"]
DEFAULT_NUM : int [300]
_values : List<Integer> [ArrayList<Integer>]
_currentVal : int [DEFAULT_NUM]

To avoid making it look cluttered, perhaps the initial value information (shown 
in square brackets above) could be rendered in a grey font...?
Comment 1 Dani Megert CLA 2005-06-17 02:05:36 EDT
Good idea. In most cases we could get the value from the AST.
Comment 2 Dani Megert CLA 2005-06-17 02:08:18 EDT
Martin, does the AST only contain the const values or also the init values?
Comment 3 Martin Aeschlimann CLA 2005-06-17 03:37:26 EDT
You can easely check with the ASTView.

If you have the AST of the class containing the filed, then of course you can
access any kind of initialzer.
If you only have the field binding (what I guess you have), only static final
have initialializers, and only if it is a literal. 

BTW, also IFields from the Java model give access to the const values .