Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 56062 - [source lookup] Duplicate source lookup should indicate full location of duplicate
Summary: [source lookup] Duplicate source lookup should indicate full location of dupl...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 4.5 M7   Edit
Assignee: Sarika Sinha CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 123013 454556 (view as bug list)
Depends on:
Blocks: 460234
  Show dependency tree
 
Reported: 2004-03-24 18:06 EST by Darin Swanson CLA
Modified: 2015-04-27 08:48 EDT (History)
7 users (show)

See Also:
daniel_megert: review-
daniel_megert: review+
daniel_megert: review-
daniel_megert: review+


Attachments
WorkbenchAdapter to append rootpath to labels (3.99 KB, patch)
2015-01-09 04:30 EST, Sarika Sinha CLA
daniel_megert: review-
Details | Diff
Debug WorkbenchAdapter to append rootpath to labels (5.31 KB, patch)
2015-01-14 03:35 EST, Sarika Sinha CLA
no flags Details | Diff
Java Resolve Source Duplicate Handler with Label Provider (6.83 KB, patch)
2015-04-02 02:55 EDT, Sarika Sinha CLA
daniel_megert: review-
Details | Diff
To provide different status handlers for resolving source duplication (2.02 KB, patch)
2015-04-02 02:59 EDT, Sarika Sinha CLA
no flags Details | Diff
JDT SourceElementLabelProvider Adapter (5.85 KB, patch)
2015-04-13 08:48 EDT, Sarika Sinha CLA
no flags Details | Diff
Platform SourceElementLabelProvider Adapter (1.93 KB, patch)
2015-04-13 10:21 EDT, Sarika Sinha CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Swanson CLA 2004-03-24 18:06:40 EST
If you have duplicate source for a classfile, the duplicate source files found 
dialog does not indicate the full location of the duplicates.

For example, the JAR should be indicated as well as the package name (which 
may be the same).
Comment 1 Darin Wright CLA 2004-03-24 22:01:40 EST
To be addressed with new source lookup, not old.
Comment 2 Darin Wright CLA 2004-04-07 16:48:08 EDT
Fixed in new source lookup impl (thus, currently testable in Java apps, 
applets, and remote Java apps).
Comment 3 Darin Wright CLA 2004-04-07 16:48:23 EDT
Please verify, Darin (S).
Comment 4 Darin Swanson CLA 2004-04-08 23:21:04 EDT
Now I get a dialog that shows me two class names that are identical.

I have no way to tell which is which?

As well clicking "Cancel" seems to pick one and show the source for it?
Comment 5 Darin Wright CLA 2004-04-09 00:02:04 EDT
What's your test case? I was using an external zip and a project that had the 
same source. The dialog shows the file name followed by it's container name 
(i.e. xxxxx.java - somewhere/else/...). What type of launch config?
Comment 6 Darin Swanson CLA 2004-04-09 00:08:20 EDT
I put the ant.jar on the build path twice from two different locations.
I then have a Java app that creates an echo task and executes it.
Stepping into the echo class, I get prompted but all that is listed 
is "Echo.class" twice.
Comment 7 Darin Wright CLA 2004-04-14 11:25:56 EDT
Will investigate
Comment 8 Darin Wright CLA 2004-05-05 14:23:38 EDT
Ah, I see - but I'm not sure how to fix it. The two classes are on the 
buildpath as java elements, and are rendered with their IWorkbenchAdapter, 
which I cannot configure (from the platform, we have no notion of the java 
workbench adapater). Thus, they show up with default rendering (unqaulified). 
It works if you put the source zips on the source lookup path (rather than the 
buildpath).
Comment 9 Darin Wright CLA 2004-06-15 10:09:18 EDT
Deferred
Comment 10 Darin Wright CLA 2006-01-09 08:45:22 EST
*** Bug 123013 has been marked as a duplicate of this bug. ***
Comment 11 Eclipse Webmaster CLA 2009-08-30 02:34:40 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.
Comment 12 Noopur Gupta CLA 2014-12-09 06:51:15 EST
*** Bug 454556 has been marked as a duplicate of this bug. ***
Comment 13 Noopur Gupta CLA 2014-12-09 06:53:04 EST
Reopening after bug 454556.
Comment 14 Sarika Sinha CLA 2015-01-09 04:30:02 EST
Created attachment 249815 [details]
WorkbenchAdapter to append rootpath to labels

Added Workbench Adapter extending the existing JavaWorkbenchAdapter form JDTUI to append root path to the labels for JavaElements.
Comment 15 Dani Megert CLA 2015-01-12 08:05:38 EST
Comment on attachment 249815 [details]
WorkbenchAdapter to append rootpath to labels

This does not compile: you are using getJavaElement(element), but this is a private method.
Comment 16 Sarika Sinha CLA 2015-01-14 03:35:16 EST
Created attachment 249920 [details]
Debug WorkbenchAdapter to append rootpath to labels

Removed the dependency on JavaWorkbenchAdapter from jdt.ui.
Added a new Java Debug Workbench Adapter which provide the appended labels for duplicate sources.
Comment 18 Sarika Sinha CLA 2015-01-27 04:02:55 EST
Verified using

Eclipse SDK

Version: Mars (4.5)
Build id: I20150126-2000
Comment 19 Dani Megert CLA 2015-02-18 08:43:03 EST
This caused bug 460234. I've reverted the fix with http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?id=dc0bcc9d1c4dd8e91321d26a56136d746d0e3ba3

