mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +02:00
LaunchBar - some checks to prevent NPE's in ui
Change-Id: Iddece4d412b8d88ffba833b55950ec693a2817cc Reviewed-on: https://git.eclipse.org/r/31554 Tested-by: Hudson CI Reviewed-by: Elena Laskavaia <elaskavaia.cdt@gmail.com>
This commit is contained in:
parent
bf0e781811
commit
742c1d9ee8
3 changed files with 15 additions and 7 deletions
|
@ -33,14 +33,16 @@ public class DefaultDescriptorLabelProvider extends LabelProvider {
|
||||||
ILaunchBarManager manager = desc.getType().getManager();
|
ILaunchBarManager manager = desc.getType().getManager();
|
||||||
ILaunchTarget target = manager.getActiveLaunchTarget();
|
ILaunchTarget target = manager.getActiveLaunchTarget();
|
||||||
ILaunchConfigurationType type = manager.getLaunchConfigurationType(desc, target);
|
ILaunchConfigurationType type = manager.getLaunchConfigurationType(desc, target);
|
||||||
ImageDescriptor imageDescriptor = DebugUITools.getDefaultImageDescriptor(type);
|
if (type != null) {
|
||||||
if (imageDescriptor != null) {
|
ImageDescriptor imageDescriptor = DebugUITools.getDefaultImageDescriptor(type);
|
||||||
Image image = images.get(imageDescriptor);
|
if (imageDescriptor != null) {
|
||||||
if (image == null) {
|
Image image = images.get(imageDescriptor);
|
||||||
image = imageDescriptor.createImage();
|
if (image == null) {
|
||||||
images.put(imageDescriptor, image);
|
image = imageDescriptor.createImage();
|
||||||
|
images.put(imageDescriptor, image);
|
||||||
|
}
|
||||||
|
return image;
|
||||||
}
|
}
|
||||||
return image;
|
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
Activator.log(e);
|
Activator.log(e);
|
||||||
|
|
|
@ -168,6 +168,10 @@ public class ConfigSelector extends CSelector {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ILaunchConfigurationType configType = getManager().getLaunchConfigurationType(desc, target);
|
ILaunchConfigurationType configType = getManager().getLaunchConfigurationType(desc, target);
|
||||||
|
if (configType == null) {
|
||||||
|
MessageDialog.openError(shell, "No launch configuration type", "Cannot edit this configuration");
|
||||||
|
return;
|
||||||
|
}
|
||||||
ILaunchGroup group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(configType, mode.getIdentifier());
|
ILaunchGroup group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(configType, mode.getIdentifier());
|
||||||
LaunchGroupExtension groupExt = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(group.getIdentifier());
|
LaunchGroupExtension groupExt = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(group.getIdentifier());
|
||||||
if (groupExt != null) {
|
if (groupExt != null) {
|
||||||
|
|
|
@ -131,6 +131,8 @@ public class ModeSelector extends CSelector {
|
||||||
protected ILaunchGroup getLaunchGroup(String mode) {
|
protected ILaunchGroup getLaunchGroup(String mode) {
|
||||||
try {
|
try {
|
||||||
ILaunchConfigurationType type = getManager().getLaunchConfigurationType(getManager().getActiveLaunchDescriptor(), getManager().getActiveLaunchTarget());
|
ILaunchConfigurationType type = getManager().getLaunchConfigurationType(getManager().getActiveLaunchDescriptor(), getManager().getActiveLaunchTarget());
|
||||||
|
if (type == null)
|
||||||
|
return null;
|
||||||
return DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(type, mode);
|
return DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(type, mode);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
Activator.log(e.getStatus());
|
Activator.log(e.getStatus());
|
||||||
|
|
Loading…
Add table
Reference in a new issue