Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2011-01-31 10:10:25 +0000
committerDani Megert2011-01-31 10:10:25 +0000
commit2be7ecc2f215ccdc79f3c3044fd87fd369bc1e95 (patch)
treeea606552690230027020307d4f1e8adcf3de291d /org.eclipse.debug.ui/ui/org/eclipse/debug/ui
parentcb9cf53ed2e361a1d6ed1615e4b56cc0ca88a8c2 (diff)
downloadeclipse.platform.debug-2be7ecc2f215ccdc79f3c3044fd87fd369bc1e95.tar.gz
eclipse.platform.debug-2be7ecc2f215ccdc79f3c3044fd87fd369bc1e95.tar.xz
eclipse.platform.debug-2be7ecc2f215ccdc79f3c3044fd87fd369bc1e95.zip
Fixed bug 335727: Remove all breakpoint causes an NPE
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/ui')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java36
1 files changed, 21 insertions, 15 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
index 04840ac91..bc9702123 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
@@ -141,8 +141,10 @@ public class DebugUITools {
}
/**
- * Returns the default image descriptor for the given element
- * or <code>null</code> if none is defined.
+ * Returns the default image descriptor for the given element.
+ *
+ * @param element the element
+ * @return the image descriptor or <code>null</code> if none
*/
public static ImageDescriptor getDefaultImageDescriptor(Object element) {
String imageKey= getDefaultImageKey(element);
@@ -257,16 +259,17 @@ public class DebugUITools {
*/
public static void deleteBreakpoints(IBreakpoint[] breakpoints, final Shell shell, IProgressMonitor progressMonitor) throws CoreException {
IMarker[] markers= new IMarker[breakpoints.length];
- for (int i= 0; i < breakpoints.length; i++) {
- if (!breakpoints[i].isRegistered())
+ int markerCount;
+ for (markerCount= 0; markerCount < breakpoints.length; markerCount++) {
+ if (!breakpoints[markerCount].isRegistered())
break;
- markers[i]= breakpoints[i].getMarker();
- if (markers[i] == null)
+ markers[markerCount]= breakpoints[markerCount].getMarker();
+ if (markers[markerCount] == null)
break;
}
// We only offer undo support if all breakpoints are registered and have associated markers
- boolean allowUndo= markers.length == breakpoints.length;
+ boolean allowUndo= markerCount == breakpoints.length;
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoints(breakpoints, !allowUndo);
@@ -372,8 +375,11 @@ public class DebugUITools {
}
/**
- * Extracts the first element from the given selection and casts it to IAdaptable.
- */
+ * Extracts the first element from the given selection and casts it to IAdaptable.
+ *
+ * @param activeContext the selection
+ * @return an adaptable
+ */
private static IAdaptable getDebugContextElementForSelection(ISelection activeContext) {
if (activeContext instanceof IStructuredSelection) {
IStructuredSelection selection = (IStructuredSelection) activeContext;
@@ -919,13 +925,13 @@ public class DebugUITools {
}
/**
- * Returns the launch group that the given launch configuration belongs
- * to, for the specified mode, or <code>null</code> if none.
+ * Returns the launch group that the given launch configuration belongs to, for the specified
+ * mode, or <code>null</code> if none.
*
- * @param configuration
- * @param mode
- * @return the launch group the given launch configuration belongs to, for
- * the specified mode, or <code>null</code> if none
+ * @param configuration the launch configuration
+ * @param mode the mode
+ * @return the launch group the given launch configuration belongs to, for the specified mode,
+ * or <code>null</code> if none
* @since 3.0
*/
public static ILaunchGroup getLaunchGroup(ILaunchConfiguration configuration, String mode) {

Back to the top