IDEA-25753 Surround With try-catch etc. - doesn't indent comment correctly

1. Java 'surround with' processing is corrected for the first comment statement;
2. Corresponding tests are added;
3. Green cody policy is applied;
This commit is contained in:
Denis Zhdanov
2011-05-03 17:23:14 +04:00
parent fec8b2b9a2
commit 06b56cf449
33 changed files with 436 additions and 15 deletions
@@ -0,0 +1,6 @@
class Test {
void foo() {
<selection>// This is comment"
int i = 1;</selection>
}
}
@@ -0,0 +1,9 @@
class Test {
void foo() {
{
// This is comment"
int i = 1;
}<caret>
}
}
@@ -0,0 +1,6 @@
class Test {
void foo() {
<selection>// This is comment"
int i = 1;</selection>
}
}
@@ -0,0 +1,8 @@
class Test {
void foo() {
do {
// This is comment"
int i = 1;
} while (<caret><selection>true</selection>);
}
}
@@ -0,0 +1,6 @@
class Test {
void foo() {
<selection>// This is comment"
int i = 1;</selection>
}
}
@@ -0,0 +1,8 @@
class Test {
void foo() {
for (<caret>) {
// This is comment"
int i = 1;
}
}
}
@@ -0,0 +1,6 @@
class Test {
void foo() {
<selection>// This is comment"
int i = 1;</selection>
}
}
@@ -0,0 +1,9 @@
class Test {
void foo() {
if (<caret>) {
// This is comment"
int i = 1;
} else {
}
}
}
@@ -0,0 +1,6 @@
class Test {
void foo() {
<selection>// This is comment"
int i = 1;</selection>
}
}
@@ -0,0 +1,8 @@
class Test {
void foo() {
if (<caret>) {
// This is comment"
int i = 1;
}
}
}
@@ -0,0 +1,6 @@
class Test {
void foo() {
<selection>// This is comment"
int i = 1;</selection>
}
}
@@ -0,0 +1,10 @@
class Test {
void foo() {
Runnable <caret><selection>runnable</selection> = new Runnable() {
public void run() {
// This is comment"
int i = 1;
}
};
}
}
@@ -0,0 +1,6 @@
class Test {
void foo() {
<selection>// This is comment"
int i = 1;</selection>
}
}
@@ -0,0 +1,8 @@
class Test {
void foo() {
synchronized (<caret>) {
// This is comment"
int i = 1;
}
}
}
@@ -0,0 +1,6 @@
class Test {
void foo() {
<selection>// This is comment"
int i = 1;</selection>
}
}
@@ -0,0 +1,11 @@
class Test {
void foo() {
try {
// This is comment"
int i = 1;
} catch (Exception e) {
<caret><selection>e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.</selection>
} finally {
}
}
}
@@ -0,0 +1,6 @@
class Test {
void foo() {
<selection>// This is comment"
int i = 1;</selection>
}
}
@@ -0,0 +1,10 @@
class Test {
void foo() {
try {
// This is comment"
int i = 1;
} catch (Exception e) {
<caret><selection>e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.</selection>
}
}
}
@@ -0,0 +1,6 @@
class Test {
void foo() {
<selection>// This is comment"
int i = 1;</selection>
}
}
@@ -0,0 +1,9 @@
class Test {
void foo() {
try {
// This is comment"
int i = 1;
} finally {<caret>
}
}
}
@@ -0,0 +1,6 @@
class Test {
void foo() {
<selection>// This is comment"
int i = 1;</selection>
}
}
@@ -0,0 +1,8 @@
class Test {
void foo() {
while (<caret><selection>true</selection>) {
// This is comment"
int i = 1;
}
}
}