Hint: Implement all abstract methods

Posted by Radek Matous on Jan 12 2009, 02:13:32 PM CET

Today I would like to introduce new hint that was implemented already a few weeks ago but probably hardly anyone knows about it. This hint can be useful in case when you need to implement abstract methods in a class that extends another class.
As long as you have not implemented all methods, a light bulb will appear next to the class  declaration.Clicking the light bulb displays a hint how to fix the class. In our example  the hint would suggest to "Implement all abstract methods."  


If you click it, or press Alt-Return then skeletons of all necessary abstract methods will be generated for you.


Category: Features | Permalink | Comments [15]

Trackback URL: http://blogs.sun.com/netbeansphp/entry/hint_implement_all_abstract_methods
Comments:

Great feature. It would be very handy. However, it should be enhanced. I think that it will be nice if Netbeans has a symbol or indicator to give a clue if a given method is inherited from abstract one (or an interface method) or not (Just like @override in Java but PHP does not support it)

Thanks

Posted by pcdinh on January 12, 2009 at 06:48 PM CET #

Thanks for feedback. Definitely, to annotate inherited methods similar like in java as you mentioned is one of the features on our list

Posted by radek on January 12, 2009 at 06:57 PM CET #

Hi, Radek. Nice! One picky note: shouldn't it be "Implement all abstract methods", not "Implements all abstract methods" - e.g. "Implement" not "Implements"?

Posted by David Van Couvering on January 13, 2009 at 12:19 AM CET #

The more eyes we have, the more bugs we see :)

You are right David, I've noticed it also just when I first looked at this published blog entry, will be fixed, thanks

Posted by radek on January 13, 2009 at 09:14 AM CET #

Tested. No bugs found.
Note: order of generated functions seems to be random. Maybe some definite order should be used.

Posted by Mikhail Matveev on January 13, 2009 at 08:09 PM CET #

Hi, nice feature. I noticed few days ago, but it is stil not working propely.

interface Test {
public function Pokus($var = TRUE);
}

Result:
public function Pokus($var)
{
}

Expected:
public function Pokus($var = TRUE)
{
}

Fatal error: Declaration of Moje::Pokus() must be compatible with that of Test::Pokus()

Posted by Michal Kocian on January 14, 2009 at 12:25 AM CET #

thanks, I reported it: http://www.netbeans.org/issues/show_bug.cgi?id=156749

Posted by radek on January 14, 2009 at 11:35 AM CET #

The IDE is great, but I'm having problems using the PHP features don't know why. I've just fresh installed a full version of the 6.5 IDE including php support. But I just cannot see any of those features. I just tried creating a file with 2 classes like the one on the post for testing purposes, to see this hint, but it won't show. Also I can't use any refactor menu item on PHP and a friend of mine has a feature called Generate Getter/Setter in his portuguese brazilian version of the IDE, under the Source/InsertCode menu, but for me it do not show. I've also started a new topic in the forums with a screenshot. I anyone could help me on this I'd really appreciate. Thanks and congratulations for the IDE.

http://forums.netbeans.org/topic8665.html

Posted by Juliano Polito on February 14, 2009 at 02:38 PM CET #

Hi Juliano,

Hint: Implement all abstract methods and other features were added after 6.5 and thus you cannot find them in 6.5 release. You can find them in 6.7 builds (either development builds or milestone builds). Download links:
http://bits.netbeans.org/netbeans/6.7/m2/
http://bits.netbeans.org/download/trunk/nightly/latest/

Posted by radek on March 09, 2009 at 08:11 PM CET #

I can only force the IDE to implement abstract methods if the abstract class or interface is declared in the same file as the inheriting/implementing class. If the declaration is in other file, the lightbulb does not appear, although the IDE recognizes the abstract class/interface

NetBeans IDE 6.7 Beta (Build 200904242137)

Posted by Wojtek on June 20, 2009 at 01:45 PM CEST #

UPDATE: with RC3 the above does not apply to abstract classes. It however still does not work with interfaces.

BR

Posted by Wojtek on June 21, 2009 at 12:04 PM CEST #

All the above method is very workable and useful.

Posted by Fosia on August 13, 2009 at 02:27 PM CEST #

Thank you by admin

Posted by mirc on August 23, 2009 at 04:29 AM CEST #

It was a very nice idea! Just wanna say thank you for the information you have shared. Just continue writing this kind of post. I will be your loyal reader. Thanks again.

Posted by links of london on October 30, 2009 at 03:10 AM CET #

All the above method is very workable and useful.

Posted by Funs blog on November 14, 2009 at 06:50 AM CET #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed