Utility Method for Retrieving Current Hints

I believe it would be really cool if we had a Hints wizard, which would generate the basic stubs for new hints for NetBeans IDE. Imagine if we had that—wouldn't that increase the chance (a lot) of NetBeans IDE getting hint contributions from the broader community? And getting more hints is one significant step to NetBeans IDE's editor (especially its Java editor) becoming an even more valuable tool to its users.

One part of such a wizard would let the hint developer register the hint in the layer file via the wizard, i.e., without actually needing to touch the layer file itself. So, here's a utility method for retrieving the currently registered hints, which would probably end up in some kind of list in the wizard. For testing purposes, I've put the code into a CallableSystemAction.performAction, which results in this:

Here's the code itself:

public void performAction() {
    try {

        //Prepare Output window:
        OutputWriter writer;
        InputOutput io = IOProvider.getDefault().getIO("Hint Folders", false);
        writer = io.getOut();

        //Get Hints folder:
        FileObject hintObject = Repository.getDefault().getDefaultFileSystem().getRoot().
        DataFolder hintFolder = DataFolder.findFolder(hintObject);

        //Work with children of Hints folder:
        DataObject[] hintFolderKids = hintFolder.getChildren();
        for (int i = 0; i < hintFolderKids.length; i++) {
            DataFolder oneHintFolderKid = (DataFolder) hintFolderKids[i];

            //Work with grandchildren of Hints folder:
            DataObject[] oneHintFolderGrandKids = oneHintFolderKid.getChildren();
            StringBuilder builder = new StringBuilder();
            for (int j = 0; j < oneHintFolderGrandKids.length; j++) {
                DataObject oneHintFilderGrandKid = oneHintFolderGrandKids[j];
                builder.append("-- " + oneHintFilderGrandKid.getNodeDelegate().getDisplayName() + "\\n");

            //Create message, consisting of one child, plus all related grandchildren:
            String msg = "\\n" + oneHintFolderKid.getNodeDelegate().getDisplayName() + "\\n" + builder;

            //Write to Output window:

    } catch (IOException ex) {


Anyone want to work with me on a hint wizard? Let me know—it would be of great benefit to many people.


im not netbeans user, but cool idea

Posted by raveman on February 18, 2008 at 03:43 AM PST #

I also think this is a GREAT idea!

Posted by Thomas Zillinger on February 18, 2008 at 05:37 PM PST #

Thanks for the support, raveman and Thomas! Watch this blog for developments....

Posted by Geertjan on February 19, 2008 at 01:22 AM PST #

I have actually once started to work on such a wizard - I did not have time to really finish it though....

Posted by Jan Lahoda on February 19, 2008 at 05:55 PM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« April 2014