Bug 54532 - unable to format java code snippet
Summary: unable to format java code snippet
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-11 15:56 EST by Kit Lo CLA
Modified: 2006-11-16 11:27 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 Kit Lo CLA 2004-03-11 15:56:47 EST
Using integration build eclipse-SDK-I20040310-win32, I was not able to format a 
java file with just one java function in it. I was able to do that in Eclipse 
2.1.3.

I noticed that this integration build is using the new 
MultiPassContentFormatter. So, is it just a bug, or the function has been 
removed?
Comment 1 Martin Aeschlimann CLA 2004-03-15 05:57:21 EST
The new code formatter requires a syntactically correct Java program. So if you
file just contained a method declaration but was not inside a type, then this
doesn't work anymore.

Note that programatically you can still format just a method, but you now always
have to give this context information to the formatter.

Please reopen if I misunderstood your request.
Comment 2 Kit Lo CLA 2004-03-22 11:26:20 EST
This sounds like a step backwards. I used the Java formatter to format the JSP 
Java partitions in a JSP file. That worked in Eclipse 2.1.3, but won't work in 
3.0.

If you were talking about using the "format(int kind, String source, int 
offset, int length, int indentationLevel, String lineSeparator)" API to format 
a method (by specifying the "kind" of the code snippet to format), that may 
not work for us because all we know is the JSP Java contains some Java 
snippets.

Any suggestions?
Comment 3 Kit Lo CLA 2004-03-22 11:50:20 EST
p.s. The Java statement in a JSP Java partition may not be complete. We may 
have half of a "if" statement (like "if (condition) {") in one partition, and 
another half (like "statement;}") in another partition.
Comment 4 Dirk Baeumer CLA 2004-03-23 10:02:46 EST
Moving to JDT/Core. 
Comment 5 Olivier Thomann CLA 2004-04-16 14:28:39 EDT
There is no plan to provide support for formatting incomplete piece of code.
Close as WONTFIX
Comment 6 Kit Lo CLA 2006-11-16 11:27:20 EST
closing resolved bug