Not sure how I oversaw this: the fix overwrote JDT UI's workbench adapter. This is not good.
Comment 20 Sarika Sinha CLA 2015-02-19 04:33:37 EST
(In reply to Dani Megert from comment #19)
> This caused bug 460234. I've reverted the fix with
> http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/
> ?id=dc0bcc9d1c4dd8e91321d26a56136d746d0e3ba3
> 
> Not sure how I oversaw this: the fix overwrote JDT UI's workbench adapter.
> This is not good.

the patch was implementing IWorkbenchAdapter and not extending JDT UI Workbench Adapter. I ma not sure, how are these two related. I don't see the Project properties problem in the latest I build.
Eclipse SDK

Version: Mars (4.5)
Build id: I20150217-0800
Comment 21 Dani Megert CLA 2015-02-19 05:38:35 EST
(In reply to Sarika Sinha from comment #20)
> (In reply to Dani Megert from comment #19)
> > This caused bug 460234. I've reverted the fix with
> > http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/
> > ?id=dc0bcc9d1c4dd8e91321d26a56136d746d0e3ba3
> > 
> > Not sure how I oversaw this: the fix overwrote JDT UI's workbench adapter.
> > This is not good.
> 
> the patch was implementing IWorkbenchAdapter and not extending JDT UI
> Workbench Adapter. I ma not sure, how are these two related.

+ <factory
+ class="org.eclipse.jdt.internal.debug.ui.sourcelookup.WorkbenchAdapterFactory"
+ adaptableType="org.eclipse.jdt.core.IJavaElement">
+ <adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
+ </factory>

This overwrites the contribution from JDT UI.


> I don't see the
> Project properties problem in the latest I build.
> Eclipse SDK
> 
> Version: Mars (4.5)
> Build id: I20150217-0800
Please try again, but make sure JDT Debug is not loaded. Hint: use a new workspace and follow the steps from the other bug.
Comment 22 Sarika Sinha CLA 2015-04-02 02:55:07 EDT
Created attachment 252111 [details]
Java Resolve Source Duplicate Handler with Label Provider
Comment 23 Sarika Sinha CLA 2015-04-02 02:59:41 EDT
Created attachment 252112 [details]
To provide different status handlers for resolving source duplication

Have added a new Status handler and label handler for Java. It extends the features provided by Platform Debug.

Platform debug has added the ability for components to add different status handlers for resolving duplicate source elements.
Comment 24 Dani Megert CLA 2015-04-08 10:09:07 EDT
(In reply to Sarika Sinha from comment #22)
> Created attachment 252111 [details] [diff]
> Java Resolve Source Duplicate Handler with Label Provider

I don't like that fix. It uses internal code, connects two bundles with a random status code (206), and duplicates code.
Comment 25 Sarika Sinha CLA 2015-04-09 06:54:43 EDT
As there was no API, I had to duplicate some code, I can create an enhancement to open up the API to enable adding status handlers.
Even in the platform debug, status code is used to bind two bundles.
Comment 26 Dani Megert CLA 2015-04-09 08:13:31 EDT
(In reply to Sarika Sinha from comment #25)
> As there was no API, I had to duplicate some code, I can create an
> enhancement to open up the API to enable adding status handlers.
> Even in the platform debug, status code is used to bind two bundles.

If we consider adding API, then I would assume there's an easier way to achieve what we need.
Comment 27 Dani Megert CLA 2015-04-13 04:05:02 EDT
(In reply to Dani Megert from comment #26)
> (In reply to Sarika Sinha from comment #25)
> > As there was no API, I had to duplicate some code, I can create an
> > enhancement to open up the API to enable adding status handlers.
> > Even in the platform debug, status code is used to bind two bundles.
> 
> If we consider adding API, then I would assume there's an easier way to
> achieve what we need.


We can fix this along the lines of comment 14, but instead of providing an IWorkbenchAdapter we provide an org.eclipse.debug.internal.ui.sourcelookup.SourceElementLabelProvider. SourceElementLabelProvider#getText needs to first ask for that adapter.

If we don't want to use internals (we already do in plugin.xml), we can add an interface, e.g. ISourceElementLabelProvider during 4.6.
Comment 28 Sarika Sinha CLA 2015-04-13 08:48:30 EDT
Created attachment 252338 [details]
JDT SourceElementLabelProvider Adapter
Comment 29 Sarika Sinha CLA 2015-04-13 10:21:40 EDT
Created attachment 252343 [details]
Platform SourceElementLabelProvider Adapter

Platform patch provides a way to adapt to SourceElementLabelProvider. JDT patch adds an adapter for SourceElementLabelProvider to provide appropriate text and Image.
Comment 30 Dani Megert CLA 2015-04-13 13:37:48 EDT
(In reply to Sarika Sinha from comment #29)
> Created attachment 252343 [details] [diff]
> Platform SourceElementLabelProvider Adapter
> 
> Platform patch provides a way to adapt to SourceElementLabelProvider. JDT
> patch adds an adapter for SourceElementLabelProvider to provide appropriate
> text and Image.

The name "JavaDebugSourceElementLabelProviderAdapter" is not good. We usually use the same (or similar) name as the adapter in the plugin.xml.

Please put all changes into one patch to reduce overhead.

JavaPlugin is internal and should be avoided.
Comment 33 Sarika Sinha CLA 2015-04-27 08:48:13 EDT
Verified using
Eclipse SDK

Version: Mars (4.5)
Build id: I20150426-2000