Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Implementation of the shared library view

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/ChangeLog,v
retrieving revision 1.75
diff -u -r1.75 ChangeLog
--- ChangeLog 17 Jan 2003 00:15:12 -0000 1.75
+++ ChangeLog 17 Jan 2003 19:30:57 -0000
@@ -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
Index: plugin.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/plugin.properties,v
retrieving revision 1.28
diff -u -r1.28 plugin.properties
--- plugin.properties 17 Jan 2003 00:15:12 -0000 1.28
+++ plugin.properties 17 Jan 2003 19:30:57 -0000
@@ -52,3 +52,5 @@
 SourcePropertyPage.name=Source Lookup
 
 DisassemblyEditor.name=Disassembly Editor
+
+LoadSymbolsAction.label=Load Symbols
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/plugin.xml,v
retrieving revision 1.45
diff -u -r1.45 plugin.xml
--- plugin.xml 17 Jan 2003 00:15:12 -0000 1.45
+++ plugin.xml 17 Jan 2003 19:30:57 -0000
@@ -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">
@@ -740,6 +777,27 @@
                helpContextId="add_globals_action_context"
                label="%AddGlobalsAction.label"
                tooltip="%AddGlobalsAction.tooltip">
+            <enablement>
+               <pluginState
+                     value="activated"
+                     id="org.eclipse.cdt.debug.ui">
+               </pluginState>
+            </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"
Index: icons/full/clcl16/load_symbols_co.gif
===================================================================
RCS file: icons/full/clcl16/load_symbols_co.gif
diff -N icons/full/clcl16/load_symbols_co.gif
Binary files /dev/null and load_symbols_co.gif differ
Index: icons/full/cview16/sharedlibraries_view.gif
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/icons/full/cview16/sharedlibraries_view.gif,v
retrieving revision 1.1
diff -u -r1.1 sharedlibraries_view.gif
Binary files /tmp/cvskvuEFr and sharedlibraries_view.gif differ
Index: icons/full/dlcl16/load_symbols_co.gif
===================================================================
RCS file: icons/full/dlcl16/load_symbols_co.gif
diff -N icons/full/dlcl16/load_symbols_co.gif
Binary files /dev/null and load_symbols_co.gif differ
Index: icons/full/elcl16/load_symbols_co.gif
===================================================================
RCS file: icons/full/elcl16/load_symbols_co.gif
diff -N icons/full/elcl16/load_symbols_co.gif
Binary files /dev/null and load_symbols_co.gif differ
Index: icons/full/eview16/sharedlibraries_view.gif
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/icons/full/eview16/sharedlibraries_view.gif,v
retrieving revision 1.1
diff -u -r1.1 sharedlibraries_view.gif
Binary files /tmp/cvsE1S4vQ and sharedlibraries_view.gif differ
Index: icons/full/obj16/library_obj.gif
===================================================================
RCS file: icons/full/obj16/library_obj.gif
diff -N icons/full/obj16/library_obj.gif
Binary files /dev/null and library_obj.gif differ
Index: icons/full/obj16/library_syms_obj.gif
===================================================================
RCS file: icons/full/obj16/library_syms_obj.gif
diff -N icons/full/obj16/library_syms_obj.gif
Binary files /dev/null and library_syms_obj.gif differ
Index: icons/full/obj16/sharedlibraryl_obj.gif
===================================================================
RCS file: icons/full/obj16/sharedlibraryl_obj.gif
diff -N icons/full/obj16/sharedlibraryl_obj.gif
Binary files /tmp/cvsYJvbYg and /dev/null differ
Index: icons/full/obj16/sharedlibraryu_obj.gif
===================================================================
RCS file: icons/full/obj16/sharedlibraryu_obj.gif
diff -N icons/full/obj16/sharedlibraryu_obj.gif
Binary files /tmp/cvsq2ylpH and /dev/null differ
Index: src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java,v
retrieving revision 1.32
diff -u -r1.32 CDTDebugModelPresentation.java
--- src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java 15 Jan 2003 18:17:33 -0000 1.32
+++ src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java 17 Jan 2003 19:30:57 -0000
@@ -22,6 +22,7 @@
 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 @@
    {
     return getVariableImage( (IVariable)element );
    }
+   if ( element instanceof ICSharedLibrary )
+   {
+    return getSharedLibraryImage( (ICSharedLibrary)element );
+   }
   }
   catch( CoreException e )
   {
@@ -244,6 +249,12 @@
   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 @@
   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.
@@ -769,6 +791,18 @@
  protected Image getExpressionImage( IExpression element ) throws DebugException
  {
   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 )
Index: src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java,v
retrieving revision 1.13
diff -u -r1.13 CDebugImages.java
--- src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java 17 Jan 2003 00:15:12 -0000 1.13
+++ src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java 17 Jan 2003 19:30:57 -0000
@@ -65,8 +65,8 @@
  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$
Index: src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsActionDelegate.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsActionDelegate.java
diff -N src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsActionDelegate.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsActionDelegate.java 17 Jan 2003 19:30:58 -0000
@@ -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;
+ }
+}
Index: src/org/eclipse/cdt/debug/internal/ui/views/AbstractDebugEventHandler.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/AbstractDebugEventHandler.java,v
retrieving revision 1.1
diff -u -r1.1 AbstractDebugEventHandler.java
--- src/org/eclipse/cdt/debug/internal/ui/views/AbstractDebugEventHandler.java 6 Aug 2002 19:00:46 -0000 1.1
+++ src/org/eclipse/cdt/debug/internal/ui/views/AbstractDebugEventHandler.java 17 Jan 2003 19:30:57 -0000
@@ -77,9 +77,7 @@
  {
   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 )
Index: src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesView.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesView.java,v
retrieving revision 1.1
diff -u -r1.1 SharedLibrariesView.java
--- src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesView.java 17 Jan 2003 00:15:12 -0000 1.1
+++ src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesView.java 17 Jan 2003 19:30:57 -0000
@@ -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.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 @@
  *
  * @since: Jan 16, 2003
  */
-public class SharedLibrariesView extends AbstractDebugEventHandlerView
+public class SharedLibrariesView extends AbstractDebugView
          implements ISelectionListener,
             IPropertyChangeListener,
             IDebugExceptionHandler
 {
  /**
-  * Enter type comment.
+  * Event handler for this view
+  */
+ private SharedLibrariesViewEventHandler fEventHandler;
+
+ /**
+  * The model presentation used as the label provider for the tree viewer.
+  */
+ private IDebugModelPresentation fModelPresentation;
+
+ /**
+  * Sets the event handler for this view
   *
-  * @since: Jan 16, 2003
+  * @param eventHandler event handler
   */
- public class SharedLibrariesViewLabelProvider extends LabelProvider
-              implements ITableLabelProvider
+ protected void setEventHandler( SharedLibrariesViewEventHandler eventHandler )
  {
-  /* (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;
-  }
+  fEventHandler = eventHandler;
+ }
 
-  /* (non-Javadoc)
-   * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(Object, int)
-   */
-  public String getColumnText( Object element, int columnIndex )
+ /**
+  * 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 @@
  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 @@
   * @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;
+ }
 }
Index: src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesViewEventHandler.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesViewEventHandler.java,v
retrieving revision 1.1
diff -u -r1.1 SharedLibrariesViewEventHandler.java
--- src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesViewEventHandler.java 17 Jan 2003 00:15:12 -0000 1.1
+++ src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesViewEventHandler.java 17 Jan 2003 19:30:57 -0000
@@ -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)
@@ -48,5 +79,81 @@
     }
    }
   }
+ }
+
+ /**
+  * 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();
  }
 }

Back to the top