Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Java Template Doesn't Work With an Indented Brace(Java Template Doesn't Work With an Indented Brace)
Java Template Doesn't Work With an Indented Brace [message #1288969] Wed, 09 April 2014 01:14
Al Koch is currently offline Al KochFriend
Messages: 62
Registered: August 2011
Member
Hello,

I am using Kepler and have been trying to modify the default template for "for - iterate over array" at Window > Preferences > Java > Editor > Templates. The default is:
for (int ${index} = 0; ${index} < ${array}.length; ${index}++) {
	${line_selection}${cursor}
}


and I simply want to indent the closing brace so that we have:
for (int ${index} = 0; ${index} < ${array}.length; ${index}++) {
	${line_selection}${cursor}
	}


The change is being saved (I can return and see the indented brace) but when I try to use this in a .java file by typing "for<Ctrl><Space>" the popup list shows "for - iterate over array" with the original non-indented brace and when I select that I get the default/non-indented brace as:
for (int ${index} = 0; ${index} < ${array}.length; ${index}++) {
	${line_selection}${cursor}
}


If I make some other change to the template such as:
for (int ${index} = 0; ${index} < ${array}.length; ${index}++) {
	${line_selection}${cursor}
	THIS IS JUST A TEST
	}


I get:
for (int i = 0; i < bBPMN2.length; i++) {
	
	THIS IS JUST A TEST
}


The new text is used (although I don't know why I get the blank line) so that suggests to me that the template is being activated. So it seems that I just can't get an indented closing brace. I am wondering if there is some other "format" setting that is overriding the indentation on my closing brace but I can't find anything. Not that I can see why it would make a difference but I have tried this with "Use code formatter" turned off and it makes no difference.

How can I get an indented closing brace?

Thank you.
Al



Previous Topic:Can't step while remote debugging in latest Kepler
Next Topic:Not a valid line number?
Goto Forum:
  


Current Time: Wed May 29 21:30:45 GMT 2024

Powered by FUDForum. Page generated in 0.03962 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top