Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
academic - 15 Feb 2006 18:26 GMT
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
stixwix - 15 Feb 2006 18:40 GMT
> I just wrote my first java program (ImageJ).
>
[quoted text clipped - 6 lines]
>
> Thanks

Most IDEs will do this.  You can do it manually in Eclipse with ctrl I.
Green - 15 Feb 2006 18:40 GMT
Use Jalopy - the source code formatting tool.
http://jalopy.sourceforge.net/
Chris Stiles - 16 Feb 2006 17:53 GMT
> Use Jalopy - the source code formatting tool.
> http://jalopy.sourceforge.net/

Still not compatible with Java 5.

Signature

regards, chris

James McGill - 15 Feb 2006 18:46 GMT
> 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.
academic - 15 Feb 2006 19:09 GMT
thanks

>> 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.
Roedy Green - 17 Feb 2006 05:58 GMT
On Wed, 15 Feb 2006 11:46:37 -0700, James McGill
<jmcgill@cs.arizona.edu> wrote, quoted or indirectly quoted someone
who said :

>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.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

James McGill - 18 Feb 2006 00:47 GMT
> 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.
IchBin - 15 Feb 2006 18:47 GMT
> I just wrote my first java program (ImageJ).
>
[quoted text clipped - 6 lines]
>
> 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"

Signature

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-)

Roedy Green - 17 Feb 2006 06:06 GMT
>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.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

James McGill - 18 Feb 2006 00:44 GMT
> 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.
Roedy Green - 18 Feb 2006 20:45 GMT
On Fri, 17 Feb 2006 17:44:45 -0700, James McGill
<jmcgill@cs.arizona.edu> wrote, quoted or indirectly quoted someone
who said :

>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.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

academic - 15 Feb 2006 18:51 GMT
Thanks all
Vs2005 does have it, a little hidden
Is Eclipse a costly tool? Seem to be popular

Thanks again

>I just wrote my first java program (ImageJ).
>
[quoted text clipped - 6 lines]
>
> Thanks
Oliver Wong - 15 Feb 2006 19:01 GMT
> Thanks all
> Vs2005 does have it, a little hidden
> Is Eclipse a costly tool? Seem to be popular

   Eclipse is free (both as in free beer, and as in freedom), but can be
tricky to learn to use at first.

http://www.eclipse.org/

   - Oliver
academic - 15 Feb 2006 19:08 GMT
thanks

>> Thanks all
>> Vs2005 does have it, a little hidden
[quoted text clipped - 6 lines]
>
>    - Oliver
Roedy Green - 17 Feb 2006 06:06 GMT
>Is Eclipse a costly tool? Seem to be popular

$0
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

academic - 17 Feb 2006 10:25 GMT
thanks for all the input

>>Is Eclipse a costly tool? Seem to be popular
>
> $0
Oliver Wong - 17 Feb 2006 17:20 GMT
>>Is Eclipse a costly tool? Seem to be popular
>
> $0

   Is that Canadian or US (or something else)?

   - Oliver
jussij@zeusedit.com - 16 Feb 2006 05:00 GMT
> 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
academic - 16 Feb 2006 13:47 GMT
thanks I'll look at that

>> Is there some way I can have a program (maybe VS2005) maintain
>> or correct the format of a java file?
[quoted text clipped - 16 lines]
> Jussi Jumppanen
> Author: Zeus for Windows


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.