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:
parent
640781486b
commit
f5900614c5
24 changed files with 1015 additions and 10 deletions
|
@ -1,3 +1,12 @@
|
|||
2003-01-31 Mikhail Khodjaiants
|
||||
Implementing the 'Signals' view.
|
||||
* ICSharedLibraryManager.java
|
||||
* ICSignalManager.java: new
|
||||
* ICSignal.java: new
|
||||
* CSignalManager.java: new
|
||||
* CSignal.java: new
|
||||
* CDebugTarget.java
|
||||
|
||||
2003-01-30 Mikhail Khodjaiants
|
||||
Create an address breakpoint if the source locator can not find the file specified by gdb.
|
||||
* CDebugTarget.java
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
package org.eclipse.cdt.debug.core;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
|
||||
import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
|
||||
|
@ -16,12 +15,6 @@ import org.eclipse.core.runtime.IAdaptable;
|
|||
*/
|
||||
public interface ICSharedLibraryManager extends IAdaptable
|
||||
{
|
||||
void sharedLibraryLoaded( ICDISharedLibrary library );
|
||||
|
||||
void sharedLibraryUnloaded( ICDISharedLibrary library );
|
||||
|
||||
void symbolsLoaded( ICDISharedLibrary library );
|
||||
|
||||
ICSharedLibrary[] getSharedLibraries();
|
||||
|
||||
void dispose();
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.debug.core;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICSignal;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since: Jan 31, 2003
|
||||
*/
|
||||
public interface ICSignalManager extends IAdaptable
|
||||
{
|
||||
ICSignal[] getSignals() throws DebugException;
|
||||
|
||||
void dispose();
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.debug.core.model;
|
||||
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.model.IDebugElement;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since: Jan 31, 2003
|
||||
*/
|
||||
public interface ICSignal extends IDebugElement
|
||||
{
|
||||
String getName();
|
||||
|
||||
String getDescription();
|
||||
|
||||
boolean isPassEnabled();
|
||||
|
||||
boolean isStopEnabled();
|
||||
|
||||
void setPassEnabled( boolean enable ) throws DebugException;
|
||||
|
||||
void setStopEnabled( boolean enable ) throws DebugException;
|
||||
|
||||
void signal() throws DebugException;
|
||||
|
||||
void dispose();
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.debug.internal.core;
|
||||
|
||||
import org.eclipse.cdt.debug.core.ICSignalManager;
|
||||
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;
|
||||
import org.eclipse.cdt.debug.internal.core.model.CSignal;
|
||||
import org.eclipse.debug.core.DebugEvent;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.model.IDebugTarget;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since: Jan 31, 2003
|
||||
*/
|
||||
public class CSignalManager implements ICSignalManager
|
||||
{
|
||||
private CDebugTarget fDebugTarget = null;
|
||||
private ICSignal[] fSignals = null;
|
||||
|
||||
/**
|
||||
* Constructor for CSignalManager.
|
||||
*/
|
||||
public CSignalManager( CDebugTarget target )
|
||||
{
|
||||
setDebugTarget( target );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.ICSignalManager#getSignals()
|
||||
*/
|
||||
public ICSignal[] getSignals() throws DebugException
|
||||
{
|
||||
if ( fSignals == null )
|
||||
{
|
||||
// load signals from target
|
||||
}
|
||||
return ( fSignals != null ) ? fSignals : new ICSignal[0];
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.ICSignalManager#dispose()
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
if ( fSignals != null )
|
||||
for ( int i = 0; i < fSignals.length; ++i )
|
||||
{
|
||||
fSignals[i].dispose();
|
||||
}
|
||||
fSignals = null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
|
||||
*/
|
||||
public Object getAdapter( Class adapter )
|
||||
{
|
||||
if ( adapter.equals( ICSignalManager.class ) )
|
||||
{
|
||||
return this;
|
||||
}
|
||||
if ( adapter.equals( CSignalManager.class ) )
|
||||
{
|
||||
return this;
|
||||
}
|
||||
if ( adapter.equals( IDebugTarget.class ) )
|
||||
{
|
||||
return fDebugTarget;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IDebugTarget getDebugTarget()
|
||||
{
|
||||
return fDebugTarget;
|
||||
}
|
||||
|
||||
protected void setDebugTarget( CDebugTarget target )
|
||||
{
|
||||
fDebugTarget = target;
|
||||
}
|
||||
|
||||
public void signalChanged( ICDISignal cdiSignal )
|
||||
{
|
||||
CSignal signal = find( cdiSignal );
|
||||
if ( signal != null )
|
||||
{
|
||||
signal.fireChangeEvent( DebugEvent.STATE );
|
||||
}
|
||||
}
|
||||
|
||||
private CSignal find( ICDISignal cdiSignal )
|
||||
{
|
||||
try
|
||||
{
|
||||
ICSignal[] signals = getSignals();
|
||||
for ( int i = 0; i < signals.length; ++i )
|
||||
if ( signals[i].getName().equals( cdiSignal.getName() ) )
|
||||
return (CSignal)signals[i];
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -22,6 +22,7 @@ import org.eclipse.cdt.debug.core.CDebugModel;
|
|||
import org.eclipse.cdt.debug.core.ICBreakpointManager;
|
||||
import org.eclipse.cdt.debug.core.ICMemoryManager;
|
||||
import org.eclipse.cdt.debug.core.ICSharedLibraryManager;
|
||||
import org.eclipse.cdt.debug.core.ICSignalManager;
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointHit;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager;
|
||||
|
@ -51,6 +52,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
|
|||
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterObject;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
|
||||
|
@ -73,6 +75,7 @@ import org.eclipse.cdt.debug.core.sourcelookup.ISourceMode;
|
|||
import org.eclipse.cdt.debug.internal.core.CDebugUtils;
|
||||
import org.eclipse.cdt.debug.internal.core.CMemoryManager;
|
||||
import org.eclipse.cdt.debug.internal.core.CSharedLibraryManager;
|
||||
import org.eclipse.cdt.debug.internal.core.CSignalManager;
|
||||
import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
|
||||
import org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint;
|
||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager;
|
||||
|
@ -227,6 +230,11 @@ public class CDebugTarget extends CDebugElement
|
|||
*/
|
||||
private CSharedLibraryManager fSharedLibraryManager;
|
||||
|
||||
/**
|
||||
* A signal manager for this target.
|
||||
*/
|
||||
private CSignalManager fSignalManager;
|
||||
|
||||
/**
|
||||
* Whether the debugger process is default.
|
||||
*/
|
||||
|
@ -272,6 +280,7 @@ public class CDebugTarget extends CDebugElement
|
|||
setThreadList( new ArrayList( 5 ) );
|
||||
setDisassemblyManager( new DisassemblyManager( this ) );
|
||||
setSharedLibraryManager( new CSharedLibraryManager( this ) );
|
||||
setSignalManager( new CSignalManager( this ) );
|
||||
initialize();
|
||||
DebugPlugin.getDefault().getLaunchManager().addLaunchListener( this );
|
||||
DebugPlugin.getDefault().getExpressionManager().addExpressionListener( this );
|
||||
|
@ -877,9 +886,11 @@ public class CDebugTarget extends CDebugElement
|
|||
if ( adapter.equals( ICBreakpointManager.class ) )
|
||||
return this;
|
||||
if ( adapter.equals( DisassemblyManager.class ) )
|
||||
return fDisassemblyManager;
|
||||
return getDisassemblyManager();
|
||||
if ( adapter.equals( ICSharedLibraryManager.class ) )
|
||||
return fSharedLibraryManager;
|
||||
return getSharedLibraryManager();
|
||||
if ( adapter.equals( ICSignalManager.class ) )
|
||||
return getSignalManager();
|
||||
return super.getAdapter( adapter );
|
||||
}
|
||||
|
||||
|
@ -969,6 +980,10 @@ public class CDebugTarget extends CDebugElement
|
|||
{
|
||||
getSharedLibraryManager().symbolsLoaded( (ICDISharedLibrary)source );
|
||||
}
|
||||
if ( source instanceof ICDISignal )
|
||||
{
|
||||
getSignalManager().signalChanged( (ICDISignal)source );
|
||||
}
|
||||
if ( source instanceof ICDIBreakpoint )
|
||||
{
|
||||
handleBreakpointChangedEvent( (ICDIBreakpoint)source );
|
||||
|
@ -1127,6 +1142,7 @@ public class CDebugTarget extends CDebugElement
|
|||
DebugPlugin.getDefault().getLaunchManager().removeLaunchListener( this );
|
||||
disposeMemoryManager();
|
||||
disposeSharedLibraryManager();
|
||||
disposeSignalManager();
|
||||
removeAllExpressions();
|
||||
try
|
||||
{
|
||||
|
@ -2328,6 +2344,21 @@ public class CDebugTarget extends CDebugElement
|
|||
fSharedLibraryManager.dispose();
|
||||
}
|
||||
|
||||
protected void setSignalManager( CSignalManager sm )
|
||||
{
|
||||
fSignalManager = sm;
|
||||
}
|
||||
|
||||
protected CSignalManager getSignalManager()
|
||||
{
|
||||
return fSignalManager;
|
||||
}
|
||||
|
||||
protected void disposeSignalManager()
|
||||
{
|
||||
fSignalManager.dispose();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.ICBreakpointManager#getBreakpointAddress(IBreakpoint)
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.debug.internal.core.model;
|
||||
|
||||
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;
|
||||
import org.eclipse.cdt.debug.core.model.ICSignal;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since: Jan 31, 2003
|
||||
*/
|
||||
public class CSignal extends CDebugElement implements ICSignal, ICDIEventListener
|
||||
{
|
||||
private ICDISignal fCDISignal;
|
||||
|
||||
/**
|
||||
* Constructor for CSignal.
|
||||
* @param target
|
||||
*/
|
||||
public CSignal( CDebugTarget target, ICDISignal cdiSignal )
|
||||
{
|
||||
super( target );
|
||||
fCDISignal = cdiSignal;
|
||||
getCDISession().getEventManager().addEventListener( this );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICSignal#getDescription()
|
||||
*/
|
||||
public String getDescription()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICSignal#getName()
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICSignal#isPassEnabled()
|
||||
*/
|
||||
public boolean isPassEnabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICSignal#isStopEnabled()
|
||||
*/
|
||||
public boolean isStopEnabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICSignal#setPassEnabled(boolean)
|
||||
*/
|
||||
public void setPassEnabled( boolean enable ) throws DebugException
|
||||
{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICSignal#setStopEnabled(boolean)
|
||||
*/
|
||||
public void setStopEnabled( boolean enable ) throws DebugException
|
||||
{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvent(ICDIEvent)
|
||||
*/
|
||||
public void handleDebugEvent( ICDIEvent event )
|
||||
{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICSignal#dispose()
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
getCDISession().getEventManager().removeEventListener( this );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICSignal#signal()
|
||||
*/
|
||||
public void signal() throws DebugException
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,3 +1,21 @@
|
|||
2003-01-31 Mikhail Khodjaiants
|
||||
Implementing the 'Signals' view.
|
||||
* CDebugImages.java
|
||||
* ICDebugHelpContextIds.java
|
||||
* SignalActionDelegate.java
|
||||
* SignalsView.java: new
|
||||
* SignalsViewContentProvider.java: new
|
||||
* SignalsViewer.java: new
|
||||
* SignalsViewEventHandler.java: new
|
||||
* AbstractDebugEventHandler.java
|
||||
* plugin.xml
|
||||
* plugin.properties
|
||||
icons/full/clcl16/signal_co.gif
|
||||
icons/full/dlcl16/signal_co.gif
|
||||
icons/full/elcl16/signal_co.gif
|
||||
icons/full/eview6/signals_view.gif
|
||||
icons/full/cview6/signals_view.gif
|
||||
|
||||
2003-01-30 Mikhail Khodjaiants
|
||||
Disassembly editor input fix.
|
||||
* CDTDebugModelPresentation.java
|
||||
|
|
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/signal_co.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/signal_co.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 136 B |
Binary file not shown.
After Width: | Height: | Size: 883 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/signal_co.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/signal_co.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 136 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/signal_co.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/signal_co.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 136 B |
Binary file not shown.
After Width: | Height: | Size: 883 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/obj16/signal_obj.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/obj16/signal_obj.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 129 B |
|
@ -9,6 +9,7 @@ providerName=Eclipse.org
|
|||
RegistersView.name=Registers
|
||||
MemoryView.name=Memory
|
||||
SharedLibrariesView.name=Shared Libraries
|
||||
SignalsView.name=Signals
|
||||
|
||||
CDebuggerPage.name=C Debugger UI Page
|
||||
MemoryPreferencePage.name=Memory View
|
||||
|
@ -54,3 +55,5 @@ SourcePropertyPage.name=Source Lookup
|
|||
DisassemblyEditor.name=Disassembly Editor
|
||||
|
||||
LoadSymbolsAction.label=Load Symbols
|
||||
SignalAction.label=Signal
|
||||
|
||||
|
|
|
@ -55,6 +55,13 @@
|
|||
class="org.eclipse.cdt.debug.internal.ui.views.sharedlibs.SharedLibrariesView"
|
||||
id="org.eclipse.cdt.debug.ui.SharedLibrariesView">
|
||||
</view>
|
||||
<view
|
||||
name="%SignalsView.name"
|
||||
icon="icons/full/cview16/signals_view.gif"
|
||||
category="org.eclipse.debug.ui"
|
||||
class="org.eclipse.cdt.debug.internal.ui.views.signals.SignalsView"
|
||||
id="org.eclipse.cdt.debug.ui.SignalsView">
|
||||
</view>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.perspectiveExtensions">
|
||||
|
@ -75,6 +82,11 @@
|
|||
relationship="stack"
|
||||
id="org.eclipse.cdt.debug.ui.SharedLibrariesView">
|
||||
</view>
|
||||
<view
|
||||
relative="org.eclipse.debug.ui.VariableView"
|
||||
relationship="stack"
|
||||
id="org.eclipse.cdt.debug.ui.SignalsView">
|
||||
</view>
|
||||
<actionSet
|
||||
id="org.eclipse.cdt.debug.ui.debugActionSet">
|
||||
</actionSet>
|
||||
|
@ -654,7 +666,7 @@
|
|||
<action
|
||||
label="%LoadSymbolsAction.label"
|
||||
icon="icons/full/clcl16/load_symbols_co.gif"
|
||||
helpContextId="breakpoint_properties_action_context"
|
||||
helpContextId="load_symbols_action_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.LoadSymbolsActionDelegate"
|
||||
menubarPath="additions"
|
||||
enablesFor="1"
|
||||
|
@ -667,6 +679,25 @@
|
|||
</enablement>
|
||||
</action>
|
||||
</objectContribution>
|
||||
<objectContribution
|
||||
objectClass="org.eclipse.cdt.debug.core.model.ICSignal"
|
||||
id="org.eclipse.cdt.debug.ui.SignalActions">
|
||||
<action
|
||||
label="%SignalAction.label"
|
||||
icon="icons/full/clcl16/signal_co.gif"
|
||||
helpContextId="signal_action_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.SignalActionDelegate"
|
||||
menubarPath="additions"
|
||||
enablesFor="1"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.SignalActionDelegate">
|
||||
<enablement>
|
||||
<pluginState
|
||||
value="activated"
|
||||
id="org.eclipse.cdt.debug.ui">
|
||||
</pluginState>
|
||||
</enablement>
|
||||
</action>
|
||||
</objectContribution>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.viewActions">
|
||||
|
|
|
@ -67,6 +67,7 @@ public class CDebugImages
|
|||
public static final String IMG_OBJS_FOLDER = NAME_PREFIX + "folder_obj.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_LOADED_SHARED_LIBRARY = NAME_PREFIX + "library_syms_obj.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_SHARED_LIBRARY = NAME_PREFIX + "library_obj.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_SIGNAL = NAME_PREFIX + "signal_obj.gif"; //$NON-NLS-1$
|
||||
|
||||
public static final String IMG_LCL_TYPE_NAMES = NAME_PREFIX + "tnames_co.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_LCL_CHANGE_REGISTER_VALUE = NAME_PREFIX + "change_reg_value_co.gif"; //$NON-NLS-1$
|
||||
|
@ -116,6 +117,7 @@ public class CDebugImages
|
|||
public static final ImageDescriptor DESC_OBJS_FOLDER = createManaged( T_OBJ, IMG_OBJS_FOLDER );
|
||||
public static final ImageDescriptor DESC_OBJS_LOADED_SHARED_LIBRARY = createManaged( T_OBJ, IMG_OBJS_LOADED_SHARED_LIBRARY );
|
||||
public static final ImageDescriptor DESC_OBJS_SHARED_LIBRARY = createManaged( T_OBJ, IMG_OBJS_SHARED_LIBRARY );
|
||||
public static final ImageDescriptor DESC_OBJS_SIGNAL = createManaged( T_OBJ, IMG_OBJS_SIGNAL );
|
||||
public static final ImageDescriptor DESC_WIZBAN_ADD_SOURCE_LOCATION = createManaged( T_WIZBAN, IMG_WIZBAN_ADD_SOURCE_LOCATION ); //$NON-NLS-1$
|
||||
public static final ImageDescriptor DESC_WIZBAN_ADD_PRJ_SOURCE_LOCATION = createManaged( T_WIZBAN, IMG_WIZBAN_ADD_PRJ_SOURCE_LOCATION ); //$NON-NLS-1$
|
||||
public static final ImageDescriptor DESC_WIZBAN_ADD_DIR_SOURCE_LOCATION = createManaged( T_WIZBAN, IMG_WIZBAN_ADD_DIR_SOURCE_LOCATION ); //$NON-NLS-1$
|
||||
|
|
|
@ -35,6 +35,7 @@ public interface ICDebugHelpContextIds
|
|||
public static final String REGISTERS_VIEW = PREFIX + "registers_view_context"; //$NON-NLS-1$
|
||||
public static final String MEMORY_VIEW = PREFIX + "memory_view_context"; //$NON-NLS-1$
|
||||
public static final String SHARED_LIBRARIES_VIEW = PREFIX + "shared_libraries_view_context"; //$NON-NLS-1$
|
||||
public static final String SIGNALS_VIEW = PREFIX + "signals_view_context"; //$NON-NLS-1$
|
||||
|
||||
// Preference pages
|
||||
public static final String MEMORY_PREFERENCE_PAGE = PREFIX + "memory_preference_page_context"; //$NON-NLS-1$
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICSignal;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.core.runtime.MultiStatus;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.swt.custom.BusyIndicator;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.IObjectActionDelegate;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since: Jan 31, 2003
|
||||
*/
|
||||
public class SignalActionDelegate implements IObjectActionDelegate
|
||||
{
|
||||
private ICSignal fSignal = null;
|
||||
|
||||
/**
|
||||
* Constructor for SignalActionDelegate.
|
||||
*/
|
||||
public SignalActionDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
|
||||
*/
|
||||
public void setActivePart( IAction action, IWorkbenchPart targetPart )
|
||||
{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IActionDelegate#run(IAction)
|
||||
*/
|
||||
public void run( IAction action )
|
||||
{
|
||||
if ( getSignal() != null )
|
||||
{
|
||||
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(),
|
||||
DebugException.REQUEST_FAILED, "Unable to load symbols of shared library.", null );
|
||||
BusyIndicator.showWhile( Display.getCurrent(),
|
||||
new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
doAction( getSignal() );
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
ms.merge( e.getStatus() );
|
||||
}
|
||||
}
|
||||
} );
|
||||
if ( !ms.isOK() )
|
||||
{
|
||||
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
|
||||
if ( window != null )
|
||||
{
|
||||
CDebugUIPlugin.errorDialog( "Operation failed.", ms );
|
||||
}
|
||||
else
|
||||
{
|
||||
CDebugUIPlugin.log( ms );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
|
||||
*/
|
||||
public void selectionChanged( IAction action, ISelection selection )
|
||||
{
|
||||
if ( selection instanceof IStructuredSelection )
|
||||
{
|
||||
Object element = ((IStructuredSelection)selection).getFirstElement();
|
||||
if ( element instanceof ICSignal )
|
||||
{
|
||||
boolean enabled = enablesFor( (ICSignal)element );
|
||||
action.setEnabled( enabled );
|
||||
if ( enabled )
|
||||
{
|
||||
setSignal( (ICSignal)element );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
action.setEnabled( false );
|
||||
setSignal( null );
|
||||
}
|
||||
|
||||
protected void doAction( ICSignal signal ) throws DebugException
|
||||
{
|
||||
signal.signal();
|
||||
}
|
||||
|
||||
private boolean enablesFor( ICSignal signal )
|
||||
{
|
||||
return ( signal != null );
|
||||
}
|
||||
|
||||
private void setSignal( ICSignal signal )
|
||||
{
|
||||
fSignal = signal;
|
||||
}
|
||||
|
||||
protected ICSignal getSignal()
|
||||
{
|
||||
return fSignal;
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ import org.eclipse.debug.ui.AbstractDebugView;
|
|||
import org.eclipse.jface.viewers.IBasicPropertyConstants;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
|
||||
|
@ -204,6 +205,22 @@ public abstract class AbstractDebugEventHandler implements IDebugEventSetListene
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this event handler's viewer as a table
|
||||
* viewer or <code>null</code> if none.
|
||||
*
|
||||
* @return this event handler's viewer as a tree
|
||||
* viewer or <code>null</code> if none
|
||||
*/
|
||||
protected TableViewer getTableViewer()
|
||||
{
|
||||
if ( getViewer() instanceof TableViewer )
|
||||
{
|
||||
return (TableViewer)getViewer();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this event handler's viewer is
|
||||
* currently available.
|
||||
|
|
|
@ -0,0 +1,222 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.debug.internal.ui.views.signals;
|
||||
|
||||
import org.eclipse.cdt.debug.core.ICSignalManager;
|
||||
import org.eclipse.cdt.debug.core.model.ICSignal;
|
||||
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
|
||||
import org.eclipse.cdt.debug.internal.ui.CImageDescriptor;
|
||||
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
||||
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandlerView;
|
||||
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.model.IDebugElement;
|
||||
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.jface.action.IToolBarManager;
|
||||
import org.eclipse.jface.action.Separator;
|
||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
import org.eclipse.jface.viewers.IContentProvider;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.ITableLabelProvider;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.ISelectionListener;
|
||||
import org.eclipse.ui.IWorkbenchActionConstants;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since: Jan 30, 2003
|
||||
*/
|
||||
public class SignalsView extends AbstractDebugEventHandlerView
|
||||
implements ISelectionListener,
|
||||
IPropertyChangeListener,
|
||||
IDebugExceptionHandler
|
||||
{
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since: Jan 30, 2003
|
||||
*/
|
||||
public class SignalsViewLabelProvider extends LabelProvider implements ITableLabelProvider
|
||||
{
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(Object, int)
|
||||
*/
|
||||
public Image getColumnImage( Object element, int columnIndex )
|
||||
{
|
||||
if ( columnIndex == 0 )
|
||||
return CDebugUIPlugin.getImageDescriptorRegistry().get( new CImageDescriptor( CDebugImages.DESC_OBJS_SIGNAL, 0 ) );
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(Object, int)
|
||||
*/
|
||||
public String getColumnText( Object element, int columnIndex )
|
||||
{
|
||||
if ( element instanceof ICSignal )
|
||||
{
|
||||
switch( columnIndex )
|
||||
{
|
||||
case 0:
|
||||
return ((ICSignal)element).getName();
|
||||
case 1:
|
||||
return ( ((ICSignal)element).isPassEnabled() ) ?
|
||||
SignalsViewer.YES_VALUE : SignalsViewer.NO_VALUE;
|
||||
case 2:
|
||||
return ( ((ICSignal)element).isStopEnabled() ) ?
|
||||
SignalsViewer.YES_VALUE : SignalsViewer.NO_VALUE;
|
||||
case 3:
|
||||
return ((ICSignal)element).getDescription();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.AbstractDebugView#createViewer(Composite)
|
||||
*/
|
||||
protected Viewer createViewer( Composite parent )
|
||||
{
|
||||
CDebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener( this );
|
||||
|
||||
// add tree viewer
|
||||
final SignalsViewer vv = new SignalsViewer( parent, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL );
|
||||
vv.setContentProvider( new SignalsViewContentProvider() );
|
||||
vv.setLabelProvider( new SignalsViewLabelProvider() );
|
||||
vv.setUseHashlookup( true );
|
||||
|
||||
// listen to selection in debug view
|
||||
getSite().getPage().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
|
||||
setEventHandler( new SignalsViewEventHandler( this ) );
|
||||
|
||||
return vv;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.AbstractDebugView#createActions()
|
||||
*/
|
||||
protected void createActions()
|
||||
{
|
||||
// set initial content here, as viewer has to be set
|
||||
setInitialContent();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.AbstractDebugView#getHelpContextId()
|
||||
*/
|
||||
protected String getHelpContextId()
|
||||
{
|
||||
return ICDebugHelpContextIds.SIGNALS_VIEW;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.AbstractDebugView#fillContextMenu(IMenuManager)
|
||||
*/
|
||||
protected void fillContextMenu( IMenuManager menu )
|
||||
{
|
||||
menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(IToolBarManager)
|
||||
*/
|
||||
protected void configureToolBar( IToolBarManager tbm )
|
||||
{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.ISelectionListener#selectionChanged(IWorkbenchPart, ISelection)
|
||||
*/
|
||||
public void selectionChanged( IWorkbenchPart part, ISelection selection )
|
||||
{
|
||||
if ( selection instanceof IStructuredSelection )
|
||||
{
|
||||
setViewerInput( (IStructuredSelection)selection );
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(PropertyChangeEvent)
|
||||
*/
|
||||
public void propertyChange( PropertyChangeEvent event )
|
||||
{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler#handleException(DebugException)
|
||||
*/
|
||||
public void handleException( DebugException e )
|
||||
{
|
||||
}
|
||||
|
||||
protected void setViewerInput( IStructuredSelection ssel )
|
||||
{
|
||||
ICSignalManager sm = null;
|
||||
if ( ssel != null && ssel.size() == 1 )
|
||||
{
|
||||
Object input = ssel.getFirstElement();
|
||||
if ( input instanceof IDebugElement )
|
||||
{
|
||||
sm = (ICSignalManager)((IDebugElement)input).getDebugTarget().getAdapter( ICSignalManager.class );
|
||||
}
|
||||
}
|
||||
|
||||
Object current = getViewer().getInput();
|
||||
if ( current != null && current.equals( sm ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
showViewer();
|
||||
getViewer().setInput( sm );
|
||||
updateObjects();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the viewer input on creation
|
||||
*/
|
||||
protected void setInitialContent()
|
||||
{
|
||||
ISelection selection =
|
||||
getSite().getPage().getSelection( IDebugUIConstants.ID_DEBUG_VIEW );
|
||||
if ( selection instanceof IStructuredSelection && !selection.isEmpty() )
|
||||
{
|
||||
setViewerInput( (IStructuredSelection)selection );
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IWorkbenchPart#dispose()
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
getSite().getPage().removeSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
|
||||
CDebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener( this );
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates this view's content provider.
|
||||
*
|
||||
* @return a content provider
|
||||
*/
|
||||
protected IContentProvider createContentProvider()
|
||||
{
|
||||
SignalsViewContentProvider cp = new SignalsViewContentProvider();
|
||||
cp.setExceptionHandler( this );
|
||||
return cp;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.debug.internal.ui.views.signals;
|
||||
|
||||
import org.eclipse.cdt.debug.core.ICSignalManager;
|
||||
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since: Jan 30, 2003
|
||||
*/
|
||||
public class SignalsViewContentProvider implements IStructuredContentProvider
|
||||
{
|
||||
/**
|
||||
* Handler for exceptions as content is retrieved
|
||||
*/
|
||||
private IDebugExceptionHandler fExceptionHandler = null;
|
||||
|
||||
/**
|
||||
* Constructor for SignalsViewContentProvider.
|
||||
*/
|
||||
public SignalsViewContentProvider()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
|
||||
*/
|
||||
public Object[] getElements( Object inputElement )
|
||||
{
|
||||
if ( inputElement instanceof ICSignalManager )
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((ICSignalManager)inputElement).getSignals();
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
if ( getExceptionHandler() != null )
|
||||
{
|
||||
getExceptionHandler().handleException( e );
|
||||
}
|
||||
else
|
||||
{
|
||||
CDebugUIPlugin.log( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, Object, Object)
|
||||
*/
|
||||
public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an exception handler for this content provider.
|
||||
*
|
||||
* @param handler debug exception handler or <code>null</code>
|
||||
*/
|
||||
protected void setExceptionHandler( IDebugExceptionHandler handler )
|
||||
{
|
||||
fExceptionHandler = handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the exception handler for this content provider.
|
||||
*
|
||||
* @return debug exception handler or <code>null</code>
|
||||
*/
|
||||
protected IDebugExceptionHandler getExceptionHandler()
|
||||
{
|
||||
return fExceptionHandler;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.debug.internal.ui.views.signals;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICSignal;
|
||||
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler;
|
||||
import org.eclipse.debug.core.DebugEvent;
|
||||
import org.eclipse.debug.core.model.IDebugTarget;
|
||||
import org.eclipse.debug.ui.AbstractDebugView;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since: Jan 30, 2003
|
||||
*/
|
||||
public class SignalsViewEventHandler extends AbstractDebugEventHandler
|
||||
{
|
||||
/**
|
||||
* Constructor for SignalsViewEventHandler.
|
||||
* @param view
|
||||
*/
|
||||
public SignalsViewEventHandler( AbstractDebugView view )
|
||||
{
|
||||
super( view );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler#doHandleDebugEvents(DebugEvent[])
|
||||
*/
|
||||
protected void doHandleDebugEvents( DebugEvent[] events )
|
||||
{
|
||||
for( int i = 0; i < events.length; i++ )
|
||||
{
|
||||
DebugEvent event = events[i];
|
||||
switch( event.getKind() )
|
||||
{
|
||||
case DebugEvent.CREATE:
|
||||
case DebugEvent.TERMINATE:
|
||||
if ( event.getSource() instanceof IDebugTarget ||
|
||||
event.getSource() instanceof ICSignal )
|
||||
refresh();
|
||||
break;
|
||||
case DebugEvent.CHANGE :
|
||||
if ( event.getSource() instanceof ICSignal )
|
||||
refresh( event.getSource() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the given element in the viewer - must be called in UI thread.
|
||||
*/
|
||||
protected void refresh( Object element )
|
||||
{
|
||||
if ( isAvailable() )
|
||||
{
|
||||
getView().showViewer();
|
||||
getTableViewer().refresh( element );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the viewer - must be called in UI thread.
|
||||
*/
|
||||
public void refresh()
|
||||
{
|
||||
if ( isAvailable() )
|
||||
{
|
||||
getView().showViewer();
|
||||
getTableViewer().refresh();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
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.jface.viewers.CellEditor;
|
||||
import org.eclipse.jface.viewers.ComboBoxCellEditor;
|
||||
import org.eclipse.jface.viewers.ICellModifier;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.TableColumn;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since: Jan 30, 2003
|
||||
*/
|
||||
public class SignalsViewer extends TableViewer
|
||||
{
|
||||
// String constants
|
||||
protected static final String YES_VALUE = "yes";
|
||||
protected static final String NO_VALUE = "no";
|
||||
|
||||
// Column properties
|
||||
private static final String CP_NAME = "name";
|
||||
private static final String CP_PASS = "pass";
|
||||
private static final String CP_SUSPEND = "suspend";
|
||||
private static final String CP_DESCRIPTION = "description";
|
||||
|
||||
/**
|
||||
* Constructor for SignalsViewer.
|
||||
* @param parent
|
||||
* @param style
|
||||
*/
|
||||
public SignalsViewer( Composite parent, int style )
|
||||
{
|
||||
super( parent, style );
|
||||
Table table = getTable();
|
||||
table.setLinesVisible( true );
|
||||
table.setHeaderVisible( true );
|
||||
table.setLayoutData( new GridData( GridData.FILL_BOTH ) );
|
||||
|
||||
// Create the table columns
|
||||
new TableColumn( table, SWT.NULL );
|
||||
new TableColumn( table, SWT.NULL );
|
||||
new TableColumn( table, SWT.NULL );
|
||||
new TableColumn( table, SWT.NULL );
|
||||
TableColumn[] columns = table.getColumns();
|
||||
columns[0].setResizable( true );
|
||||
columns[1].setResizable( false );
|
||||
columns[2].setResizable( false );
|
||||
columns[3].setResizable( true );
|
||||
|
||||
columns[0].setText( "Name" );
|
||||
columns[1].setText( "Pass" );
|
||||
columns[2].setText( "Suspend" );
|
||||
columns[3].setText( "Description" );
|
||||
|
||||
PixelConverter pc = new PixelConverter( parent );
|
||||
columns[0].setWidth( pc.convertWidthInCharsToPixels( 20 ) );
|
||||
columns[1].setWidth( pc.convertWidthInCharsToPixels( 15 ) );
|
||||
columns[2].setWidth( pc.convertWidthInCharsToPixels( 15 ) );
|
||||
columns[3].setWidth( pc.convertWidthInCharsToPixels( 50 ) );
|
||||
|
||||
CellEditor cellEditor = new ComboBoxCellEditor( table, new String[]{ YES_VALUE, NO_VALUE } );
|
||||
setCellEditors( new CellEditor[]{ null, cellEditor, cellEditor, null } );
|
||||
setColumnProperties( new String[]{ CP_NAME, CP_PASS, CP_SUSPEND, CP_DESCRIPTION } );
|
||||
setCellModifier( createCellModifier() );
|
||||
}
|
||||
|
||||
private ICellModifier createCellModifier()
|
||||
{
|
||||
return new ICellModifier()
|
||||
{
|
||||
public boolean canModify( Object element, String property )
|
||||
{
|
||||
if ( element instanceof ICSignal )
|
||||
{
|
||||
return ((ICSignal)element).getDebugTarget().isSuspended();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Object getValue( Object element, String property )
|
||||
{
|
||||
if ( element instanceof ICSignal )
|
||||
{
|
||||
if ( CP_PASS.equals( property ) )
|
||||
{
|
||||
return ( ((ICSignal)element).isPassEnabled() ) ? new Integer( 0 ) : new Integer( 1 );
|
||||
}
|
||||
else if ( CP_SUSPEND.equals( property ) )
|
||||
{
|
||||
return ( ((ICSignal)element).isStopEnabled() ) ? new Integer( 0 ) : new Integer( 1 );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void modify( Object element, String property, Object value )
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue