mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 440015 - Fix NPE On Launch Configuration Edit
Prompt user with error dialog when they attempt to edit a launch configuration with no active target selected. Change-Id: I3b0a649312259beba73437223e5b96e99396d31e Signed-off-by: Jonathan Williams <jonwilliams@qnx.com> Reviewed-on: https://git.eclipse.org/r/30184 Tested-by: Hudson CI Reviewed-by: Doug Schaefer <dschaefer@qnx.com>
This commit is contained in:
parent
0cdedcb9e9
commit
947b25009a
2 changed files with 7 additions and 2 deletions
|
@ -430,7 +430,7 @@ public class LaunchBarManager extends PlatformObject implements ILaunchBarManage
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ILaunchConfiguration getLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException {
|
public ILaunchConfiguration getLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException {
|
||||||
if (activeLaunchDesc == null)
|
if (activeLaunchDesc == null || target == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Map<String, ILaunchConfigurationProvider> targetMap = configProviders.get(descriptor.getType().getId());
|
Map<String, ILaunchConfigurationProvider> targetMap = configProviders.get(descriptor.getType().getId());
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.eclipse.debug.core.ILaunchMode;
|
||||||
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
||||||
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchGroupExtension;
|
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchGroupExtension;
|
||||||
import org.eclipse.debug.ui.ILaunchGroup;
|
import org.eclipse.debug.ui.ILaunchGroup;
|
||||||
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.jface.viewers.ILabelProvider;
|
import org.eclipse.jface.viewers.ILabelProvider;
|
||||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
|
@ -146,12 +147,16 @@ public class ConfigSelector extends CSelector {
|
||||||
@Override
|
@Override
|
||||||
public void handleEdit(Object element) {
|
public void handleEdit(Object element) {
|
||||||
try {
|
try {
|
||||||
|
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||||
ILaunchDescriptor desc = (ILaunchDescriptor) element;
|
ILaunchDescriptor desc = (ILaunchDescriptor) element;
|
||||||
ILaunchMode mode = getManager().getActiveLaunchMode();
|
ILaunchMode mode = getManager().getActiveLaunchMode();
|
||||||
ILaunchTarget target = getManager().getActiveLaunchTarget();
|
ILaunchTarget target = getManager().getActiveLaunchTarget();
|
||||||
|
if (target == null) {
|
||||||
|
MessageDialog.openError(shell, "No Active Target", "You must create a target to edit this launch configuration.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
ILaunchConfigurationType configType = getManager().getLaunchConfigurationType(desc, target);
|
ILaunchConfigurationType configType = getManager().getLaunchConfigurationType(desc, target);
|
||||||
ILaunchGroup group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(configType, mode.getIdentifier());
|
ILaunchGroup group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(configType, mode.getIdentifier());
|
||||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
|
||||||
LaunchGroupExtension groupExt = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(group.getIdentifier());
|
LaunchGroupExtension groupExt = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(group.getIdentifier());
|
||||||
if (groupExt != null) {
|
if (groupExt != null) {
|
||||||
ILaunchConfiguration config = getManager().getLaunchConfiguration(desc, target);
|
ILaunchConfiguration config = getManager().getLaunchConfiguration(desc, target);
|
||||||
|
|
Loading…
Add table
Reference in a new issue