1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

Warning cleanup.

This commit is contained in:
Mikhail Khodjaiants 2007-02-21 12:02:04 +00:00
parent 5dfbff2013
commit 1ac3376300
20 changed files with 83 additions and 95 deletions

View file

@ -48,7 +48,7 @@ public class AbsolutePathSourceContainer extends AbstractSourceContainer {
return wfiles;
// The file is not already in the workspace so try to create an external translation unit for it.
String projectName = getDirector().getLaunchConfiguration().getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
String projectName = getDirector().getLaunchConfiguration().getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
ICProject project = CoreModel.getDefault().getCModel().getCProject(projectName);
if (project != null)
{
@ -85,7 +85,7 @@ public class AbsolutePathSourceContainer extends AbstractSourceContainer {
}
public String getName() {
return SourceLookupMessages.getString( "AbsolutePathSourceContainer.0" );
return SourceLookupMessages.getString( "AbsolutePathSourceContainer.0" ); //$NON-NLS-1$
}
/* (non-Javadoc)

View file

@ -88,7 +88,7 @@ public class MappingSourceContainer extends AbstractSourceContainer {
try {
Object[] objects = container.findSourceElements( name );
if ( objects.length > 0 ) {
if ( isFindDuplicates() ) {
if ( isFindDuplicates() && results != null ) {
for( int j = 0; j < objects.length; j++ ) {
results.add( objects[j] );
}

View file

@ -174,10 +174,8 @@ public class CMemoryBlockRetrievalExtension extends PlatformObject implements IM
memorySpaceID = sbuf.toString();
}
catch( CDIException e ) { // thrown by CDI client decoding method
addrBigInt = null;
}
catch (CoreException e) {
addrBigInt = null; // thrown by our decoding method
catch (CoreException e) { // thrown by our decoding method
}
}
@ -382,7 +380,7 @@ public class CMemoryBlockRetrievalExtension extends PlatformObject implements IM
*
*/
public static String addressToString(BigInteger address, String memorySpaceID) {
return memorySpaceID + ":0x" + address.toString(16);
return memorySpaceID + ":0x" + address.toString(16); //$NON-NLS-1$
}
/*
@ -395,7 +393,7 @@ public class CMemoryBlockRetrievalExtension extends PlatformObject implements IM
// minimum is "<space>:0x?"
if (index == -1 || str.length() <= index + 3 || str.charAt(index+1) != '0' || str.charAt(index+2) != 'x') {
IStatus s = new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), CDebugCorePlugin.INTERNAL_ERROR, InternalDebugCoreMessages.getString( "CMemoryBlockRetrievalExtension.5" ), null );
IStatus s = new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), CDebugCorePlugin.INTERNAL_ERROR, InternalDebugCoreMessages.getString( "CMemoryBlockRetrievalExtension.5" ), null ); //$NON-NLS-1$
throw new CoreException( s );
}

View file

@ -13,7 +13,6 @@ package org.eclipse.cdt.debug.internal.core.model;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.model.ICVariable;
import org.eclipse.cdt.debug.core.model.IEnableDisableTarget;
import org.eclipse.debug.core.DebugException;
/**
* The super class for all variable types.

View file

@ -1294,7 +1294,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
}
}
protected IThread getCurrentThread() throws DebugException {
protected IThread getCurrentThread() {
IThread[] threads = getThreads();
for( int i = 0; i < threads.length; ++i ) {
if ( ((CThread)threads[i]).isCurrent() )
@ -1368,7 +1368,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
return globals;
}
private List getCFileGlobals( IBinaryObject file ) throws DebugException {
private List getCFileGlobals( IBinaryObject file ) {
ArrayList list = new ArrayList();
ISymbol[] symbols = file.getSymbols();
for( int i = 0; i < symbols.length; ++i ) {
@ -1677,7 +1677,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
vo = getCDITarget().getGlobalVariableDescriptors( info.getPath().lastSegment(), null, info.getName() );
}
catch( CDIException e ) {
throw new DebugException( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED, (vo != null) ? vo.getName() + ": " + e.getMessage() : e.getMessage(), null ) ); //$NON-NLS-1$
throw new DebugException( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED, e.getMessage(), null ) );
}
return CVariableFactory.createGlobalVariable( this, info, vo );
}

View file

@ -786,12 +786,14 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
}
protected void setCurrent( boolean current ) {
if (!current)
{
if (getCDITarget().getConfiguration() instanceof ICDITargetConfiguration2 && ((ICDITargetConfiguration2)getCDITarget().getConfiguration()).supportsThreadControl())
current = true; // When the debugger can control individual threads treat every thread is "current"
boolean c = current;
if ( !c ) {
if ( getCDITarget().getConfiguration() instanceof ICDITargetConfiguration2
&& ((ICDITargetConfiguration2)getCDITarget().getConfiguration()).supportsThreadControl() )
c = true; // When the debugger can control individual
// threads treat every thread is "current"
}
fIsCurrent = current;
fIsCurrent = c;
}
protected int getStackDepth() throws DebugException {

View file

@ -516,7 +516,7 @@ public abstract class CVariable extends AbstractCVariable implements ICDIEventLi
}
}
private String processExpression( String oldExpression ) throws DebugException {
private String processExpression( String oldExpression ) {
return oldExpression;
}

View file

@ -23,7 +23,7 @@ public class AbsolutePathSourceContainerType extends AbstractSourceContainerType
}
public String getMemento(ISourceContainer container) throws CoreException {
return "";
return ""; //$NON-NLS-1$
}
}

View file

@ -124,26 +124,24 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
if ( f instanceof ICStackFrame ) {
ICStackFrame frame = (ICStackFrame)f;
LinkedList list = new LinkedList();
if ( frame != null ) {
Object result = null;
String fileName = frame.getFile();
if ( fileName != null && fileName.length() > 0 ) {
ICSourceLocation[] locations = getSourceLocations();
for( int i = 0; i < locations.length; ++i ) {
try {
result = locations[i].findSourceElement( fileName );
}
catch( CoreException e ) {
// do nothing
}
if ( result != null ) {
if ( result instanceof List )
list.addAll( (List)result );
else
list.add( result );
if ( !searchForDuplicateFiles() )
break;
}
Object result = null;
String fileName = frame.getFile();
if ( fileName != null && fileName.length() > 0 ) {
ICSourceLocation[] locations = getSourceLocations();
for( int i = 0; i < locations.length; ++i ) {
try {
result = locations[i].findSourceElement( fileName );
}
catch( CoreException e ) {
// do nothing
}
if ( result != null ) {
if ( result instanceof List )
list.addAll( (List)result );
else
list.add( result );
if ( !searchForDuplicateFiles() )
break;
}
}
}

View file

@ -12,9 +12,10 @@ package org.eclipse.cdt.debug.internal.ui;
import java.util.HashMap;
import java.util.Iterator;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.Assert;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;

View file

@ -26,8 +26,7 @@ import org.eclipse.swt.graphics.Image;
*
* @since Aug 30, 2002
*/
public class CDebugImages
{
public class CDebugImages {
private static final String NAME_PREFIX = "org.eclipse.cdt.debug.ui."; //$NON-NLS-1$
private static final int NAME_PREFIX_LENGTH = NAME_PREFIX.length();

View file

@ -10,8 +10,8 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.util.Assert;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DragSource;
import org.eclipse.swt.dnd.DropTarget;

View file

@ -13,7 +13,7 @@ package org.eclipse.cdt.debug.internal.ui.dialogfields;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.util.Assert;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ICheckStateListener;

View file

@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.dialogfields;
import org.eclipse.jface.util.Assert;
import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;

View file

@ -17,7 +17,7 @@ import java.util.List;
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
import org.eclipse.cdt.debug.internal.ui.SWTUtil;
import org.eclipse.jface.util.Assert;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;

View file

@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.dialogfields;
import org.eclipse.jface.util.Assert;
import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;

View file

@ -10,6 +10,9 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.editors;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
@ -23,11 +26,8 @@ import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextHoverExtension;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import java.util.regex.*;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.ISelectionListener;
@ -40,37 +40,37 @@ import org.eclipse.ui.IWorkbenchPart;
class LanguageOperators {
public String getAssignmentOperator() {
return "=";
return "="; //$NON-NLS-1$
}
public String getGreaterThanEqualToOperator() {
return ">=";
return ">="; //$NON-NLS-1$
}
public String getEqualToOperator() {
return "==";
return "=="; //$NON-NLS-1$
}
public String getNotEqualToOperator() {
return "!=";
return "!="; //$NON-NLS-1$
}
public String getLessThenEqualToOperator() {
return "<=";
return "<="; //$NON-NLS-1$
}
public String getValueChangeOperatorsRegex() {
return "(\\+\\+)|(\\-\\-)|(\\+\\=)|"
+ "(\\-\\=)|(\\*\\=)|(/\\=)|(\\&\\=)"
+ "(\\%\\=)|(\\^\\=)|(\\|\\=)|(\\<\\<\\=)|(\\>\\>\\=)";
return "(\\+\\+)|(\\-\\-)|(\\+\\=)|" //$NON-NLS-1$
+ "(\\-\\=)|(\\*\\=)|(/\\=)|(\\&\\=)" //$NON-NLS-1$
+ "(\\%\\=)|(\\^\\=)|(\\|\\=)|(\\<\\<\\=)|(\\>\\>\\=)"; //$NON-NLS-1$
}
public String getEqualToOperatorsRegex() {
return "\\=\\=|\\<\\=|\\>\\=|!\\=";
return "\\=\\=|\\<\\=|\\>\\=|!\\="; //$NON-NLS-1$
}
public String getIdentifierRegex() {
return "[_A-Za-z][_A-Za-z0-9]*";
return "[_A-Za-z][_A-Za-z0-9]*"; //$NON-NLS-1$
}
}
@ -127,37 +127,32 @@ public class DebugTextHover implements ICEditorTextHover, ITextHoverExtension,
// evaluated.
if (match_found) {
return null;
} else {
pattern = Pattern.compile(operatorsObj
.getEqualToOperatorsRegex());
String[] tokens = pattern.split(expression);
for (int i = 0; i < tokens.length; i++) {
//If the expression contains assignment operator that
// can change the value of a variable, the expression
// should not be evaluated.
if (tokens[i].indexOf(operatorsObj
.getAssignmentOperator()) != -1)
return null;
}
//Supressing function calls from evaluation.
String functionCallRegex = operatorsObj
.getIdentifierRegex()
+ "\\s*\\(";
pattern = Pattern.compile(functionCallRegex);
matcher = pattern.matcher(expression);
match_found = matcher.find();
if (match_found) {
}
pattern = Pattern.compile(operatorsObj
.getEqualToOperatorsRegex());
String[] tokens = pattern.split(expression);
for (int i = 0; i < tokens.length; i++) {
//If the expression contains assignment operator that
// can change the value of a variable, the expression
// should not be evaluated.
if (tokens[i].indexOf(operatorsObj
.getAssignmentOperator()) != -1)
return null;
}
}
//Supressing function calls from evaluation.
String functionCallRegex = operatorsObj.getIdentifierRegex() + "\\s*\\("; //$NON-NLS-1$
pattern = Pattern.compile(functionCallRegex);
matcher = pattern.matcher(expression);
match_found = matcher.find();
if (match_found) {
return null;
}
StringBuffer buffer = new StringBuffer();
String result = evaluateExpression(frame, expression);
if (result == null)
return null;
try {
if (result != null)
appendVariable(buffer, makeHTMLSafe(expression),
makeHTMLSafe(result.trim()));
appendVariable(buffer, makeHTMLSafe(expression), makeHTMLSafe(result.trim()));
} catch (DebugException x) {
CDebugUIPlugin.log(x);
}
@ -199,8 +194,7 @@ public class DebugTextHover implements ICEditorTextHover, ITextHoverExtension,
/**
* Append HTML for the given variable to the given buffer
*/
private static void appendVariable(StringBuffer buffer, String expression,
String value) throws DebugException {
private static void appendVariable(StringBuffer buffer, String expression, String value) throws DebugException {
if (value.length() > MAX_HOVER_INFO_SIZE)
value = value.substring(0, MAX_HOVER_INFO_SIZE) + " ..."; //$NON-NLS-1$
buffer.append("<p>"); //$NON-NLS-1$

View file

@ -11,8 +11,8 @@
package org.eclipse.cdt.debug.internal.ui.preferences;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.util.Assert;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

View file

@ -41,11 +41,9 @@ public class SignalsViewContentProvider implements IStructuredContentProvider {
if ( inputElement instanceof ICDebugTarget ) {
ICDebugTarget target = (ICDebugTarget)inputElement;
try {
if ( target != null ) {
Object[] signals = target.getSignals();
if ( signals != null )
return signals;
}
Object[] signals = target.getSignals();
if ( signals != null )
return signals;
}
catch( DebugException e ) {
if ( getExceptionHandler() != null )

View file

@ -30,7 +30,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.Job;
@ -66,7 +65,7 @@ public abstract class AbstractImportExecutableWizard extends Wizard implements I
private void waitForJob(String name)
{
IJobManager jobMan = Platform.getJobManager();
IJobManager jobMan = Job.getJobManager();
Job[] jobs = jobMan.find(null);
for (int i = 0; i < jobs.length; i++) {
@ -151,7 +150,7 @@ public abstract class AbstractImportExecutableWizard extends Wizard implements I
setConfigurationDefaults(wc, targetProject);
final IStructuredSelection selection = new StructuredSelection(wc.doSave());
final String identifier = new String("org.eclipse.debug.ui.launchGroup.debug");
final String identifier = new String("org.eclipse.debug.ui.launchGroup.debug"); //$NON-NLS-1$
UIJob openLaunchConfigJob = new UIJob(Messages.AbstractImportExecutableWizard_CreateLaunchConfiguration) {