1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

*org.eclipse.cdt.debug.internal.core/CBreakpointManager.java

*org.eclipse.cdt.debug.internal.uui.propertypages/CBreakpointPreferenceStore.java
*org.eclipse.cdt.debug.internal.uui.propertypages/CBreakpointPropertyPage.java

221408 nor P3 Wind cdt-debug-inbox@eclipse.org NEW Ability to move breakpoints manually to a different line

Patch from Elena
This commit is contained in:
Alain Magloire 2008-03-28 15:34:57 +00:00
parent 02f51cf12a
commit d0e1ee1473
3 changed files with 40 additions and 13 deletions

View file

@ -90,6 +90,7 @@ import org.eclipse.debug.core.IBreakpointManagerListener;
import org.eclipse.debug.core.IBreakpointsListener;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.ILineBreakpoint;
import org.eclipse.debug.core.model.ISourceLocator;
import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
@ -978,8 +979,21 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
condition0 = cdiCondition;
}
}
if ( enabled0 != null || condition0 != null ) {
changeBreakpointPropertiesOnTarget( cdiBreakpoint, enabled0, condition0 );
int line = 0;
if (breakpoint instanceof ILineBreakpoint) {
ILineBreakpoint l = (ILineBreakpoint) breakpoint;
line = l.getLineNumber();
}
int oldLine = ( delta != null ) ? delta.getAttribute( IMarker.LINE_NUMBER, 0 ) : 0; //$NON-NLS-1$
boolean basic = oldLine>0 && oldLine != line;
if (basic) {
final ICBreakpoint[] breakpoints = new ICBreakpoint[] {breakpoint};
breakpointsRemoved(breakpoints, null);
handleBreakpointDestroyedEvent(cdiBreakpoint); // events has to processed before add executes
breakpointsAdded(breakpoints);
} else if (enabled0 != null || condition0 != null) {
changeBreakpointPropertiesOnTarget(cdiBreakpoint, enabled0, condition0);
}
}
catch( CoreException e ) {

View file

@ -27,6 +27,8 @@ public class CBreakpointPreferenceStore implements IPreferenceStore {
protected final static String IGNORE_COUNT = "IGNORE_COUNT"; //$NON-NLS-1$
protected final static String LINE = "LINE"; //$NON-NLS-1$
protected HashMap fProperties;
private boolean fIsDirty = false;

View file

@ -20,6 +20,7 @@ import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
@ -346,22 +347,28 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
if ( fileName != null ) {
addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.7" ), fileName ) ); //$NON-NLS-1$
}
ILineBreakpoint lBreakpoint = (ILineBreakpoint)breakpoint;
StringBuffer lineNumber = new StringBuffer( 4 );
ILineBreakpoint lBreakpoint = (ILineBreakpoint) breakpoint;
int lNumber = 0;
try {
int lNumber = lBreakpoint.getLineNumber();
if ( lNumber > 0 ) {
lineNumber.append( lNumber );
lNumber = lBreakpoint.getLineNumber();
} catch (CoreException e) {
CDebugUIPlugin.log(e);
}
}
catch( CoreException ce ) {
CDebugUIPlugin.log( ce );
}
if ( lineNumber.length() > 0 ) {
addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.9" ), lineNumber.toString() ) ); //$NON-NLS-1$
if (lNumber > 0) {
getPreferenceStore().setValue( CBreakpointPreferenceStore.LINE, lNumber);
createLineNumberEditor(getFieldEditorParent());
}
}
}
protected void createLineNumberEditor( Composite parent ) {
String title = PropertyPageMessages.getString( "CBreakpointPropertyPage.9" );
BreakpointIntegerFieldEditor labelFieldEditor =new BreakpointIntegerFieldEditor( CBreakpointPreferenceStore.LINE ,title, parent);
labelFieldEditor.setValidRange( 1, Integer.MAX_VALUE );
addField( labelFieldEditor );
}
protected void createEnabledField( Composite parent ) {
fEnabled = new BooleanFieldEditor( CBreakpointPreferenceStore.ENABLED, PropertyPageMessages.getString( "CBreakpointPropertyPage.19" ), parent ); //$NON-NLS-1$
@ -448,6 +455,10 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
else if ( property.equals( CBreakpointPreferenceStore.CONDITION ) ) {
breakpoint.setCondition( getPreferenceStore().getString( CBreakpointPreferenceStore.CONDITION ) );
}
else if ( property.equals( CBreakpointPreferenceStore.LINE ) ) {
// already workspace runnable, setting markers are safe
breakpoint.getMarker().setAttribute(IMarker.LINE_NUMBER, getPreferenceStore().getInt(CBreakpointPreferenceStore.LINE));
}
}
}
};