1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

LaunchBar - project based descriptor bug

project based descriptor must not accept launch configs without project
set
ownProject should not log exception when lc does not exist

Change-Id: I9a600641324b0ae22a2fdb99e68ff530cd1d33df
Reviewed-on: https://git.eclipse.org/r/31400
Reviewed-by: Elena Laskavaia <elaskavaia.cdt@gmail.com>
Tested-by: Elena Laskavaia <elaskavaia.cdt@gmail.com>
This commit is contained in:
Alena Laskavaia 2014-08-11 16:19:25 -04:00 committed by Elena Laskavaia
parent a458a0fe9f
commit bc0a8fb72f
2 changed files with 9 additions and 0 deletions

View file

@ -14,6 +14,7 @@ import java.util.HashMap;
import org.eclipse.cdt.launchbar.core.internal.Activator; import org.eclipse.cdt.launchbar.core.internal.Activator;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.debug.core.ILaunchConfigurationType;
@ -33,6 +34,8 @@ public class ConfigBasedLaunchConfigurationProvider extends AbstractLaunchConfig
if (configMap.containsKey(element)) if (configMap.containsKey(element))
return true; return true;
return element.getType().getIdentifier().equals(typeId); return element.getType().getIdentifier().equals(typeId);
} catch (DebugException e) {
return false; // config does not exists, not point logging
} catch (CoreException e) { } catch (CoreException e) {
Activator.log(e); Activator.log(e);
return false; return false;

View file

@ -27,6 +27,10 @@ public abstract class ProjectBasedLaunchDescriptorType extends ConfigBasedLaunch
return false; return false;
} }
public boolean ownsConfiguration(ILaunchConfiguration element) {
return super.ownsConfiguration(element) && getProject(element) != null;
}
protected boolean ownsLaunchDescriptor(ILaunchDescriptor ld) { protected boolean ownsLaunchDescriptor(ILaunchDescriptor ld) {
if (!(ld instanceof ProjectBasedLaunchDescriptorType)) if (!(ld instanceof ProjectBasedLaunchDescriptorType))
return false; return false;
@ -41,6 +45,8 @@ public abstract class ProjectBasedLaunchDescriptorType extends ConfigBasedLaunch
if (element instanceof ILaunchConfiguration) { if (element instanceof ILaunchConfiguration) {
ILaunchConfiguration llc = (ILaunchConfiguration) element; ILaunchConfiguration llc = (ILaunchConfiguration) element;
IProject project = getProject(llc); IProject project = getProject(llc);
if (project == null)
return null;
// TODO we need disable project based descriptor here // TODO we need disable project based descriptor here
return new ProjectBasedLaunchDescriptor(this, project, llc); return new ProjectBasedLaunchDescriptor(this, project, llc);
} else if (element instanceof IProject) { } else if (element instanceof IProject) {