Advanced (Unorthodox?) Formatting in Eclipse [message #766649] |
Fri, 16 December 2011 07:36 |
David Illescas Messages: 1 Registered: December 2011 |
Junior Member |
|
|
Hello.
Although I am a newcomer to this forum I am not a newcomer to Eclipse. I have, however, failed to make use of its powerful source code formatting features because, well, the way I format my code is rather idiosyncratic.
Consider the following snippet:
package source;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class
HelloWorld
extends SomeClass
implements SomeInterface
{
/**
* @param args
*/
public static void
main
(String[] args)
{
System.out.println
("Hello World from Java 1.7");
@SuppressWarnings("unused")
List<Integer> complicated_object =
new LinkedList<Integer>( Arrays.asList(new Integer[]{5,6,7,8,9}) );
printMessage("four");
}
private static void
printMessage
(String string)
{
switch(string){
case("one"):
System.out.println(1);
break;
case("two"):
System.out.println(2);
break;
default:
System.out.println(
"You entered some other number, and yes, I know this" +
"\"error\" message could be more helpful."
);
break;
}
}
}
As you can see there are a number of odd things happening above, and I am not sure that the range of settings on the source code formatter permits my code to look this way(I could be mistaken about this). For instance, I break the linked list declaration at the assignment operator; I also put the class name on its own line, and the method name on its own line; I put short argument lists on the same line as the method name, medium length argument lists on their own line, and multi-line argument lists using a traditional function brace arrangement.
I am wondering if anyone knows of any "low-level" interface for configuring the source code formatter, so that the formatting and clean-up can be made completely consistent and automatic.
Thank you.
[Updated on: Fri, 16 December 2011 08:15] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04517 seconds