[MODULE]Get main project and get its git information

"Gabriele" <[email protected]> Tue, 31 Jan 2017 12:21:05 +0000
Newsgroups gmane.comp.java.netbeans.devel
Message-ID <[email protected]>
I'm using this code to get the selected project, but getMainProject always returns null so it falls back to getting all projects.

Code:
 Project[] projects;
 Project project = OpenProjects.getDefault().getMainProject();
 projects = project == null ? OpenProjects.getDefault().getOpenProjects() : new Project[]{project};
 for (Project p : projects) {
   ProjectInformation info = ProjectUtils.getInformation(p);
   System.out.println(info.getName());
 }



After that, I want to extract the project's credentials and info to connect to the repository. I couldn't find any example or hint on how to do that. 
Can anyone set me in the right direction?