Mark Occurrences Module on my NetBeans 5.0 update center
I have uploaded the Mark Occurrences module to my NetBeans 5.0 update center (here).
The Mark Occurrences module highlights the references to Class, Method, Field, Parameter or Local variable under the caret in a Java Source File. It also highlights the normal and exceptional method returns when the caret is on the method's return type symbol. When the caret is on a Throwable in the throws clause of the method declaration the places where that Throwable is potentially thrown are highlighted. This includes method invocations and throw statements. See the screenshots below.
To enable the feature click on the select Mark Occurrences button on the toolbar or View:Mark Occurrences menu item.
NOTE: The Mark Occurrences modules uses contrib/Experimental Editor Highlights module. The NBM for contrib/Experimental Editor Highlights module is available on my update center. I am not the author of that module though.
Note: I developed the Mark Occurrences module to help folks switch to NetBeans IDE. It will be deprecated when the same functionality becomes available in NetBeans.
DISCLAIMER: These modules are experimental. So no guarantees. Use the modules at your own risk.
Screenshots:
| Class references | Method references |
 |  |
| Method returns | Field references |
 |  |
| Parameter references | Local variable references |
 |  |
Sources
The source for the module can be found here.
Credits:
Jan Lahoda and Miloslav Metelka provided valuable help.
Parts of the implementation is based on the code from Tim Boudreau's contrib/CodeInfo module.
Posted by sandipchitale
( Jan 27 2006, 11:56:24 PM PST ) Permalink
Automatic creation of Update Center descriptor
Lately there has been a groundswell of NetBeans modules. This has resulted in a discussion on several blogs e.g. Manual Creation of Autoupdate Descriptors entry on Geertjan's Weblog. In that entry he discussed how to create the Update Center descriptors manually. It turns out that NetBeans build system's extension ant tasks already have a task for generating the update center descriptors. I will show you how to use it.
I develop all my modules under contri/ folder. Let us assume I have a module named MyModule in contrib/ directory. I have an ant script build-update-center.xml in contrib/ folder. Here is how it looks like:
<?xml version="1.0" encoding="UTF-8"?>
<project name="build-update-center" default="all" basedir=".">
<property name="update.center.descriptor.folder" value="c:/myblog/resources"/>
<property name="update.center.distbase.url" value="http://my.blogs.org/myblog/resources"/>
<target name="clean">
<delete file="${update.center.descriptor.folder}/update-center.xml"/>
<delete file="${update.center.descriptor.folder}/org-netbeans-modules-mymodule.nbm"/>
</target>
<target name="-build-bootstrap">
<ant dir="${basedir}/../nbbuild" antfile="build.xml" target="nbm"/>
</target>
<target name="-build-modules">
<ant dir="MyModule" antfile="build.xml" target="nbm"/>
</target>
<target name="all" depends="-build-bootstrap,-build-modules">
<copy file="MyModule/build/org-netbeans-modules-mymodule.nbm" todir="${update.center.descriptor.folder}" overwrite="true"/>
<taskdef name="makeupdatedesc"
classname="org.netbeans.nbbuild.MakeUpdateDesc"
classpath="${basedir}/../nbbuild/nbantext.jar"/>
<makeupdatedesc desc="${update.center.descriptor.folder}/update-center.xml" distbase="">
<group name="MyGroup">
<fileset dir="MyModule/build">
<include name="org-netbeans-modules-mymodule.nbm" />
</fileset>
</group>
</makeupdatedesc>
</target>
<target name="all-clean" depends="clean,all"/>
</project>
Basically it uses the makeupdatedesc task implemented by org.netbeans.nbbuild.MakeUpdateDesc class. The -build-bootstrap target makes sure the jar (nbantext.jar) containing org.netbeans.nbbuild.MakeUpdateDesc is built and available (Thanks to Sven Reimers for the tip).
The property update.center.descriptor.folder specifies the folder where you want to create the update-center.xml descriptor. That is also where the NBMs of your modules are copied. The property update.center.distbase.url specifies the URL where your Update Center will be available (i.e. update-center.xml descriptor). The -build-module target makes sure that your module's NBM is built.
BTW you can add any number of modules and module groups you want using similar pattern.
After running the script upload the update-center.xml and all the module NBMs to the URL specified by update.center.distbase.url. Thats all!
This technique works for modules developed under contrib/ folder. You may have to tweak it for your scenario.
DISCLAIMER: This script is experimental. So no guarantees. Use the script at your own risk.
Posted by sandipchitale
( Jan 27 2006, 09:23:32 AM PST ) Permalink