DevFaqListenForOpeningClosingProject

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);
    }
}

Inspired by https://github.com/shannah/mirah-nbm/blob/695afe895553bbcae0a2f3ad8bfc38f48963de9b/src/ca/weblite/netbeans/mirah/antproject/web/WebMirahProjectOpenedHook.java

For all project-types

See https://blogs.oracle.com/geertjan/entry/org_netbeans_spi_project_ui

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo