1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-29 11:55:40 +02:00

Display the error message in the array label, if the attempt to get array values fails.

This commit is contained in:
Mikhail Khodjaiants 2004-08-05 19:57:18 +00:00
parent 7d757bfbc2
commit c33f0a9a16
4 changed files with 25 additions and 11 deletions

View file

@ -1,3 +1,9 @@
2004-08-05 Mikhail Khodjaiants
Display the error message in the array label, if the attempt to get array values fails.
* CArrayPartition.java
* CArrayPartitionValue.java
* CDebugElement.java: made the exception throwing methods static.
2004-08-05 Mikhail Khodjaiants 2004-08-05 Mikhail Khodjaiants
Fixed the "resumed" event handler of the variable types. Fixed the "resumed" event handler of the variable types.
* CExpression.java * CExpression.java

View file

@ -274,7 +274,7 @@ public class CArrayPartition extends AbstractCVariable {
} }
} }
catch( CDIException e ) { catch( CDIException e ) {
// children.add( CVariableFactory.createVariableWithError( parent, e.getMessage() ) ); requestFailed( e.getMessage(), e );
} }
} }
else { else {

View file

@ -14,7 +14,9 @@ import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.core.model.ICDebugElementStatus;
import org.eclipse.cdt.debug.core.model.ICExpressionEvaluator; import org.eclipse.cdt.debug.core.model.ICExpressionEvaluator;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IVariable; import org.eclipse.debug.core.model.IVariable;
@ -94,8 +96,14 @@ public class CArrayPartitionValue extends AbstractCValue {
if ( !isAllocated() || !hasVariables() ) if ( !isAllocated() || !hasVariables() )
return Collections.EMPTY_LIST; return Collections.EMPTY_LIST;
if ( fVariables.size() == 0 ) { if ( fVariables.size() == 0 ) {
try {
fVariables = CArrayPartition.splitArray( this, getCDIVariable(), getStart(), getEnd() ); fVariables = CArrayPartition.splitArray( this, getCDIVariable(), getStart(), getEnd() );
} }
catch( DebugException e ) {
setStatus( ICDebugElementStatus.ERROR, e.getMessage() );
getParentVariable().fireChangeEvent( DebugEvent.STATE );
}
}
return fVariables; return fVariables;
} }

View file

@ -11,8 +11,8 @@
package org.eclipse.cdt.debug.internal.core.model; package org.eclipse.cdt.debug.internal.core.model;
import java.text.MessageFormat; import java.text.MessageFormat;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugModel;
import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDISession; import org.eclipse.cdt.debug.core.cdi.ICDISession;
@ -74,7 +74,7 @@ abstract public class CDebugElement extends PlatformObject implements ICDebugEle
* @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier() * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
*/ */
public String getModelIdentifier() { public String getModelIdentifier() {
return CDebugModel.getPluginIdentifier(); return CDIDebugModel.getPluginIdentifier();
} }
/* /*
@ -217,7 +217,7 @@ abstract public class CDebugElement extends PlatformObject implements ICDebugEle
* @param e Exception that has occurred (<code>can be null</code>) * @param e Exception that has occurred (<code>can be null</code>)
* @throws DebugException The exception with a status code of <code>REQUEST_FAILED</code> * @throws DebugException The exception with a status code of <code>REQUEST_FAILED</code>
*/ */
public void requestFailed( String message, Exception e ) throws DebugException { public static void requestFailed( String message, Exception e ) throws DebugException {
requestFailed( message, e, DebugException.REQUEST_FAILED ); requestFailed( message, e, DebugException.REQUEST_FAILED );
} }
@ -228,7 +228,7 @@ abstract public class CDebugElement extends PlatformObject implements ICDebugEle
* @param e underlying exception that has occurred * @param e underlying exception that has occurred
* @throws DebugException The exception with a status code of <code>TARGET_REQUEST_FAILED</code> * @throws DebugException The exception with a status code of <code>TARGET_REQUEST_FAILED</code>
*/ */
public void targetRequestFailed( String message, CDIException e ) throws DebugException { public static void targetRequestFailed( String message, CDIException e ) throws DebugException {
requestFailed( MessageFormat.format( "Target request failed: {0}.", new String[]{ message } ), e, DebugException.TARGET_REQUEST_FAILED ); //$NON-NLS-1$ requestFailed( MessageFormat.format( "Target request failed: {0}.", new String[]{ message } ), e, DebugException.TARGET_REQUEST_FAILED ); //$NON-NLS-1$
} }
@ -240,7 +240,7 @@ abstract public class CDebugElement extends PlatformObject implements ICDebugEle
* @param code status code * @param code status code
* @throws DebugException a new exception with given status code * @throws DebugException a new exception with given status code
*/ */
public void requestFailed( String message, Throwable e, int code ) throws DebugException { public static void requestFailed( String message, Throwable e, int code ) throws DebugException {
throwDebugException( message, code, e ); throwDebugException( message, code, e );
} }
@ -251,7 +251,7 @@ abstract public class CDebugElement extends PlatformObject implements ICDebugEle
* @param e Throwable that has occurred * @param e Throwable that has occurred
* @throws DebugException The exception with a status code of <code>TARGET_REQUEST_FAILED</code> * @throws DebugException The exception with a status code of <code>TARGET_REQUEST_FAILED</code>
*/ */
public void targetRequestFailed( String message, Throwable e ) throws DebugException { public static void targetRequestFailed( String message, Throwable e ) throws DebugException {
throwDebugException( MessageFormat.format( "Target request failed: {0}.", new String[]{ message } ), DebugException.TARGET_REQUEST_FAILED, e ); //$NON-NLS-1$ throwDebugException( MessageFormat.format( "Target request failed: {0}.", new String[]{ message } ), DebugException.TARGET_REQUEST_FAILED, e ); //$NON-NLS-1$
} }
@ -261,15 +261,15 @@ abstract public class CDebugElement extends PlatformObject implements ICDebugEle
* @param message Failure message * @param message Failure message
* @throws DebugException The exception with a status code of <code>NOT_SUPPORTED</code>. * @throws DebugException The exception with a status code of <code>NOT_SUPPORTED</code>.
*/ */
public void notSupported( String message ) throws DebugException { public static void notSupported( String message ) throws DebugException {
throwDebugException( message, DebugException.NOT_SUPPORTED, null ); throwDebugException( message, DebugException.NOT_SUPPORTED, null );
} }
/** /**
* Throws a debug exception with the given message, error code, and underlying exception. * Throws a debug exception with the given message, error code, and underlying exception.
*/ */
protected void throwDebugException( String message, int code, Throwable exception ) throws DebugException { protected static void throwDebugException( String message, int code, Throwable exception ) throws DebugException {
throw new DebugException( new Status( IStatus.ERROR, CDebugModel.getPluginIdentifier(), code, message, exception ) ); throw new DebugException( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), code, message, exception ) );
} }
protected void infoMessage( Throwable e ) { protected void infoMessage( Throwable e ) {