mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 16:55:38 +02:00
Fix some trivial sonar warnings
Change-Id: I3da053a5fb4186a8cbbef73f58dc50d8b89bbd8e
This commit is contained in:
parent
fb9547a46c
commit
7a16ca18f5
7 changed files with 39 additions and 28 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008, 2014 Ericsson and others.
|
* Copyright (c) 2008, 2015 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -174,8 +174,10 @@ public class FinalLaunchSequence extends ReflectionSequence {
|
||||||
*/
|
*/
|
||||||
@RollBack("stepInitializeFinalLaunchSequence")
|
@RollBack("stepInitializeFinalLaunchSequence")
|
||||||
public void rollBackInitializeFinalLaunchSequence(RequestMonitor requestMonitor) {
|
public void rollBackInitializeFinalLaunchSequence(RequestMonitor requestMonitor) {
|
||||||
if (fTracker != null) fTracker.dispose();
|
if (fTracker != null) {
|
||||||
fTracker = null;
|
fTracker.dispose();
|
||||||
|
fTracker = null;
|
||||||
|
}
|
||||||
requestMonitor.done();
|
requestMonitor.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,7 +483,7 @@ public class FinalLaunchSequence extends ReflectionSequence {
|
||||||
sourceLookup.setSourceLookupPath(sourceLookupDmc, locator.getSourceContainers(), requestMonitor);
|
sourceLookup.setSourceLookupPath(sourceLookupDmc, locator.getSourceContainers(), requestMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static String INVALID = "invalid"; //$NON-NLS-1$
|
private static final String INVALID = "invalid"; //$NON-NLS-1$
|
||||||
/**
|
/**
|
||||||
* If we are dealing with a remote-attach debugging session, connect to the target.
|
* If we are dealing with a remote-attach debugging session, connect to the target.
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2013 Wind River Systems and others.
|
* Copyright (c) 2006, 2015 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -195,7 +195,7 @@ public class GdbLaunch extends DsfLaunch
|
||||||
// ITerminate
|
// ITerminate
|
||||||
|
|
||||||
static class LaunchCommandRequest extends CRequest implements IDebugCommandRequest {
|
static class LaunchCommandRequest extends CRequest implements IDebugCommandRequest {
|
||||||
Object[] elements;
|
private Object[] elements;
|
||||||
|
|
||||||
public LaunchCommandRequest(Object[] objects) {
|
public LaunchCommandRequest(Object[] objects) {
|
||||||
elements = objects;
|
elements = objects;
|
||||||
|
@ -323,8 +323,9 @@ public class GdbLaunch extends DsfLaunch
|
||||||
// updating of some of the Debug view actions.
|
// updating of some of the Debug view actions.
|
||||||
// 'DebugEvent.TERMINATE' will be fired when each of the corresponding processes
|
// 'DebugEvent.TERMINATE' will be fired when each of the corresponding processes
|
||||||
// exits and handled by 'handleDebugEvents()' method.
|
// exits and handled by 'handleDebugEvents()' method.
|
||||||
if (isTerminated())
|
if (isTerminated()) {
|
||||||
fireTerminate();
|
fireTerminate();
|
||||||
|
}
|
||||||
|
|
||||||
rm.setStatus(getStatus());
|
rm.setStatus(getStatus());
|
||||||
rm.done();
|
rm.done();
|
||||||
|
@ -363,7 +364,7 @@ public class GdbLaunch extends DsfLaunch
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> T getAdapter(Class<T> adapter) {
|
public <T> T getAdapter(Class<T> adapter) {
|
||||||
if (adapter.equals(ITerminateHandler.class) == false) {
|
if (!adapter.equals(ITerminateHandler.class)) {
|
||||||
// Must force adapters to be loaded.
|
// Must force adapters to be loaded.
|
||||||
// Except in the case of terminate. Terminate can be used
|
// Except in the case of terminate. Terminate can be used
|
||||||
// when running headless (no UI) and therefore we should not
|
// when running headless (no UI) and therefore we should not
|
||||||
|
|
|
@ -63,14 +63,14 @@ import org.eclipse.debug.core.model.ISourceLocator;
|
||||||
@ThreadSafe
|
@ThreadSafe
|
||||||
public class GdbLaunchDelegate extends AbstractCLaunchDelegate2
|
public class GdbLaunchDelegate extends AbstractCLaunchDelegate2
|
||||||
{
|
{
|
||||||
public final static String GDB_DEBUG_MODEL_ID = "org.eclipse.cdt.dsf.gdb"; //$NON-NLS-1$
|
public static final String GDB_DEBUG_MODEL_ID = "org.eclipse.cdt.dsf.gdb"; //$NON-NLS-1$
|
||||||
|
|
||||||
private final static String NON_STOP_FIRST_VERSION = "6.8.50"; //$NON-NLS-1$
|
private static final String NON_STOP_FIRST_VERSION = "6.8.50"; //$NON-NLS-1$
|
||||||
|
|
||||||
// Can be removed once we remove the deprecated newServiceFactory(String)
|
// Can be removed once we remove the deprecated newServiceFactory(String)
|
||||||
private boolean fIsNonStopSession = false;
|
private boolean fIsNonStopSession = false;
|
||||||
|
|
||||||
private final static String TRACING_FIRST_VERSION = "7.1.50"; //$NON-NLS-1$
|
private static final String TRACING_FIRST_VERSION = "7.1.50"; //$NON-NLS-1$
|
||||||
|
|
||||||
private GdbLaunch fGdbLaunch;
|
private GdbLaunch fGdbLaunch;
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,7 @@ public class InferiorRuntimeProcess extends RuntimeProcess {
|
||||||
try {
|
try {
|
||||||
type = config.getType().getName();
|
type = config.getType().getName();
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
type = null;
|
||||||
}
|
}
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
buffer.append(config.getName());
|
buffer.append(config.getName());
|
||||||
|
|
|
@ -449,39 +449,45 @@ public class LaunchUtils {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
|
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
|
||||||
if (project == null || !project.isAccessible())
|
if (project == null || !project.isAccessible()) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project, false);
|
ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project, false);
|
||||||
|
|
||||||
// Not a CDT project?
|
// Not a CDT project?
|
||||||
if (projDesc == null)
|
if (projDesc == null) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
String buildConfigID = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, ""); //$NON-NLS-1$
|
String buildConfigID = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, ""); //$NON-NLS-1$
|
||||||
ICConfigurationDescription cfg = null;
|
ICConfigurationDescription cfg = null;
|
||||||
if (buildConfigID.length() != 0)
|
if (buildConfigID.length() != 0) {
|
||||||
cfg = projDesc.getConfigurationById(buildConfigID);
|
cfg = projDesc.getConfigurationById(buildConfigID);
|
||||||
|
}
|
||||||
|
|
||||||
// if configuration is null fall-back to active
|
// if configuration is null fall-back to active
|
||||||
if (cfg == null)
|
if (cfg == null) {
|
||||||
cfg = projDesc.getActiveConfiguration();
|
cfg = projDesc.getActiveConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
// Environment variables and inherited vars
|
// Environment variables and inherited vars
|
||||||
HashMap<String, String> envMap = new HashMap<String, String>();
|
HashMap<String, String> envMap = new HashMap<String, String>();
|
||||||
IEnvironmentVariable[] vars = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(cfg, true);
|
IEnvironmentVariable[] vars = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(cfg, true);
|
||||||
for (IEnvironmentVariable var : vars)
|
for (IEnvironmentVariable var : vars) {
|
||||||
envMap.put(var.getName(), var.getValue());
|
envMap.put(var.getName(), var.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
// Add variables from build info
|
// Add variables from build info
|
||||||
ICdtVariable[] build_vars = CCorePlugin.getDefault().getCdtVariableManager().getVariables(cfg);
|
ICdtVariable[] buildVars = CCorePlugin.getDefault().getCdtVariableManager().getVariables(cfg);
|
||||||
for (ICdtVariable var : build_vars) {
|
for (ICdtVariable var : buildVars) {
|
||||||
try {
|
try {
|
||||||
// The project_classpath variable contributed by JDT is useless for running C/C++
|
// The project_classpath variable contributed by JDT is useless for running C/C++
|
||||||
// binaries, but it can be lethal if it has a very large value that exceeds shell
|
// binaries, but it can be lethal if it has a very large value that exceeds shell
|
||||||
// limit. See http://bugs.eclipse.org/bugs/show_bug.cgi?id=408522
|
// limit. See http://bugs.eclipse.org/bugs/show_bug.cgi?id=408522
|
||||||
if (!"project_classpath".equals(var.getName())) //$NON-NLS-1$
|
if (!"project_classpath".equals(var.getName())) {//$NON-NLS-1$
|
||||||
envMap.put(var.getName(), var.getStringValue());
|
envMap.put(var.getName(), var.getStringValue());
|
||||||
|
}
|
||||||
} catch (CdtVariableException e) {
|
} catch (CdtVariableException e) {
|
||||||
// Some Eclipse dynamic variables can't be resolved dynamically... we don't care.
|
// Some Eclipse dynamic variables can't be resolved dynamically... we don't care.
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2012 Wind River Systems and others.
|
* Copyright (c) 2006, 2015 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -40,13 +40,13 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
public class ServicesLaunchSequence extends Sequence {
|
public class ServicesLaunchSequence extends Sequence {
|
||||||
|
|
||||||
DsfSession fSession;
|
private DsfSession fSession;
|
||||||
GdbLaunch fLaunch;
|
private GdbLaunch fLaunch;
|
||||||
|
|
||||||
ICommandControlService fCommandControl;
|
private ICommandControlService fCommandControl;
|
||||||
CSourceLookup fSourceLookup;
|
private CSourceLookup fSourceLookup;
|
||||||
|
|
||||||
Step[] fSteps = new Step[] {
|
private Step[] fSteps = new Step[] {
|
||||||
new Step() { @Override
|
new Step() { @Override
|
||||||
public void execute(RequestMonitor requestMonitor) {
|
public void execute(RequestMonitor requestMonitor) {
|
||||||
fLaunch.getServiceFactory().createService(IMIBackend.class, fSession, fLaunch.getLaunchConfiguration()).initialize(requestMonitor);
|
fLaunch.getServiceFactory().createService(IMIBackend.class, fSession, fLaunch.getLaunchConfiguration()).initialize(requestMonitor);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2010 Wind River Systems and others.
|
* Copyright (c) 2006, 2015 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -27,7 +27,7 @@ public class ShutdownSequence extends Sequence {
|
||||||
|
|
||||||
class ServiceShutdownStep extends Step {
|
class ServiceShutdownStep extends Step {
|
||||||
|
|
||||||
IDsfService fService;
|
private IDsfService fService;
|
||||||
|
|
||||||
ServiceShutdownStep( IDsfService service ) {
|
ServiceShutdownStep( IDsfService service ) {
|
||||||
super();
|
super();
|
||||||
|
@ -73,8 +73,9 @@ public class ShutdownSequence extends Sequence {
|
||||||
private Step[] createSteps() {
|
private Step[] createSteps() {
|
||||||
IDsfService[] services = getServices();
|
IDsfService[] services = getServices();
|
||||||
ServiceShutdownStep[] steps = new ServiceShutdownStep[services.length];
|
ServiceShutdownStep[] steps = new ServiceShutdownStep[services.length];
|
||||||
for ( int i = 0; i < steps.length; ++i )
|
for ( int i = 0; i < steps.length; ++i ) {
|
||||||
steps[i] = new ServiceShutdownStep( services[i] );
|
steps[i] = new ServiceShutdownStep( services[i] );
|
||||||
|
}
|
||||||
return steps;
|
return steps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue