Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Khodjaiants2003-01-17 14:31:40 -0500
committerMikhail Khodjaiants2003-01-17 14:31:40 -0500
commited8c15c83a843fbec0f27da1e9029e07e68a6922 (patch)
treed7f228af86bfec669293a83ba5403a09a2a47032 /debug/org.eclipse.cdt.debug.ui
parentc6de1af5f3e9b8aeb155b126e8749260c82e9b20 (diff)
downloadorg.eclipse.cdt-ed8c15c83a843fbec0f27da1e9029e07e68a6922.tar.gz
org.eclipse.cdt-ed8c15c83a843fbec0f27da1e9029e07e68a6922.tar.xz
org.eclipse.cdt-ed8c15c83a843fbec0f27da1e9029e07e68a6922.zip
Implementation of the shared library view.
Diffstat (limited to 'debug/org.eclipse.cdt.debug.ui')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/ChangeLog10
-rw-r--r--debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/load_symbols_co.gifbin0 -> 104 bytes
-rw-r--r--debug/org.eclipse.cdt.debug.ui/icons/full/cview16/sharedlibraries_view.gifbin160 -> 153 bytes
-rw-r--r--debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/load_symbols_co.gifbin0 -> 81 bytes
-rw-r--r--debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/load_symbols_co.gifbin0 -> 100 bytes
-rw-r--r--debug/org.eclipse.cdt.debug.ui/icons/full/eview16/sharedlibraries_view.gifbin160 -> 153 bytes
-rw-r--r--debug/org.eclipse.cdt.debug.ui/icons/full/obj16/library_obj.gifbin0 -> 160 bytes
-rw-r--r--debug/org.eclipse.cdt.debug.ui/icons/full/obj16/library_syms_obj.gifbin0 -> 153 bytes
-rw-r--r--debug/org.eclipse.cdt.debug.ui/icons/full/obj16/sharedlibraryl_obj.gifbin160 -> 0 bytes
-rw-r--r--debug/org.eclipse.cdt.debug.ui/icons/full/obj16/sharedlibraryu_obj.gifbin168 -> 0 bytes
-rw-r--r--debug/org.eclipse.cdt.debug.ui/plugin.properties2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/plugin.xml58
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java34
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsActionDelegate.java126
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/AbstractDebugEventHandler.java4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesView.java122
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesViewEventHandler.java113
18 files changed, 391 insertions, 82 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog
index 42f1efcf97..b0caed6428 100644
--- a/debug/org.eclipse.cdt.debug.ui/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog
@@ -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
diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/load_symbols_co.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/load_symbols_co.gif
new file mode 100644
index 0000000000..4007422e43
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/load_symbols_co.gif
Binary files differ
diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/cview16/sharedlibraries_view.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/cview16/sharedlibraries_view.gif
index d84096acfc..e45ab0f692 100644
--- a/debug/org.eclipse.cdt.debug.ui/icons/full/cview16/sharedlibraries_view.gif
+++ b/debug/org.eclipse.cdt.debug.ui/icons/full/cview16/sharedlibraries_view.gif
Binary files differ
diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/load_symbols_co.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/load_symbols_co.gif
new file mode 100644
index 0000000000..545b489bdf
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/load_symbols_co.gif
Binary files differ
diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/load_symbols_co.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/load_symbols_co.gif
new file mode 100644
index 0000000000..2e4eca281c
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/load_symbols_co.gif
Binary files differ
diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/eview16/sharedlibraries_view.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/eview16/sharedlibraries_view.gif
index d84096acfc..e45ab0f692 100644
--- a/debug/org.eclipse.cdt.debug.ui/icons/full/eview16/sharedlibraries_view.gif
+++ b/debug/org.eclipse.cdt.debug.ui/icons/full/eview16/sharedlibraries_view.gif
Binary files differ
diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/library_obj.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/library_obj.gif
new file mode 100644
index 0000000000..148057bb3c
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/library_obj.gif
Binary files differ
diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/library_syms_obj.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/library_syms_obj.gif
new file mode 100644
index 0000000000..e45ab0f692
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/library_syms_obj.gif
Binary files differ
diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/sharedlibraryl_obj.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/sharedlibraryl_obj.gif
deleted file mode 100644
index d84096acfc..0000000000
--- a/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/sharedlibraryl_obj.gif
+++ /dev/null
Binary files differ
diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/sharedlibraryu_obj.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/sharedlibraryu_obj.gif
deleted file mode 100644
index 99626dee90..0000000000
--- a/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/sharedlibraryu_obj.gif
+++ /dev/null
Binary files differ
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties
index 0bd4833ed1..3dc22cce4d 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.properties
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties
@@ -52,3 +52,5 @@ CDebugActionGroup.name=C/C++ Debug
SourcePropertyPage.name=Source Lookup
DisassemblyEditor.name=Disassembly Editor
+
+LoadSymbolsAction.label=Load Symbols
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index ae00f8fd44..e8eabfbdbe 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -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">
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java
index 44996e8a50..07959ce0c6 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java
@@ -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();
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java
index 73a3c73c3a..a0161ed3a6 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java
@@ -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$
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsActionDelegate.java
new file mode 100644
index 0000000000..8d2b056ff7
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsActionDelegate.java
@@ -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;
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/AbstractDebugEventHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/AbstractDebugEventHandler.java
index f3a2ac57a5..cedd98a843 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/AbstractDebugEventHandler.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/AbstractDebugEventHandler.java
@@ -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 )
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesView.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesView.java
index f13982e0db..12ae6dcfe1 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesView.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesView.java
@@ -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.
+ * 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 @@ 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;
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesViewEventHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesViewEventHandler.java
index 91fdc2b03c..6cc564dc6f 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesViewEventHandler.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesViewEventHandler.java
@@ -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();
+ }
}

Back to the top