Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Creating an IFolder directly under workspace
Creating an IFolder directly under workspace [message #272007] Mon, 20 September 2004 14:09 Go to next message
Joe Hudson is currently offline Joe HudsonFriend
Messages: 20
Registered: July 2009
Junior Member
Hello, I'm developing a plug-in using Eclipse 3.1 and would like to know
how to create an IFolder directly in the workspace. I would like to use
this folder for keeping resources associated with my plug-in.

I know that I can just get the workspace location and do file management
with java.io.File but I would like to do it the Eclipse way. Could
someone please correct the code that I am using below? Thanks in advance.

IPath path =
ResourcesPlugin.getWorkspace().getRoot().getFullPath().appen d( ".foo");
IFolder folder =
ResourcesPlugin.getWorkspace().getRoot().getFolder(path);

It seems that I can only use IFolders directly under projects because the
error I receive is shown below:
java.lang.IllegalArgumentException: Path must include project and resource
name: /.foo

Thank you very much for your help.

Joe
Re: Creating an IFolder directly under workspace [message #272021 is a reply to message #272007] Mon, 20 September 2004 15:00 Go to previous message
Eclipse UserFriend
Originally posted by: john.eclipsefaq.org

Folders in the workspace must belong to a project. For storing private
metadata for your plugin, I suggest using the location provided by
Plugin.getStateLocation() on your plugin instance. This will give you a
directory in a private location reserved for your plugin. The end user
will not be able to see it. You need to use plain java.io APIs to read
and write to this location.
--

Joe Hudson wrote:
> Hello, I'm developing a plug-in using Eclipse 3.1 and would like to know
> how to create an IFolder directly in the workspace. I would like to use
> this folder for keeping resources associated with my plug-in.
>
> I know that I can just get the workspace location and do file management
> with java.io.File but I would like to do it the Eclipse way. Could
> someone please correct the code that I am using below? Thanks in advance.
>
> IPath path =
> ResourcesPlugin.getWorkspace().getRoot().getFullPath().appen d( ".foo");
> IFolder folder =
> ResourcesPlugin.getWorkspace().getRoot().getFolder(path);
>
> It seems that I can only use IFolders directly under projects because the
> error I receive is shown below:
> java.lang.IllegalArgumentException: Path must include project and resource
> name: /.foo
>
> Thank you very much for your help.
>
> Joe
>
Previous Topic:Alternate eclipse update sites ..
Next Topic:Displaying complete text of very long error messages
Goto Forum:
  


Current Time: Fri Sep 27 11:16:57 GMT 2024

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

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

Back to the top