Apache NetBeans
Apache NetBeans
Latest release

Apache NetBeans 24

Download

How to listen for projects to be opened/closed?

Specific for a project-type

Implement a ProjectOpenedHook and register it to a project-type `

@ProjectServiceProvider(
    service =ProjectOpenedHook.class,
    projectType = {"org-netbeans-modules-web-project"}
)
public class MyProjectOpenedHook extends ProjectOpenedHook {

    private final Project project;

    public MyProjectOpenedHook(Project project) {
        this.project = project;
    }

    @Override
    protected void projectOpened() {
          System.out.println("opened"+project);
    }

    @Override
    protected void projectClosed() {
          System.out.println("closed"+project);
    }
}

For all project-types