How to remove invalid launch configuration from recent launches dropdown

I am currently developing an Eclipse plug-in that adds its own custom launch configurations that are associated with specific resources in the production environment.

Background:, the underlying resource will change, which will invalidate the launch configuration and should not be launched

How can I programmatically remove a launch configuration from recent launch releases?

I mean this little down arrow:

enter image description here

This will show all the recent launch configurations that were launched recently.

EDIT: I am currently trying to access history via LaunchConfigurationManager and I cannot find an API that can tell me where I can get the correct instance, currently null anyway.

SECOND EDIT: The LaunchConfigurationManager is part of an internal package and should not be used.

+3


source to share


2 answers


To reflect the deletion Resource

, it needs to be linked to a launch configuration usingILaunchConfigurationWorkingCopy.setMappedResources(IResource[])

Then, when you remove this resource from the workspace (whether on disk or not), it will hide the startup configuration that this resource is mapped to.

My solution was to include this method call in the method performApply()

usedAbstractLaunchConfigurationTab



Link for ILaunchConfigurationWorkingCopy API where I found this

PS Now when the resource is deleted (but not on disk, you can try this with a project in regards to normal Java startup config) and then add again, the startup config maintains all past data

+1


source


Background: Sometimes the underlying resource will change, making the launch configuration invalid and should not be started

Why would you want to remove the "invalid" launch configuration from history, but otherwise leave it intact? If it is not valid, remove it completely or have it repaired. But that's just my two cents, not knowing the details of your statement.

If you are willing to take the risk and use the internal API, you can get LaunchHistory

through DebugUIPlugin.getDefault().getLaunchConfigurationManager()lgetLaunchHistory()

.



But have you tried to remove and re-add the wrong launch config right away to just remove it from history?

ILaunchConfigurationWorkingCopy workingCopy = launchConfig.getWorkingCopy();
workingCopy.delete();
ILaunchConfigurationType launchType = launchConfig.getType();
IContainer container = launchConfig.getFile() == null ? null : launchConfig.getFile().getParent();
ILaunchConfigurationWorkingCopy newLaunchConfig = launchType.newInstance( container, workingCopy.getName() );
// copy all attributes from 'launchConfig' to 'newLaunchConfig'
newLaunchConfig.doSave();

      

+1


source







All Articles