views:

345

answers:

2

I want to hide a physical file (eg: Sample.abc) which is generated at runtime.This should not be shown to the user.How can i programmatically handle this logic in my eclipse plugin development.

Thanks in advance

Regards Mathan

+2  A: 

When you want to hide some files in your application based on eclipse, you can call

IFolder byteFolder; // Some folder
byteFolder.setTeamPrivateMember(true);
byteFolder.setDerived(true);

setDerived is a interface methode of IResource

A derived resource is a regular file or folder that is created in the course of translating, compiling, copying, or otherwise processing other files. Derived resources are not original data, and can be recreated from other resources. It is commonplace to exclude derived resources from version and configuration management because they would otherwise clutter the team repository with version of these ever-changing files as each user regenerates them.

If a resource or any of its ancestors is marked as derived, a team provider should assume that the resource is not under version and configuration management by default. That is, the resource should only be stored in a team repository if the user explicitly indicates that this resource is worth saving.

Newly-created resources are not marked as derived; rather, the mark must be set explicitly using setDerived(true). Derived marks are maintained in the in-memory resource tree, and are discarded when the resources are deleted. Derived marks are saved to disk when a project is closed, or when the workspace is saved.

Projects and the workspace root are never considered derived; attempts to mark them as derived are ignored.

This operation does not result in a resource change event, and does not trigger autobuilds.

Markus Lausberg
Hi Markus,Thanks for your response, If iam setting "team private member" and 'derived' as 'true'.Can i access files inside in this hidden folder ?Can i write data in these files ?regardsMathan
you can access the files like all the others, when you use the file path. The options are for eclipse views only.
Markus Lausberg
A: 

I'd probably go with Markus' solution as it works in the generic case.

An alternative, much simpler, approach is to make the file name begin with ".", by default all files with that prefix are hidden in Eclipse (e.g. the .project and .classpath files in every project).

Rich Seller