Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » CNF: How can ContentProvider determine project of an object?
CNF: How can ContentProvider determine project of an object? [message #641289] Wed, 24 November 2010 18:18 Go to next message
Eclipse UserFriend
Originally posted by: yoduderoo.netscape.net

Hi,
I use Common Navigator Framework in an RCP app. The user creates
projects and under each project are domain objects which are retrieved
from a DB.

For the content provider methods such as hasChildren(Object element), I
need to know the project to which the passed domain object belongs
(i.e., element argument in hasChildren()).

How does one determine the nav tree path of an element passed to a
content provider?

Thanks, -yo
Re: CNF: How can ContentProvider determine project of an object? [message #641498 is a reply to message #641289] Thu, 25 November 2010 17:05 Go to previous messageGo to next message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
You don't need to worry about navigating the tree of the objects if the object is an IResource (which it will be if you are using the CNF against a workspace. Check if it's an IResource and use IResource.getProject().

Re: CNF: How can ContentProvider determine project of an object? [message #641520 is a reply to message #641498] Thu, 25 November 2010 19:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: yoduderoo.netscape.net

The objects are not IResource but rather EMF objects retrieved from a
database.
Thanks, y

Francis Upton wrote:
> You don't need to worry about navigating the tree of the objects if the
> object is an IResource (which it will be if you are using the CNF
> against a workspace. Check if it's an IResource and use
> IResource.getProject().
Re: CNF: How can ContentProvider determine project of an object? [message #641521 is a reply to message #641520] Thu, 25 November 2010 19:27 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
I don't think anyone can answer this question. There isn't a general
way to know the project of an EObject. Certainly one can use
EObject.eResource() to determine the containing resource and
Resource.getURI() to determine that resource's URI. If it's of the form
platform:/resource/ (URI.isPlatformResource() is true) you can map that
to a workspace IResource (as described in the FAQ). In the end though,
I think only you have the specific knowledge to answer your own question.


Yodude wrote:
> The objects are not IResource but rather EMF objects retrieved from a
> database.
> Thanks, y
>
> Francis Upton wrote:
>> You don't need to worry about navigating the tree of the objects if
>> the object is an IResource (which it will be if you are using the CNF
>> against a workspace. Check if it's an IResource and use
>> IResource.getProject().


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Unable to compile class for JSP
Next Topic:FormEditor and Refresh editor pages
Goto Forum:
  


Current Time: Tue Apr 23 17:24:59 GMT 2024

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

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

Back to the top