Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » EFS and IProject(How to create an IProject from a EFS)
EFS and IProject [message #516664] Wed, 24 February 2010 17:26 Go to next message
Matthew Flint is currently offline Matthew FlintFriend
Messages: 3
Registered: July 2009
Junior Member
My team would like to add the contents of a XML file into a workspace as if it were a project. In this way, certain portions of the XML can be treated as resources - with all the advantages that go with them. We have thus created our own file system that retrieves FileStore objects from the XML file. That part seems to work just fine.

It's when we try to create the project in the workspace that we're stuck. To create the project, we use the code suggested by the EFS team ( http://wiki.eclipse.org/EFS#Can_I_programmatically_create_a_ project_located_on_a_non-local_filesystem.3F) i.e.

IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("Proj");
IProjectDescription description = workspace.newProjectDescription("Proj");
description.setLocationURI("dpd://ourroot");
project.create(description, null);


A project node is created in our common navigator but nothing else. There are errors in the .log file in the workspace and the problem seems to be that no .project file can be found. If I understand correctly, setting the location URI of the project description to a URI in our own scheme means that eclipse will ask for the .project file within our filesystem (which makes sense). My question is, what exactly do we have to do to create this file for Eclipse? Is there no way to use "default" behavior for this particular file, i.e., have Eclipse create it as if the project were on the "normal" file system? For example, test for the name ".project" in the getChild and other functions of that type and then execute some super great Eclipse code like workspace.getProjectDescFile().

Thanks.
Re: EFS and IProject [message #517543 is a reply to message #516664] Mon, 01 March 2010 09:23 Go to previous messageGo to next message
BLANC Philippe is currently offline BLANC PhilippeFriend
Messages: 89
Registered: July 2009
Member
Hello, I have the same problem as yours.
Can somebody help us about this point?

Thanks in advance.
Re: EFS and IProject [message #517570 is a reply to message #516664] Mon, 01 March 2010 11:19 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Matthew,

I only know a little about this, but normally when a new project is
created, even if an existing older, the .project file doesn't yet exist
and Eclipse will create one. So when Eclipse initially checks for the
..project file you should ensure that it reaches the conclusion that no
such file exists. Then when Eclipse tries to create the .project file,
you should ensure that you indeed create one and then store exactly what
Eclipse is trying to store there.


Matthew Flint wrote:
> My team would like to add the contents of a XML file into a workspace
> as if it were a project. In this way, certain portions of the XML can
> be treated as resources - with all the advantages that go with them.
> We have thus created our own file system that retrieves FileStore
> objects from the XML file. That part seems to work just fine.
> It's when we try to create the project in the workspace that we're
> stuck. To create the project, we use the code suggested by the EFS
> team
> ( http://wiki.eclipse.org/EFS#Can_I_programmatically_create_a_ project_located_on_a_non-local_filesystem.3F)
> i.e.
>
>
> IProject project =
> ResourcesPlugin.getWorkspace().getRoot().getProject("Proj");
> IProjectDescription description =
> workspace.newProjectDescription("Proj");
> description.setLocationURI("dpd://ourroot");
> project.create(description, null);
>
>
> A project node is created in our common navigator but nothing else.
> There are errors in the .log file in the workspace and the problem
> seems to be that no .project file can be found. If I understand
> correctly, setting the location URI of the project description to a
> URI in our own scheme means that eclipse will ask for the .project
> file within our filesystem (which makes sense). My question is, what
> exactly do we have to do to create this file for Eclipse? Is there no
> way to use "default" behavior for this particular file, i.e., have
> Eclipse create it as if the project were on the "normal" file system?
> For example, test for the name ".project" in the getChild and other
> functions of that type and then execute some super great Eclipse code
> like workspace.getProjectDescFile().
>
> Thanks.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EFS and IProject [message #517651 is a reply to message #517570] Mon, 01 March 2010 15:42 Go to previous message
BLANC Philippe is currently offline BLANC PhilippeFriend
Messages: 89
Registered: July 2009
Member
Hello,
I've some additional questions about IResource and EFS api interactions.

In my RCP project, I need to use the IResource API. Indeed, I would like to reuse the Common Navigator part and the builder/Marker mechanisms.

The problem is that my model is not based on the local file system. I have only one configuration file that symbolises a tree model. I would like to display this tree model in my Common Navigator view. Moreover, each element of this tree model should be considered as a IResource.

So, I decided to implement my own file system.
Each file store is mapped with a tree model element.
I know that IResource and FileStore are linked via an URI. So, I also have to associate a unique URI to each FileStore.

However, I don't know how to start and how to fill my IResource tree.
Firstly, I supposed to create a IProject resource. But I don't know how to populate it (according my tree model). Do I have to manually create all the resources (corresponding to my tree model elements) ?

Thanks in advance for your help.
Previous Topic:Breadcrumb Questions
Next Topic:CCATS Numbers for Eclipse Platform
Goto Forum:
  


Current Time: Thu Apr 18 19:47:07 GMT 2024

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

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

Back to the top