Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2006-11-01
7
Medium Priority
?
1,949 Views
Last Modified: 2012-05-05
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?
Thanks
0
Comment
Question by:ALad2005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 7

Expert Comment

by:Igor Bazarny
ID: 17855540
Do you need this inside IDE? If so, check out jdt
0
 
LVL 8

Accepted Solution

by:
colr__ earned 672 total points
ID: 17856441
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.
0
 
LVL 7

Assisted Solution

by:tomboshell
tomboshell earned 664 total points
ID: 17856699
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.  
0
 

Author Comment

by:ALad2005
ID: 17858141
Tomboshell:
     your option 1 - I have been using this, but it's not practical, becasue the java codes are very large with many  
     methods.
     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.

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

Bazarny:
       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.
Thanks.
Anil

0
 
LVL 7

Assisted Solution

by:Igor Bazarny
Igor Bazarny earned 664 total points
ID: 17864896
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 Eclipse.org 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
0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question