Below follows an explanation of how to set up NetBeans IDE for this purpose.
When you check out the VisualVM sources from dev.java.net, you will end up with the folder structure below. The folder that you see highlighted, named "visualvm", contains the VisualVM sources:
In Tools | NetBeans Platform, where you've registered VisualVM as the platform against which your VisualVM modules will be compiled, you need to register the folder above, in the "Sources" tab and also in the "Javadoc" tab:
That's all. Then the sources and Javadoc are accessible from the Java editor in NetBeans IDE.