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

Implementing the 'Signals' view.

This commit is contained in:
Mikhail Khodjaiants 2003-02-03 23:08:44 +00:00
parent 4572bd4f18
commit 0cf8c37fd5
7 changed files with 83 additions and 9 deletions

View file

@ -1,3 +1,8 @@
2003-02-03 Mikhail Khodjaiants
Implementing the 'Signals' view.
* CSignalManager.java: new
* CSignal.java: new
2003-02-03 Alain Magloire
* src/org/eclipse/cdt/debug/core/cdi/event/ICDIExitEvent.java:

View file

@ -5,7 +5,10 @@
*/
package org.eclipse.cdt.debug.internal.core;
import java.util.ArrayList;
import org.eclipse.cdt.debug.core.ICSignalManager;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
import org.eclipse.cdt.debug.core.model.ICSignal;
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
@ -23,6 +26,7 @@ public class CSignalManager implements ICSignalManager
{
private CDebugTarget fDebugTarget = null;
private ICSignal[] fSignals = null;
private boolean fIsDisposed = false;
/**
* Constructor for CSignalManager.
@ -37,9 +41,21 @@ public class CSignalManager implements ICSignalManager
*/
public ICSignal[] getSignals() throws DebugException
{
if ( fSignals == null )
if ( !isDisposed() && fSignals == null )
{
// load signals from target
try
{
ICDISignal[] cdiSignals = ((CDebugTarget)getDebugTarget()).getCDISession().getSignalManager().getSignals();
ArrayList list = new ArrayList( cdiSignals.length );
for ( int i = 0; i < cdiSignals.length; ++i )
{
list.add( new CSignal( (CDebugTarget)getDebugTarget(), cdiSignals[i] ) );
}
fSignals = (ICSignal[])list.toArray( new ICSignal[list.size()] );
}
catch( CDIException e )
{
}
}
return ( fSignals != null ) ? fSignals : new ICSignal[0];
}
@ -55,6 +71,7 @@ public class CSignalManager implements ICSignalManager
fSignals[i].dispose();
}
fSignals = null;
fIsDisposed = true;
}
/* (non-Javadoc)
@ -110,4 +127,9 @@ public class CSignalManager implements ICSignalManager
}
return null;
}
protected boolean isDisposed()
{
return fIsDisposed;
}
}

View file

@ -5,6 +5,7 @@
*/
package org.eclipse.cdt.debug.internal.core.model;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
@ -36,7 +37,7 @@ public class CSignal extends CDebugElement implements ICSignal, ICDIEventListene
*/
public String getDescription()
{
return "";
return getCDISignal().getDescription();
}
/* (non-Javadoc)
@ -44,7 +45,7 @@ public class CSignal extends CDebugElement implements ICSignal, ICDIEventListene
*/
public String getName()
{
return "";
return getCDISignal().getName();
}
/* (non-Javadoc)
@ -52,7 +53,7 @@ public class CSignal extends CDebugElement implements ICSignal, ICDIEventListene
*/
public boolean isPassEnabled()
{
return false;
return !getCDISignal().isIgnore();
}
/* (non-Javadoc)
@ -60,7 +61,7 @@ public class CSignal extends CDebugElement implements ICSignal, ICDIEventListene
*/
public boolean isStopEnabled()
{
return false;
return getCDISignal().isStopSet();
}
/* (non-Javadoc)
@ -97,5 +98,18 @@ public class CSignal extends CDebugElement implements ICSignal, ICDIEventListene
*/
public void signal() throws DebugException
{
try
{
getCDISignal().signal();
}
catch( CDIException e )
{
targetRequestFailed( e.getMessage(), null );
}
}
protected ICDISignal getCDISignal()
{
return fCDISignal;
}
}

View file

@ -1,3 +1,9 @@
2003-02-03 Mikhail Khodjaiants
Implementing the 'Signals' view.
* SignalActionDelegate.java
* SignalsViewer.java: new
* CDTDebugModelPresentation.java
2003-01-31 Mikhail Khodjaiants
Implementing the 'Signals' view.
* CDebugImages.java

View file

@ -358,7 +358,7 @@ public class CDTDebugModelPresentation extends LabelProvider
if ( info != null && info instanceof ICDISignalExitInfo)
{
ICDISignalExitInfo sigInfo = (ICDISignalExitInfo)info;
label += MessageFormat.format( " (Signal ''{0}'' received. Meaning: {1})",
label += MessageFormat.format( " (Signal ''{0}'' received. Description: {1})",
new String[] { sigInfo.getName(), sigInfo.getDescription() } );
}
else if ( info != null && info instanceof ICDIExitInfo )
@ -374,7 +374,7 @@ public class CDTDebugModelPresentation extends LabelProvider
{
ICDISignal signal = ((ICDISignalReceived)info).getSignal();
String label = target.getName() +
MessageFormat.format( " (Signal ''{0}'' received. Meaning: {1})",
MessageFormat.format( " (Signal ''{0}'' received. Description: {1})",
new String[] { signal.getName(), signal.getDescription() } );
return label;
}

View file

@ -5,6 +5,8 @@
*/
package org.eclipse.cdt.debug.internal.ui.actions;
import java.text.MessageFormat;
import org.eclipse.cdt.debug.core.model.ICSignal;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.runtime.MultiStatus;
@ -49,7 +51,9 @@ public class SignalActionDelegate implements IObjectActionDelegate
if ( getSignal() != null )
{
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(),
DebugException.REQUEST_FAILED, "Unable to load symbols of shared library.", null );
DebugException.REQUEST_FAILED,
MessageFormat.format( "Unable to deliver the signal ''{0}'' to the target.", new String[] { getSignal().getName() } ),
null );
BusyIndicator.showWhile( Display.getCurrent(),
new Runnable()
{

View file

@ -7,9 +7,11 @@ package org.eclipse.cdt.debug.internal.ui.views.signals;
import org.eclipse.cdt.debug.core.model.ICSignal;
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
import org.eclipse.debug.core.DebugException;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ComboBoxCellEditor;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@ -106,6 +108,27 @@ public class SignalsViewer extends TableViewer
public void modify( Object element, String property, Object value )
{
IStructuredSelection sel = (IStructuredSelection)getSelection();
Object entry = sel.getFirstElement();
if ( entry instanceof ICSignal && value instanceof Integer )
{
try
{
boolean enable = ( ((Integer)value).intValue() == 0 );
if ( CP_PASS.equals( property ) )
{
((ICSignal)entry).setPassEnabled( enable );
}
else if ( CP_SUSPEND.equals( property ) )
{
((ICSignal)entry).setStopEnabled( enable );
}
refresh( entry );
}
catch( DebugException e )
{
}
}
}
};
}