diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog index b183cd38bd5..9bb9ad0a005 100644 --- a/debug/org.eclipse.cdt.debug.ui/ChangeLog +++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog @@ -1,3 +1,9 @@ +2005-01-21 Mikhail Khodjaiants + Fix for bug 83437: Loading symbols should be run in the background. + * ActionMessages.properties + * LoadSymbolsActionDelegate.java + * LoadSymbolsForAllActionDelegate.java + 2005-01-20 Mikhail Khodjaiants Fix for bug 83412: Run to line and resume at line should run in the background. * ResumeAtLineAdapter.java diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties index d3de62d53b9..c73b7e351d1 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties @@ -16,6 +16,7 @@ LoadSymbolsForAllAction.Load_symbols_for_all_shared_libraries_1=Load symbols for LoadSymbolsForAllActionDelegate.Error(s)_occurred_loading_the_symbols_1=Error(s) occurred loading the symbols. LoadSymbolsForAllAction.Load_Symbols_For_All_2=Load Symbols For All LoadSymbolsForAllActionDelegate.Error_1=Error +LoadSymbolsForAllActionDelegate.0=Operation failed. LoadSymbolsForAllAction.Unable_to_load_symbols_1=Unable to load symbols. SignalZeroWorkbenchActionDelegate.0=Exceptions occurred attempting to resume without signal. SignalZeroWorkbenchActionDelegate.1=Resume without signal failed. 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 index ee77fac1415..8a60a901e3f 100644 --- 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 @@ -10,18 +10,20 @@ *******************************************************************************/ 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.ui.CDebugUIPlugin; +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.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. @@ -38,52 +40,35 @@ public class LoadSymbolsActionDelegate implements IObjectActionDelegate { public LoadSymbolsActionDelegate() { } - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart) + /* (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(IAction) + /* (non-Javadoc) + * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ public void run( IAction action ) { - if ( getSharedLibrary() != null ) { - final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, - ActionMessages.getString( "LoadSymbolsActionDelegate.Unable_to_load_symbols_of_shared_library_1" ), //$NON-NLS-1$ - 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( ActionMessages.getString( "LoadSymbolsActionDelegate.Operation_failed_1" ), ms ); //$NON-NLS-1$ - } - else { - CDebugUIPlugin.log( ms ); - } - } + 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(IAction, ISelection) + /* (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 ) { @@ -116,4 +101,10 @@ public class LoadSymbolsActionDelegate implements IObjectActionDelegate { 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 84ceedb9ef4..8a59ea879d5 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 @@ -10,9 +10,16 @@ ***********************************************************************/ 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.ICDebugTarget; +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.DebugEvent; import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.jface.action.IAction; @@ -39,9 +46,20 @@ public class LoadSymbolsForAllActionDelegate extends AbstractViewActionDelegate * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractViewActionDelegate#doAction() */ protected void doAction() throws DebugException { - ICDebugTarget target = getDebugTarget( getView().getViewer().getInput() ); + final ICDebugTarget target = getDebugTarget( getView().getViewer().getInput() ); if ( target != null ) { - target.loadSymbols(); + DebugPlugin.getDefault().asyncExec( + new Runnable() { + + public void run() { + try { + target.loadSymbols(); + } + catch( DebugException e ) { + failed( e ); + } + } + } ); } } @@ -68,4 +86,10 @@ public class LoadSymbolsForAllActionDelegate extends AbstractViewActionDelegate } return null; } + + protected void failed( Throwable e ) { + MultiStatus ms = new MultiStatus( CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, ActionMessages.getString( "LoadSymbolsForAllActionDelegate.0" ), null ); //$NON-NLS-1$ + ms.add( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, e.getMessage(), e ) ); + CDebugUtils.error( ms, this ); + } }