Question

I created a NetBeans module with, among other things, a custom project type. Then I decided to move some of the project-related stuff, including actions related to opening, creating and closing a project, to a separate library, to reduce dependency on the NetBeans platform.

Now I need to call code in the library when project is created, opened or closed in NetBeans, but I don't know how to get notified of those events. Can someone help?

Was it helpful?

Solution

You should extend a ProjectOpenedHook implementing the appropriate methods and ten add your extension to your Project's Lookup

OTHER TIPS

Antonio's suggestion works great, I just want to add some extra info.

  • To create a project, I created a Project Template, from an empty project. In the generated WizardIterator class, I replaced the call to unZipFile() with call my Project.create()

  • ProjectFactory's loadProject() method can also be used to trigger logic related to opening a project.

  • I handle project closing as Antonio suggested.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top