This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 203373 - [context launching] Eclipse platform not able to pass all input file selections to the debug launch shortcut
Summary: [context launching] Eclipse platform not able to pass all input file selectio...
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-13 17:44 EDT by Kevin Jiang CLA
Modified: 2008-02-01 14:41 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Jiang CLA 2007-09-13 17:44:10 EDT
Build ID: 3.3 GA

Steps To Reproduce:
Scenario: Our launch configuration requires multiple files as input. When multiple files are selected and the bug button (icon) is pressed, the platform is only able to pass the first file to the launch shortcut. So the user will be asked again for the path(s) of the other file(s) when invoking our launch shortcut. 

The code that might be responsible for this behavior is in the "protected IResource getSelectedResource0()" method in SelectedResourceManager.java in the org.eclipse.debug.internal.ui.stringsubstitution package. In this method, the selection (which contains multiple files at this point) is casted into an instance of type IStructuredSelection named ss. Only the first element in ss will be initiated into an Object o, and this object named o then gets casted into an instance of type IResource called resource. And resource will be returned to the calling method and eventually be used to extract the file paths. As only the first element actually gets returned, so the other file paths will be lost before they are passed to the launch shortbut. As a result, our launch shortbut is not able to create a launch configuration properly and is forced to ask the user for input again.

Expected behavior: all of the selections should be properly stored and passed on to the next function. The user should not be asked for input files again if he/she already selected them, and a debug session should start given the inputs.



More information:
Comment 1 Darin Wright CLA 2007-09-18 09:05:18 EDT
Consider for 3.4
Comment 2 Samantha Chan CLA 2007-11-26 12:36:02 EST
Hi Darin,

I just want to give you more information on the impact of this problem.  Since not all files from the selection can be passed to our launch shortcut, our launch shortcut is unable to match the current selection with any of the existing launch configurations.  We do matching by comparing the current selection with the resources associated with the launch configurations.  As a result, our launch shortcut will go off to create a new launch configuration every time context launching is used.  This pollutes the user's workspace as we end up creating launch configurations unnecessarily.  If the user has configured the source lookup path differently, the user will have to re-configure with the new launch configuration.

Alternatively, we can change our code so that if the selected resource matches one of the resources in our launch configurations, then we can consider the launch config a match.  However, this will likely create conflicts and the user will end up having to pick a launch configuration to launch.

Thanks...
Sam
Comment 3 Darin Wright CLA 2008-01-31 11:05:58 EST
Sam, I believe you should be able to work around this problem in 3.4 with the new API on ILaunchShortcut2, by implementing "getLaunchConfigurations(ISelection selection)". We pass the entire selection to the shortcut, which can determine the correct configuration(s) to choose from. 

The shortcut can return 3 options:
* null - indicates the selection does not apply
* empty collection - indicates the selection applies with no existing configs
* 1 or more configs - launch the config or select from multiple

When you return an empty collection the shortcut will be asked to launch the selection, and we also pass in the entire selection, not just one resource.
Comment 4 Darin Wright CLA 2008-02-01 14:41:49 EST
Marking as works for me.