Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Add method to interface?
Add method to interface? [message #199393] Thu, 24 March 2005 11:16 Go to next message
Eclipse UserFriend
Hi.
I was wondering if there's any magic way to add a method from a class to
it's interface through a context menu or something?

Basically, let's say I have:

public Class MyClass implements MyInterface { ... }

public Interface MyInterface {
public void doSomething();
}

then I go into MyClass and type:

public void doSomethingElse { ... }

I would like to be able to right click on the new method in MyClass and
have an option to add the method signature to MyInterface.

Is there any way to do this?
Guess I'm just lazy and don't want to type. :)

Thanks!

- Jonathan
Re: Add method to interface? [message #199490 is a reply to message #199393] Fri, 25 March 2005 09:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse.rizzoweb.com

Jonathan wrote:
> Hi.
> I was wondering if there's any magic way to add a method from a class to
> it's interface through a context menu or something?

I would have sworn it was possible through the Refactoring menu, but
apparently it is not (at least not in 3.0.x - I don't know about 3.1).
The closest thing is you can select a class and choose Refactor >
Extract Interface... to create a new interface from a class' methods.
But that does not carry over for existing interfaces.

Please search Bugzilla for an enhancement request and, if not found,
enter one.

Eric
Re: Add method to interface? [message #199671 is a reply to message #199490] Tue, 29 March 2005 09:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nospam.nospam.org

Eric Rizzo wrote:
> Jonathan wrote:
>
>> Hi.
>> I was wondering if there's any magic way to add a method from a class
>> to it's interface through a context menu or something?
>
>
> I would have sworn it was possible through the Refactoring menu, but
> apparently it is not (at least not in 3.0.x - I don't know about 3.1).
> The closest thing is you can select a class and choose Refactor >
> Extract Interface... to create a new interface from a class' methods.
> But that does not carry over for existing interfaces.
>
> Please search Bugzilla for an enhancement request and, if not found,
> enter one.
>
> Eric

You can hit Ctrl-1 at the method and it usually offers "extract to
interface".

r.
Re: Add method to interface? [message #199685 is a reply to message #199671] Tue, 29 March 2005 10:07 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse.rizzoweb.com

Richard Nemec wrote:
> Eric Rizzo wrote:
>
>> Jonathan wrote:
>>
>>> Hi.
>>> I was wondering if there's any magic way to add a method from a class
>>> to it's interface through a context menu or something?
>
> You can hit Ctrl-1 at the method and it usually offers "extract to
> interface".

So it does - nice.
I still think this should be a Refactoring instead of a Quick Fix thing.
So I entered a request:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=89352

Eric
Previous Topic:Importance of JavaEditorTextHovers
Next Topic:Automating JUnit Plugin Test, returns java result 13
Goto Forum:
  


Current Time: Mon Jun 09 06:34:08 EDT 2025

Powered by FUDForum. Page generated in 0.04884 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top