Redmine Plugin for NetBeans

The RedmineNB dev team is pleased to announce the first alpha release of the RedmineNB Plugin for NetBeans. RedmineNB adds support for Redmine issue tracker (Version 1.3.0+) to NetBeans and is built on top of the redmine-java-api library (V1.8.0).

Since RedmineNB has an implementation dependency to the Issue Tracking module the plugin is only compatible with NetBeans 7.1.1. A Redmine V1.3.0+ installation is required for best compatibility (tested with V1.3.1). There are some limitations in the functionality since the used Redmine REST API is not yet fully developed. This page gives an overview of the Redmine REST API.

The plugin can be downloaded from the RedmineNB project@kenai and for more information consult the project’s Wiki. Please note that RedmineNB is still under development and not yet intended for production use.

Categories: Java, NetBeans, Redmine Tags: , ,

CoolEditorActions V1.1.19 released

2012-02-6 9 comments

This is a minor update of the CoolEditorActions NetBeans Plugin and includes the following changes:

New and noteworthy in V1.1.19

  • Update Center integration
  • Added new actions to the Project folder sub menu:
    CoolEditorActions Popup Menu
  • The “Open in System” behavior can be configured in the new Options Panel:
  • The NetBeans Default implementation of “Open in System” depends on the Java Desktop API. On the SunOS and Linux Platforms, this API is dependent on Gnome libraries. If those libraries are unavailable, the Desktop API is not available. But now you can define Custom Commands for opening files and folders! The Command of the general File Type “file” is used if no special command is set to the specific MIME Type of a file.

The Plugin is compatible with NetBeans 7.1 and can be downloaded from here:

CoolEditorActions V1.0.5 released

I’ve been updated my CoolEditorActions NetBeans Plugin which is now compatible with NetBeans 7.1.

Other improvements:

  • The Button’s Popup Menu is lazy loaded
  • Improved Open & Select Project action
  • Added Close Project action
  • minor bug fixes

The Plugin can be downloaded from here:

Categories: Java, NetBeans Tags: , , ,

New plugin CoolEditorActions released

Today I released the first version of the CoolEditorActions NetBeans plugin. This plugin adds a drop down button to the editor’s toolbar. From the popup menu, some useful actions are available for all the file path objects:

The plugin can be downloaded from the Kenai Project site. Feel free to write me some feedback!

I will submit this plugin in the next few days also to the NetBeans Plugin Portal.

Categories: Java, NetBeans Tags: , , ,

Dynamically show/hide individual toolbars

In NetBeans you can define your own toolbar configurations (a set of visible/invisible toolbars). DevFaqHideShowToolbar shows you how you can activate a specific toolbar configuration at runtime. But how can I show an individual toolbar dynamically? For example, to show/hide certain toolbar(s) by the visibility of a TopComponent.

An explicit Toolbar API isn’t available in the NetBeans Platform. The class org.openide.awt.ToolbarPool is used to install and update the configured toolbars. With the constructor public ToolbarPool(DataFolder df) an own toolbar configuration at the specified location in the layer.xml (DataFolder) can be created.

But I don’t want create a new toolbar configuration for each TopComponent who should have their own toolbars. The idea is:

  1. Declare the toolbar for the TopComponent at a certain location (!= Toolbars/) in the module’s layer.xml
  2. Register the toolbar in the active toolbar configuration
  3. show the toolbar on TopComponent#componentOpened()
  4. hide the toolbar on TopComponent#componentClosed()

All these steps should be performed dynamically at runtime. How can I achieve this? Let’s go ahead…

Declare the toolbar

<!-- file: layer.xml -->
   <folder name="MyModule">
      <folder name="Toolbars">
         <folder name="MyToolbar">
            <attr name="displayName" stringvalue="My Toolbar" />
            <file name="my-action-1.instance">

Register the toolbar in the active toolbar configuration
Using a shadow entry any custom toolbar is registered once in the default toolbar pool (at Toolbars/):

