From e7fadca73f572ac662b2f67b3e916398d8018abe Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Fri, 28 May 2004 19:04:31 +0000 Subject: [PATCH] Changed the error handling of the "Add Globals" and "Enable/Disable Variable" actions. --- debug/org.eclipse.cdt.debug.ui/ChangeLog | 6 ++ .../ui/actions/ActionMessages.properties | 1 + .../ui/actions/AddGlobalsActionDelegate.java | 11 +++- .../EnableVariablesActionDelegate.java | 60 +++++++++---------- 4 files changed, 44 insertions(+), 34 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog index 7a62b0ef0dd..2c9d74bac29 100644 --- a/debug/org.eclipse.cdt.debug.ui/ChangeLog +++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog @@ -1,3 +1,9 @@ +2004-05-28 Mikhail Khodjaiants + Changed the error handling of the "Add Globals" and "Enable/Disable Variable" actions. + * AddGlobalsActionDelegate.java + * EnableVariablesActionDelegate.java + * ActionMessages.properties + 2004-05-28 Mikhail Khodjaiants Removed diassembly editor actions. * plugin.xml 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 a035b85dd3d..5075fddc126 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 @@ -36,3 +36,4 @@ ResumeAtLineActionDelegate.Operation_failed_1=Operation failed. ResumeAtLineActionDelegate.Missing_document=Missing document ResumeAtLineActionDelegate.Empty_editor_1=Empty editor ResumeAtLineActionDelegate.Operation_is_not_supported_1=Operation is not supported +AddGlobalsActionDelegate.Error(s)_occured_adding_globals_1=Error(s) occured adding globals. diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddGlobalsActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddGlobalsActionDelegate.java index 9d09ddb2212..69dcb83365e 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddGlobalsActionDelegate.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddGlobalsActionDelegate.java @@ -17,6 +17,7 @@ import org.eclipse.cdt.debug.core.model.IExecFileInfo; import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.debug.ui.DebugUITools; @@ -104,13 +105,17 @@ public class AddGlobalsActionDelegate extends ActionDelegate implements IViewAct } } } ); - if ( getStatus() != null && !getStatus().isOK() ) { + IStatus status = getStatus(); + if ( status != null && !status.isOK() ) { + if ( status.isMultiStatus() ) { + status = new MultiStatus( status.getPlugin(), status.getCode(), status.getChildren(), ActionMessages.getString( "AddGlobalsActionDelegate.Error(s)_occured_adding_globals_1" ), status.getException() ); //$NON-NLS-1$ + } IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow(); if ( window != null ) { - CDebugUIPlugin.errorDialog( getErrorDialogMessage(), getStatus() ); + CDebugUIPlugin.errorDialog( getErrorDialogMessage(), status ); } else { - CDebugUIPlugin.log( getStatus() ); + CDebugUIPlugin.log( status ); } } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableVariablesActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableVariablesActionDelegate.java index 6b4df491c39..9dc3458fb30 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableVariablesActionDelegate.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableVariablesActionDelegate.java @@ -15,6 +15,7 @@ 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.IViewActionDelegate; import org.eclipse.ui.IViewPart; @@ -81,43 +82,40 @@ public class EnableVariablesActionDelegate implements IViewActionDelegate return; final Iterator enum = selection.iterator(); - final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, CDebugUIPlugin.getResourceString("internal.ui.actions.EnableVariablesActionDelegate.Enable_variables_failed."), null ); //$NON-NLS-1$ - Runnable runnable = new Runnable() + final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, CDebugUIPlugin.getResourceString("internal.ui.actions.EnableVariablesActionDelegate.Exceptions_occurred_enabling_the_variables"), null ); //$NON-NLS-1$ + BusyIndicator.showWhile( + Display.getCurrent(), + new Runnable() + { + public void run() + { + while( enum.hasNext() ) + { + ICVariable var = (ICVariable)enum.next(); + try { - public void run() + if ( size > 1 ) { - while( enum.hasNext() ) - { - ICVariable var = (ICVariable)enum.next(); - try - { - if ( size > 1 ) - { - if ( isEnableAction() ) - var.setEnabled( true ); - else - var.setEnabled( false ); - } - else - var.setEnabled( !var.isEnabled() ); - } - catch( DebugException e ) - { - ms.merge( e.getStatus() ); - } - } - update(); + if ( isEnableAction() ) + var.setEnabled( true ); + else + var.setEnabled( false ); } - }; - - final Display display = CDebugUIPlugin.getStandardDisplay(); - if ( display.isDisposed() ) - return; - display.asyncExec( runnable ); + else + var.setEnabled( !var.isEnabled() ); + } + catch( DebugException e ) + { + ms.merge( e.getStatus() ); + } + } + update(); + } + } ); if ( !ms.isOK() ) { - CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.EnableVariablesActionDelegate.Exceptions_occurred_enabling_the_variables"), ms ); //$NON-NLS-1$ + CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.EnableVariablesActionDelegate.Enable_variables_failed."), ms ); //$NON-NLS-1$ } }