Is there a program that will maintain or correct the format of a java file?

A

academic

I just wrote my first java program (ImageJ).

When I went from writing c to VisualBasic I didn't like the fact that VB
controlled the format of the text. But I've since gotten use to it and now
find maintaining indentation and such a drag.

Is there some way I can have a program (maybe VS2005) maintain or correct
the format of a java file?


Thanks
 
S

stixwix

academic said:
I just wrote my first java program (ImageJ).

When I went from writing c to VisualBasic I didn't like the fact that VB
controlled the format of the text. But I've since gotten use to it and now
find maintaining indentation and such a drag.

Is there some way I can have a program (maybe VS2005) maintain or correct
the format of a java file?


Thanks

Most IDEs will do this. You can do it manually in Eclipse with ctrl I.
 
J

James McGill

Is there some way I can have a program (maybe VS2005) maintain or correct
the format of a java file?

I suspect you would fall in love with Eclipse, once you got used to it.
 
I

IchBin

academic said:
I just wrote my first java program (ImageJ).

When I went from writing c to VisualBasic I didn't like the fact that VB
controlled the format of the text. But I've since gotten use to it and now
find maintaining indentation and such a drag.

Is there some way I can have a program (maybe VS2005) maintain or correct
the format of a java file?


Thanks
I do not use MS IDE's but they should have the ability to build your own
Formats. Example, Eclipse you can do this by

"Menu Windows / Preferences / Java / Code Style / Formatter"

--

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
 
A

academic

Thanks all
Vs2005 does have it, a little hidden
Is Eclipse a costly tool? Seem to be popular

Thanks again
 
J

jussij

Is there some way I can have a program (maybe VS2005) maintain
or correct the format of a java file?

The Zeus for Windows IDE has auto-indenting and a code
template feature:

http://www.zeusedit.com/java.html
Note: Zeus is shareware (45 day trial).

It comes with class browsing, syntax highlighting, code
folding, project/workspace management, integrated version
control etc etc.

Also the link below shows how to integrate the Jacobe Java
code beautifier utility into Zeus:

http://www.zeusedit.com/forum/viewtopic.php?t=291

Jussi Jumppanen
Author: Zeus for Windows
 
A

academic

thanks I'll look at that


The Zeus for Windows IDE has auto-indenting and a code
template feature:

http://www.zeusedit.com/java.html
Note: Zeus is shareware (45 day trial).

It comes with class browsing, syntax highlighting, code
folding, project/workspace management, integrated version
control etc etc.

Also the link below shows how to integrate the Jacobe Java
code beautifier utility into Zeus:

http://www.zeusedit.com/forum/viewtopic.php?t=291

Jussi Jumppanen
Author: Zeus for Windows
 
R

Roedy Green

I suspect you would fall in love with Eclipse, once you got used to it.

Objectively it really boosts productivity even if it is frustratingly
slow at times. It seems to need time to get "warmed up" on itself, a
project or file.

The singularly most frustrating thing is its refusal to reformat if
there are any syntax errors. If I ever unbalance a () or {} I am in
for a long hunt.

Perhaps someone could write a plugin to make a good guess at where ()
{} are missing or needed.


When you inserted a } it would tag it with a comment saying what it
was the end of, and would ENFORCE those comments in future.
 
R

Roedy Green

I do not use MS IDE's but they should have the ability to build your own
Formats. Example, Eclipse you can do this by

"Menu Windows / Preferences / Java / Code Style / Formatter"

It is incredible the degree of control the Eclipse formatter gives
you. I can't believe how many asymmetric micro configuring decisions
it took for me to get the formatter to produce "normally formatted"
code.

The other magic is once you have discovered a better format, redoing
your entire universe of code to the new standard is only a few clicks
away.

Someone may write a formatter that gleans the rules you like just by
looking at a sufficiently large sample of your own hand-formatted
code, or your boss's! I had a boss who was utterly fanatical about
code formatting. He put Monk to shame with his additional rules for
what was acceptable.

Most of the large code samples on my website were formatted by Eclipse
-- any code snippet that has a class name beginning Test..
e.g. TestJTextArea http://mindprod.com/jgloss/jtextarea.html

The small ones were done by SlickEdit.
 
J

James McGill

The other magic is once you have discovered a better format, redoing
your entire universe of code to the new standard is only a few clicks
away.

Explaining why everything in the source repository now creates
substantial diffs, on the other hand, can be quite an adventure.
For this reason I've forced myself to find no fault with the initial
config of eclipse.
 
J

James McGill

When you inserted a } it would tag it with a comment saying what it
was the end of, and would ENFORCE those comments in future.

Sounds like a good opportunity for an editor plugin. Somewhere, there's
some sort of notification event for the bracket matching (it already has
highlighting) so why not a code formatting template here? Good idea.
 
R

Roedy Green

Explaining why everything in the source repository now creates
substantial diffs, on the other hand, can be quite an adventure.
For this reason I've forced myself to find no fault with the initial
config of eclipse.

To avoid this problem, we need a compact ugly format for the
repository. Then when you fetch code you fluff it up to your preferred
style, and the repository automatically compresses it back to the ugly
standard style before checkin.

You really want a scid for this. You can't totally avoid deltas
because of the problem of where you put line breaks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top