Any netbeans features that will make my day?

Viewed 8670

I've recently gotten quite fond of netbeans for my php work because of the XDebug integration. It has made me all but forget about textmate (which imho still beats netbeans for the little things)

What do you think is the one awesome netbeans feature I should know about, and more importantly why and how do I use it?

I'm asking this to optimize my skills in the use of the IDE and based on the idea that what works well for others might just work for me (and hopefully others).

21 Answers

I find the single most useful feature in Netbeans for PHP work is that it understands PHPDoc (in the same way that it understands Javadoc), and uses it for type hinting.

Type /** before a function definition, hit return and it'll create a PHPDoc template.

/**                              <-- I typed this one line
 * @param <type> $otherObj       <-- Netbeans added these 3 lines
 * @return <type>                <--
 */                              <--
public function exampleFunction($otherObj)
{
    $myObj = new MyClass($otherObj);
    return $myObj;
}

Replace the <type> placemarkers with the appropriate types:

/**      
 * @param OtherClass $otherObj
 * @return MyClass
 */
public function exampleFunction($otherObj)
{
    $myObj = new MyClass($otherObj);
    return $myObj;
}

And voila, you'll get type completion (and pop-up documentation) with Ctrl-space.

if ($x instanceof SomeClass) {
  $x->.... // now it has code completion with SomeClass' methods.
}

I would add Tasks integration. Don't have time to finalize something? Add a simple task which NetBeans will track for you. You can customize what gets tracked in Tasks in Options -> Miscellaneous -> Tasks, but I found the format below to be most useful, as it aligns well with PHPDoc comments (see therefromhere's comment):

/**
 * @todo Create public setters and __toString() for this class.
 */

Ctrl + Space is my favorite and most used feature when programming in java, I think it is enabled for PHP as well. But if you like net beans you most likely know about it already, if not try it out discover what it does.

Also navigating to the relevant source code by Ctrl + Clicking on anything from variables, to method calls, to class references is a nice feature.

Additionally, the popup menus that are displayed when right clicking in source code contain many useful tools for everything from refactoring to code generation.

This is going to sound ridiculously trivial, but one thing I do in Netbeans is code formatting. Its code formatting (source->format) rocks.

Its SVN integration is great too, but that's already been said.

The ability to create quick on the fly macros.

For example , here is one that will put a semi-colon at the end of the current line and places your cursor back where it was before the macro started.

";" delete-previous caret-end-line ";" jump-list-last-edit jump-list-last-edit (I know this is present in other language implementations by default. But it does not work by default in PHP Netbeans.)

As someone who tends to stick with IDE for a long time, I love being able to customize little things to make me more efficient.

If you consider Netbeans 6.7 it has a sync feature a bit like Dreamweaver

In the way that you can add a custom ftp, import it to the project and when you save the files locally they are also uploaded to the server so you have a semi backup system in place.

(trust me it's better than working directly onto a ftp tree and realizing that the transfer failed somehow between the current tmp file and the server file and you lost your work because you closed the file window :) )

maybe the search box, to find anything in the source code`?

Some features definitely worth looking out for, including the ones mentioned above:

  1. Version control Integration, including Local History
  2. IDE wide search box
  3. Integration with Tomcat/Apache, GlassFish can be helpful when you are looking to work with PHP and other server side technologies, like JSP
  4. Very good integration with MySQL- essential to wAMP/LAMP development

TextMate is a great slick little editor I use all the time on my Mac, but not an IDE. I haven't enjoyed Netbeans on Mac very much being so non-native, but on Windows or Linux I prefer it over Eclipse.

  • The Swing GUI designer with Java has been huge in getting projects done rapidly.
  • Other people have said it, but integrated Subversion is awesome. If I've been working with a project from the terminal in Linux it figures out I've got SVN checked out on that directory and handles it fine.
  • I love the code formatting (right click in the editor), especially when team members write poorly spaced/indented code with nano, xemacs, or something like that.

I've personally used Eclipse a couple of years ago for Java development, and ever since i knew Netbeans at version 3.5, it has gotten really good with the integration of server technologies as TomCat for J2EE application deployment, subversion, uml and plenty of plug-ins for different tecnologies, not just java now.

  • Database integration (MySQL, Jdb, SQL editor).
  • Continuous progress in PHP integration and features.
  • Subversion integration...it does help A LOT!
  • Code indent, custom color highlighting.
  • If you are a PHP developer, Ruby on Rails integration can be of help too, if you want to expand your expertise on web apps.
Related