I am trying to create netbeans module which whould work upon standard maven java projects. Is there some better way to do that then how it was adviced in: How can I get a project type on Netbeans Platform? This seems to be pretty dependent on implmenetation (note the *Impl postfix of the implementing class found in lookup). I couldn’t find any standard method in the Project API. Any ideas? Or is it safe to rely on some “NbMavenProjectImpl” string?
Currently I am going this way:
Project mainProject = OpenProjects.getDefault().getMainProject();
if (mainProject == null) {
return;
}
String projectType = mainProject.getClass().getName();
if (projectType.equals("NbMavenProjectImpl")) {
// do some action with the project here
}
One approach would be
Another one, which should be preferred, is to register your business logic into the maven project lookup eg. using an annotation
and then accessing the business logic like
That way you can decouple your API from implementation and as a bonus you can share the same business logic between more project types, if appropriate.