Add method to interface?

Is there an add method to interface / abstract class refactoring which will add the method to all the derived classes?

Nick

7 comments

Nick Pratt wrote:

Is there an add method to interface / abstract class refactoring which will add the method to all the derived classes?

Nick

And what bodies those methods should have? Please use method hierarchy
instead. Ctrl+I (implement method) works there.

--
Maxim Shafirov
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

You could press Alt-Enter on the interface' method in question.

Tom

0

The same as other IDEA defaults:

null for an object, 0 for int/long.

If I have a hierarchy it would be nice to be able to go to the interface class, "add new interface method / abstract method" and then have the new method body in my 10 derrived classes all created for me.

Otherwise, its 10 clicks on each file, ctrl-I, select.

Apart from repeating the same operation 10 times being a pain, try it with the lovely lost focus bugs that IDEA still has, even in 4.5.2.

0

Hi,

You can generate such stub method code with StructuralReplace

Nick Pratt wrote:

The same as other IDEA defaults:

null for an object, 0 for int/long.

If I have a hierarchy it would be nice to be able to go to the interface class, "add new interface method / abstract method" and then have the new method body in my 10 derrived classes all created for me.

Otherwise, its 10 clicks on each file, ctrl-I, select.

Apart from repeating the same operation 10 times being a pain, try it with the lovely lost focus bugs that IDEA still has, even in 4.5.2.



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

0

How do I do that?

Best regards,

Eugene Belyaev

Hi,

You can generate such stub method code with StructuralReplace

Nick Pratt wrote:

>> The same as other IDEA defaults:
>>
>> null for an object, 0 for int/long.
>>
>> If I have a hierarchy it would be nice to be able to go to the
>> interface class, "add new interface method / abstract method" and
>> then have the new method body in my 10 derrived classes all created
>> for me.
>>
>> Otherwise, its 10 clicks on each file, ctrl-I, select.
>>
>> Apart from repeating the same operation 10 times being a pain, try it
>> with the lovely lost focus bugs that IDEA still has, even in 4.5.2.
>>

0

Hi,

Find all derived classes like:

class $myclass$ implements Interface {
$myclasscontext$
}

myclasscontext occurence count 0..10000

Replace them with

class $myclass$ implements Interface {
$myclasscontext$

public Object mynewmethod() {
return null;
}
}


Eugene Belyaev wrote:

How do I do that?

Best regards,

Eugene Belyaev

>>Hi,
>>
>>You can generate such stub method code with StructuralReplace
>>
>>Nick Pratt wrote:
>>
>>
>>>The same as other IDEA defaults:
>>>
>>>null for an object, 0 for int/long.
>>>
>>>If I have a hierarchy it would be nice to be able to go to the
>>>interface class, "add new interface method / abstract method" and
>>>then have the new method body in my 10 derrived classes all created
>>>for me.
>>>
>>>Otherwise, its 10 clicks on each file, ctrl-I, select.
>>>
>>>Apart from repeating the same operation 10 times being a pain, try it
>>>with the lovely lost focus bugs that IDEA still has, even in 4.5.2.
>>>




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

0

I would like this as well, and entered a request for this feature some time ago:
http://www.intellij.net/tracker/idea/viewSCR?publicId=23103

0

Please sign in to leave a comment.