1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Added tooltips to breakpoints and watchpoints.

This commit is contained in:
Mikhail Khodjaiants 2003-05-06 16:28:55 +00:00
parent eec646bbe5
commit 33aba856fd
6 changed files with 138 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2003-05-06 Mikhail Khodjaiants
Added tooltips to breakpoints and watchpoints.
* CAddressBreakpoint.java
* CBreakpoint.java
* CFunctionBreakpoint.java
* CLineBreakpoint.java
* CWatchpoint.java
2003-05-05 Mikhail Khodjaiants
Added a status functionality to the CDebugElement class.
This allows to reflect the problems occured in the element in UI.

View file

@ -8,6 +8,7 @@ package org.eclipse.cdt.debug.internal.core.breakpoints;
import java.util.Map;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.internal.core.CDebugUtils;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@ -85,4 +86,30 @@ public class CAddressBreakpoint extends CBreakpoint implements ICAddressBreakpoi
{
return C_ADDRESS_BREAKPOINT;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
*/
protected String getMarkerMessage() throws CoreException
{
StringBuffer sb = new StringBuffer( "Address breakpoint:" );
String name = ensureMarker().getResource().getName();
if ( name != null && name.length() > 0 )
{
sb.append( ' ' );
sb.append( name );
}
try
{
long address = Long.parseLong( getAddress() );
sb.append( " [address: " );
sb.append( CDebugUtils.toHexAddressString( address ) );
sb.append( ']' );
}
catch( NumberFormatException e )
{
}
sb.append( getConditionText() );
return sb.toString();
}
}

View file

@ -116,6 +116,7 @@ public abstract class CBreakpoint extends Breakpoint
public void setCondition( String condition ) throws CoreException
{
setAttribute( CONDITION, condition );
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
}
/* (non-Javadoc)
@ -132,6 +133,7 @@ public abstract class CBreakpoint extends Breakpoint
public void setIgnoreCount( int ignoreCount ) throws CoreException
{
setAttribute( IGNORE_COUNT, ignoreCount );
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
}
/* (non-Javadoc)
@ -256,4 +258,25 @@ public abstract class CBreakpoint extends Breakpoint
{
return ( (getCondition() != null && getCondition().trim().length() > 0) || getIgnoreCount() > 0 );
}
protected String getConditionText() throws CoreException
{
StringBuffer sb = new StringBuffer();
int ignoreCount = getIgnoreCount();
if ( ignoreCount > 0 )
{
sb.append( " [" );
sb.append( "ignore count:" );
sb.append( ' ' );
sb.append( ignoreCount );
sb.append( ']' );
}
String condition = getCondition();
if ( condition != null && condition.length() > 0 )
{
sb.append( " if " );
sb.append( condition );
}
return sb.toString();
}
}

View file

@ -106,4 +106,29 @@ public class CFunctionBreakpoint extends CBreakpoint implements ICFunctionBreakp
}
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
*/
protected String getMarkerMessage() throws CoreException
{
StringBuffer sb = new StringBuffer( "Function breakpoint:" );
String name = ensureMarker().getResource().getName();
if ( name != null && name.length() > 0 )
{
sb.append( ' ' );
sb.append( name );
}
String function = getFunction();
if ( function != null && function.trim().length() > 0 )
{
sb.append( " [" );
sb.append( "function:" );
sb.append( ' ' );
sb.append( function.trim() );
sb.append( ']' );
}
sb.append( getConditionText() );
return sb.toString();
}
}

View file

@ -69,4 +69,29 @@ public class CLineBreakpoint extends CBreakpoint implements ICLineBreakpoint
{
return C_LINE_BREAKPOINT;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
*/
protected String getMarkerMessage() throws CoreException
{
StringBuffer sb = new StringBuffer( "Line breakpoint:" );
String fileName = ensureMarker().getResource().getName();
if ( fileName != null && fileName.length() > 0 )
{
sb.append( ' ' );
sb.append( fileName );
}
int lineNumber = getLineNumber();
if ( lineNumber > 0 )
{
sb.append( " [" );
sb.append( "line:" );
sb.append( ' ' );
sb.append( lineNumber );
sb.append( ']' );
}
sb.append( getConditionText() );
return sb.toString();
}
}

View file

@ -68,4 +68,34 @@ public class CWatchpoint extends CBreakpoint implements ICWatchpoint
{
return C_WATCHPOINT;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
*/
protected String getMarkerMessage() throws CoreException
{
StringBuffer sb = new StringBuffer();
if ( isWriteType() && !isReadType() )
sb.append( "Write " );
else if ( !isWriteType() && isReadType() )
sb.append( "Read " );
else if ( isWriteType() && isReadType() )
sb.append( "Access " );
sb.append( "watchpoint: " );
String fileName = ensureMarker().getResource().getName();
if ( fileName != null && fileName.length() > 0 )
{
sb.append( ' ' );
sb.append( fileName );
}
String expression = getExpression();
if ( expression != null && expression.length() > 0 )
{
sb.append( " at \'" );
sb.append( expression );
sb.append( '\'' );
}
sb.append( getConditionText() );
return sb.toString();
}
}