Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 54898

Summary: PDE should automatically locate source for external plug-ins during debugging
Product: [Eclipse Project] PDE Reporter: Wassim Melhem <wassim.melhem>
Component: UIAssignee: PDE-UI-Inbox <pde-ui-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: darin.eclipse, jeffmcaffer, jerome_lanneluc
Version: 3.0   
Target Milestone: 3.0 M9   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Wassim Melhem CLA 2004-03-15 16:10:23 EST
Setup:
The user has a few workspace plug-ins that reference only a subset of the 
platform he is targetting.

Problem:
Code from external plug-ins that are not directly referenced by projects in 
the workspace is not part of the Java model, and consequently not part of the 
Source Lookup scope.
So when you launch a runtime workbench in debug mode, and want to step into 
code that is not part of the workspace Java search/Source Lookup scope, the 
debugger prompts you to enter a source location.  

Expectation:
Since PDE knows where the source is, the debugger should not prompt the user 
for these source code locations, it should consult PDE which could provide 
that information just in time.

Two approaches, one simpler than the other:
1. Use the "Add to Java Search" feature, in which PDE will create a fake Java 
project and add classpath entries referencing JARs from external plug-ins.
This will, in effect, add these classes to the Java Search scope, and source 
would be located without problems.  

The way this "Add to Java Search" is currently provided can certainly be 
improved (bug 52651).  However, this introduces a problem.  The JARS 
referenced in this fake Java project are not part of the Java model.  They are 
arbitrary libraries on the filesystem.  So when you open the Java editor on 
these external files, you will get one without a ruler, making your debugging 
experience less pleasant than the one you are used to.

2. Some people don't see why they should need to go through the "Add to Java 
Search" stuff to tell the debugger where the source is.  Good point.
The Debug team is coming out with a new source lookup mechanism, which allows 
the concept of a source lookup participant.

In this case, PDE registers itself as a source lookup participant for runtime 
workbench launches.  When you launch in debug mode, the debugger usually 
searches your workspace projects linearly to search for source associated with 
the current class in its frame.  If it does not find the associate source 
file, it prompts the user for source.  In this case, when it does not find 
source, it will ask the PDE participant for source and we could provide it 
just in time.

Note that in this scenario also, we will run into the same problem as in 1, 
where the external Java file will open without a ruler, so you won't see the 
breakpoints in the editor.  You will of course see them in the Breakpoints 
view.


So it sounds like whatever solution we would pursue (and #2 is obviously more 
desirable), we need to open a bug report against JDT/UI to look into the ruler 
issue when opening external files.
Comment 1 Wassim Melhem CLA 2004-03-15 16:16:25 EST
Opened bug 54900 for the Java editor problem.
Comment 2 Wassim Melhem CLA 2004-03-15 16:21:21 EST
Solution #2 is only possible, of course, if the debugger is able to give us 
enough information about the class in the frame to trace the plug-in where it 
is coming from.  
This information could be as simple as what JAR the class is coming from.  I'm 
using the word simple loosely.  DarinW is the best person to judge how easy it 
would be to provide such information.
Comment 3 Wassim Melhem CLA 2004-03-15 16:22:01 EST
In Darin we trust :-)
Comment 4 Jeff McAffer CLA 2004-03-15 16:45:34 EST
Good capture of the issues.  

Note that I am currently doing number 1 and it does not work as is.  I have 
added my entire target to the java search path and I still do not get any 
source.  I have to laboriously search for and add the source jars individually 
as the debugger cannot find them an prompts me.
Comment 5 Wassim Melhem CLA 2004-03-15 16:52:33 EST
I have not looked into yet.  But my conjecture is that it does not work as-is 
now, because when PDE is computing the source lookup locations for the 
debugger, we only use plug-in projects (ie. ones with 
plugin.xm/fragment.xml/manifest.mf).  So the fake Java project is being 
ignored.  This aspect will be fixed.
Comment 6 Wassim Melhem CLA 2004-03-23 08:06:15 EST
*** Bug 55641 has been marked as a duplicate of this bug. ***
Comment 7 Wassim Melhem CLA 2004-05-20 15:58:02 EDT
The "External Plug-in Libraries" project is now added to the source lookup.
So people who use the Add to Java Search functionality would have their source 
found, and the source prompt dialog will not pop up.

The JDT/Text seems to have fixed the ruler issue.  Breakpoints can now be set 
in these external JARs.