Index: plugins/org.chromium.debug.ui/src/org/chromium/debug/ui/actions/SynchronizeBreakpoints.java |
diff --git a/plugins/org.chromium.debug.ui/src/org/chromium/debug/ui/actions/SynchronizeBreakpoints.java b/plugins/org.chromium.debug.ui/src/org/chromium/debug/ui/actions/SynchronizeBreakpoints.java |
index 3ba654a0a88666c2309238c3522a6ae27f0570c2..87cdc489001ff6d5e8a94e3a7346f7623a4ab782 100644 |
--- a/plugins/org.chromium.debug.ui/src/org/chromium/debug/ui/actions/SynchronizeBreakpoints.java |
+++ b/plugins/org.chromium.debug.ui/src/org/chromium/debug/ui/actions/SynchronizeBreakpoints.java |
@@ -1,3 +1,7 @@ |
+// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
package org.chromium.debug.ui.actions; |
import java.text.MessageFormat; |
@@ -75,20 +79,10 @@ public class SynchronizeBreakpoints implements IWorkbenchWindowActionDelegate { |
final Set<DebugTargetImpl> targets = new HashSet<DebugTargetImpl>(3); |
for (Iterator<?> it = structuredSelection.iterator(); it.hasNext(); ) { |
Object element = it.next(); |
- IDebugTarget debugTarget; |
- if (element instanceof ILaunch) { |
- ILaunch launch = (ILaunch) element; |
- debugTarget = launch.getDebugTarget(); |
- } else if (element instanceof IDebugElement) { |
- IDebugElement debugElement = (IDebugElement) element; |
- debugTarget = debugElement.getDebugTarget(); |
- } else { |
- continue; |
- } |
- if (debugTarget instanceof DebugTargetImpl == false) { |
+ DebugTargetImpl debugTargetImpl = getDebugTargetImpl(element); |
+ if (debugTargetImpl == null) { |
continue; |
} |
- DebugTargetImpl debugTargetImpl = (DebugTargetImpl) debugTarget; |
targets.add(debugTargetImpl); |
} |
if (targets.isEmpty()) { |
@@ -124,4 +118,21 @@ public class SynchronizeBreakpoints implements IWorkbenchWindowActionDelegate { |
} |
private Runnable currentRunnable; |
+ |
+ public static DebugTargetImpl getDebugTargetImpl(Object element) { |
+ IDebugTarget debugTarget; |
+ if (element instanceof ILaunch) { |
+ ILaunch launch = (ILaunch) element; |
+ debugTarget = launch.getDebugTarget(); |
+ } else if (element instanceof IDebugElement) { |
+ IDebugElement debugElement = (IDebugElement) element; |
+ debugTarget = debugElement.getDebugTarget(); |
+ } else { |
+ return null; |
+ } |
+ if (debugTarget instanceof DebugTargetImpl == false) { |
+ return null; |
+ } |
+ return (DebugTargetImpl) debugTarget; |
+ } |
} |