Structural Replace doesn't work as excpected

I guess there something I don't understand in Structural Replace because I just can't get it to work correctly. For example if I wanted to add something to the beginning of the class, I might do something like this:

Search:
class $Class$ {
$Contents$

Replace:
class $Class$ {
String theString = "MyString";
$Contents$

If I have a class like this:

public class MyClass extends ParentClass {
}

I would want the result to be:
public class MyClass extends ParentClass {
String theString = "MyString";
}

Unfortunately all the modifiers and extends / implements information is lost and the result is:
class MyClass {
String theString = "MyString";
}

Is there a way to make this kind of replacement to work?

2 comments
Comment actions Permalink

Hi,

The problem (will be fixed in next update release) goes from short
patterns, you can specify access modifiers/extends/implements in
patterns as a workaround.

Markus Halttunen wrote:

I guess there something I don't understand in Structural Replace because I just can't get it to work correctly. For example if I wanted to add something to the beginning of the class, I might do something like this:

Search:
class $Class$ {
$Contents$

Replace:
class $Class$ {
String theString = "MyString";
$Contents$

If I have a class like this:

public class MyClass extends ParentClass {
}

I would want the result to be:
public class MyClass extends ParentClass {
String theString = "MyString";
}

Unfortunately all the modifiers and extends / implements information is lost and the result is:
class MyClass {
String theString = "MyString";
}

Is there a way to make this kind of replacement to work?



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink



On 8/4/04 7:58 AM, in article ceqj1o$khc$1@is.intellij.net, "Maxim
Mossienko" <Maxim.Mossienko@jetbrains.com> wrote:

Hi,

The problem (will be fixed in next update release)


Any slated time for that? At least as an EAP.

R

0

Please sign in to leave a comment.