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();
writer.reset();
io.select();//Get Hints folder:
FileObject hintObject = Repository.getDefault().getDefaultFileSystem().getRoot().
getFileObject("org-netbeans-modules-java-hints/rules/hints");
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:
writer.println(msg);
}
} catch (IOException ex) {
Exceptions.printStackTrace(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
I also think this is a GREAT idea!
Thanks for the support, raveman and Thomas! Watch this blog for developments....
I have actually once started to work on such a wizard - I did not have time to really finish it though....