public static boolean registerToolbar(String toolbarConfigPath) {
   try {
      FileObject fo = FileUtil.getConfigFile(toolbarConfigPath);
      if (fo == null) {
         return false;
      DataFolder df = DataFolder.findFolder(fo);
      DataFolder target = ToolbarPool.getDefault().getFolder();
      FileObject targetFO = target.getPrimaryFile().getFileObject(fo.getNameExt() + ".shadow");

      if (df != null && targetFO == null) {
         DataShadow ds = df.createShadow(target);
         return true;
   } catch (IOException ex) {
   return false;

Show/hide the toolbar
For programatically hide and show a toolbar you can write:

Toolbar toolbar = ToolbarPool.getDefault().findToolbar("MyToolbar");

The drawback is that the visible state of the toolbar will not be propagated to the toolbar context menu actions.

After debugging I found this solution (or hack):

public static void setToolbarVisible(Toolbar toolbar, boolean visible) {
   try {
      ClassLoader cl = Lookup.getDefault().lookup(ClassLoader.class);
      Class cToolbarConfiguration = cl.loadClass("");
      // invoke static ToolbarConfiguration.findConfiguration( String name)
      Object toolbarConfig = cToolbarConfiguration.getMethod("findConfiguration", String.class).
              invoke(cToolbarConfiguration, "Standard");
      // invoke ToolbarConfiguration#setToolbarVisible( Toolbar tb, boolean visible)
      toolbarConfig.getClass().getMethod("setToolbarVisible", Toolbar.class, boolean.class).invoke(toolbarConfig, toolbar, visible);
   } catch (Exception ex) {
      throw new IllegalArgumentException(ex);

Link the toolbar together with the TopComponent’s visibility state (simplified):

String toolbarName = "MyToolbar";

public final void componentOpened() {
   ToolbarUtil.registerToolbar("MyModule/Toolbars/" + toolbarName);
   ToolbarUtil.setToolbarVisible(toolbarName, true);

public final void componentClosed() {
  ToolbarUtil.setToolbarVisible(toolbarName, false);
Categories: Java, NB Platform, NetBeans Tags: ,

StatusLine in menu bar

With a simple NetBeans startup parameter the StatusLine can be placed in the menu bar: add the property

to the NetBeans configuration file installRoot/etc/netbeans.conf:

# Options used by NetBeans launcher by default, can be overridden by explicit
# command line switches:
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-Xmx1500m -J-XX:PermSize=32m -J-XX:MaxPermSize=400m -J-Dapple.laf.useScreenMenuBar=true -J-Dsun.java2d.noddraw=true"

Don’t forget to add -J-D before the property name!

See also FaqNetbeansConf

Categories: NetBeans Tags:

Simple Validation API & DialogDescriptor

This post shows you how the Simple Validation API (HowTo, Project@Kenai) can be used together with a NetBeans Platform standard dialog (using a DialogDescriptor).

The Simple Validation API gives you a convenience method to show a dialog like (excerpt from the BasicDemo):

JPanel panel = new JPanel();
... // setup panel

ValidationPanel vp = new ValidationPanel();
... // setup validation

// Convenience method to show a simple dialog
if (vp.showOkCancelDialog("URL")) {
} else {

To use a standard NetBeans Platform dialog, the sample above can be replaced with:

... // as above
DialogDescriptor dd = ValidationUtil.createDialogDescriptor(vp, panel, "URL");
Object ret = DialogDisplayer.getDefault().notify(dd);
if (DialogDescriptor.OK_OPTION.equals(ret)) {
} else {
public class ValidationUtil {

   private ValidationUtil() {
      // default constructor suppressed for non-instantiability

   public static DialogDescriptor createDialogDescriptor(ValidationPanel vp, Object innerPane, String title) {
      final DialogDescriptor dd = new DialogDescriptor(innerPane, title);

      ValidationUI okButtonEnabler = new ValidationUI() {
         private NotificationLineSupport nls = dd.createNotificationLineSupport();

         public void showProblem(Problem problem) {
            if (problem != null) {
               switch (problem.severity()) {
                  case FATAL:
                  case WARNING:
            } else {

         public void clearProblem() {

      return dd;