Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331753 - creating new virtual files under virtual folders not allowed
Summary: creating new virtual files under virtual folders not allowed
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Resources-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-03 04:49 EST by harishiva CLA
Modified: 2021-12-05 14:58 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description harishiva CLA 2010-12-03 04:49:08 EST
Build Identifier: I20100713-0800

Hi there,
 
  I am using Eclipse Helios IDE for C/++ development as well as for customizing it for some custom toolchain. In my application I want to have all my source files under project directory but at the same time I want them to be grouped and show them under specific folders. For this I can use virtual folders and I can import the files to appropriate virtual folders with virtual link. But my problem here is I can not create new files under any virtual folder. Actually I want all source files under project directory and a link is need to be created to this virtual folder. 
  So, virtual file creation would be very useful. Also, while developing or extending a plugins how can I make it to create virtual folders for a project? Which plugin I can use for this purpose? 

Thanks,
Harishiva


Reproducible: Always
Comment 1 James Blackburn CLA 2010-12-03 05:37:10 EST
Virtual resources are a platform feature.
Comment 2 Szymon Brandys CLA 2010-12-03 05:56:28 EST
(In reply to comment #0)
> I am using Eclipse Helios IDE for C/++ development as well as for customizing
> it for some custom toolchain. In my application I want to have all my source
> files under project directory but at the same time I want them to be grouped
> and show them under specific folders. For this I can use virtual folders and I
> can import the files to appropriate virtual folders with virtual link. But my
> problem here is I can not create new files under any virtual folder. Actually I
> want all source files under project directory and a link is need to be created
> to this virtual folder. 

Virtual folders may contain only other virtual folders or linked resources. If you want to group linked and regular files under a folder, use a regular folder here.

>   So, virtual file creation would be very useful. Also, while developing or
> extending a plugins how can I make it to create virtual folders for a project?
> Which plugin I can use for this purpose? 

You should use org.eclipse.core.resources bundle. To create a virtual folder use
IFolder#create(int, boolean, IProgressMonitor) and IResource#VIRTUAL flag.
Comment 3 Serge Beauchamp CLA 2010-12-03 05:57:22 EST
(In reply to comment #0)
> Build Identifier: I20100713-0800
> 
> Hi there,
> 
>   I am using Eclipse Helios IDE for C/++ development as well as for customizing
> it for some custom toolchain. In my application I want to have all my source
> files under project directory but at the same time I want them to be grouped
> and show them under specific folders. For this I can use virtual folders and I
> can import the files to appropriate virtual folders with virtual link. But my
> problem here is I can not create new files under any virtual folder. Actually I
> want all source files under project directory and a link is need to be created
> to this virtual folder. 
>   So, virtual file creation would be very useful. Also, while developing or
> extending a plugins how can I make it to create virtual folders for a project?
> Which plugin I can use for this purpose? 
> 
> Thanks,
> Harishiva
> 
> 
> Reproducible: Always

I see different questions/requests in your comment.

1) Virtual files, i.e. files that are defined in the .project file, and do not exist in the file system, is not a feature that currently exist in Helios.

2) It is possible to simulate having virtual files, by having the files in the first level under the project directory, hiding them using resource filters, then creating linked resources under the virtual folders with the link target pointing to those files.

3) If you want create virtual folders programatically from an Eclipse plugins, you have to use the org.eclipse.core.resources API, using the IFolder.create() using the VIRTUAL flag.

Does this answers your question?
Comment 4 harishiva CLA 2010-12-03 07:08:08 EST
Yes. This answers my questions partially. Thanks for your help.

