From 4c5be532cc983da8b11246a3948793dfbc6f6d59 Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Mon, 15 Nov 2004 20:47:48 +0000 Subject: [PATCH] Batch breakpoint updates in one job. --- debug/org.eclipse.cdt.debug.core/ChangeLog | 4 ++ .../internal/core/CBreakpointManager.java | 48 +++++++++++-------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index f0b59f27cd0..ac3f7a29a18 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,7 @@ +2004-11-15 Mikhail Khodjaiants + Batch breakpoint updates in one job. + * CBreakpointManager.java + 2004-11-12 Mikhail Khodjaiants Apply the breakpoint's condition changes to the associated gdb breakpoint only if there are differences. diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java index ae6cc961e4d..c3be782c941 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java @@ -353,31 +353,20 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent String condition = breakpoint.getCondition(); String oldCondition = ( delta != null ) ? delta.getAttribute( ICBreakpoint.CONDITION, "" ) : condition; //$NON-NLS-1$ String[] newThreadIs = getThreadNames( breakpoint ); + Boolean enabled0 = null; + ICDICondition condition0 = null; if ( enabled != oldEnabled && enabled != cdiBreakpoint.isEnabled() ) { - DebugPlugin.getDefault().asyncExec( new Runnable() { - public void run() { - try { - cdiBreakpoint.setEnabled( enabled ); - } - catch( CDIException e ) { - } - } - } ); + enabled0 = ( enabled ) ? Boolean.TRUE : Boolean.FALSE; } if ( ignoreCount != oldIgnoreCount || condition.compareTo( oldCondition ) != 0 || areThreadFiltersChanged( newThreadIs, cdiBreakpoint ) ) { final ICDICondition cdiCondition = cdiTarget.createCondition( ignoreCount, condition, newThreadIs ); - if ( ! cdiCondition.equals( cdiBreakpoint.getCondition() ) ) { - DebugPlugin.getDefault().asyncExec( new Runnable() { - public void run() { - try { - cdiBreakpoint.setCondition( cdiCondition ); - } - catch( CDIException e ) { - } - } - } ); + if ( !cdiCondition.equals( cdiBreakpoint.getCondition() ) ) { + condition0 = cdiCondition; } } + if ( enabled0 != null || condition0 != null ) { + changeBreakpointPropertiesOnTarget( cdiBreakpoint, enabled0, condition0 ); + } } catch( CoreException e ) { requestFailed( MessageFormat.format( InternalDebugCoreMessages.getString( "CBreakpointManager.4" ), new String[] { e.getMessage() } ), e ); //$NON-NLS-1$ @@ -387,6 +376,27 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent } } + private void changeBreakpointPropertiesOnTarget( final ICDIBreakpoint breakpoint, final Boolean enabled, final ICDICondition condition ) { + DebugPlugin.getDefault().asyncExec( new Runnable() { + public void run() { + if ( enabled != null ) { + try { + breakpoint.setEnabled( enabled.booleanValue() ); + } + catch( CDIException e ) { + } + } + if ( condition != null ) { + try { + breakpoint.setCondition( condition ); + } + catch( CDIException e ) { + } + } + } + } ); + } + private void handleBreakpointCreatedEvent( final ICDIBreakpoint cdiBreakpoint ) { if ( cdiBreakpoint instanceof ICDIWatchpoint ) doHandleWatchpointCreatedEvent( (ICDIWatchpoint)cdiBreakpoint );