[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools] How to attach a SRC folder to a IJavaProject
|
- From: Nirmalya Ghosh <nirmalya@xxxxxxxxxxxxxxxxx>
- Date: Wed, 11 Jun 2003 16:47:48 +0800
- Newsgroups: eclipse.tools
- Organization: I'M Technologies Ltd.
- User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3b) Gecko/20030210
Hi,
I've managed to create a IJavaProject.
Now I want to programmatically attach a SRC folder to it. This is what I
tried:
IJavaModel javamodel = JavaCore.create(workspaceroot);
if(javamodel!=null)
{ javaProj = javamodel.getJavaProject(iProject.getName());
IPackageFragmentRoot[] allpackroots = null;
int numpackroots = 0;
if(javaProj!=null && javaProj.exists())
{ try { allpackroots = javaProj.getAllPackageFragmentRoots(); }
catch (JavaModelException e){ e.printStackTrace(); }
}
//Tryign to create my SRC folder under this IJavaProject
if(allpackroots != null)
{ this.packFragRoot = allpackroots[0];
try { this.packFragRoot.attachSource(new Path("src"),null,null); }
catch (JavaModelException e) { e.printStackTrace(); }
}
}
But, I get a Java Model Exception in the line
"this.packFragRoot.attachSource(new Path("src"),null,null);"
With the following message :
"Java Model Status [Operation not supported for specified element
type(s):[project root] [in myJavaProj]]"
Could anyone please suggest how to go about programmatically creating
the SRC folder under the IJavaProject that I just created.
Thanks in advance.
Regards,
Nirmalya