[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.jdt] Correct Indentation

Hello!

I write my eclipse based program which generate java code. I would like to use

org.eclipse.jdt.internal.ui.actions.IndentAction to correct indentation.

But I have a problem when with the following example:

String src = "class a {" +EOL+
"static String s = \"a\"\n"+
"+\"{\"\n"+
"+\"{\"\n"+
"+\"{\"\n"+
";\n"+
"// comment\n"+
"}"+EOL;
IDocument document = new Document(src);

IndentAction.indent(document, project);

I get the following output:

<pre>
class a {
	static String s = "a"
	+"{"
		+"{"
		+"{"
			;
		// comment
		}
</pre>

but when I select "Correct Indentaton" in editor menu I have the following output:

<pre>
class a {
	static String s = "a"
		+"{"
		+"{"
		+"{"
		;
	// comment
}
</pre>

Is there any option in the project settings which can correct indentation?

Thanks