Is there a way to copy text into buffer all the variab开发者_开发知识库les local and inherited for a particular class?
I would recommend using an external tool like javap to quickly list all instance variables of a class (in the stdout, which you can easily copy).
The
javap
command disassembles a class file.
Its output depends on the options used.
If no options are used,javap
prints out the package, protected, and public fields and methods of the classes passed to it.javap
prints its output tostdout
.
You can call it as an external tool from your eclipse session:
Run>External Tools
. This brings up the external tool launch wizard.- Select
Program
, and give a name, "javap
".- For "
Location:
", hit the browser file system, and find where yourjavap
app is located.- For "
Working Directory
", select "Browse Workspace...
", and choose your workspace where your class file is located.
For example, I have a project in my workspace calledhelloDB
, after I selected this project, the test box will update to:${workspace_loc:/helloDB}
.
I don't thinkjavap
uses this directly, but you can use it for the "Arguments:
" section.- My
helloDB.class
file is located in mybin
directory relative to my project.
So for "Arguments:
", so for my project I entered:-classpath ${workspace_loc:/helloDB}/bin helloDB
Note: there's a space between.../bin
andhelloDB
. ThehelloDB
is my.class
file.- Hit run
精彩评论