Bug 5702 - "Keep else if on the same line" appears to do the reverse
Summary: "Keep else if on the same line" appears to do the reverse
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Martin Aeschlimann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-11-09 05:29 EST by Jon Skeet CLA
Modified: 2001-11-20 09:04 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Skeet CLA 2001-11-09 05:29:59 EST
In the "new lines" settings, I have:

Insert new line before opening brace
Insert new line in control statement
Insert a new line inside an empty block

That formats the sample code as:

{

	if (size < currentSize)
	{
		try
		{
			size = inStream.available();
		}
		catch (IOException e)
		{
		}
	}
	else if (size == currentSize)
	{
		++size;
	}
	else
	{
		--size;
	}

}

Note that "else if" is on the same line. If I tick "Keep else if on the same 
line", I get:

{

	if (size < currentSize)
	{
		try
		{
			size = inStream.available();
		}
		catch (IOException e)
		{
		}
	}
	else
		if (size == currentSize)
		{
			++size;
		}
		else
		{
			--size;
		}

}

Note that now the "else if" is split - ie not on the same line.

Jon
Comment 1 Erich Gamma CLA 2001-11-12 09:03:37 EST
is the UI presenting this option properly?
Comment 2 Jon Skeet CLA 2001-11-12 09:32:42 EST
Could you clarify exactly what you mean?

If you're asking whether the code formatter in the editor itself exhibits the 
same, behaviour, the answer is yes: with the option to keep the else-if on the 
same line ticked, the "if" appears on the next line.
Comment 3 Martin Aeschlimann CLA 2001-11-20 09:04:30 EST
Label has been changed (-> Insert new line between 'else if')

>111106