diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog
index 63d10b0b6ae..4fa8453e8a2 100644
--- a/debug/org.eclipse.cdt.debug.core/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.core/ChangeLog
@@ -1,3 +1,10 @@
+2004-05-20 Mikhail Khodjaiants
+ The "IStackFrameInfo" interface is removed and it's methods moved to "ICStackFrame".
+ * ICStackFrameInfo: removed
+ * CStackFrame.java
+ * CSourceLocator.java
+ * CSourceManager.java
+
2004-05-19 Mikhail Khodjaiants
Added the support of watch expressions.
* CDIDebugModel.java
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IStackFrameInfo.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IStackFrameInfo.java
deleted file mode 100644
index b3b6c45e044..00000000000
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IStackFrameInfo.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *(c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- *
- */
-
-package org.eclipse.cdt.debug.core.model;
-
-import org.eclipse.debug.core.model.IVariable;
-
-/**
- *
- * Provides the access to the stack frame information.
- *
- * @since Aug 16, 2002
- */
-public interface IStackFrameInfo
-{
- /**
- * Returns the address of this stack frame.
- *
- * @return the address of this stack frame
- */
- long getAddress();
-
- /**
- * Returns the source file of this stack frame or null
- * if the source file is unknown.
- *
- * @return the source file of this stack frame
- */
- String getFile();
-
- /**
- * Returns the function of this stack frame or null
- * if the function is unknown.
- *
- * @return the function of this stack frame
- */
- String getFunction();
-
- /**
- * Returns the line number of this stack frame or 0
- * if the line number is unknown.
- *
- * @return the line number of this stack frame
- */
- int getFrameLineNumber();
-
- /**
- * Returns the level of this stack frame.
- *
- * @return the level of this stack frame
- */
- int getLevel();
-
- /**
- * Returns the arguments of this stack frame.
- *
- * @return the arguments of this stack frame
- */
- IVariable[] getArguments();
-}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java
index 75ada20bb3b..0557da42140 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java
@@ -1,9 +1,13 @@
-/*
- *(c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
*
- */
-
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ ***********************************************************************/
package org.eclipse.cdt.debug.internal.core.model;
import java.text.NumberFormat;
@@ -23,7 +27,6 @@ import org.eclipse.cdt.debug.core.model.IRestart;
import org.eclipse.cdt.debug.core.model.IResumeWithoutSignal;
import org.eclipse.cdt.debug.core.model.IRunToAddress;
import org.eclipse.cdt.debug.core.model.IRunToLine;
-import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.internal.core.CExpressionTarget;
import org.eclipse.core.runtime.IAdaptable;
@@ -36,18 +39,10 @@ import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.IVariable;
/**
- *
* Proxy to a stack frame on the target.
- *
- * @since Aug 7, 2002
*/
-public class CStackFrame extends CDebugElement
- implements ICStackFrame,
- IStackFrameInfo,
- IRestart,
- IResumeWithoutSignal,
- ICDIEventListener
-{
+public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart, IResumeWithoutSignal, ICDIEventListener {
+
/**
* Underlying CDI stack frame.
*/
@@ -75,47 +70,45 @@ public class CStackFrame extends CDebugElement
/**
* Constructor for CStackFrame.
+ *
* @param target
*/
- public CStackFrame( CThread thread, ICDIStackFrame cdiFrame )
- {
+ public CStackFrame( CThread thread, ICDIStackFrame cdiFrame ) {
super( (CDebugTarget)thread.getDebugTarget() );
setCDIStackFrame( cdiFrame );
setThread( thread );
getCDISession().getEventManager().addEventListener( this );
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#getThread()
*/
- public IThread getThread()
- {
+ public IThread getThread() {
return fThread;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#getVariables()
*/
- public IVariable[] getVariables() throws DebugException
- {
+ public IVariable[] getVariables() throws DebugException {
List list = getVariables0();
return (IVariable[])list.toArray( new IVariable[list.size()] );
}
- protected synchronized List getVariables0() throws DebugException
- {
- if ( fVariables == null )
- {
+ protected synchronized List getVariables0() throws DebugException {
+ if ( fVariables == null ) {
List vars = getAllCDIVariableObjects();
fVariables = new ArrayList( vars.size() );
Iterator it = vars.iterator();
- while( it.hasNext() )
- {
+ while( it.hasNext() ) {
fVariables.add( new CModificationVariable( this, (ICDIVariableObject)it.next() ) );
}
}
- else if ( refreshVariables() )
- {
+ else if ( refreshVariables() ) {
updateVariables();
}
setRefreshVariables( false );
@@ -124,31 +117,25 @@ public class CStackFrame extends CDebugElement
/**
* Incrementally updates this stack frame's variables.
- *
+ *
*/
- protected void updateVariables() throws DebugException
- {
+ protected void updateVariables() throws DebugException {
List locals = getAllCDIVariableObjects();
int index = 0;
- while( index < fVariables.size() )
- {
+ while( index < fVariables.size() ) {
ICDIVariableObject varObject = findVariable( locals, (CVariable)fVariables.get( index ) );
- if ( varObject != null )
- {
+ if ( varObject != null ) {
locals.remove( varObject );
index++;
}
- else
- {
+ else {
// remove variable
fVariables.remove( index );
}
}
-
// add any new locals
Iterator newOnes = locals.iterator();
- while( newOnes.hasNext() )
- {
+ while( newOnes.hasNext() ) {
fVariables.add( new CModificationVariable( this, (ICDIVariableObject)newOnes.next() ) );
}
}
@@ -156,31 +143,31 @@ public class CStackFrame extends CDebugElement
/**
* Sets the containing thread.
*
- * @param thread the containing thread
+ * @param thread
+ * the containing thread
*/
- protected void setThread( CThread thread )
- {
+ protected void setThread( CThread thread ) {
fThread = thread;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#hasVariables()
*/
- public boolean hasVariables() throws DebugException
- {
+ public boolean hasVariables() throws DebugException {
return getVariables0().size() > 0;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#getLineNumber()
*/
- public int getLineNumber() throws DebugException
- {
- if ( isSuspended() )
- {
+ public int getLineNumber() throws DebugException {
+ if ( isSuspended() ) {
ISourceLocator locator = ((CDebugTarget)getDebugTarget()).getSourceLocator();
- if ( locator != null && locator instanceof IAdaptable &&
- ((IAdaptable)locator).getAdapter( ICSourceLocator.class ) != null )
+ if ( locator != null && locator instanceof IAdaptable && ((IAdaptable)locator).getAdapter( ICSourceLocator.class ) != null )
return ((ICSourceLocator)((IAdaptable)locator).getAdapter( ICSourceLocator.class )).getLineNumber( this );
if ( getCDIStackFrame() != null && getCDIStackFrame().getLocation() != null )
return getCDIStackFrame().getLocation().getLineNumber();
@@ -188,302 +175,289 @@ public class CStackFrame extends CDebugElement
return -1;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#getCharStart()
*/
- public int getCharStart() throws DebugException
- {
+ public int getCharStart() throws DebugException {
return -1;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#getCharEnd()
*/
- public int getCharEnd() throws DebugException
- {
+ public int getCharEnd() throws DebugException {
return -1;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#getName()
*/
- public String getName() throws DebugException
- {
+ public String getName() throws DebugException {
ICDILocation location = getCDIStackFrame().getLocation();
-
- String func = ""; //$NON-NLS-1$
- String file = ""; //$NON-NLS-1$
- String line = ""; //$NON-NLS-1$
-
+ String func = ""; //$NON-NLS-1$
+ String file = ""; //$NON-NLS-1$
+ String line = ""; //$NON-NLS-1$
if ( location.getFunction() != null && location.getFunction().trim().length() > 0 )
func += location.getFunction() + "() "; //$NON-NLS-1$
-
- if ( location.getFile() != null && location.getFile().trim().length() > 0 )
- {
+ if ( location.getFile() != null && location.getFile().trim().length() > 0 ) {
file = location.getFile();
-
if ( location.getLineNumber() != 0 ) {
- line = NumberFormat.getInstance().format(new Integer(location.getLineNumber()));
+ line = NumberFormat.getInstance().format( new Integer( location.getLineNumber() ) );
}
- } else {
+ }
+ else {
return func;
}
- return CDebugCorePlugin.getFormattedString("internal.core.model.CStackFrame.function_at_file", new String[] {func, file}) + line; //$NON-NLS-1$
-
+ return CDebugCorePlugin.getFormattedString( "internal.core.model.CStackFrame.function_at_file", new String[]{ func, file } ) + line; //$NON-NLS-1$
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#getRegisterGroups()
*/
- public IRegisterGroup[] getRegisterGroups() throws DebugException
- {
+ public IRegisterGroup[] getRegisterGroups() throws DebugException {
return ((CDebugTarget)getDebugTarget()).getRegisterGroups();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#hasRegisterGroups()
*/
- public boolean hasRegisterGroups() throws DebugException
- {
+ public boolean hasRegisterGroups() throws DebugException {
return ((CDebugTarget)getDebugTarget()).getRegisterGroups().length > 0;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(ICDIEvent)
*/
- public void handleDebugEvents( ICDIEvent[] events )
- {
+ public void handleDebugEvents( ICDIEvent[] events ) {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#canStepInto()
*/
- public boolean canStepInto()
- {
- try
- {
+ public boolean canStepInto() {
+ try {
return exists() && isTopStackFrame() && getThread().canStepInto();
}
- catch( DebugException e )
- {
+ catch( DebugException e ) {
logError( e );
return false;
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#canStepOver()
*/
- public boolean canStepOver()
- {
- try
- {
+ public boolean canStepOver() {
+ try {
return exists() && getThread().canStepOver();
}
- catch( DebugException e )
- {
+ catch( DebugException e ) {
logError( e );
}
return false;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#canStepReturn()
*/
- public boolean canStepReturn()
- {
- try
- {
- if ( !exists() )
- {
+ public boolean canStepReturn() {
+ try {
+ if ( !exists() ) {
return false;
}
List frames = ((CThread)getThread()).computeStackFrames();
- if ( frames != null && !frames.isEmpty() )
- {
+ if ( frames != null && !frames.isEmpty() ) {
boolean bottomFrame = this.equals( frames.get( frames.size() - 1 ) );
return !bottomFrame && getThread().canStepReturn();
}
}
- catch( DebugException e )
- {
+ catch( DebugException e ) {
logError( e );
}
return false;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#isStepping()
*/
- public boolean isStepping()
- {
+ public boolean isStepping() {
return getThread().isStepping();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#stepInto()
*/
- public void stepInto() throws DebugException
- {
- if ( canStepInto() )
- {
+ public void stepInto() throws DebugException {
+ if ( canStepInto() ) {
getThread().stepInto();
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#stepOver()
*/
- public void stepOver() throws DebugException
- {
- if ( !canStepOver() )
- {
+ public void stepOver() throws DebugException {
+ if ( !canStepOver() ) {
return;
}
- if ( isTopStackFrame() )
- {
+ if ( isTopStackFrame() ) {
getThread().stepOver();
}
- else
- {
-// ((CThread)getThread()).stepToFrame( this );
+ else {
+ // ((CThread)getThread()).stepToFrame( this );
getThread().stepOver(); // for now
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#stepReturn()
*/
- public void stepReturn() throws DebugException
- {
- if ( !canStepReturn() )
- {
+ public void stepReturn() throws DebugException {
+ if ( !canStepReturn() ) {
return;
}
- if ( isTopStackFrame() )
- {
+ if ( isTopStackFrame() ) {
getThread().stepReturn();
}
- else
- {
-/*
- List frames = ((CThread)getThread()).computeStackFrames();
- int index = frames.indexOf( this );
- if ( index >= 0 && index < frames.size() - 1 )
- {
- IStackFrame nextFrame = (IStackFrame)frames.get( index + 1 );
- ((CThread)getThread()).stepToFrame( nextFrame );
- }
-*/
+ else {
+ /*
+ * List frames = ((CThread)getThread()).computeStackFrames(); int index = frames.indexOf( this ); if ( index >= 0 && index < frames.size() - 1 ) {
+ * IStackFrame nextFrame = (IStackFrame)frames.get( index + 1 ); ((CThread)getThread()).stepToFrame( nextFrame ); }
+ */
getThread().stepReturn(); // for now
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#canResume()
*/
- public boolean canResume()
- {
+ public boolean canResume() {
return getThread().canResume();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
*/
- public boolean canSuspend()
- {
+ public boolean canSuspend() {
return getThread().canSuspend();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
*/
- public boolean isSuspended()
- {
+ public boolean isSuspended() {
return getThread().isSuspended();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#resume()
*/
- public void resume() throws DebugException
- {
+ public void resume() throws DebugException {
getThread().resume();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#suspend()
*/
- public void suspend() throws DebugException
- {
+ public void suspend() throws DebugException {
getThread().suspend();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ITerminate#canTerminate()
*/
- public boolean canTerminate()
- {
+ public boolean canTerminate() {
boolean exists = false;
- try
- {
+ try {
exists = exists();
}
- catch( DebugException e )
- {
+ catch( DebugException e ) {
logError( e );
}
return exists && getThread().canTerminate() || getDebugTarget().canTerminate();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ITerminate#isTerminated()
*/
- public boolean isTerminated()
- {
+ public boolean isTerminated() {
return getThread().isTerminated();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ITerminate#terminate()
*/
- public void terminate() throws DebugException
- {
- if ( getThread().canTerminate() )
- {
+ public void terminate() throws DebugException {
+ if ( getThread().canTerminate() ) {
getThread().terminate();
}
- else
- {
+ else {
getDebugTarget().terminate();
}
}
/**
- * Returns the underlying CDI stack frame that this model object is
- * a proxy to.
+ * Returns the underlying CDI stack frame that this model object is a proxy to.
*
* @return the underlying CDI stack frame
*/
- protected ICDIStackFrame getCDIStackFrame()
- {
+ protected ICDIStackFrame getCDIStackFrame() {
return fCDIStackFrame;
}
/**
- * Sets the underlying CDI stack frame. Called by a thread
- * when incrementally updating after a step has completed.
+ * Sets the underlying CDI stack frame. Called by a thread when incrementally updating after a step has completed.
*
- * @param frame the underlying stack frame
+ * @param frame
+ * the underlying stack frame
*/
- protected void setCDIStackFrame( ICDIStackFrame frame )
- {
- if ( frame != null )
- {
+ protected void setCDIStackFrame( ICDIStackFrame frame ) {
+ if ( frame != null ) {
fLastCDIStackFrame = frame;
}
- else
- {
+ else {
fLastCDIStackFrame = fCDIStackFrame;
}
fCDIStackFrame = frame;
@@ -491,318 +465,251 @@ public class CStackFrame extends CDebugElement
}
/**
- * The underlying stack frame that existed before the current underlying
- * stack frame. Used only so that equality can be checked on stack frame
- * after the new one has been set.
+ * The underlying stack frame that existed before the current underlying stack frame. Used only so that equality can be checked on stack frame after the new
+ * one has been set.
*/
- protected ICDIStackFrame getLastCDIStackFrame()
- {
+ protected ICDIStackFrame getLastCDIStackFrame() {
return fLastCDIStackFrame;
}
/**
- * Helper method for computeStackFrames(). For the purposes of detecting if
- * an underlying stack frame needs to be disposed, stack frames are equal if
- * the frames are equal and the locations are equal.
+ * Helper method for computeStackFrames(). For the purposes of detecting if an underlying stack frame needs to be disposed, stack frames are equal if the
+ * frames are equal and the locations are equal.
*/
- protected static boolean equalFrame( ICDIStackFrame frameOne, ICDIStackFrame frameTwo )
- {
+ protected static boolean equalFrame( ICDIStackFrame frameOne, ICDIStackFrame frameTwo ) {
if ( frameOne == null || frameTwo == null )
return false;
ICDILocation loc1 = frameOne.getLocation();
ICDILocation loc2 = frameTwo.getLocation();
if ( loc1 == null || loc2 == null )
return false;
- if ( loc1.getFile() != null && loc1.getFile().length() > 0 &&
- loc2.getFile() != null && loc2.getFile().length() > 0 &&
- loc1.getFile().equals( loc2.getFile() ) )
-
- {
- if ( loc1.getFunction() != null && loc1.getFunction().length() > 0 &&
- loc2.getFunction() != null && loc2.getFunction().length() > 0 &&
- loc1.getFunction().equals( loc2.getFunction() ) )
+ if ( loc1.getFile() != null && loc1.getFile().length() > 0 && loc2.getFile() != null && loc2.getFile().length() > 0 && loc1.getFile().equals( loc2.getFile() ) ) {
+ if ( loc1.getFunction() != null && loc1.getFunction().length() > 0 && loc2.getFunction() != null && loc2.getFunction().length() > 0 && loc1.getFunction().equals( loc2.getFunction() ) )
return true;
}
- if ( ( loc1.getFile() == null || loc1.getFile().length() < 1 ) &&
- ( loc2.getFile() == null || loc2.getFile().length() < 1 ) )
-
- {
- if ( loc1.getFunction() != null && loc1.getFunction().length() > 0 &&
- loc2.getFunction() != null && loc2.getFunction().length() > 0 &&
- loc1.getFunction().equals( loc2.getFunction() ) )
+ if ( (loc1.getFile() == null || loc1.getFile().length() < 1) && (loc2.getFile() == null || loc2.getFile().length() < 1) ) {
+ if ( loc1.getFunction() != null && loc1.getFunction().length() > 0 && loc2.getFunction() != null && loc2.getFunction().length() > 0 && loc1.getFunction().equals( loc2.getFunction() ) )
return true;
}
- if ( ( loc1.getFile() == null || loc1.getFile().length() < 1 ) &&
- ( loc2.getFile() == null || loc2.getFile().length() < 1 ) &&
- ( loc1.getFunction() == null || loc1.getFunction().length() < 1 ) &&
- ( loc2.getFunction() == null || loc2.getFunction().length() < 1 ) )
- {
+ if ( (loc1.getFile() == null || loc1.getFile().length() < 1) && (loc2.getFile() == null || loc2.getFile().length() < 1) && (loc1.getFunction() == null || loc1.getFunction().length() < 1) && (loc2.getFunction() == null || loc2.getFunction().length() < 1) ) {
if ( loc1.getAddress() == loc2.getAddress() )
return true;
}
- return false;
+ return false;
}
- protected boolean exists() throws DebugException
- {
+ protected boolean exists() throws DebugException {
return ((CThread)getThread()).computeStackFrames().indexOf( this ) != -1;
}
/**
* @see IAdaptable#getAdapter(Class)
*/
- public Object getAdapter( Class adapter )
- {
+ public Object getAdapter( Class adapter ) {
if ( adapter == IRunToLine.class ) {
return getDebugTarget().getAdapter( adapter );
}
if ( adapter == IRunToAddress.class ) {
return getDebugTarget().getAdapter( adapter );
}
- if ( adapter == IStackFrame.class )
- {
+ if ( adapter == IStackFrame.class ) {
return this;
}
- if ( adapter == ICDIStackFrame.class )
- {
+ if ( adapter == ICDIStackFrame.class ) {
return getCDIStackFrame();
}
- if ( adapter == IStackFrameInfo.class )
- {
- return this;
- }
return super.getAdapter( adapter );
}
-
- protected void dispose()
- {
+
+ protected void dispose() {
getCDISession().getEventManager().removeEventListener( this );
disposeAllVariables();
}
-
+
/**
- * Retrieves local variables in this stack frame. Returns an empty
- * list if there are no local variables.
- *
+ * Retrieves local variables in this stack frame. Returns an empty list if there are no local variables.
+ *
*/
- protected List getCDILocalVariableObjects() throws DebugException
- {
+ protected List getCDILocalVariableObjects() throws DebugException {
List list = new ArrayList();
- try
- {
+ try {
list.addAll( Arrays.asList( getCDISession().getVariableManager().getLocalVariableObjects( getCDIStackFrame() ) ) );
}
- catch( CDIException e )
- {
- targetRequestFailed( e.getMessage(), null );
- }
- return list;
- }
-
- /**
- * Retrieves arguments in this stack frame. Returns an empty list
- * if there are no arguments.
- *
- */
- protected List getCDIArgumentObjects() throws DebugException
- {
- List list = new ArrayList();
- try
- {
- list.addAll( Arrays.asList( getCDISession().getVariableManager().getArgumentObjects( getCDIStackFrame() ) ) );
- }
- catch( CDIException e )
- {
+ catch( CDIException e ) {
targetRequestFailed( e.getMessage(), null );
}
return list;
}
-/*
- protected List getAllCDIVariables() throws DebugException
- {
+
+ /**
+ * Retrieves arguments in this stack frame. Returns an empty list if there are no arguments.
+ *
+ */
+ protected List getCDIArgumentObjects() throws DebugException {
List list = new ArrayList();
- list.addAll( getCDIArguments() );
- list.addAll( getCDILocalVariables() );
+ try {
+ list.addAll( Arrays.asList( getCDISession().getVariableManager().getArgumentObjects( getCDIStackFrame() ) ) );
+ }
+ catch( CDIException e ) {
+ targetRequestFailed( e.getMessage(), null );
+ }
return list;
- }
-*/
- protected List getAllCDIVariableObjects() throws DebugException
- {
+ }
+
+ /*
+ * protected List getAllCDIVariables() throws DebugException { List list = new ArrayList(); list.addAll( getCDIArguments() ); list.addAll(
+ * getCDILocalVariables() ); return list; }
+ */
+ protected List getAllCDIVariableObjects() throws DebugException {
List list = new ArrayList();
list.addAll( getCDIArgumentObjects() );
list.addAll( getCDILocalVariableObjects() );
return list;
- }
+ }
- protected boolean isTopStackFrame() throws DebugException
- {
+ protected boolean isTopStackFrame() throws DebugException {
IStackFrame tos = getThread().getTopStackFrame();
return tos != null && tos.equals( this );
}
-
- protected void disposeAllVariables()
- {
+
+ protected void disposeAllVariables() {
if ( fVariables == null )
return;
Iterator it = fVariables.iterator();
- while( it.hasNext() )
- {
+ while( it.hasNext() ) {
((CVariable)it.next()).dispose();
}
fVariables = null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.cdt.debug.core.IStackFrameInfo#getAddress()
*/
- public long getAddress()
- {
+ public long getAddress() {
return getCDIStackFrame().getLocation().getAddress();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.cdt.debug.core.IStackFrameInfo#getFile()
*/
- public String getFile()
- {
+ public String getFile() {
return getCDIStackFrame().getLocation().getFile();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.cdt.debug.core.IStackFrameInfo#getFunction()
*/
- public String getFunction()
- {
+ public String getFunction() {
return getCDIStackFrame().getLocation().getFunction();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.cdt.debug.core.IStackFrameInfo#getLevel()
*/
- public int getLevel()
- {
+ public int getLevel() {
return getCDIStackFrame().getLevel();
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.IStackFrameInfo#getFrameLineNumber()
- */
- public int getFrameLineNumber()
- {
- return getCDIStackFrame().getLocation().getLineNumber();
- }
/*
- * @see org.eclipse.cdt.debug.core.IStackFrameInfo#getArguments()
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.debug.core.IStackFrameInfo#getFrameLineNumber()
*/
- public IVariable[] getArguments()
- {
- ArrayList list = new ArrayList();
- IVariable[] vars = new IVariable[0];
- try
- {
- vars = getVariables();
- }
- catch( DebugException e )
- {
- CDebugCorePlugin.log( e );
- }
- for ( int i = 0; i < vars.length; ++i )
- {
- if ( vars[i] instanceof CVariable && ((CVariable)vars[i]).isArgument() )
- {
- list.add( vars[i] );
- }
- }
- return (IVariable[])list.toArray( new IVariable[list.size()] );
+ public int getFrameLineNumber() {
+ return getCDIStackFrame().getLocation().getLineNumber();
}
-
- protected synchronized void preserve()
- {
+
+ protected synchronized void preserve() {
preserveVariables();
}
- private void preserveVariables()
- {
+ private void preserveVariables() {
if ( fVariables == null )
return;
- try
- {
+ try {
Iterator it = fVariables.iterator();
- while( it.hasNext() )
- {
+ while( it.hasNext() ) {
((CVariable)it.next()).setChanged( false );
}
}
- catch( DebugException e )
- {
+ catch( DebugException e ) {
CDebugCorePlugin.log( e );
}
}
-
- protected ICDIVariableObject findVariable( List list, CVariable var )
- {
+
+ protected ICDIVariableObject findVariable( List list, CVariable var ) {
Iterator it = list.iterator();
- while( it.hasNext() )
- {
+ while( it.hasNext() ) {
ICDIVariableObject newVarObject = (ICDIVariableObject)it.next();
if ( var.sameVariableObject( newVarObject ) )
return newVarObject;
}
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.cdt.debug.core.IRestart#canRestart()
*/
- public boolean canRestart()
- {
+ public boolean canRestart() {
return getDebugTarget() instanceof IRestart && ((IRestart)getDebugTarget()).canRestart();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.cdt.debug.core.IRestart#restart()
*/
- public void restart() throws DebugException
- {
- if ( canRestart() )
- {
+ public void restart() throws DebugException {
+ if ( canRestart() ) {
((IRestart)getDebugTarget()).restart();
}
}
-
- private void setRefreshVariables( boolean refresh )
- {
+
+ private void setRefreshVariables( boolean refresh ) {
fRefreshVariables = refresh;
}
-
- private boolean refreshVariables()
- {
+
+ private boolean refreshVariables() {
return fRefreshVariables;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#canResumeWithoutSignal()
*/
- public boolean canResumeWithoutSignal()
- {
- return ( getDebugTarget() instanceof IResumeWithoutSignal &&
- ((IResumeWithoutSignal)getDebugTarget()).canResumeWithoutSignal() );
+ public boolean canResumeWithoutSignal() {
+ return (getDebugTarget() instanceof IResumeWithoutSignal && ((IResumeWithoutSignal)getDebugTarget()).canResumeWithoutSignal());
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#resumeWithoutSignal()
*/
- public void resumeWithoutSignal() throws DebugException
- {
- if ( canResumeWithoutSignal() )
- {
+ public void resumeWithoutSignal() throws DebugException {
+ if ( canResumeWithoutSignal() ) {
((IResumeWithoutSignal)getDebugTarget()).resumeWithoutSignal();
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.cdt.debug.core.model.ICStackFrame#evaluateExpression(java.lang.String)
*/
public IValue evaluateExpression( String expression ) throws DebugException {
CExpressionTarget target = (CExpressionTarget)getDebugTarget().getAdapter( CExpressionTarget.class );
- return ( target != null ) ? target.evaluateExpression( expression ) : null;
+ return (target != null) ? target.evaluateExpression( expression ) : null;
}
-}
+}
\ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java
index 033606e2c7d..2885e0022c6 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java
@@ -15,15 +15,13 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
-
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugUtils;
-import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
+import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.core.sourcelookup.IProjectSourceLocation;
@@ -42,6 +40,7 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.IPersistableSourceLocator;
import org.eclipse.debug.core.model.IStackFrame;
+import org.osgi.framework.Bundle;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -103,11 +102,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
*/
public Object getSourceElement( IStackFrame stackFrame )
{
- if ( stackFrame != null && stackFrame.getAdapter( IStackFrameInfo.class ) != null )
- {
- return getInput( (IStackFrameInfo)stackFrame.getAdapter( IStackFrameInfo.class ) );
- }
- return null;
+ return getInput( stackFrame );
}
/* (non-Javadoc)
@@ -115,43 +110,47 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
*/
public int getLineNumber( IStackFrame frame )
{
- IStackFrameInfo info = (IStackFrameInfo)frame.getAdapter( IStackFrameInfo.class );
- return ( info != null ) ? info.getFrameLineNumber() : 0;
+ return ( frame instanceof ICStackFrame ) ? ((ICStackFrame)frame).getFrameLineNumber() : 0;
}
- protected Object getInput( IStackFrameInfo info )
+ protected Object getInput( IStackFrame f )
{
- LinkedList list = new LinkedList();
- if ( info != null )
+ if ( f instanceof ICStackFrame )
{
- Object result = null;
- String fileName = info.getFile();
- if ( fileName != null && fileName.length() > 0 )
+ ICStackFrame frame = (ICStackFrame)f;
+ LinkedList list = new LinkedList();
+ if ( frame != null )
{
- ICSourceLocation[] locations = getSourceLocations();
- for ( int i = 0; i < locations.length; ++i )
+ Object result = null;
+ String fileName = frame.getFile();
+ if ( fileName != null && fileName.length() > 0 )
{
- try
+ ICSourceLocation[] locations = getSourceLocations();
+ for ( int i = 0; i < locations.length; ++i )
{
- 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;
+ 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;
+ }
}
}
- }
- }
- return ( list.size() > 0 ) ? ( ( list.size() == 1 ) ? list.getFirst() : list ) : null;
+ }
+ return ( list.size() > 0 ) ? ( ( list.size() == 1 ) ? list.getFirst() : list ) : null;
+ }
+ return null;
}
/* (non-Javadoc)
@@ -415,7 +414,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
private void addAdditionalLocations( Element root, List sourceLocations ) throws CoreException
{
- ClassLoader classLoader = CDebugCorePlugin.getDefault() .getDescriptor().getPluginClassLoader();
+ Bundle bundle = CDebugCorePlugin.getDefault().getBundle();
MultiStatus status = new MultiStatus( CDebugCorePlugin.getUniqueIdentifier(),
CDebugCorePlugin.INTERNAL_ERROR,
@@ -442,7 +441,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
Class clazz = null;
try
{
- clazz = classLoader.loadClass( className );
+ clazz = bundle.loadClass( className );
}
catch( ClassNotFoundException e )
{
@@ -483,7 +482,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
private void addOldLocations( Element root, List sourceLocations ) throws CoreException
{
- ClassLoader classLoader = CDebugCorePlugin.getDefault() .getDescriptor().getPluginClassLoader();
+ Bundle bundle = CDebugCorePlugin.getDefault().getBundle();
NodeList list = root.getChildNodes();
int length = list.getLength();
@@ -506,7 +505,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
Class clazz = null;
try
{
- clazz = classLoader.loadClass( className );
+ clazz = bundle.loadClass( className );
}
catch( ClassNotFoundException e )
{
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java
index 0844a1236c6..78cb2617ab7 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java
@@ -10,7 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.debug.internal.core.sourcelookup;
-import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
+import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
@@ -54,9 +54,8 @@ public class CSourceManager implements ICSourceLocator, IPersistableSourceLocato
if ( getCSourceLocator() != null ) {
return getCSourceLocator().getLineNumber( frame );
}
- IStackFrameInfo info = (IStackFrameInfo)frame.getAdapter( IStackFrameInfo.class );
- if ( info != null ) {
- return info.getFrameLineNumber();
+ if ( frame instanceof ICStackFrame ) {
+ return ((ICStackFrame)frame).getFrameLineNumber();
}
return 0;
}
diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog
index 9b555eca152..8f94814a92f 100644
--- a/debug/org.eclipse.cdt.debug.ui/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog
@@ -1,3 +1,11 @@
+2004-05-20 Mikhail Khodjaiants
+ The "IStackFrameInfo" interface is removed and it's methods moved to "ICStackFrame".
+ * CDTDebugModelPresentation.java
+ * FileNotFoundElement.java
+ * DefaultSourceLocator.java
+ * SourceLookupBlock.java
+ * SourceLookupLabelProvider.java
+
2004-05-19 Mikhail Khodjaiants
Added the support of watch expressions.
* CDTDebugModelPresentation.java
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java
index 2cc7e45bab4..cb655211927 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java
@@ -8,7 +8,6 @@ package org.eclipse.cdt.debug.internal.ui;
import java.text.MessageFormat;
import java.util.HashMap;
-
import org.eclipse.cdt.core.resources.FileStorage;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointHit;
@@ -26,12 +25,12 @@ import org.eclipse.cdt.debug.core.model.ICDebugTargetType;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
+import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.model.ICType;
import org.eclipse.cdt.debug.core.model.ICValue;
import org.eclipse.cdt.debug.core.model.ICVariable;
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
import org.eclipse.cdt.debug.core.model.IDummyStackFrame;
-import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
import org.eclipse.cdt.debug.core.model.IState;
import org.eclipse.cdt.debug.internal.ui.editors.CDebugEditor;
import org.eclipse.cdt.debug.internal.ui.editors.EditorInputDelegate;
@@ -60,7 +59,6 @@ import org.eclipse.debug.core.model.IThread;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.IVariable;
import org.eclipse.debug.core.model.IWatchExpression;
-import org.eclipse.debug.internal.ui.DebugUIMessages;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugModelPresentation;
@@ -516,16 +514,16 @@ public class CDTDebugModelPresentation extends LabelProvider
return getFormattedString( CDebugUIPlugin.getResourceString("internal.ui.CDTDebugModelPresentation.Thread_threadName_suspended"), thread.getName() ); //$NON-NLS-1$
}
- protected String getStackFrameText( IStackFrame stackFrame, boolean qualified ) throws DebugException
+ protected String getStackFrameText( IStackFrame f, boolean qualified ) throws DebugException
{
- IStackFrameInfo info = (IStackFrameInfo)stackFrame.getAdapter( IStackFrameInfo.class );
- if ( info != null )
+ if ( f instanceof ICStackFrame )
{
+ ICStackFrame frame = (ICStackFrame)f;
StringBuffer label = new StringBuffer();
- label.append( info.getLevel() );
+ label.append( frame.getLevel() );
label.append( ' ' );
- String function = info.getFunction();
+ String function = frame.getFunction();
if ( function != null )
{
function = function.trim();
@@ -533,16 +531,16 @@ public class CDTDebugModelPresentation extends LabelProvider
{
label.append( function );
label.append( "() " ); //$NON-NLS-1$
- if ( info.getFile() != null )
+ if ( frame.getFile() != null )
{
- IPath path = new Path( info.getFile() );
+ IPath path = new Path( frame.getFile() );
if ( !path.isEmpty() )
{
label.append( CDebugUIPlugin.getResourceString("internal.ui.CDTDebugModelPresentation.at")+" " ); //$NON-NLS-1$ //$NON-NLS-2$
label.append( ( qualified ? path.toOSString() : path.lastSegment() ) );
label.append( ":" ); //$NON-NLS-1$
- if ( info.getFrameLineNumber() != 0 )
- label.append( info.getFrameLineNumber() );
+ if ( frame.getFrameLineNumber() != 0 )
+ label.append( frame.getFrameLineNumber() );
}
}
}
@@ -551,8 +549,8 @@ public class CDTDebugModelPresentation extends LabelProvider
label.append( CDebugUIPlugin.getResourceString("internal.ui.CDTDebugModelPresentation.Symbol_not_available") ); //$NON-NLS-1$
return label.toString();
}
- return ( stackFrame.getAdapter( IDummyStackFrame.class ) != null ) ?
- getDummyStackFrameLabel( stackFrame ) : stackFrame.getName();
+ return ( f.getAdapter( IDummyStackFrame.class ) != null ) ?
+ getDummyStackFrameLabel( f ) : f.getName();
}
private String getDummyStackFrameLabel( IStackFrame stackFrame )
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/FileNotFoundElement.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/FileNotFoundElement.java
index 2ac72c3e684..b0da367f766 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/FileNotFoundElement.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/FileNotFoundElement.java
@@ -5,7 +5,7 @@
*/
package org.eclipse.cdt.debug.internal.ui.editors;
-import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
+import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunch;
@@ -30,13 +30,16 @@ public class FileNotFoundElement
public IPath getFullPath()
{
- IStackFrameInfo frameInfo = (IStackFrameInfo)fStackFrame.getAdapter( IStackFrameInfo.class );
- if ( frameInfo != null && frameInfo.getFile() != null && frameInfo.getFile().length() > 0 )
+ if ( fStackFrame instanceof ICStackFrame )
{
- Path path = new Path( frameInfo.getFile() );
- if ( path.isValidPath( frameInfo.getFile() ) )
+ String fn = ((ICStackFrame)fStackFrame).getFile();
+ if ( fn != null && fn.trim().length() > 0 )
{
- return path;
+ Path path = new Path( fn );
+ if ( path.isValidPath( fn ) )
+ {
+ return path;
+ }
}
}
return null;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java
index c113ed2dcd6..1a4b41381ea 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java
@@ -11,16 +11,14 @@ import java.io.StringReader;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.List;
-
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
-
import org.eclipse.cdt.core.resources.FileStorage;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
-import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
+import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.core.sourcelookup.SourceLookupFactory;
import org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry;
@@ -294,8 +292,7 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
}
if ( res == null )
{
- IStackFrameInfo frameInfo = (IStackFrameInfo)stackFrame.getAdapter( IStackFrameInfo.class );
- if ( frameInfo != null && frameInfo.getFile() != null && frameInfo.getFile().length() > 0 )
+ if ( stackFrame instanceof ICStackFrame && !isEmpty( ((ICStackFrame)stackFrame).getFile() ) )
{
res = new FileNotFoundElement( stackFrame );
}
@@ -367,11 +364,10 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
private String getFileName( IStackFrame frame )
{
- IStackFrameInfo frameInfo = (IStackFrameInfo)frame.getAdapter( IStackFrameInfo.class );
- if ( frameInfo != null )
+ if ( frame instanceof ICStackFrame )
{
- String name = frameInfo.getFile();
- if ( name != null && name.trim().length() > 0 )
+ String name = ((ICStackFrame)frame).getFile();
+ if ( !isEmpty( name ) )
return name.trim();
}
return null;
@@ -404,7 +400,7 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
private boolean isEmpty( String string )
{
- return string == null || string.length() == 0;
+ return string == null || string.trim().length() == 0;
}
private IProject getProject( ILaunchConfiguration configuration ) throws CoreException
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupBlock.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupBlock.java
index 80ce5649582..5d3f31ded32 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupBlock.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupBlock.java
@@ -434,7 +434,7 @@ public class SourceLookupBlock implements Observer
field.setDialogFieldListener(
new IDialogFieldListener()
{
- public void dialogFieldChanged( DialogField field )
+ public void dialogFieldChanged( DialogField f )
{
doCheckStateChanged();
}
@@ -448,12 +448,12 @@ public class SourceLookupBlock implements Observer
new SourceListDialogField( CDebugUIPlugin.getResourceString("ui.sourcelookup.SourceLookupBlock.Additional_Source_Locations"), //$NON-NLS-1$
new IListAdapter()
{
- public void customButtonPressed( DialogField field, int index )
+ public void customButtonPressed( DialogField f, int index )
{
doAddedSourceButtonPressed( index );
}
- public void selectionChanged(DialogField field)
+ public void selectionChanged(DialogField f)
{
}
} );
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupLabelProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupLabelProvider.java
index 7e0a9758c7a..200a50c98e4 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupLabelProvider.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupLabelProvider.java
@@ -22,10 +22,9 @@ public class SourceLookupLabelProvider extends LabelProvider implements ITableLa
{
if ( element instanceof IProjectSourceLocation )
{
- if ( ((IProjectSourceLocation)element).getProject().isOpen() )
- return CDebugImages.get( CDebugImages.IMG_OBJS_PROJECT );
- else
- return CDebugImages.get( CDebugImages.IMG_OBJS_CLOSED_PROJECT );
+ return ( ((IProjectSourceLocation)element).getProject().isOpen() ) ?
+ CDebugImages.get( CDebugImages.IMG_OBJS_PROJECT ) :
+ CDebugImages.get( CDebugImages.IMG_OBJS_CLOSED_PROJECT );
}
if ( element instanceof IDirectorySourceLocation )
{