Getting started with the new Java language support inrastructure in NetBeans 6.0
By sandipchitale on Oct 29, 2006
There is going be a complete overhaul of Java editor in NetBeans 6.0. There are going to be a lot of cool, new features. Jan Lahoda has already blogged about some of those features. All those new features are supported by a javac based Java language support infrastructure. The Jackpot technology is also part of it. If you want to learn more about the new infrastucture go here.
I have developed a simple module - WhichElement - based on the new Java language support infrastructure APIs ( we need a good name for this ;) ). This blog may help/inspire you to get started with the new APIs.
The WhichElement module shows information about the Element under the caret in a read-only text field (40 column) in the IDE status bar. The tool tip shows the full text so that it can be seen when is wider than 40 columns. The text field contents can be copied using standard keybinding (e.g. on windows - Ctrl+A Ctrl+C).
This module demonstrates/makes use of:
- CaretAwareJavaSourceTaskFactory - a factory for creating a task which is run every time the caret position in the Java editor changes. This factory is registered using the:
- CancellableTask<CompilationInfo> - a caret sensitive task which finds the Element under the caret and displays information about it in the status bar.
I have uploaded the WhichElements Module to my Netbeans update center described here.
You will need a NetBeans IDE dev build dated after 10/25/2006. As pointed out by Jesse Glick you can get the latest dev build here. You can also build the NetBeans IDE using the sources checked out after 10/25/2006 from the NetBeans CVS repository. (How to get NetBeans CVS Access?).
If you want to hack the above project you will need to check out the NetBeans sources from the NetBeans CVS repository.
DISCLAIMER: This module is experimental. So no guarantees. Use the module at your own risk.