JavaTools Community Tip: Saving Space with Package Names in NetBeans IDE
When you have a deep package structure, this takes a lot of space in the left navigation bar in NetBeans IDE. There is a way to truncate the
package names when showing them in the Projects window, saving some
space: start NetBeans IDE after adding the following to the command line:
-J-Dorg.netbeans.spi.java.project.support.ui.packageView.TRUNCATE_PACKAGE_NAMES=true
This will make a package named net.java.javatools.projects.interface appear like net.jav.jav.pro.interface in the package tree. Still identifiable, but using less space.
If you are using a Mac, you can do this by editing the NetBeans start file: on Applications, right click on the NetBeans.app file and select "Show package contents". Go to Content/MacOS and edit the NetBeans file. Look for a line starting with "eval launchNbexec " and add the truncate option. It should look somewhat like this:
eval launchNbexec \
--jdkhome '"$netbeans_jdkhome"' \
-J-Dcom.apple.mrj.application.apple.menu.about.name=NetBeans \
-J-Xdock:name=NetBeans \
'"-J-Xdock:icon=$progdir/../nb6.0/netbeans.icns"' \
--branding nb \
--clusters '"$netbeans_clusters"' \
-J-Dnetbeans.importclass=org.netbeans.upgrade.AutoUpgrade \
-J-Dnetbeans.accept_license_class=org.netbeans.license.AcceptLicense \
${netbeans_default_options} \
-J-Dorg.netbeans.spi.java.project.support.ui.packageView.TRUNCATE_PACKAGE_NAMES=true \
'"$@"'
;;
From: JavaTools Community Newsletter, Issue 171
| Attachment | Size |
|---|---|
| toolstips.jpg | 3.43 KB |
- Login or register to post comments
- 287 reads
- Email this Quick Tip
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)







Comments
Tim Boudreau replied on Tue, 2008/06/17 - 2:14am
Simpler way on Mac-OS:
cd /Applications/NetBeans\ 6.1.app/Contents/Resources/NetBeans/etc/
sudo vi netbeans.conf
add
-J-Dorg.netbeans.spi.java.project.support.ui.packageView.TRUNCATE_PACKAGE_NAMES=true
inside the quotes to the definition of netbeans_default_options.
Daniel Sheppard replied on Thu, 2008/06/26 - 4:52am
Thanks for the good tip. It would be cool if the user could define path abbreviations as a part of their project definition. That way default shortenings that don't make sense or are ambiguous (as is the case for me) could be made meaningful to the user.
There is a second thing that this highlights - it is a change to etc/netbeans.conf and so it isn't inherited when the IDE is upgraded in the way that an option would be. Am I right here? If so, daily build users could soon find this a little frustrating.
I think that this is worthy of being made into a full feature.
Thanks
Dan Sheppard