How can I open a Project programatically?
Here’s the source of this FAQ:
Just wanted to put the core of it here for future reference as this was not easy for me to find:
File projectToBeOpenedFile = new File(getPath());
FileObject projectToBeOpened = FileUtil.toFileObject(projectToBeOpenedFile);
Project project = ProjectManager.getDefault().findProject(projectToBeOpened);
Project[] array = new Project[1];
array[0] = project;
OpenProjects.getDefault().open(array, false);
Remember to add references to Project API and Project UI API.
Go to the link to see the explanation of the code.