Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » How to attach a SRC folder to a IJavaProject
How to attach a SRC folder to a IJavaProject [message #70597] Wed, 11 June 2003 04:54 Go to next message
Eclipse UserFriend
Originally posted by: nirmalya.imcorporation.com

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
Re: How to attach a SRC folder to a IJavaProject [message #70730 is a reply to message #70597] Wed, 11 June 2003 09:25 Go to previous message
Eclipse UserFriend
Originally posted by: Olivier_Thomann.ca.ibm.comNOSPAM

>Could anyone please suggest how to go about programmatically creating the
>SRC folder under the IJavaProject that I just created.
Look at the API newSourceEntry(...) on org.eclipse.jdt.core.JavaCore.
It should help.
--
Olivier
Previous Topic:Getting "Unknown extension point" warnings
Next Topic:default perspective for launch
Goto Forum:
  


Current Time: Sat Jul 12 19:35:02 EDT 2025

Powered by FUDForum. Page generated in 0.03453 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top