X

Geertjan's Blog

  • May 15, 2005

Adding More Power to Menus in NetBeans IDE 4.1

Geertjan Wielenga
Product Manager
One things I've missed in standard projects is that you can't create contextual menus and attach Ant targets to them. This is possible for free-form projects. The difference is, I guess, because the philosophy behind these projects is different. When working with a standard project, you don't have your own Ant scripts and so the IDE provides them for you. The assumption is that you have no intention of extending these IDE-given Ant scripts too much, otherwise you'd be using a free-form project. However, there's more flexibility in standard projects than I thought. It's all documented in the build.xml template: "There exist several targets which are by default empty and which can be used for execution of your tasks. These targets are usually executed before and after some main targets."

Here is a complete list of these targets:

-pre-init:                 called before initialization of project propertie
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products

The one I've found most useful so far is -post-jar. In so many situations, such as when developing NetBeans Modules, one needs a JAR file before going any further. And for these situations this target is really useful. You can just refer to any of your own targets in this target, and it will be executed after the JAR is created, which happens when the Build Project menu is used. This means that you've actually added your own targets to the Build Project menu. For example, this is how I build NetBeans Modules:

<target name="-post-jar" depends="create-xml-file-for-module,create-nbm,reload" />

So, the revelation for me was that even though standard projects are limited in that they don't allow for customized contextual menus, the existing contextual menus can be extended, to the extent that my not being able to create my own contextual menus for standard projects doesn't make much difference.

Join the discussion

Comments ( 7 )
  • guest Tuesday, October 11, 2005
    im unable to use webservice which is made by netbean ide in .Net
  • shilpa Tuesday, October 11, 2005
    im unable to use webservice which is made by netbean ide in .Net
  • shilpa pawar Tuesday, October 11, 2005
    how to make a web service in netbean ide to be used by .Net client help me
  • shilpa pawar Tuesday, October 11, 2005
    how to make a web service in netbean ide to be used by .Net client help me
  • Geertjan Monday, October 17, 2005
    Sure, please specify exactly what you did and where things went wrong. I'll try to help.
  • seeta Thursday, March 2, 2006
    fgnjgy
  • lalalala Tuesday, April 25, 2006
    lhjgkjyhgh
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.