| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 1 package org.chromium.debug.ui.actions; | 5 package org.chromium.debug.ui.actions; |
| 2 | 6 |
| 3 import java.text.MessageFormat; | 7 import java.text.MessageFormat; |
| 4 import java.util.HashSet; | 8 import java.util.HashSet; |
| 5 import java.util.Iterator; | 9 import java.util.Iterator; |
| 6 import java.util.Set; | 10 import java.util.Set; |
| 7 | 11 |
| 8 import org.chromium.debug.core.ChromiumDebugPlugin; | 12 import org.chromium.debug.core.ChromiumDebugPlugin; |
| 9 import org.chromium.debug.core.model.BreakpointSynchronizer; | 13 import org.chromium.debug.core.model.BreakpointSynchronizer; |
| 10 import org.chromium.debug.core.model.DebugTargetImpl; | 14 import org.chromium.debug.core.model.DebugTargetImpl; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 72 } |
| 69 | 73 |
| 70 private Runnable createRunnable(ISelection selection) { | 74 private Runnable createRunnable(ISelection selection) { |
| 71 if (selection instanceof IStructuredSelection == false) { | 75 if (selection instanceof IStructuredSelection == false) { |
| 72 return null; | 76 return null; |
| 73 } | 77 } |
| 74 IStructuredSelection structuredSelection = (IStructuredSelection) selection; | 78 IStructuredSelection structuredSelection = (IStructuredSelection) selection; |
| 75 final Set<DebugTargetImpl> targets = new HashSet<DebugTargetImpl>(3); | 79 final Set<DebugTargetImpl> targets = new HashSet<DebugTargetImpl>(3); |
| 76 for (Iterator<?> it = structuredSelection.iterator(); it.hasNext(); ) { | 80 for (Iterator<?> it = structuredSelection.iterator(); it.hasNext(); ) { |
| 77 Object element = it.next(); | 81 Object element = it.next(); |
| 78 IDebugTarget debugTarget; | 82 DebugTargetImpl debugTargetImpl = getDebugTargetImpl(element); |
| 79 if (element instanceof ILaunch) { | 83 if (debugTargetImpl == null) { |
| 80 ILaunch launch = (ILaunch) element; | |
| 81 debugTarget = launch.getDebugTarget(); | |
| 82 } else if (element instanceof IDebugElement) { | |
| 83 IDebugElement debugElement = (IDebugElement) element; | |
| 84 debugTarget = debugElement.getDebugTarget(); | |
| 85 } else { | |
| 86 continue; | 84 continue; |
| 87 } | 85 } |
| 88 if (debugTarget instanceof DebugTargetImpl == false) { | |
| 89 continue; | |
| 90 } | |
| 91 DebugTargetImpl debugTargetImpl = (DebugTargetImpl) debugTarget; | |
| 92 targets.add(debugTargetImpl); | 86 targets.add(debugTargetImpl); |
| 93 } | 87 } |
| 94 if (targets.isEmpty()) { | 88 if (targets.isEmpty()) { |
| 95 return null; | 89 return null; |
| 96 } | 90 } |
| 97 if (direction != BreakpointSynchronizer.Direction.RESET_REMOTE && targets.si
ze() > 1) { | 91 if (direction != BreakpointSynchronizer.Direction.RESET_REMOTE && targets.si
ze() > 1) { |
| 98 // Only "reset remote" mode is implemented for a multiple selection. | 92 // Only "reset remote" mode is implemented for a multiple selection. |
| 99 return null; | 93 return null; |
| 100 } | 94 } |
| 101 | 95 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 117 target.synchronizeBreakpoints(direction, callback); | 111 target.synchronizeBreakpoints(direction, callback); |
| 118 } | 112 } |
| 119 return Status.OK_STATUS; | 113 return Status.OK_STATUS; |
| 120 } | 114 } |
| 121 }.schedule(); | 115 }.schedule(); |
| 122 } | 116 } |
| 123 }; | 117 }; |
| 124 } | 118 } |
| 125 | 119 |
| 126 private Runnable currentRunnable; | 120 private Runnable currentRunnable; |
| 121 |
| 122 public static DebugTargetImpl getDebugTargetImpl(Object element) { |
| 123 IDebugTarget debugTarget; |
| 124 if (element instanceof ILaunch) { |
| 125 ILaunch launch = (ILaunch) element; |
| 126 debugTarget = launch.getDebugTarget(); |
| 127 } else if (element instanceof IDebugElement) { |
| 128 IDebugElement debugElement = (IDebugElement) element; |
| 129 debugTarget = debugElement.getDebugTarget(); |
| 130 } else { |
| 131 return null; |
| 132 } |
| 133 if (debugTarget instanceof DebugTargetImpl == false) { |
| 134 return null; |
| 135 } |
| 136 return (DebugTargetImpl) debugTarget; |
| 137 } |
| 127 } | 138 } |
| OLD | NEW |