Bug 100512 - [navigation] show init and const values in Java Outline view
Summary: [navigation] show init and const values in Java Outline view
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-17 01:28 EDT by Will Hains CLA
Modified: 2005-06-17 03:37 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 .