* affected (and not simply all frames in affected types) will be returned.
*/
protected JDIStackFrame getAffectedFrame(JDIThread thread,
List<String> replacedClassNames) throws DebugException {
List<IJavaStackFrame> frames = thread.computeStackFrames();
JDIStackFrame affectedFrame = null;
JDIStackFrame frame = null;
ICompilationUnit compilationUnit = null;
CompilationUnitDelta delta = null;
IProject project = null;
for (int j = frames.size() - 1; j >= 0; j--) {
frame = (JDIStackFrame) frames.get(j);
if (containsChangedType(frame, replacedClassNames)) {
// smart drop to frame support
compilationUnit = getCompilationUnit(frame);
// if we can't find the source, then do type-based drop
if (compilationUnit != null) {
try {
project = compilationUnit.getCorrespondingResource()
.getProject();
delta = getDelta(compilationUnit,
getLastProjectBuildTime(project));
if (!delta.hasChanged(frame.getName(),
frame.getSignature())) {
continue;
}
} catch (CoreException exception) {
// If smart drop to frame fails, just do type-based drop
}
}
if (frame.supportsDropToFrame()) {
affectedFrame = frame;
break;
}
// The frame we wanted to drop to cannot be popped.
// Set the affected frame to the next lowest pop-able
// frame on the stack.
while (j > 0) {
j--;
frame = (JDIStackFrame) frames.get(j);
if (frame.supportsDropToFrame()) {
affectedFrame = frame;
break;
}
}
break;