Bug 22376 - Parent of JarEntryFile
Summary: Parent of JarEntryFile
Status: VERIFIED DUPLICATE of bug 148944
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.3 M6   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 153044
  Show dependency tree
 
Reported: 2002-08-13 06:54 EDT by Dani Megert CLA
Modified: 2007-03-20 03:56 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2002-08-13 06:54:06 EDT
We select the parent if an element is filtered. This works except for
JarEntryFile objects (e.g. a resource in a JAR). Both getName and getFullPath
return the handle relative to the JAR.

How can we get the parent for such an element? I.e. we would like to get the 
IPackageFragment or IPackageFragmentRoot for that entry.
Comment 1 Jerome Lanneluc CLA 2002-08-20 07:50:08 EDT
A JarEntryFile is a non-java resource and thus it is not a java element. It is 
just an IStorage. Thus it is not possible to navigate back to the 
IPackageFragment or IPackageFragmentRoot. You will have to remember the 
IPackageFragment or the IPackageFragmentRoot you selected to obtain this 
JarEntryFile.
Comment 2 Dani Megert CLA 2002-08-20 09:01:15 EDT
Sorry but I still think it's a J Core problem:
It's the J Core API that extends the workspace to return any Object(s) i.e. even
non-IResource(s) namely:
Object[] *.getNonJavaResources().
The Core/resource API is consistent because for IContainer.members() returns
IResource(s) which allow to get the parent (IContainer).
I would expect a similar thing from th J Core API i.e. *.getNonJavaResources()
returning INonJavaResource(ren) from which I can get the parent.
Comment 3 Jerome Lanneluc CLA 2002-08-20 09:21:05 EDT
Are you proposing to wrap every non-java resource in a INonJavaResource with a 
pointer to its parent?
Comment 4 Dani Megert CLA 2002-08-20 09:40:24 EDT
Either that or having a Java Model method to get the parent for such an element.
I mean at the end it is the model ;-)

Resources also wrap (in a way) each file to get me the parent. Also, Java
Elements allow me to get the parent (if any).
Comment 5 Dani Megert CLA 2002-08-20 09:42:10 EDT
What about returning IAdaptable instead of Object. This could then be
used/extended to get the parent (if needed).
Note: both, IStorage and IResource are adaptable.
Comment 6 Philipe Mulet CLA 2002-10-02 09:43:55 EDT
This would break existing APIs. Non-java resources are not meant to be part of 
the JavaModel. This is a commodity to visualize them in the package view. We 
don't support any action onto them, you directly have the raw resource in your 
hand and can operate on it as you would do with any resource. Resources are not 
connected back to the JavaModel. 

You should remember how you got this resource (which element you traversed). 
Alternatively you may try to iterate over containers until you hit one for 
which a corresponding element exists.

Closing
Comment 7 Dani Megert CLA 2004-12-07 10:33:45 EST
The new support to navigate (F3 and later Ctrl+Click) from an NLS key in a
properties file to the corresponding reference will not work for JARs due to
this bug.

Please reconsider.
Comment 8 Dani Megert CLA 2004-12-07 10:37:41 EST
It would already help if I could get the JAR (package fragment root) then I
could locate the stuff myself.
Comment 9 Markus Keller CLA 2007-03-07 13:37:19 EST
The fix for bug 148944 will fix this bug as well (IJarEntryResource#getParent()).
Comment 10 Jerome Lanneluc CLA 2007-03-09 06:18:25 EST
Reopening to mark as dup
Comment 11 Jerome Lanneluc CLA 2007-03-09 06:18:59 EST

*** This bug has been marked as a duplicate of bug 148944 ***
Comment 12 Maxime Daniel CLA 2007-03-20 03:56:33 EDT
Verified for 3.3 M6 using v_743.