Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Associating EMF objects to an IProject
Associating EMF objects to an IProject [message #406997] Mon, 12 February 2007 19:30 Go to next message
Greg Fox is currently offline Greg FoxFriend
Messages: 39
Registered: July 2009
Member
I am trying to use the Eclipse project mechanism to maintain my
applications structure. So far I am simply using the CommonNavigator and
the Item Providers to populate the navigator so that they appear to be
part of the project.

Is there a way to actually add EMF content to an IProject?

Is there a way to associate an IProject back to an EMF object without
adding it as an attribute of the EMF object?
Re: Associating EMF objects to an IProject [message #407000 is a reply to message #406997] Mon, 12 February 2007 20:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Greg,

I'm not sure what it would mean to add EMF content to an IProject.
Given an EObject, you can use EObject.eResource() to determine the
resource that contains it and then you can use Resource.getURI to
determine the "location" of that resource. If it's of the form
"platform:/resource/<project>/... (i.e., in 2.3 if
URI.isPlatformResource return true), then you can map that to an IFile
in the workspace (i.e., in 2.3 using IWorkspaceRoot.getFile(new
Path(uri.toPlatformString())).


Greg wrote:
> I am trying to use the Eclipse project mechanism to maintain my
> applications structure. So far I am simply using the CommonNavigator
> and the Item Providers to populate the navigator so that they appear
> to be part of the project.
>
> Is there a way to actually add EMF content to an IProject?
>
> Is there a way to associate an IProject back to an EMF object without
> adding it as an attribute of the EMF object?
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Associating EMF objects to an IProject [message #548765 is a reply to message #407000] Thu, 22 July 2010 22:26 Go to previous messageGo to next message
Edward MacKerrow is currently offline Edward MacKerrowFriend
Messages: 7
Registered: July 2010
Location: Santa Fe, New Mexico
Junior Member
I have what I think is a similar question to Greg's. I have an EMF model that has an EObject named "MyProject", users are expected to create instances of "MyProject". At the moment this class contains slots of MyTasks (not YET Mylyn Tasks). My dream would be to have MyProject actually be an instance of IProject and MyTask actually be instances / extensions of Mylyn Tasks.

I am not sure how, or if I should (?), use EMF to create EMF objects that are implementations of IProject (so that I can use the Mylyn functionality directly on those Projects).

To be clear:
1) I have the IDE as my current EMF runtime target.

2) My EMF generated app runs fine, but the user creates a MyProject instance from the EMF Editor tree.

3) What I would really like though is that the User can create a new Project that is an Eclipse Project from the EMF Editor. Maybe I should just make a new Project wizard for my app outside of EMF (why not?).

4) But, ..., then I need to link other EMF generated objects to the project they are contained in. (Maybe I should just also do this "outside of EMF", that is generate all my EMF code as I do now, then edit the generated code to integrate with IProject)

Any suggestions or guidance is appreciated.

Thanks
Ed
Re: Associating EMF objects to an IProject [message #548770 is a reply to message #548765] Thu, 22 July 2010 22:34 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Ed,

Comments below.

Edward MacKerrow wrote:
> I have what I think is a similar question to Greg's. I have an EMF
> model that has an EObject named "MyProject", users are expected to
> create instances of "MyProject". At the moment this class contains
> slots of MyTasks (not YET Mylyn Tasks). My dream would be to have
> MyProject actually be an instance of IProject
That's not possible. IProject can't be implemented directly nor can its
implementation class be extended.
> and MyTask actually be instances / extensions of Mylyn Tasks.
> I am not sure how, or if I should (?), use EMF to create EMF objects
> that are implementations of IProject (so that I can use the Mylyn
> functionality directly on those Projects).
No you shouldn't try.
>
> To be clear:
> 1) I have the IDE as my current EMF runtime target.
>
> 2) My EMF generated app runs fine, but the user creates a MyProject
> instance from the EMF Editor tree.
>
> 3) What I would really like though is that the User can create a new
> Project that is an Eclipse Project from the EMF Editor. Maybe I
> should just make a new Project wizard for my app outside of EMF (why
> not?).
>
> 4) But, ..., then I need to link other EMF generated objects to the
> project they are contained in. (Maybe I should just also do this
> "outside of EMF", that is generate all my EMF code as I do now, then
> edit the generated code to integrate with IProject)
Generally you can look at any EObject's eResource().getURI(). From that
you can determine whether it is contained in the workspace
(platform:/resource) and you can determine the name of the project
containing it (the first segment after platform:/resource). You can then
look that name up in the IWorkspaceRoot.
>
> Any suggestions or guidance is appreciated.
>
> Thanks
> Ed


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:EMF Source for SDK builds?
Next Topic:Query2 Downloads?
Goto Forum:
  


Current Time: Fri Apr 26 09:34:52 GMT 2024

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

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

Back to the top