1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 03:53:21 +02:00

Fix for bug 83437: Loading symbols should be run in the background.

This commit is contained in:
Mikhail Khodjaiants 2005-01-21 19:38:37 +00:00
parent 57e12dda16
commit 8c18009c05
4 changed files with 65 additions and 43 deletions

View file

@ -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

View file

@ -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.

View file

@ -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 );
}
}

View file

@ -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 );
}
}