Implementation of the shared library view.
|
@ -1,3 +1,13 @@
|
|||
2003-01-17 Mikhail Khodjaiants
|
||||
Implementation of the shared library view.
|
||||
* LoadSymbolsActionDelegate.java
|
||||
* SharedLibrariesView.java
|
||||
* SharedLibrariesViewEventHandler.java
|
||||
* CDTDebugModelPresentation.java
|
||||
* CDebugImages.java
|
||||
* plugin.properties
|
||||
* plugin.xml
|
||||
|
||||
2003-01-16 Mikhail Khodjaiants
|
||||
Implementing the Shared Libraries view.
|
||||
* SharedLibrariesView.java
|
||||
|
|
After Width: | Height: | Size: 104 B |
Before Width: | Height: | Size: 160 B After Width: | Height: | Size: 153 B |
After Width: | Height: | Size: 81 B |
After Width: | Height: | Size: 100 B |
Before Width: | Height: | Size: 160 B After Width: | Height: | Size: 153 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/obj16/library_obj.gif
Normal file
After Width: | Height: | Size: 160 B |
After Width: | Height: | Size: 153 B |
Before Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 168 B |
|
@ -52,3 +52,5 @@ CDebugActionGroup.name=C/C++ Debug
|
|||
SourcePropertyPage.name=Source Lookup
|
||||
|
||||
DisassemblyEditor.name=Disassembly Editor
|
||||
|
||||
LoadSymbolsAction.label=Load Symbols
|
||||
|
|
|
@ -627,6 +627,43 @@
|
|||
</enablement>
|
||||
</action>
|
||||
</viewerContribution>
|
||||
<viewerContribution
|
||||
targetID="org.eclipse.cdt.debug.ui.SharedLibrariesView"
|
||||
id="org.eclipse.cdt.debug.ui.SharedLibrariesViewPopupActions">
|
||||
<action
|
||||
label="%ShowFullPathsAction.label"
|
||||
icon="icons/full/clcl16/show_paths.gif"
|
||||
helpContextId="show_full_paths_action_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
|
||||
menubarPath="renderGroup"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction">
|
||||
<enablement>
|
||||
<pluginState
|
||||
value="activated"
|
||||
id="org.eclipse.cdt.debug.ui">
|
||||
</pluginState>
|
||||
</enablement>
|
||||
</action>
|
||||
</viewerContribution>
|
||||
<objectContribution
|
||||
objectClass="org.eclipse.cdt.debug.core.model.ICSharedLibrary"
|
||||
id="org.eclipse.cdt.debug.ui.SharedLibraryActions">
|
||||
<action
|
||||
label="%LoadSymbolsAction.label"
|
||||
icon="icons/full/clcl16/load_symbols_co.gif"
|
||||
helpContextId="breakpoint_properties_action_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.LoadSymbolsActionDelegate"
|
||||
menubarPath="additions"
|
||||
enablesFor="1"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.LoadSymbolsActionDelegate">
|
||||
<enablement>
|
||||
<pluginState
|
||||
value="activated"
|
||||
id="org.eclipse.cdt.debug.ui">
|
||||
</pluginState>
|
||||
</enablement>
|
||||
</action>
|
||||
</objectContribution>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.viewActions">
|
||||
|
@ -748,6 +785,27 @@
|
|||
</enablement>
|
||||
</action>
|
||||
</viewContribution>
|
||||
<viewContribution
|
||||
targetID="org.eclipse.cdt.debug.ui.SharedLibrariesView"
|
||||
id="org.eclipse.debug.ui.sharedLibrariesView.toolbar">
|
||||
<action
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
|
||||
toolbarPath="renderGroup"
|
||||
hoverIcon="icons/full/clcl16/show_paths.gif"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
|
||||
disabledIcon="icons/full/dlcl16/show_paths.gif"
|
||||
icon="icons/full/elcl16/show_parents.gif"
|
||||
helpContextId="show_full_paths_action_context"
|
||||
label="%ShowFullPathsAction.label"
|
||||
tooltip="%ShowFullPathsAction.tooltip">
|
||||
<enablement>
|
||||
<pluginState
|
||||
value="activated"
|
||||
id="org.eclipse.cdt.debug.ui">
|
||||
</pluginState>
|
||||
</enablement>
|
||||
</action>
|
||||
</viewContribution>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.editorActions">
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
|||
import org.eclipse.cdt.debug.core.model.ICDebugTargetType;
|
||||
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
|
||||
import org.eclipse.cdt.debug.core.model.ICValue;
|
||||
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
|
||||
import org.eclipse.cdt.debug.core.model.IDummyStackFrame;
|
||||
|
@ -228,6 +229,10 @@ public class CDTDebugModelPresentation extends LabelProvider
|
|||
{
|
||||
return getVariableImage( (IVariable)element );
|
||||
}
|
||||
if ( element instanceof ICSharedLibrary )
|
||||
{
|
||||
return getSharedLibraryImage( (ICSharedLibrary)element );
|
||||
}
|
||||
}
|
||||
catch( CoreException e )
|
||||
{
|
||||
|
@ -244,6 +249,12 @@ public class CDTDebugModelPresentation extends LabelProvider
|
|||
StringBuffer label = new StringBuffer();
|
||||
try
|
||||
{
|
||||
if ( element instanceof ICSharedLibrary )
|
||||
{
|
||||
label.append( getSharedLibraryText( (ICSharedLibrary)element, showQualified ) );
|
||||
return label.toString();
|
||||
}
|
||||
|
||||
if ( element instanceof IRegisterGroup )
|
||||
{
|
||||
label.append( ((IRegisterGroup)element).getName() );
|
||||
|
@ -478,6 +489,17 @@ public class CDTDebugModelPresentation extends LabelProvider
|
|||
return label;
|
||||
}
|
||||
|
||||
protected String getSharedLibraryText( ICSharedLibrary library, boolean qualified ) throws DebugException
|
||||
{
|
||||
String label = new String();
|
||||
IPath path = new Path( library.getFileName() );
|
||||
if ( !path.isEmpty() )
|
||||
label += ( qualified ? path.toOSString() : path.lastSegment() );
|
||||
return label + MessageFormat.format( " (Start address: ''{0}'' End address: ''{1}'')",
|
||||
new String[] { CDebugUtils.toHexAddressString( library.getStartAddress() ),
|
||||
CDebugUtils.toHexAddressString( library.getEndAddress() ) } );
|
||||
}
|
||||
|
||||
/**
|
||||
* Plug in the single argument to the resource String for the key to
|
||||
* get a formatted resource String.
|
||||
|
@ -771,6 +793,18 @@ public class CDTDebugModelPresentation extends LabelProvider
|
|||
return fDebugImageRegistry.get( new CImageDescriptor( DebugUITools.getImageDescriptor( IDebugUIConstants.IMG_OBJS_EXPRESSION ), 0 ) );
|
||||
}
|
||||
|
||||
protected Image getSharedLibraryImage( ICSharedLibrary element ) throws DebugException
|
||||
{
|
||||
if ( element.areSymbolsLoaded() )
|
||||
{
|
||||
return CDebugUIPlugin.getImageDescriptorRegistry().get( new CImageDescriptor( CDebugImages.DESC_OBJS_LOADED_SHARED_LIBRARY, 0 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return CDebugUIPlugin.getImageDescriptorRegistry().get( new CImageDescriptor( CDebugImages.DESC_OBJS_SHARED_LIBRARY, 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
protected DisassemblyEditorInput getDisassemblyEditorInput( ICAddressBreakpoint breakpoint )
|
||||
{
|
||||
IDebugTarget[] targets = DebugPlugin.getDefault().getLaunchManager().getDebugTargets();
|
||||
|
|
|
@ -65,8 +65,8 @@ public class CDebugImages
|
|||
public static final String IMG_OBJS_DISASSEMBLY = NAME_PREFIX + "disassembly_obj.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_PROJECT = NAME_PREFIX + "project_obj.gif"; //$NON-NLS-1$
|
||||
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 + "sharedlibraryl_obj.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_SHARED_LIBRARY = NAME_PREFIX + "sharedlibraryu_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_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$
|
||||
|
|
|
@ -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.ICSharedLibrary;
|
||||
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 17, 2003
|
||||
*/
|
||||
public class LoadSymbolsActionDelegate implements IObjectActionDelegate
|
||||
{
|
||||
private ICSharedLibrary fLibrary = null;
|
||||
|
||||
/**
|
||||
* Constructor for LoadSymbolsActionDelegate.
|
||||
*/
|
||||
public LoadSymbolsActionDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
/* (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 ( getSharedLibrary() != 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( getSharedLibrary() );
|
||||
}
|
||||
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 ICSharedLibrary )
|
||||
{
|
||||
boolean enabled = enablesFor( (ICSharedLibrary)element );
|
||||
action.setEnabled( enabled );
|
||||
if ( enabled )
|
||||
{
|
||||
setSharedLibrary( (ICSharedLibrary)element );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
action.setEnabled( false );
|
||||
setSharedLibrary( null );
|
||||
}
|
||||
|
||||
protected void doAction( ICSharedLibrary library ) throws DebugException
|
||||
{
|
||||
library.loadSymbols();
|
||||
}
|
||||
|
||||
private boolean enablesFor( ICSharedLibrary library )
|
||||
{
|
||||
return ( library != null && !library.areSymbolsLoaded() );
|
||||
}
|
||||
|
||||
private void setSharedLibrary( ICSharedLibrary library )
|
||||
{
|
||||
fLibrary = library;
|
||||
}
|
||||
|
||||
protected ICSharedLibrary getSharedLibrary()
|
||||
{
|
||||
return fLibrary;
|
||||
}
|
||||
}
|
|
@ -77,9 +77,7 @@ public abstract class AbstractDebugEventHandler implements IDebugEventSetListene
|
|||
{
|
||||
if ( isAvailable() )
|
||||
{
|
||||
final Object parent =
|
||||
(
|
||||
(ITreeContentProvider)getTreeViewer().getContentProvider()).getParent( element );
|
||||
final Object parent = ((ITreeContentProvider)getTreeViewer().getContentProvider()).getParent( element );
|
||||
// a parent can be null for a debug target or process that has not yet been associated
|
||||
// with a launch
|
||||
if ( parent != null )
|
||||
|
|
|
@ -6,17 +6,13 @@
|
|||
package org.eclipse.cdt.debug.internal.ui.views.sharedlibs;
|
||||
|
||||
import org.eclipse.cdt.debug.core.ICSharedLibraryManager;
|
||||
import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
|
||||
import org.eclipse.cdt.debug.internal.core.CDebugUtils;
|
||||
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.AbstractDebugEventHandler;
|
||||
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.AbstractDebugView;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
import org.eclipse.debug.ui.IDebugModelPresentation;
|
||||
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.jface.action.IToolBarManager;
|
||||
|
@ -25,16 +21,10 @@ import org.eclipse.jface.util.IPropertyChangeListener;
|
|||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
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.TableViewer;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.TableColumn;
|
||||
import org.eclipse.ui.ISelectionListener;
|
||||
import org.eclipse.ui.IWorkbenchActionConstants;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
@ -44,58 +34,50 @@ import org.eclipse.ui.IWorkbenchPart;
|
|||
*
|
||||
* @since: Jan 16, 2003
|
||||
*/
|
||||
public class SharedLibrariesView extends AbstractDebugEventHandlerView
|
||||
public class SharedLibrariesView extends AbstractDebugView
|
||||
implements ISelectionListener,
|
||||
IPropertyChangeListener,
|
||||
IDebugExceptionHandler
|
||||
{
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since: Jan 16, 2003
|
||||
* Event handler for this view
|
||||
*/
|
||||
public class SharedLibrariesViewLabelProvider 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 && element instanceof ICSharedLibrary )
|
||||
{
|
||||
if ( ((ICSharedLibrary)element).areSymbolsLoaded() )
|
||||
{
|
||||
return CDebugUIPlugin.getImageDescriptorRegistry().get( new CImageDescriptor( CDebugImages.DESC_OBJS_LOADED_SHARED_LIBRARY, 0 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return CDebugUIPlugin.getImageDescriptorRegistry().get( new CImageDescriptor( CDebugImages.DESC_OBJS_SHARED_LIBRARY, 0 ) );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private SharedLibrariesViewEventHandler fEventHandler;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(Object, int)
|
||||
*/
|
||||
public String getColumnText( Object element, int columnIndex )
|
||||
/**
|
||||
* The model presentation used as the label provider for the tree viewer.
|
||||
*/
|
||||
private IDebugModelPresentation fModelPresentation;
|
||||
|
||||
/**
|
||||
* Sets the event handler for this view
|
||||
*
|
||||
* @param eventHandler event handler
|
||||
*/
|
||||
protected void setEventHandler( SharedLibrariesViewEventHandler eventHandler )
|
||||
{
|
||||
fEventHandler = eventHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the event handler for this view
|
||||
*
|
||||
* @return The event handler for this view
|
||||
*/
|
||||
protected SharedLibrariesViewEventHandler getEventHandler()
|
||||
{
|
||||
return fEventHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IWorkbenchPart#dispose()
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
super.dispose();
|
||||
if ( getEventHandler() != null )
|
||||
{
|
||||
if ( element instanceof ICSharedLibrary )
|
||||
{
|
||||
switch( columnIndex )
|
||||
{
|
||||
case 0:
|
||||
return ((ICSharedLibrary)element).getFileName();
|
||||
case 1:
|
||||
return CDebugUtils.toHexAddressString( ((ICSharedLibrary)element).getStartAddress() );
|
||||
case 2:
|
||||
return CDebugUtils.toHexAddressString( ((ICSharedLibrary)element).getEndAddress() );
|
||||
case 3:
|
||||
return ( ((ICSharedLibrary)element).areSymbolsLoaded() ) ? "Yes" : "No";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
getEventHandler().dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,25 +87,8 @@ public class SharedLibrariesView extends AbstractDebugEventHandlerView
|
|||
protected Viewer createViewer( Composite parent )
|
||||
{
|
||||
TableViewer viewer = new TableViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL );
|
||||
|
||||
Table table = viewer.getTable();
|
||||
table.setHeaderVisible( true );
|
||||
table.setLinesVisible( 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].setText( "Name" );
|
||||
columns[1].setText( "Start Address" );
|
||||
columns[2].setText( "End Address" );
|
||||
columns[3].setText( "Symbols" );
|
||||
|
||||
viewer.setContentProvider( new SharedLibrariesViewContentProvider() );
|
||||
viewer.setLabelProvider( new SharedLibrariesViewLabelProvider() );
|
||||
viewer.setLabelProvider( getModelPresentation() );
|
||||
|
||||
// listen to selection in debug view
|
||||
getSite().getPage().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
|
||||
|
@ -235,8 +200,17 @@ public class SharedLibrariesView extends AbstractDebugEventHandlerView
|
|||
* @param viewer the viewer associated with this view
|
||||
* @return an event handler
|
||||
*/
|
||||
protected AbstractDebugEventHandler createEventHandler( Viewer viewer )
|
||||
protected SharedLibrariesViewEventHandler createEventHandler( Viewer viewer )
|
||||
{
|
||||
return new SharedLibrariesViewEventHandler( this );
|
||||
}
|
||||
|
||||
protected IDebugModelPresentation getModelPresentation()
|
||||
{
|
||||
if ( fModelPresentation == null )
|
||||
{
|
||||
fModelPresentation = DebugUITools.newDebugModelPresentation();
|
||||
}
|
||||
return fModelPresentation;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,24 +6,55 @@
|
|||
package org.eclipse.cdt.debug.internal.ui.views.sharedlibs;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
|
||||
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler;
|
||||
import org.eclipse.debug.core.DebugEvent;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.IDebugEventSetListener;
|
||||
import org.eclipse.debug.ui.AbstractDebugView;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since: Jan 16, 2003
|
||||
*/
|
||||
public class SharedLibrariesViewEventHandler extends AbstractDebugEventHandler
|
||||
public class SharedLibrariesViewEventHandler implements IDebugEventSetListener
|
||||
{
|
||||
/**
|
||||
* This event handler's view
|
||||
*/
|
||||
private AbstractDebugView fView;
|
||||
|
||||
/**
|
||||
* Constructor for SharedLibrariesViewEventHandler.
|
||||
* @param view
|
||||
*/
|
||||
public SharedLibrariesViewEventHandler( AbstractDebugView view )
|
||||
{
|
||||
super( view );
|
||||
setView( view );
|
||||
DebugPlugin.getDefault().addDebugEventListener( this );
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IDebugEventSetListener#handleDebugEvents(DebugEvent[])
|
||||
*/
|
||||
public void handleDebugEvents( final DebugEvent[] events )
|
||||
{
|
||||
if ( !isAvailable() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
Runnable r = new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if ( isAvailable() )
|
||||
{
|
||||
doHandleDebugEvents( events );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
getView().asyncExec( r );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -49,4 +80,80 @@ public class SharedLibrariesViewEventHandler extends AbstractDebugEventHandler
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* De-registers this event handler from the debug model.
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
DebugPlugin plugin = DebugPlugin.getDefault();
|
||||
plugin.removeDebugEventListener( this );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the view this event handler is
|
||||
* updating.
|
||||
*
|
||||
* @return debug view
|
||||
*/
|
||||
protected AbstractDebugView getView()
|
||||
{
|
||||
return fView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the view this event handler is updating.
|
||||
*
|
||||
* @param view debug view
|
||||
*/
|
||||
private void setView( AbstractDebugView view )
|
||||
{
|
||||
fView = view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the viewer this event handler is updating.
|
||||
*
|
||||
* @return viewer
|
||||
*/
|
||||
protected TableViewer getTableViewer()
|
||||
{
|
||||
return (TableViewer)getView().getViewer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this event handler's viewer is
|
||||
* currently available.
|
||||
*
|
||||
* @return whether this event handler's viewer is
|
||||
* currently available
|
||||
*/
|
||||
protected boolean isAvailable()
|
||||
{
|
||||
return getView().isAvailable();
|
||||
}
|
||||
}
|
||||
|
|