DevFaqOpenProjectProgramatically

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.

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