I am developing a plugin.In this i take project as input from textbox which is a string , but it has to be converted to IJavaProject type before proceeding. How can i do that ?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If
projectNamedoes not exist,IProject, which is just a handle, will be null.IJavaProjectwill also be null… so I would not recommend beny23‘s solution.The javadoc for
JavaCore.create(IProject)states, “no check is done at this time on the existence or the java nature of this project”.See this thread for creating a Java Project programmatically from scratch. Extract
You can check if is has actually been created with:
See also this thread as another code example of Java Project creation.
That thread also creates project, even though their nature is more complete than just Java.