Board index » jbuilder » Repost: indentation problem in JBuilder 7

Repost: indentation problem in JBuilder 7


2003-09-30 04:38:15 PM
jbuilder18
Quote
I have JBuilder SE 7.0.155.0
Some code blocks always give me indentation problems. For example:
for(int i=0;i<10;i++)
{
if(true)
{

}
}
The closing brace of the 'if' block always has incorrect indentation. What
might be wrong?
Rgds
Sachin
 
 

Re:Repost: indentation problem in JBuilder 7

Hi,
Can someone at least let me know if the code I have mentioned gets indented
properly on their JBuilder or not? That way I will know if the problem is
with any of my settings or with JBuilder in general.
Typing 'tab' on any lines of the code does not make any difference :-(. So
there must be a problem in JBuilder indentation logic somewhere.
Rgds
Sachin
"Sachin Vaidya" < XXXX@XXXXX.COM >wrote in message
Quote
>I have JBuilder SE 7.0.155.0
>Some code blocks always give me indentation problems. For example:
>for(int i=0;i<10;i++)
>{
>if(true)
>{
>
>}
>}
>The closing brace of the 'if' block always has incorrect indentation.
What
>might be wrong?
>Rgds
>Sachin


 

Re:Repost: indentation problem in JBuilder 7

On 9/30/2003 at 4:38:15 AM, Sachin Vaidya wrote:
Quote
Some code blocks always give me indentation problems. For example:
It does not cause problems for me, but there are so many variables that
I was guessing at that I am not surprised by that.
The best way to post a problem with formatting is to post a project,
since that will have all of the formatting options in it. Include a
source file that shows the problem, and indicate whether you are using
the "format all" command or selecting some text and formatting that.
Of course, in the latter case you should say which text you have
selected.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
www.JPMcGrath.net/newsgroups/e-mail.html
 

{smallsort}

Re:Repost: indentation problem in JBuilder 7

Hi
I didnt know how to post the project and source files. So pasting the
contents in this mail.
-----------Project
file------------------------------------------------------------------------
----------------
<?xml version="1.0" encoding="UTF-8"?>
<!--JBuilder XML Project-->
<project>
<property category="runtime" name="DefaultConfiguration" value="-1"/>
<property category="runtime" name="ExcludeDefaultForZero" value="1"/>
<property category="serverservices" name="single.server.name"
value="Tomcat 4.0"/>
<property category="sys" name="AuthorLabel" value="@author"/>
<property category="sys" name="BackupPath" value="bak"/>
<property category="sys" name="Checkstable" value="1"/>
<property category="sys" name="Company" value=""/>
<property category="sys" name="CompanyLabel" value="Company:"/>
<property category="sys" name="Copyright" value="Copyright (c) 2003"/>
<property category="sys" name="CopyrightLabel" value="Copyright:"/>
<property category="sys" name="DefaultPath" value="src"/>
<property category="sys" name="Description" value=""/>
<property category="sys" name="DescriptionLabel" value="Description:"/>
<property category="sys" name="DocPath" value="doc"/>
<property category="sys" name="ExcludeClassEnabled" value="0"/>
<property category="sys" name="IncludeTestPath" value="1"/>
<property category="sys" name="InstanceVisibility" value="2"/>
<property category="sys" name="JDK" value="java 1.3.1-b24"/>
<property category="sys" name="LastTag" value="0"/>
<property category="sys" name="Libraries" value=""/>
<property category="sys" name="Makestable" value="0"/>
<property category="sys" name="OutPath" value="classes"/>
<property category="sys" name="SourcePath" value="src;test"/>
<property category="sys" name="TestPath" value="test"/>
<property category="sys" name="Title" value=""/>
<property category="sys" name="TitleLabel" value="Title:"/>
<property category="sys" name="Version" value="1.0"/>
<property category="sys" name="VersionLabel" value="@version"/>
<property category="sys" name="WorkingDirectory" value="."/>
<file path="src/untitled1/Untitled1.java"/>
</project>
----------------------------------------------------------------------------
--------------------------------------
-------------------Source
file------------------------------------------------------------------------
------------
package untitled1;
public class Untitled1 extends Exception
{
public Untitled1()
{
}
public static void main(String[] args)
{
Untitled1 untitled11 = new Untitled1();
for(int i=0;i<10;i++)
{
if(true)
{
}
}
}
}
----------------------------------------------------------------------------
--------------------------------------
The 'if' block is wrongly indented. This incorrect formatting happens even
when I am typing the code, or when I select all text and press 'tab'.
Rgds,
Sachin
"John McGrath [TeamB]" < XXXX@XXXXX.COM >wrote in message
Quote
On 9/30/2003 at 4:38:15 AM, Sachin Vaidya wrote:

Some code blocks always give me indentation problems. For example:

It does not cause problems for me, but there are so many variables that
I was guessing at that I am not surprised by that.

The best way to post a problem with formatting is to post a project,
since that will have all of the formatting options in it. Include a
source file that shows the problem, and indicate whether you are using
the "format all" command or selecting some text and formatting that.
Of course, in the latter case you should say which text you have
selected.

--
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
www.JPMcGrath.net/newsgroups/e-mail.html
 

Re:Repost: indentation problem in JBuilder 7

Any ideas, John?
Rgds
Sachin
"Sachin Vaidya" < XXXX@XXXXX.COM >wrote in message
Quote
Hi
I didnt know how to post the project and source files. So pasting the
contents in this mail.
-----------Project

file------------------------------------------------------------------------
----------------
<?xml version="1.0" encoding="UTF-8"?>
<!--JBuilder XML Project-->
<project>
<property category="runtime" name="DefaultConfiguration" value="-1"/>
<property category="runtime" name="ExcludeDefaultForZero" value="1"/>
<property category="serverservices" name="single.server.name"
value="Tomcat 4.0"/>
<property category="sys" name="AuthorLabel" value="@author"/>
<property category="sys" name="BackupPath" value="bak"/>
<property category="sys" name="Checkstable" value="1"/>
<property category="sys" name="Company" value=""/>
<property category="sys" name="CompanyLabel" value="Company:"/>
<property category="sys" name="Copyright" value="Copyright (c) 2003"/>
<property category="sys" name="CopyrightLabel" value="Copyright:"/>
<property category="sys" name="DefaultPath" value="src"/>
<property category="sys" name="Description" value=""/>
<property category="sys" name="DescriptionLabel" value="Description:"/>
<property category="sys" name="DocPath" value="doc"/>
<property category="sys" name="ExcludeClassEnabled" value="0"/>
<property category="sys" name="IncludeTestPath" value="1"/>
<property category="sys" name="InstanceVisibility" value="2"/>
<property category="sys" name="JDK" value="java 1.3.1-b24"/>
<property category="sys" name="LastTag" value="0"/>
<property category="sys" name="Libraries" value=""/>
<property category="sys" name="Makestable" value="0"/>
<property category="sys" name="OutPath" value="classes"/>
<property category="sys" name="SourcePath" value="src;test"/>
<property category="sys" name="TestPath" value="test"/>
<property category="sys" name="Title" value=""/>
<property category="sys" name="TitleLabel" value="Title:"/>
<property category="sys" name="Version" value="1.0"/>
<property category="sys" name="VersionLabel" value="@version"/>
<property category="sys" name="WorkingDirectory" value="."/>
<file path="src/untitled1/Untitled1.java"/>
</project>
--------------------------------------------------------------------------
 

Re:Repost: indentation problem in JBuilder 7

On 10/7/2003 at 12:51:35 AM, Sachin Vaidya wrote:
Quote
I didnt know how to post the project and source files.
Zip up the project using any zip tool - the JAR program will do the
job. Then post the zip to the .attachments newsgroup and post a
message here saying that you have done so.
Quote
The 'if' block is wrongly indented. This incorrect formatting happens
even when I am typing the code, or when I select all text and press
'tab'.
This is what I get when I format that code:
==========================================
package untitled1;
public class Untitled1
extends Exception {
public Untitled1() {
}
public static void main(String[] args) {
Untitled1 untitled11 = new Untitled1();
for (int i = 0; i < 10; i++) {
if (true) {
}
}
}
}
==========================================
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
www.JPMcGrath.net/newsgroups/e-mail.html
 

Re:Repost: indentation problem in JBuilder 7

Thanks John..
The formatting works when the braces are on the same line. so
if(true){
}
works fine. However,
if(true)
{
}
doesnt. Is there any way I can set in JBuilder that the braces shud be on
new line?
Rgds
Sachin
"John McGrath [TeamB]" < XXXX@XXXXX.COM >wrote in message
Quote
On 10/7/2003 at 12:51:35 AM, Sachin Vaidya wrote:

>I didnt know how to post the project and source files.

Zip up the project using any zip tool - the JAR program will do the
job. Then post the zip to the .attachments newsgroup and post a
message here saying that you have done so.

>The 'if' block is wrongly indented. This incorrect formatting happens
>even when I am typing the code, or when I select all text and press
>'tab'.

This is what I get when I format that code:

==========================================
package untitled1;

public class Untitled1
extends Exception {
public Untitled1() {
}

public static void main(String[] args) {
Untitled1 untitled11 = new Untitled1();
for (int i = 0; i < 10; i++) {
if (true) {
}
}
}
}
==========================================

--
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
www.JPMcGrath.net/newsgroups/e-mail.html
 

Re:Repost: indentation problem in JBuilder 7

On 10/9/2003 at 3:18:14 AM, Sachin Vaidya wrote:
Quote
Is there any way I can set in JBuilder that the braces shud be on
new line?
Project Properties | Formatting | Blocks
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
www.JPMcGrath.net/newsgroups/e-mail.html
 

Re:Repost: indentation problem in JBuilder 7

Alas, changing it does not help.. The problem still persists :-(
Please note that the problem is only when the code I posted uses a for loop.
If I change the for loop to while loop, the code indents properly. I have a
feeling that JBuilders fromatting logic does not take care of semicolons
within brackets properly, due to which, in some cases (like mine), it fails.
Rgds
Sachin
"John McGrath [TeamB]" < XXXX@XXXXX.COM >wrote in message
Quote
On 10/9/2003 at 3:18:14 AM, Sachin Vaidya wrote:

>Is there any way I can set in JBuilder that the braces shud be on
>new line?

Project Properties | Formatting | Blocks

--
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
www.JPMcGrath.net/newsgroups/e-mail.html
 

Re:Repost: indentation problem in JBuilder 7

On 10/11/2003 at 5:43:28 AM, Sachin Vaidya wrote:
Quote
>>Is there any way I can set in JBuilder that the braces shud
>>be on new line?
>Project Properties | Formatting | Blocks
Alas, changing it does not help..
Can you give me an example where it does not put the brace on a new
line?
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
www.JPMcGrath.net/newsgroups/e-mail.html
 

Re:Repost: indentation problem in JBuilder 7

The problem is with the code I write myself. Anywhere in my code where I
have an 'if' block immidiately following a 'for' statement, the indentation
goes for a toss.. I will again give the same example..
for(int i=0;i<3;i++)
{
if(true)
{
}
}
In this case, if the "generate closing brace" is set, then on pressing
'enter' after the opening brace of 'if' block, the closing brace of 'if'
statement gets created automatically on the next line, but with wrong
indentation. The closing brace gets aligned with the 'for' closing brace,
which is incorrect.
Does that answer your question John, or do you want some other info?
Rgds
Sachin
"John McGrath [TeamB]" < XXXX@XXXXX.COM >wrote in message
Quote
On 10/11/2003 at 5:43:28 AM, Sachin Vaidya wrote:

>>>Is there any way I can set in JBuilder that the braces shud
>>>be on new line?

>>Project Properties | Formatting | Blocks

>Alas, changing it does not help..

Can you give me an example where it does not put the brace on a new
line?

--
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
www.JPMcGrath.net/newsgroups/e-mail.html
 

Re:Repost: indentation problem in JBuilder 7

I have a similar problem in JBuilder 9 in some files. I think the
problem is with mixed line-ends and line-ends preservation mode. After I
switched to use Unix line-ends in JBuilder the problem when away.
- Alexey.
Sachin Vaidya wrote:
Quote
>I have JBuilder SE 7.0.155.0
>Some code blocks always give me indentation problems. For example:
>for(int i=0;i<10;i++)
>{
>if(true)
>{
>
>}
>}
>The closing brace of the 'if' block always has incorrect indentation. What
>might be wrong?
>Rgds
>Sachin



 

Re:Repost: indentation problem in JBuilder 7

On 10/13/2003 at 4:25:23 AM, Sachin Vaidya wrote:
Quote
The problem is with the code I write myself.
I still cannot reproduce this.
Are you saying that it does not indent properly as you type the code?
If that is the case, then a good way to describe this problem would be
to post a project containing a source file that has most of the code
needed to reproduce the problem. Then tell us where to place the
cursor and which keys to press in order to reproduce the problem.
I have doubts about the project file that you did post. It does not
specify a value for the "blockIndent" property, which would mean that
it would have the default value of 2. Yet the examples you have posted
all show a block indent of 4.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
www.JPMcGrath.net/newsgroups/e-mail.html
 

Re:Repost: indentation problem in JBuilder 7

It does not indent properly if I type the code, paste the code, anything.
Whenever I have a for loop followed immidiately by an if block, the
indentation is wrong.
Okay do exactly this... take the code sample (the for loop with 'if' block
in it) and paste it in your code anywhere. Make sure that the braces are on
the next line as the example I have given shows. Take your cursor to the for
statement. Press tab. Then take your cursor to the next line (opening brace
of the for statement) and press tab. Move the cursor down an press a tab on
the 'if' statement. Now take your cursor to the line after the 'if'
statement. This line will contain the opening brace '{'. Press tab. So far
all the lines will get correctly indented.
Now move your cursor to the next line with closing brace '}' of 'if'. This
brace does not align with the opening brace of 'if' block. Instead it aligns
with the opening brace of 'for' block.
Posting the contents of project again:
<?xml version="1.0" encoding="UTF-8"?>
<!--JBuilder XML Project-->
<project>
<property category="runtime" name="DefaultConfiguration" value="-1"/>
<property category="runtime" name="ExcludeDefaultForZero" value="1"/>
<property category="serverservices" name="single.server.name"
value="Tomcat 4.0"/>
<property category="sys" name="AuthorLabel" value="@author"/>
<property category="sys" name="BackupPath" value="bak"/>
<property category="sys" name="Checkstable" value="1"/>
<property category="sys" name="Company" value=""/>
<property category="sys" name="CompanyLabel" value="Company:"/>
<property category="sys" name="Copyright" value="Copyright (c) 2003"/>
<property category="sys" name="CopyrightLabel" value="Copyright:"/>
<property category="sys" name="DefaultPath" value="src"/>
<property category="sys" name="Description" value=""/>
<property category="sys" name="DescriptionLabel" value="Description:"/>
<property category="sys" name="DocPath" value="doc"/>
<property category="sys" name="ExcludeClassEnabled" value="0"/>
<property category="sys" name="IncludeTestPath" value="1"/>
<property category="sys" name="InstanceVisibility" value="2"/>
<property category="sys" name="JDK" value="java 1.3.1-b24"/>
<property category="sys" name="LastTag" value="0"/>
<property category="sys" name="Libraries" value=""/>
<property category="sys" name="Makestable" value="0"/>
<property category="sys" name="OutPath" value="classes"/>
<property category="sys" name="SourcePath" value="src;test"/>
<property category="sys" name="TestPath" value="test"/>
<property category="sys" name="Title" value=""/>
<property category="sys" name="TitleLabel" value="Title:"/>
<property category="sys" name="Version" value="1.0"/>
<property category="sys" name="VersionLabel" value="@version"/>
<property category="sys" name="WorkingDirectory" value="."/>
<file path="src/untitled1/Untitled1.java"/>
</project>
Regards
Sachin
"John McGrath [TeamB]" < XXXX@XXXXX.COM >wrote in message
Quote
On 10/13/2003 at 4:25:23 AM, Sachin Vaidya wrote:

>The problem is with the code I write myself.

I still cannot reproduce this.

Are you saying that it does not indent properly as you type the code?
If that is the case, then a good way to describe this problem would be
to post a project containing a source file that has most of the code
needed to reproduce the problem. Then tell us where to place the
cursor and which keys to press in order to reproduce the problem.

I have doubts about the project file that you did post. It does not
specify a value for the "blockIndent" property, which would mean that
it would have the default value of 2. Yet the examples you have posted
all show a block indent of 4.

--
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
www.JPMcGrath.net/newsgroups/e-mail.html
 

Re:Repost: indentation problem in JBuilder 7

Quote
After I switched to use Unix line-ends in
JBuilder the problem when away.
Thanks Alexey. However I didnt get what exactly I should do to fix the
problem. Could you please let me know in details?
Rgds
Sachin
"Alexey N. Solofnenko" < XXXX@XXXXX.COM >wrote in message
Quote
I have a similar problem in JBuilder 9 in some files. I think the
problem is with mixed line-ends and line-ends preservation mode. After I
switched to use Unix line-ends in JBuilder the problem when away.

- Alexey.

Sachin Vaidya wrote:
>>I have JBuilder SE 7.0.155.0
>>Some code blocks always give me indentation problems. For example:
>>for(int i=0;i<10;i++)
>>{
>>if(true)
>>{
>>
>>}
>>}
>>The closing brace of the 'if' block always has incorrect indentation.
What
>>might be wrong?
>>Rgds
>>Sachin
>
>
>