Link Here
|
14 |
import org.eclipse.core.runtime.Path; |
14 |
import org.eclipse.core.runtime.Path; |
15 |
import org.eclipse.jdt.core.JavaModelException; |
15 |
import org.eclipse.jdt.core.JavaModelException; |
16 |
import org.eclipse.jdt.core.formatter.CodeFormatter; |
16 |
import org.eclipse.jdt.core.formatter.CodeFormatter; |
|
|
17 |
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; |
17 |
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; |
18 |
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; |
18 |
import org.eclipse.jdt.internal.formatter.DefaultCodeFormatterOptions; |
19 |
import org.eclipse.jdt.internal.formatter.DefaultCodeFormatterOptions; |
19 |
|
20 |
|
Link Here
|
6239 |
"}\n"); |
6240 |
"}\n"); |
6240 |
} |
6241 |
} |
6241 |
|
6242 |
|
|
|
6243 |
/** |
6244 |
* @bug 305281: [formatter] Turning off formatting changes comment's formatting |
6245 |
* @test Verify that turning off formatting in a javadoc does not screw up its indentation |
6246 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=305281" |
6247 |
*/ |
6248 |
public void testBug305281() { |
6249 |
this.formatterPrefs = null; |
6250 |
this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_DISABLING_TAG, "format: OFF"); |
6251 |
this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_ENABLING_TAG, "format: ON"); |
6252 |
String source = |
6253 |
"public class test {\n" + |
6254 |
"\n" + |
6255 |
" /**\n" + |
6256 |
" * @param args\n" + |
6257 |
" * format: OFF\n" + |
6258 |
" */\n" + |
6259 |
" public static void main(String[] args) {\n" + |
6260 |
" do {\n" + |
6261 |
" } while (false);\n" + |
6262 |
" for (;;) {\n" + |
6263 |
" }\n" + |
6264 |
" // format: ON\n" + |
6265 |
" }\n" + |
6266 |
"}\n"; |
6267 |
formatSource(source, |
6268 |
"public class test {\n" + |
6269 |
"\n" + |
6270 |
" /**\n" + |
6271 |
" * @param args\n" + |
6272 |
" * format: OFF\n" + |
6273 |
" */\n" + |
6274 |
" public static void main(String[] args) {\n" + |
6275 |
" do {\n" + |
6276 |
" } while (false);\n" + |
6277 |
" for (;;) {\n" + |
6278 |
" }\n" + |
6279 |
" // format: ON\n" + |
6280 |
" }\n" + |
6281 |
"}\n"); |
6282 |
} |
6283 |
|
6242 |
} |
6284 |
} |