Virtual files here I mean the regular files itself. 
Actually my project involves source files of different file types. eg: .c, .cpp, .lib, .h, etc., In the project viewer I want them to be groped depending on the file type. I can do this by creating regular folders and importing and/or adding such files under them. But I don't want to create folders in the file system. I was able to do this using the concept called virtual folders. This way I can order files in my project explorer. But I cannot add new files under these folders. I want to allow the end users to add source files under these virtual folders as well as to create new files of appropriate type. But all newly created files should be under main project directory. Virtual folder in the project explorer is just for the ordering purpose.
Comment 5 Serge Beauchamp CLA 2010-12-17 05:05:41 EST
(In reply to comment #4)
> Yes. This answers my questions partially. Thanks for your help.
> 
> Virtual files here I mean the regular files itself. 
> Actually my project involves source files of different file types. eg: .c,
> .cpp, .lib, .h, etc., In the project viewer I want them to be groped depending
> on the file type. I can do this by creating regular folders and importing
> and/or adding such files under them. But I don't want to create folders in the
> file system. I was able to do this using the concept called virtual folders.
> This way I can order files in my project explorer. But I cannot add new files
> under these folders. I want to allow the end users to add source files under
> these virtual folders as well as to create new files of appropriate type. But
> all newly created files should be under main project directory. Virtual folder
> in the project explorer is just for the ordering purpose.

From what I can understand, you want all the files to reside under the project folder in the file system, but to be organized in the Eclipse workspace in a different hierarchy.

This is possible by using resource filters to systematically hide the real files from appearing in the workspace (with a 'Exclude all *.c [recursive]' filter), and by manually creating linked resources pointing to those files (with using drag and drop from windows explorer, for example) under virtual folders in the project.

There is no way to currently automate have this process.
Comment 6 harishiva CLA 2010-12-18 01:33:34 EST
(In reply to comment #5)

Yes, I want all the files reside under project folder in the file system, but to be organized in the Eclipse workspace in a different folder hierarchy. The hierarchy should be look like as follows:


Project Name
------------
 |_Header Files Folders
 |_Libraries Folder
 |_Source File Folders
 |_Folder A
 |_Folder B

I want this hierarchy to be created when user creates a new project.

I should be able to do all file operations on these virtual folders.
eg: I should be able create new source files under "Source Files Folder" as well as I should be able to add/delete existing source files under this folder. 

Reopening this bug as this is a very good feature. 
If there is no plan to add this kind of feature in near future, please point me somewhere so that I can start work on it and thus I can contribute to eclipse.
Comment 7 Serge Beauchamp CLA 2010-12-19 05:20:59 EST
(In reply to comment #6)
> (In reply to comment #5)
> 
> Yes, I want all the files reside under project folder in the file system, but
> to be organized in the Eclipse workspace in a different folder hierarchy. The
> hierarchy should be look like as follows:
> 
> 
> Project Name
> ------------
>  |_Header Files Folders
>  |_Libraries Folder
>  |_Source File Folders
>  |_Folder A
>  |_Folder B
> 
> I want this hierarchy to be created when user creates a new project.
> 
> I should be able to do all file operations on these virtual folders.
> eg: I should be able create new source files under "Source Files Folder" as
> well as I should be able to add/delete existing source files under this folder. 
> 
> Reopening this bug as this is a very good feature. 
> If there is no plan to add this kind of feature in near future, please point me
> somewhere so that I can start work on it and thus I can contribute to eclipse.

I'm not sure I understand your use case, and how common it could be.

From one hand, you can create a linked folder that points anywhere in the file system, so you can make files and folders from directory foo in the file system to appear in any folder in the workspace project.

Then, when you mention that you would like to create new files under the virtual folders, it doesn't make sense in so far as virtual folders don't exist in the file system (they are virtual), so since real files need to have real parent, they can't be created under a virtual folder.

But if you use linked folder, then you can create files and folders under it.

Regarding your point of having the hierarchy created when the user creates a new project, it sounds to me that this would be something that would be in domain of the new project wizard, such as the CDT new project wizard.

Alternatively, you could create a "new" wizard (such as the new "class", "folder", "file", etc...) to automate the creation of the hierarchy setup you are describing.

So far, I don't see something that cannot already accomplished using the existing core.resources primitives.

Let me know if you think I'm missing something.
Comment 8 Eclipse Webmaster CLA 2019-09-06 16:15:32 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 9 Eclipse Genie CLA 2021-12-05 14:58:22 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.