I'm encountering a problem for which there appears to be no solution. I even reimplemented the earlier prototype so that I now have no child nodes below the build.gradle, instead I have a Navigator showing the Gradle tasks, where you can click a task to run it.
However, despite that, a crucial problem remains: whenever I run certain important method calls from the Gradle Tooling API... the NetBeans editor suddenly empties, not only for the current document, but for all documents that had not yet been opened:
Though the content of the file is still present, on disk, the editor document is suddenly empty. That specifically happens when "BuildableProject.getTasks" is run, which is crucial in identifying the tasks in the build.gradle, as well as "BuildLauncher.forTasks", which is the command for running a task. I.e., both these calls are vital, of course, since if you can't identify tasks in the project and if you can't run them either (because the NetBeans editor suddenly empties completely for no apparent reason), well, then what's the point of using Gradle in NetBeans.
So, hoping that a Gradle expert or someone using the Gradle Tooling API can point out what the problem is. Threading? Gradle daemon? Classloading? You tell me.