Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Create a IFolder on a project with an extra level
Create a IFolder on a project with an extra level [message #1733316] Thu, 26 May 2016 13:03 Go to next message
kkt8 Mising name is currently offline kkt8 Mising nameFriend
Messages: 22
Registered: September 2014
Junior Member
hi,

I want to create a project with a folder containing another folder.
I tried this :
IFolder ifolder = project.getFolder("src" + File.separatorChar + "extraDir");
ifolder.create(true, true, monitor);
ICSourceEntry newEntry = new CSourceEntry(ifolder , null, 0); 
ICProjectDescription description = CCorePlugin.getDefault().getProjectDescription(project);
ICConfigurationDescription configs[] = description.getConfigurations();
	for(int i=0; i < configs.length; i++){
		ICConfigurationDescription config = configs[i];
		ICSourceEntry[] entries = config.getSourceEntries();
		Set<ICSourceEntry> set = new HashSet<ICSourceEntry>();
		for (int j=0; j < entries.length; j++) {
			if(new Path(entries[j].getValue()).segmentCount() == 1)
				continue;
			set.add(entries[j]);
		}
		set.add(newEntry);
		config.setSourceEntries(set.toArray(new ICSourceEntry[set.size()]));
	}
CCorePlugin.getDefault().setProjectDescription(project, description, false, monitor);


But, I have :
project
|
---- src/extraDir

I want :
project
|
---- src
|
--------- extraDir

An idea ?
thank you

chris
Re: Create a IFolder on a project with an extra level [message #1733318 is a reply to message #1733316] Thu, 26 May 2016 13:01 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33108
Registered: July 2009
Senior Member
If you're using the APIs of the CDT project, you're probably best to as
on the CDT forum.


On 26.05.2016 15:03, kkt8 Mising name wrote:
> hi,
>
> I want to create a project with a folder containing another folder.
> I tried this :
>
> IFolder ifolder = project.getFolder("src" + File.separatorChar +
> "extraDir");
You should be using
org.eclipse.core.resources.IContainer.getFolder(IPath) because the above
method should take the name of a file and that should just be a single
segment of a path name. So I don't think this makes sense.
> ifolder.create(true, true, monitor);
Is this throwing an exception?
> ICSourceEntry newEntry = new CSourceEntry(ifolder , null, 0);
> ICProjectDescription description =
> CCorePlugin.getDefault().getProjectDescription(project);
> ICConfigurationDescription configs[] = description.getConfigurations();
> for(int i=0; i < configs.length; i++){
> ICConfigurationDescription config = configs[i];
> ICSourceEntry[] entries = config.getSourceEntries();
> Set<ICSourceEntry> set = new HashSet<ICSourceEntry>();
> for (int j=0; j < entries.length; j++) {
> if(new Path(entries[j].getValue()).segmentCount() == 1)
> continue;
> set.add(entries[j]);
> }
> set.add(newEntry);
> config.setSourceEntries(set.toArray(new
> ICSourceEntry[set.size()]));
> }
> CCorePlugin.getDefault().setProjectDescription(project, description,
> false, monitor);
>
>
> But, I have :
> project
> |
> ---- src/extraDir
>
> I want :
> project
> |
> ---- src
> |
> --------- extraDir
>
> An idea ?
> thank you
>
> chris


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Create a IFolder on a project with an extra level [message #1733325 is a reply to message #1733318] Thu, 26 May 2016 13:30 Go to previous message
kkt8 Mising name is currently offline kkt8 Mising nameFriend
Messages: 22
Registered: September 2014
Junior Member
moved !
thank you
Previous Topic:How to refresh decorations of the files in Package Explorer view
Next Topic:CompareEditorInput
Goto Forum:
  


Current Time: Tue Mar 19 10:27:59 GMT 2024

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

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

Back to the top