diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog index 66f2be78075..be679dd2e60 100644 --- a/debug/org.eclipse.cdt.debug.ui/ChangeLog +++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog @@ -1,3 +1,18 @@ +2005-02-17 Mikhail Khodjaiants + Bug 82264: Enhance the Shared Libraries view. + Removed the Shared Libraries view. + * CDebugModelPresentation.java + * LoadSymbolsActionDelegate.java + * LoadSymbolsForAllActionDelegate.java + * SharedLibrariesMessages.java + * SharedLibrariesMessages.properties + * SharedLibrariesView.java + * SharedLibrariesViewContentProvider.java + * SharedLibrariesViewEventHandler.java + * ICDebugUIConstants.java + * plugin.properties + * plugin.xml + 2005-02-17 Mikhail Khodjaiants Bug 82264: Enhance the Shared Libraries view. No need to compute the module's labels in background. diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties index 6ccfd7ae1c9..909018d7747 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.properties +++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties @@ -13,14 +13,12 @@ pluginName=C/C++ Development Tools Debugger UI providerName=Eclipse.org MemoryView.name=Memory -SharedLibrariesView.name=Shared Libraries ModulesView.name=Modules SignalsView.name=Signals CDebuggerPage.name=C Debugger UI Page MemoryPreferencePage.name=Memory View CDebugPreferencePage.name=Debug -SharedLibrariesPreferencePage.name=Shared Libraries View SourcePreferencePage.name=Source Code Locations RunMenu.label=&Run diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml index 8a9266b40dc..909798074f1 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.xml +++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml @@ -40,13 +40,6 @@ - - - - - - - - - - - - - - - - - - - - - @@ -897,41 +842,6 @@ - - - - - - - - - - - @@ -1116,10 +1026,6 @@ viewId="org.eclipse.debug.ui.MemoryView" contextId="org.eclipse.cdt.debug.ui.debugging"> - - diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java index f3b7c93e0d4..101687566c1 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java @@ -12,7 +12,6 @@ package org.eclipse.cdt.debug.internal.ui; import java.text.MessageFormat; import java.util.HashMap; - import org.eclipse.cdt.core.resources.FileStorage; import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointHit; @@ -33,7 +32,6 @@ import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint; import org.eclipse.cdt.debug.core.model.ICGlobalVariable; import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; import org.eclipse.cdt.debug.core.model.ICModule; -import org.eclipse.cdt.debug.core.model.ICSharedLibrary; import org.eclipse.cdt.debug.core.model.ICSignal; import org.eclipse.cdt.debug.core.model.ICStackFrame; import org.eclipse.cdt.debug.core.model.ICThread; @@ -244,9 +242,6 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode if ( element instanceof IVariable ) { return getVariableImage( (IVariable)element ); } - if ( element instanceof ICSharedLibrary ) { - return getSharedLibraryImage( (ICSharedLibrary)element ); - } if ( element instanceof ICModule ) { return getModuleImage( (ICModule)element ); } @@ -334,10 +329,6 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode boolean showQualified = isShowQualifiedNames(); StringBuffer label = new StringBuffer(); try { - if ( element instanceof ICSharedLibrary ) { - label.append( getSharedLibraryText( (ICSharedLibrary)element, showQualified ) ); - return label.toString(); - } if ( element instanceof ICModule ) { label.append( getModuleText( (ICModule)element, showQualified ) ); return label.toString(); @@ -404,20 +395,6 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode return getDefaultText( element ); } - protected String getSharedLibraryText( ICSharedLibrary library, boolean qualified ) { - String label = new String(); - String name = library.getFileName(); - if ( !isEmpty( name ) ) { - IPath path = new Path( library.getFileName() ); - if ( !path.isEmpty() ) - label += ( qualified ? path.toOSString() : path.lastSegment() ); - } - else { - label += CDebugUIMessages.getString( "CDebugModelPresentation.unknown_1" ); //$NON-NLS-1$ - } - return label; - } - protected String getModuleText( ICModule module, boolean qualified ) { StringBuffer sb = new StringBuffer(); IPath path = module.getImageName(); @@ -455,10 +432,6 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode return this.fImageCache; } - private CDebugImageDescriptorRegistry getDebugImageRegistry() { - return this.fDebugImageRegistry; - } - private boolean isEmpty( String string ) { return ( string == null || string.trim().length() == 0 ); } @@ -653,16 +626,6 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode return fDebugImageRegistry.get( DebugUITools.getImageDescriptor( IDebugUIConstants.IMG_OBJS_EXPRESSION ) ); } - protected Image getSharedLibraryImage( ICSharedLibrary element ) { - if ( element.areSymbolsLoaded() ) { - return getImageCache().getImageFor( - new OverlayImageDescriptor( getDebugImageRegistry().get( CDebugImages.DESC_OBJS_SHARED_LIBRARY_WITH_SYMBOLS ), - new ImageDescriptor[] { null, CDebugImages.DESC_OVRS_SYMBOLS, null, null } ) ); - } - return CDebugUIPlugin.getImageDescriptorRegistry().get( CDebugImages.DESC_OBJS_SHARED_LIBRARY ); - } - - protected Image getModuleImage( ICModule element ) { switch( element.getType() ) { case ICModule.EXECUTABLE: 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 deleted file mode 100644 index 8a60a901e3f..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsActionDelegate.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.actions; - -import org.eclipse.cdt.debug.core.CDIDebugModel; -import org.eclipse.cdt.debug.core.CDebugUtils; -import org.eclipse.cdt.debug.core.model.ICSharedLibrary; -import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IWorkbenchPart; - -/** - * Enter type comment. - * - * @since: Jan 17, 2003 - */ -public class LoadSymbolsActionDelegate implements IObjectActionDelegate { - - private ICSharedLibrary fLibrary; - - /** - * Constructor for LoadSymbolsActionDelegate. - */ - public LoadSymbolsActionDelegate() { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart) - */ - public void setActivePart( IAction action, IWorkbenchPart targetPart ) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run( IAction action ) { - final ICSharedLibrary library = getSharedLibrary(); - if ( library != null ) { - - DebugPlugin.getDefault().asyncExec( - new Runnable() { - public void run() { - try { - doAction( getSharedLibrary() ); - } - catch( DebugException e ) { - failed( e ); - } - } - } ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.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; - } - - protected void failed( Throwable e ) { - MultiStatus ms = new MultiStatus( CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, ActionMessages.getString( "LoadSymbolsActionDelegate.Operation_failed_1" ), null ); //$NON-NLS-1$ - ms.add( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, e.getMessage(), e ) ); - CDebugUtils.error( ms, this ); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsForAllActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsForAllActionDelegate.java index 8a59ea879d5..75f271488ad 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsForAllActionDelegate.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsForAllActionDelegate.java @@ -24,7 +24,7 @@ import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.jface.action.IAction; /** - * The delegate for the "Load Symbols For All" action of the Shared Libraries view. + * The delegate for the "Load Symbols For All" action of the Modules view. */ public class LoadSymbolsForAllActionDelegate extends AbstractViewActionDelegate { @@ -53,7 +53,7 @@ public class LoadSymbolsForAllActionDelegate extends AbstractViewActionDelegate public void run() { try { - target.loadSymbols(); + target.loadSymbolsForAllModules(); } catch( DebugException e ) { failed( e ); diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesMessages.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesMessages.java deleted file mode 100644 index cdd6d270d07..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesMessages.java +++ /dev/null @@ -1,34 +0,0 @@ -/********************************************************************** - * Copyright (c) 2004 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - ***********************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.views.sharedlibs; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class SharedLibrariesMessages { - - private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.views.sharedlibs.SharedLibrariesMessages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - - private SharedLibrariesMessages() { - } - - public static String getString( String key ) { - try { - return RESOURCE_BUNDLE.getString( key ); - } - catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesMessages.properties deleted file mode 100644 index 84a6da8acda..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesMessages.properties +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 2004 QNX Software Systems and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Common Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/cpl-v10.html -# -# Contributors: -# QNX Software Systems - initial API and implementation -############################################################################### - -SharedLibrariesView.Name_1=Name -SharedLibrariesView.Start_Address_1=Start Address -SharedLibrariesView.End_Address_1=End Address -SharedLibrariesView.Loaded_1=Loaded -SharedLibrariesView.Not_loaded_1=Not loaded -SharedLibrariesView.Symbols_1=Symbols 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 deleted file mode 100644 index d5a931c425b..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesView.java +++ /dev/null @@ -1,281 +0,0 @@ -/********************************************************************** - * Copyright (c) 2004 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - ***********************************************************************/ -package org.eclipse.cdt.debug.internal.ui.views.sharedlibs; - -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICSharedLibrary; -import org.eclipse.cdt.debug.internal.ui.CDebugModelPresentation; -import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds; -import org.eclipse.cdt.debug.internal.ui.PixelConverter; -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.cdt.debug.ui.ICDebugUIConstants; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IDebugElement; -import org.eclipse.debug.ui.IDebugModelPresentation; -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.IBaseLabelProvider; -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.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableTreeViewer; -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.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.ui.INullSelectionListener; -import org.eclipse.ui.ISelectionListener; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.IWorkbenchPart; - -/** - * Displays shared libraries. - */ -public class SharedLibrariesView extends AbstractDebugEventHandlerView - implements ISelectionListener, - INullSelectionListener, - IPropertyChangeListener, - IDebugExceptionHandler { - - public class SharedLibrariesLabelProvider extends CDebugModelPresentation implements ITableLabelProvider { - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) - */ - public Image getColumnImage( Object element, int columnIndex ) { - if ( element instanceof ICSharedLibrary && columnIndex == 1 ) - return getImage( element ); - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) - */ - public String getColumnText( Object element, int columnIndex ) { - if ( element instanceof ICSharedLibrary ) { - ICSharedLibrary library = (ICSharedLibrary)element; - switch( columnIndex ) { - case 0: - return ""; //$NON-NLS-1$ - case 1: - return getText( element ); - case 2: - return ( library.areSymbolsLoaded() ) ? SharedLibrariesMessages.getString( "SharedLibrariesView.Loaded_1" ) : SharedLibrariesMessages.getString( "SharedLibrariesView.Not_loaded_1" ); //$NON-NLS-1$ //$NON-NLS-2$ - case 3: - return library.getStartAddress().toHexAddressString(); //$NON-NLS-1$ - case 4: - return library.getEndAddress().toHexAddressString(); //$NON-NLS-1$ - } - } - return null; - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#createViewer(Composite) - */ - protected Viewer createViewer( Composite parent ) { - TableTreeViewer viewer = new TableTreeViewer( parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL ); - Table table = viewer.getTableTree().getTable(); - table.setLinesVisible( true ); - table.setHeaderVisible( true ); - - // Create the table columns - new TableColumn( table, SWT.NULL ); - 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[1].setResizable( true ); - columns[2].setResizable( true ); - columns[3].setResizable( true ); - columns[4].setResizable( true ); - - columns[0].setText( "" ); //$NON-NLS-1$ - columns[1].setText( SharedLibrariesMessages.getString( "SharedLibrariesView.Name_1" ) ); //$NON-NLS-1$ - columns[2].setText( SharedLibrariesMessages.getString( "SharedLibrariesView.Symbols_1" ) ); //$NON-NLS-1$ - columns[3].setText( SharedLibrariesMessages.getString( "SharedLibrariesView.Start_Address_1" ) ); //$NON-NLS-1$ - columns[4].setText( SharedLibrariesMessages.getString( "SharedLibrariesView.End_Address_1" ) ); //$NON-NLS-1$ - - PixelConverter pc = new PixelConverter( parent ); - columns[0].setWidth( pc.convertWidthInCharsToPixels( 3 ) ); - columns[1].setWidth( pc.convertWidthInCharsToPixels( 50 ) ); - columns[2].setWidth( pc.convertWidthInCharsToPixels( 20 ) ); - columns[3].setWidth( pc.convertWidthInCharsToPixels( 20 ) ); - columns[4].setWidth( pc.convertWidthInCharsToPixels( 20 ) ); - - viewer.setContentProvider( createContentProvider() ); - viewer.setLabelProvider( new SharedLibrariesLabelProvider() ); - - CDebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener( this ); - - // listen to selection in debug view - getSite().getPage().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this ); - setEventHandler( createEventHandler( viewer ) ); - - return viewer; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#createActions() - */ - protected void createActions() { - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#getHelpContextId() - */ - protected String getHelpContextId() { - return ICDebugHelpContextIds.SHARED_LIBRARIES_VIEW; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#fillContextMenu(IMenuManager) - */ - protected void fillContextMenu( IMenuManager menu ) { - menu.add( new Separator( ICDebugUIConstants.EMPTY_SHARED_LIBRARIES_GROUP ) ); - menu.add( new Separator( ICDebugUIConstants.SHARED_LIBRARIES_GROUP ) ); - menu.add( new Separator( ICDebugUIConstants.EMPTY_REFRESH_GROUP ) ); - menu.add( new Separator( ICDebugUIConstants.REFRESH_GROUP ) ); - menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) ); - updateObjects(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(IToolBarManager) - */ - protected void configureToolBar( IToolBarManager tbm ) { - tbm.add( new Separator( ICDebugUIConstants.SHARED_LIBRARIES_GROUP ) ); - tbm.add( new Separator( ICDebugUIConstants.REFRESH_GROUP ) ); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.ISelectionListener#selectionChanged(IWorkbenchPart, ISelection) - */ - public void selectionChanged( IWorkbenchPart part, ISelection selection ) { - if ( !isAvailable() || !isVisible() ) - return; - if ( selection == null ) - setViewerInput( new StructuredSelection() ); - else 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 ) { - showMessage( e.getMessage() ); - } - - protected void setViewerInput( IStructuredSelection ssel ) { - ICDebugTarget target = null; - if ( ssel != null && ssel.size() == 1 ) { - Object input = ssel.getFirstElement(); - if ( input instanceof IDebugElement && ((IDebugElement)input).getDebugTarget() instanceof ICDebugTarget ) - target = (ICDebugTarget)((IDebugElement)input).getDebugTarget(); - } - - if ( getViewer() == null ) - return; - - Object current = getViewer().getInput(); - if ( current != null && current.equals( target ) ) { - updateObjects(); - return; - } - - showViewer(); - getViewer().setInput( target ); - updateObjects(); - } - - /** - * Creates this view's event handler. - * - * @param viewer the viewer associated with this view - * @return an event handler - */ - protected AbstractDebugEventHandler createEventHandler( Viewer viewer ) { - return new SharedLibrariesViewEventHandler( this ); - } - - /** - * Creates this view's content provider. - * - * @return a content provider - */ - protected IContentProvider createContentProvider() { - SharedLibrariesViewContentProvider cp = new SharedLibrariesViewContentProvider(); - cp.setExceptionHandler( this ); - return cp; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#becomesHidden() - */ - protected void becomesHidden() { - setViewerInput( new StructuredSelection() ); - super.becomesHidden(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#becomesVisible() - */ - protected void becomesVisible() { - super.becomesVisible(); - IViewPart part = getSite().getPage().findView( IDebugUIConstants.ID_DEBUG_VIEW ); - if ( part != null ) { - ISelection selection = getSite().getPage().getSelection( IDebugUIConstants.ID_DEBUG_VIEW ); - selectionChanged( part, 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(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDebugView#getPresentation(java.lang.String) - */ - public IDebugModelPresentation getPresentation( String id ) { - StructuredViewer viewer = getStructuredViewer(); - if ( viewer != null ) { - IBaseLabelProvider lp = viewer.getLabelProvider(); - return ( lp instanceof SharedLibrariesLabelProvider ) ? (SharedLibrariesLabelProvider)lp : null; - } - return null; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesViewContentProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesViewContentProvider.java deleted file mode 100644 index 6f1c6b5436c..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesViewContentProvider.java +++ /dev/null @@ -1,191 +0,0 @@ -/********************************************************************** - * Copyright (c) 2004 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - ***********************************************************************/ -package org.eclipse.cdt.debug.internal.ui.views.sharedlibs; - -import java.util.HashMap; - -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -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.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; - -/** - * Provides content for the shared libraries view. - * - * @since: Jan 21, 2003 - */ -public class SharedLibrariesViewContentProvider implements ITreeContentProvider { - - /** - * A table that maps children to their parent element such that this - * content provider can walk back up the parent chain (since values do not - * know their parent). Map of IVariable (child) ->IVariable - * (parent). - */ - private HashMap fParentCache; - - /** - * Handler for exceptions as content is retrieved - */ - private IDebugExceptionHandler fExceptionHandler; - - /** - * Constructor for SharedLibrariesViewContentProvider. - */ - public SharedLibrariesViewContentProvider() { - setParentCache( new HashMap( 10 ) ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(Object) - */ - public Object[] getChildren( Object parent ) { - if ( parent instanceof ICDebugTarget ) { - Object[] children = null; - ICDebugTarget target = (ICDebugTarget)parent; - try { - if ( target != null ) - children = target.getSharedLibraries(); - if ( children != null ) { - cache( parent, children ); - return children; - } - } - catch( DebugException e ) { - if ( getExceptionHandler() != null ) - getExceptionHandler().handleException( e ); - else - CDebugUIPlugin.log( e ); - } - } - return new Object[0]; - } - - /** - * Caches the given elememts as children of the given parent. - * - * @param parent - * parent element - * @param children - * children elements - */ - protected void cache( Object parent, Object[] children ) { - for ( int i = 0; i < children.length; i++ ) { - getParentCache().put( children[i], parent ); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(Object) - */ - public Object getParent( Object element ) { - return getParentCache().get( element ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(Object) - */ - public boolean hasChildren( Object parent ) { - if ( parent instanceof ICDebugTarget ) { - try { - ICDebugTarget target = (ICDebugTarget)parent; - return target.hasSharedLibraries(); - } - catch( DebugException e ) { - CDebugUIPlugin.log( e ); - } - } - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object) - */ - public Object[] getElements( Object inputElement ) { - return getChildren( inputElement ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.viewers.IContentProvider#dispose() - */ - public void dispose() { - setParentCache( null ); - setExceptionHandler( null ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, - * Object, Object) - */ - public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) { - clearCache(); - } - - protected void clearCache() { - if ( getParentCache() != null ) { - getParentCache().clear(); - } - } - - /** - * Remove the cached parent for the given children - * - * @param children - * for which to remove cached parents - */ - public void removeCache( Object[] children ) { - if ( getParentCache() != null ) { - for ( int i = 0; i < children.length; i++ ) { - getParentCache().remove( children[i] ); - } - } - } - - /** - * Sets an exception handler for this content provider. - * - * @param handler debug exception handler or null - */ - protected void setExceptionHandler( IDebugExceptionHandler handler ) { - this.fExceptionHandler = handler; - } - - /** - * Returns the exception handler for this content provider. - * - * @return debug exception handler or null - */ - protected IDebugExceptionHandler getExceptionHandler() { - return this.fExceptionHandler; - } - - private HashMap getParentCache() { - return this.fParentCache; - } - - private void setParentCache( HashMap parentCache ) { - this.fParentCache = parentCache; - } -} 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 deleted file mode 100644 index 8fb7e1e7bab..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesViewEventHandler.java +++ /dev/null @@ -1,80 +0,0 @@ -/********************************************************************** - * Copyright (c) 2004 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - ***********************************************************************/ -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.model.IDebugTarget; -import org.eclipse.debug.ui.AbstractDebugView; - -/** - * Updates the shared libraries view. - * - * @since: Jan 21, 2003 - */ -public class SharedLibrariesViewEventHandler extends AbstractDebugEventHandler { - - /** - * Constructs a new event handler on the given view - * - * @param view shared libraries view - */ - public SharedLibrariesViewEventHandler( 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 ICSharedLibrary ) - refresh(); - break; - case DebugEvent.CHANGE : - if ( event.getSource() instanceof ICSharedLibrary ) - refresh( event.getSource() ); - break; - } - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler#refresh() - */ - public void refresh() { - if ( isAvailable() ) { - getView().showViewer(); - getTableTreeViewer().refresh(); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler#refresh(java.lang.Object) - */ - protected void refresh( Object element ) { - if ( isAvailable() ) { - getView().showViewer(); - getTableTreeViewer().refresh( element ); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/ICDebugUIConstants.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/ICDebugUIConstants.java index e6789fcdc1b..ba86d18489e 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/ICDebugUIConstants.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/ICDebugUIConstants.java @@ -59,21 +59,6 @@ public interface ICDebugUIConstants { */ public static final String REFRESH_GROUP = "refreshGroup"; //$NON-NLS-1$ - /** - * Identifier for an empty group preceeding a - * shared libraries group in a menu (value " - * emptySharedLibrariesGroup" - * ). - */ - public static final String EMPTY_SHARED_LIBRARIES_GROUP = "emptySharedLibrariesGroup"; //$NON-NLS-1$ - - /** - * Identifier for a shared libraries group in a menu (value " - * sharedLibrariesGroup" - * ). - */ - public static final String SHARED_LIBRARIES_GROUP = "sharedLibrariesGroup"; //$NON-NLS-1$ - /** * Identifier for an empty group preceeding a * modules group in a menu (value "emptyModulesGroup").