Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [platform-debug-dev] launch shortcut question

Darin, 

My launch shortcut implements ILaunchShortcut2.

In my environment there are two launch shortcuts that can handle C projects. 

When the function ContextRunner.getParticipatingLaunchConfigurations() is invoked I see that it loops through both launch shortcuts.  
Mine shortcut's ILaunchShortcut2.getLaunchConfigurations(ISelection selection) returns empty array - a configuration does not exists but can be created. 
The other shortcuts' ILaunchShortcut2.getLaunchConfigurations(ISelection selection) returns null. 

Because of the other launch shortcut' ILaunchShortcut2.getLaunchConfigurations(ISelection selection) is returning null the variable useDefault is set to true. Once that variable is set to true it will get all launches from all launch shortcuts considered compatible with the project. 
Since my launch configuration doesn't have mapped resources the function LaunchConfigurationManager.getApplicableLaunchConfigurations( null, project) will return my launch configuration. 


Looking at the use case: 
Two launch shortcuts can handle the same project - one is saying "I don't have a launch configuration for this project but I can create one", the other is saying "default resource mapping should be used" ending up launching a launch configuration from the first launch shortcut that is not related to the project. 

I guess I was expecting a dialog to be popped up to ask the user to resolve which launch shortcut to be used - that is exactly the case if I don't have a launch configuration already created (or have one mapped to a different project). 

Is there a way I can achieve this? 

Thanks
Dobrin

-----Original Message-----
From: platform-debug-dev-bounces@xxxxxxxxxxx [mailto:platform-debug-dev-bounces@xxxxxxxxxxx] On Behalf Of Darin Wright
Sent: November 22, 2009 11:54 AM
To: Eclipse Platform Debug component developers list.
Subject: Re: [platform-debug-dev] launch shortcut question

> 
> Hello, 
> 
> For our debugger I am implementing a launch configuration type and a
> launch shortcut for that type. 
> 
> Some of the configurations of that type are created based on a 
> project and for these configurations I call 
> LaunchConfigurationWorkingCopy.setMappedResources().
> 
> But other configurations of the same type are based on different 
> selection (an external file from a different view) so there is no 
> project associated with these launch configuration instances. In 
> that case I don't call 
LaunchConfigurationWorkingCopy.setMappedResources().
> 
> Here is the problem: 
> When I select a project and click on the debug toolbar a previously 
> created configuration based on external file is launched 
> automatically.  Everything works fine if all my launch 
> configurations had mapped resource associated with them. 
> 
> I traced that this behaviour is due to 
> LaunchConfigurationManager.getApplicableLaunchConfigurations.
> When the function is trying to find launch configurations applicable
> to a specific resource it assumes that if a launch configuration 
> doesn't have mapped resources the launch configuration should be 
applicable. 
> 
> I was wandering if there is an API that should be called so the 
> launch configuration manager won't assume  configuration that 
> doesn't have mapped resource will be applicable for this resource?
> 
> Thanks 
> Dobrin_______________________________________________

You should be able to solve this by having your launch shortcut implement 
ILaunchShortcut2. This allows the shortcut to determine which existing 
configurations are applicable to a selection or active editor.

Darin 


Back to the top