Bug 364287 - [build path] Allow viewing and editing the specified index files for a library.
Summary: [build path] Allow viewing and editing the specified index files for a library.
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.8   Edit
Hardware: All All
: P2 enhancement (vote)
Target Milestone: 3.8 M5   Edit
Assignee: Deepak Azad CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 356620
Blocks:
  Show dependency tree
 
Reported: 2011-11-21 05:31 EST by Satyam Kandula CLA
Modified: 2012-01-17 08:29 EST (History)
5 users (show)

See Also:


Attachments
test.jar (2.87 KB, application/octet-stream)
2012-01-12 06:00 EST, Deepak Azad CLA
no flags Details
test.index (1.02 KB, application/octet-stream)
2012-01-12 06:01 EST, Deepak Azad CLA
no flags Details
patch for doc (7.16 KB, text/plain)
2012-01-16 05:35 EST, Deepak Azad CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Satyam Kandula CLA 2011-11-21 05:31:48 EST
With bug 356620, JDT/Core is providing the support to specify the index files when the class path library is specified. 
JDT/UI should show the index file used allow users to modify or update them.
Comment 1 Satyam Kandula CLA 2011-11-21 06:05:27 EST
I have put in the high level approach, the implementation with the bug and some questions. Please let us know if this is inline with what you would need.
Comment 2 Deepak Azad CLA 2011-11-21 07:16:30 EST
In JDT/UI we need to allow to view and edit the index location from
- a jar's properties page
- the 'Libraries' tab in the 'Java Build Path' page for a project.

I suppose we also need an extension point in PDE, see bug 356620 comment 16.

Anything else ?
Comment 3 Satyam Kandula CLA 2011-11-24 02:19:22 EST
Do you need a delta when the index is modified? BTW, we do generate the delta for the change in source attachment too. Do you make use of this?
Comment 4 Deepak Azad CLA 2011-11-24 08:35:39 EST
(In reply to comment #3)
> Do you need a delta when the index is modified? 
At this point, I don't see why we would need the delta. But then I could be wrong as I not an expert in this area.

> BTW, we do generate the delta
> for the change in source attachment too. Do you make use of this?
Yes, we do.
Comment 5 Srikanth Sankaran CLA 2011-11-27 23:16:53 EST
Per https://bugs.eclipse.org/bugs/show_bug.cgi?id=356620#c37, JDT/Core
support for this feature retargetted to early M5.
Comment 6 Deepak Azad CLA 2012-01-10 14:27:27 EST
See also bug 365446.
Comment 7 Deepak Azad CLA 2012-01-11 12:55:38 EST
I have created and pushed a topic branch - 'dazad/bug364287-JarIndex' (http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/log/?h=dazad/bug364287-JarIndex)

(In reply to comment #2)
> In JDT/UI we need to allow to view and edit the index location from
> - a jar's properties page
> - the 'Libraries' tab in the 'Java Build Path' page for a project.
These two things work. Comments are welcome on the UI and functionality. (I guess you can also just make code changes in the branch, rather than commenting here, at least for the minor changes e.g wording for labels)

TODOs:
- Validation of index file - I guess we want to provide an option for this when the user is specifying the index file? Currently JDT/Core does not provide an API to validate the index (see bug 365446), hence 'Validate' does not work.

- There are a few TODO's in code for minor things e.g. help context
- I started by copying the UI code for 'Javadoc location', hence there is some scope for code duplication reduction. I will work on this.
Comment 8 Dani Megert CLA 2012-01-12 04:05:36 EST
Do we have some example JARs and indices somewhere? If not, please create some
and attach them here so that the UI can be tested.
Comment 9 Deepak Azad CLA 2012-01-12 06:00:49 EST
Created attachment 209362 [details]
test.jar
Comment 10 Deepak Azad CLA 2012-01-12 06:01:27 EST
Created attachment 209363 [details]
test.index
Comment 11 Deepak Azad CLA 2012-01-12 06:08:27 EST
Test a 'broken' example
- Fresh workspace
- Add 'test.jar' as a library to a Java project
- Specify any invalid file as the Index for this jar e.g. you can specify test.jar as index for test.jar
- Since the index is invalid a correct index will be created in "<workspace>\.metadata\.plugins\org.eclipse.jdt.core". The file name for this index would be "<magicnumber>.index", looking at the time stamp for the file would help in identifying it.
- Open this index file in a text editor and compare with 'test.index' attached here, both will look the same.

Test a 'good' example
- Fresh workspace
- Add 'test.jar' as a library to a Java project
- Specify 'test.index' as the Index for this jar 
- Check in "<workspace>\.metadata\.plugins\org.eclipse.jdt.core", no new index file is created.
Comment 12 Deepak Azad CLA 2012-01-12 10:19:49 EST
For the 'Index Location' property on the 'Libraries' tab in the 'Java Build Path' page for a project I have used the 'Jar with Source' icon for now. But I suppose we will need a new icon?
Comment 13 Dani Megert CLA 2012-01-12 11:50:33 EST
> suppose we will need a new icon?
Yes.
Comment 14 Dani Megert CLA 2012-01-13 09:45:47 EST
The requester of the feature will never need a UI as he points to the index via its own CP container. We need to validate and decide whether we really want to provide the UI.

Deepak, please check how much we'd gain by e.g. using a pre-built index for the rt.jar and for the jdt.ui JAR.

Also, if we provide the UI for rt.jar (i.e. 'JRE System Library') then we also need to adjust the 'Edit JRE' dialog.
Comment 15 Srikanth Sankaran CLA 2012-01-16 01:22:55 EST
(In reply to comment #14)
> The requester of the feature will never need a UI as he points to the index via
> its own CP container. We need to validate and decide whether we really want to
> provide the UI.

I feel that it is a bit atypical and somewhat unnatural for a user to
specify the pre-built index using the UI. Viewing may be useful as it
simply exposes a new attribute and informs. Admit even that is only
weakly tenable.
Comment 16 Deepak Azad CLA 2012-01-16 04:06:44 EST
(In reply to comment #14)
> The requester of the feature will never need a UI 
Closing as WONTFIX for now.
Comment 17 Deepak Azad CLA 2012-01-16 05:35:42 EST
Created attachment 209537 [details]
patch for doc

I already had this patch for UI doc, attaching it here in case we need it in future.