print outline list all methods in class and class variable in java code

I'm using webshpere to java programaing.    
What I'd like to do is from a *.java source, get listing-outline of all methods/classes that I can print it.
The webshpere has the outline view but  it's for looking on the screen only.  I want to be able to copy outline of
java code and be able print it.  
Is there a way to do this?
Who is Participating?
colr__Connect With a Mentor Commented:
I think your best bet is to read the *.java source file as a text document, then parse it into seperate entities, extract the method names and print them.

Parsing it shouldnt be too tricky in that you know the method signatures are in this form:

visibility returnType methodName(optionalParams){

Mind you, some parts of that are optional, but if this is for internal use and you know exactly how your code is comprised, you shuld be able to work out a fairly simple algorithm for this.
Igor BazarnyCommented:
Do you need this inside IDE? If so, check out jdt
tomboshellConnect With a Mentor Commented:
I could think of two solutions:
1.  Maximize the Outline view, or make it big enough so that everything is showing.  Then take a screen shot and print the screen shot out.

2.  It is based upon Eclipse.  Make your own plugin that will contribute to the Outline view plugin.  You would probably need to get the Outline's contenttypeprovider.  That is the longer,harder way but it would then be integrated into your workbench.  
ALad2005Author Commented:
     your option 1 - I have been using this, but it's not practical, becasue the java codes are very large with many  
     However, can you expand on option 2?   You have something interesting there but I have no idea how to  
     implement it.
      Your direction is appreciated.

      Thanks for your suggestion, but I don't know how to parse it.  May be there is way but I too much of beginner.

       inside ide is good,  excuse my ignorance, but what's jdt? and how can I achieve that?

Thank you all , hope you can shed some more light.

Igor BazarnyConnect With a Mentor Commented:
Your IDE is based on open-source Eclipse platform which includes JDT API to access and modify java source code and compiled java classes. Search docs or site. diving into outline code is also interesting idea--it should be available as part of eclipse sdk download.

Well, thing I speak about need a lot of knowledge. Don't know your task--maybe learning jdt api and eclipse core api along the way just doesn't make sense for you
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.