mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 03:53:21 +02:00
CSignalManager no longer extends CUpdateManager.
This commit is contained in:
parent
3b2143318d
commit
1896936755
2 changed files with 54 additions and 68 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2004-11-04 Mikhail Khodjaiants
|
||||||
|
CSignalManager no longer extends CUpdateManager.
|
||||||
|
* CSignalManager.java
|
||||||
|
|
||||||
2004-11-03 Mikhail Khodjaiants
|
2004-11-03 Mikhail Khodjaiants
|
||||||
New implementation of expressions.
|
New implementation of expressions.
|
||||||
Large arrays partitioning based on the framework model.
|
Large arrays partitioning based on the framework model.
|
||||||
|
|
|
@ -11,11 +11,9 @@
|
||||||
package org.eclipse.cdt.debug.internal.core;
|
package org.eclipse.cdt.debug.internal.core;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.CDebugModel;
|
import org.eclipse.cdt.debug.core.CDebugModel;
|
||||||
import org.eclipse.cdt.debug.core.ICSignalManager;
|
import org.eclipse.cdt.debug.core.ICSignalManager;
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIManager;
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
|
||||||
import org.eclipse.cdt.debug.core.model.ICSignal;
|
import org.eclipse.cdt.debug.core.model.ICSignal;
|
||||||
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
|
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
|
||||||
|
@ -26,124 +24,108 @@ import org.eclipse.debug.core.DebugEvent;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter type comment.
|
* Manages the collection of signals on a debug target.
|
||||||
*
|
|
||||||
* @since: Jan 31, 2003
|
|
||||||
*/
|
*/
|
||||||
public class CSignalManager extends CUpdateManager implements ICSignalManager
|
public class CSignalManager implements ICSignalManager {
|
||||||
{
|
|
||||||
|
/**
|
||||||
|
* The debug target associated with this manager.
|
||||||
|
*/
|
||||||
|
private CDebugTarget fDebugTarget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of signals.
|
||||||
|
*/
|
||||||
private ICSignal[] fSignals = null;
|
private ICSignal[] fSignals = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The dispose flag.
|
||||||
|
*/
|
||||||
private boolean fIsDisposed = false;
|
private boolean fIsDisposed = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for CSignalManager.
|
* Constructor for CSignalManager.
|
||||||
*/
|
*/
|
||||||
public CSignalManager( CDebugTarget target )
|
public CSignalManager( CDebugTarget target ) {
|
||||||
{
|
fDebugTarget = target;
|
||||||
super( target );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.core.ICSignalManager#getSignals()
|
* @see org.eclipse.cdt.debug.core.ICSignalManager#getSignals()
|
||||||
*/
|
*/
|
||||||
public ICSignal[] getSignals() throws DebugException
|
public ICSignal[] getSignals() throws DebugException {
|
||||||
{
|
if ( !isDisposed() && fSignals == null ) {
|
||||||
if ( !isDisposed() && fSignals == null )
|
try {
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ICDISignal[] cdiSignals = getDebugTarget().getCDITarget().getSignals();
|
ICDISignal[] cdiSignals = getDebugTarget().getCDITarget().getSignals();
|
||||||
ArrayList list = new ArrayList( cdiSignals.length );
|
ArrayList list = new ArrayList( cdiSignals.length );
|
||||||
for ( int i = 0; i < cdiSignals.length; ++i )
|
for( int i = 0; i < cdiSignals.length; ++i ) {
|
||||||
{
|
|
||||||
list.add( new CSignal( getDebugTarget(), cdiSignals[i] ) );
|
list.add( new CSignal( getDebugTarget(), cdiSignals[i] ) );
|
||||||
}
|
}
|
||||||
fSignals = (ICSignal[])list.toArray( new ICSignal[list.size()] );
|
fSignals = (ICSignal[])list.toArray( new ICSignal[list.size()] );
|
||||||
}
|
}
|
||||||
catch( CDIException e )
|
catch( CDIException e ) {
|
||||||
{
|
|
||||||
throwDebugException( e.getMessage(), DebugException.TARGET_REQUEST_FAILED, e );
|
throwDebugException( e.getMessage(), DebugException.TARGET_REQUEST_FAILED, e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ( fSignals != null ) ? fSignals : new ICSignal[0];
|
return (fSignals != null) ? fSignals : new ICSignal[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.core.ICSignalManager#dispose()
|
* @see org.eclipse.cdt.debug.internal.core.CUpdateManager#dispose()
|
||||||
*/
|
*/
|
||||||
public void dispose()
|
public void dispose() {
|
||||||
{
|
|
||||||
if ( fSignals != null )
|
if ( fSignals != null )
|
||||||
for ( int i = 0; i < fSignals.length; ++i )
|
for( int i = 0; i < fSignals.length; ++i ) {
|
||||||
{
|
((CSignal)fSignals[i]).dispose();
|
||||||
((CSignal)fSignals[i]).dispose();
|
}
|
||||||
}
|
|
||||||
fSignals = null;
|
fSignals = null;
|
||||||
fIsDisposed = true;
|
fIsDisposed = true;
|
||||||
super.dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
|
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
|
||||||
*/
|
*/
|
||||||
public Object getAdapter( Class adapter )
|
public Object getAdapter( Class adapter ) {
|
||||||
{
|
if ( adapter.equals( ICSignalManager.class ) ) {
|
||||||
if ( adapter.equals( ICSignalManager.class ) )
|
|
||||||
{
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
if ( adapter.equals( CSignalManager.class ) )
|
if ( adapter.equals( CSignalManager.class ) ) {
|
||||||
{
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.getAdapter( adapter );
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void signalChanged( ICDISignal cdiSignal )
|
public void signalChanged( ICDISignal cdiSignal ) {
|
||||||
{
|
|
||||||
CSignal signal = find( cdiSignal );
|
CSignal signal = find( cdiSignal );
|
||||||
if ( signal != null )
|
if ( signal != null ) {
|
||||||
{
|
|
||||||
signal.fireChangeEvent( DebugEvent.STATE );
|
signal.fireChangeEvent( DebugEvent.STATE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private CSignal find( ICDISignal cdiSignal )
|
private CSignal find( ICDISignal cdiSignal ) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
ICSignal[] signals = getSignals();
|
ICSignal[] signals = getSignals();
|
||||||
for ( int i = 0; i < signals.length; ++i )
|
for( int i = 0; i < signals.length; ++i )
|
||||||
if ( signals[i].getName().equals( cdiSignal.getName() ) )
|
if ( signals[i].getName().equals( cdiSignal.getName() ) )
|
||||||
return (CSignal)signals[i];
|
return (CSignal)signals[i];
|
||||||
}
|
}
|
||||||
catch( DebugException e )
|
catch( DebugException e ) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isDisposed()
|
protected boolean isDisposed() {
|
||||||
{
|
|
||||||
return fIsDisposed;
|
return fIsDisposed;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICDIManager getCDIManager()
|
|
||||||
{
|
|
||||||
//FIXME: To change we no longer have a ICDISignalManager.
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Throws a debug exception with the given message, error code, and underlying
|
* Throws a debug exception with the given message, error code, and underlying exception.
|
||||||
* exception.
|
|
||||||
*/
|
*/
|
||||||
protected void throwDebugException( String message, int code, Throwable exception ) throws DebugException
|
protected 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,
|
|
||||||
CDebugModel.getPluginIdentifier(),
|
|
||||||
code,
|
|
||||||
message,
|
|
||||||
exception ) );
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
protected CDebugTarget getDebugTarget() {
|
||||||
|
return fDebugTarget;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue