'create groovy method from usage' position caret at the beginning of selection

This commit is contained in:
Maxim.Medvedev
2012-05-16 10:45:35 +04:00
parent a6b7faa32e
commit e5b412d4c3
18 changed files with 306 additions and 18 deletions
@@ -1,7 +1,23 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Add Method Body" "true"
class a {
void f() {
<selection>//To change body of created methods use File | Settings | File Templates.</selection><caret>
<caret><selection>//To change body of created methods use File | Settings | File Templates.</selection>
}
}
@@ -1,7 +1,23 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Add Method Body" "true"
class a {
String f() {
<selection>return null; //To change body of created methods use File | Settings | File Templates.</selection><caret>
<caret><selection>return null; //To change body of created methods use File | Settings | File Templates.</selection>
}
}
@@ -1,7 +1,23 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Add Method Body" "true"
class a {
a() {
<selection>//To change body of created methods use File | Settings | File Templates.</selection><caret>
<caret><selection>//To change body of created methods use File | Settings | File Templates.</selection>
}
}
@@ -1,7 +1,23 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Add Method Body" "true"
class a {
String f() {
<selection>return null; //To change body of created methods use File | Settings | File Templates.</selection><caret>
<caret><selection>return null; //To change body of created methods use File | Settings | File Templates.</selection>
}
}
@@ -1,3 +1,19 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Create Constructor" "true"
class Test {
@@ -7,7 +23,7 @@ class Test {
class Inner {
public Inner(String a) {
<selection>//To change body of created methods use File | Settings | File Templates.</selection><caret>
<caret><selection>//To change body of created methods use File | Settings | File Templates.</selection>
}
}
}
@@ -1,3 +1,19 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Create Method 'test'" "true"
public class Test {
public Test() {
@@ -5,6 +21,6 @@ public class Test {
}
private void test() {
<selection>//To change body of created methods use File | Settings | File Templates.<caret></selection>
<caret><selection>//To change body of created methods use File | Settings | File Templates.</selection>
}
}
@@ -1,3 +1,19 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Create Method 'test'" "true"
public class Test {
public Test() {
@@ -5,6 +21,6 @@ public class Test {
}
private void test() {
<selection>//To change body of created methods use File | Settings | File Templates.<caret></selection>
<caret><selection>//To change body of created methods use File | Settings | File Templates.</selection>
}
}
@@ -1,3 +1,19 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Create Method 'test'" "true"
public class Test {
public Test() {
@@ -5,6 +21,6 @@ public class Test {
}
private void test() {
<selection>//To change body of created methods use File | Settings | File Templates.<caret></selection>
<caret><selection>//To change body of created methods use File | Settings | File Templates.</selection>
}
}
@@ -1,3 +1,19 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Create Method 'test'" "true"
public class Test {
static void test(int i) {}
@@ -6,6 +22,6 @@ public class Test {
}
private void test() {
<selection>//To change body of created methods use File | Settings | File Templates.<caret></selection>
<caret><selection>//To change body of created methods use File | Settings | File Templates.</selection>
}
}
@@ -1,3 +1,19 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Create Method 'bar'" "true"
public class Test {
<T extends String> void foo (T t1, T t2) {
@@ -5,6 +21,6 @@ public class Test {
}
private <T extends String> void bar(T t1, T t2) {
<selection>//To change body of created methods use File | Settings | File Templates.<caret></selection>
<caret><selection>//To change body of created methods use File | Settings | File Templates.</selection>
}
}
@@ -1,3 +1,19 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Create Method 'test'" "true"
public class Test {
public Test() {
@@ -5,6 +21,6 @@ public class Test {
}
private boolean test() {
<selection>return false; //To change body of created methods use File | Settings | File Templates.<caret></selection>
<caret><selection>return false; //To change body of created methods use File | Settings | File Templates.</selection>
}
}
@@ -1,3 +1,19 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Create Method 'bar'" "true"
class A {
public void foo() {
@@ -6,6 +22,6 @@ class A {
}
private String bar() {
<selection>return null; //To change body of created methods use File | Settings | File Templates.<caret></selection>
<caret><selection>return null; //To change body of created methods use File | Settings | File Templates.</selection>
}
}
@@ -1,3 +1,19 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Create Method 'someMethod'" "true"
public class Test {
@@ -8,7 +24,7 @@ public class Test {
}
private boolean someMethod(Object o) {
<selection>return false; //To change body of created methods use File | Settings | File Templates.<caret></selection>
<caret><selection>return false; //To change body of created methods use File | Settings | File Templates.</selection>
}
};
}
@@ -1,3 +1,19 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Create Method 'f'" "true"
class A {
{
@@ -10,6 +26,6 @@ class A {
}
class B {
public static void f(Runnable runnable) {
<selection>//To change body of created methods use File | Settings | File Templates.<caret></selection>
<caret><selection>//To change body of created methods use File | Settings | File Templates.</selection>
}
}
@@ -1,3 +1,19 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Create Method 'f'" "true"
public class A {
public A() {
@@ -5,7 +21,7 @@ public class A {
}
private static int f() {
<selection>return 0; //To change body of created methods use File | Settings | File Templates.<caret></selection>
<caret><selection>return 0; //To change body of created methods use File | Settings | File Templates.</selection>
}
public A(int i) {
@@ -1,7 +1,23 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Create Method 'get'" "true"
class Generic<T> {
public T get() {
<selection>return null; //To change body of created methods use File | Settings | File Templates.<caret></selection>
<caret><selection>return null; //To change body of created methods use File | Settings | File Templates.</selection>
}
}
@@ -1,10 +1,26 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Create Method 'foo'" "true"
interface Int<T> {
}
class A1<T> implements Int<T> {
public void foo(Int<T> c) {
<selection>//To change body of created methods use File | Settings | File Templates.</selection><caret>
<caret><selection>//To change body of created methods use File | Settings | File Templates.</selection>
}
}
@@ -1,3 +1,19 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Create Method 'foo'" "true"
interface Comparable<T> {
}
@@ -8,7 +24,7 @@ class R implements Comparable<R> {
class A1<T> {
public T foo() {
<selection>return null; //To change body of created methods use File | Settings | File Templates.<caret></selection>
<caret><selection>return null; //To change body of created methods use File | Settings | File Templates.</selection>
}
}