diff options
| author | Igor Fedorenko | 2012-11-21 21:41:48 +0000 |
|---|---|---|
| committer | Mike Rennie | 2012-11-21 21:43:18 +0000 |
| commit | de526943120915e44f4ea1792f6445ffd1ef0efa (patch) | |
| tree | 4550ac7aedbf29614e453deea55ba777e7836a84 | |
| parent | 07c5f52b120128c0562ef7dc7ed2aed8388a2e68 (diff) | |
| download | eclipse.jdt.debug-de526943120915e44f4ea1792f6445ffd1ef0efa.tar.gz eclipse.jdt.debug-de526943120915e44f4ea1792f6445ffd1ef0efa.tar.xz eclipse.jdt.debug-de526943120915e44f4ea1792f6445ffd1ef0efa.zip | |
Bug 368212 - JavaLineBreakpoint.computeJavaProject does not let
ISourceLocator evaluate the stackFrame
2 files changed, 22 insertions, 27 deletions
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java index 31cce4008..cd5c4c226 100644 --- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java +++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Igor Fedorenko - Bug 368212 - JavaLineBreakpoint.computeJavaProject does not let ISourceLocator evaluate the stackFrame *******************************************************************************/ package org.eclipse.jdt.internal.debug.core.breakpoints; @@ -470,25 +471,24 @@ public class JavaLineBreakpoint extends JavaBreakpoint implements if (locator == null) return null; - Object sourceElement = null; - try { - if (locator instanceof ISourceLookupDirector - && !stackFrame.isStatic()) { - IJavaType thisType = stackFrame.getThis().getJavaType(); - if (thisType instanceof IJavaReferenceType) { - String[] sourcePaths = ((IJavaReferenceType) thisType) - .getSourcePaths(null); - if (sourcePaths != null && sourcePaths.length > 0) { - sourceElement = ((ISourceLookupDirector) locator) - .getSourceElement(sourcePaths[0]); + Object sourceElement = locator.getSourceElement(stackFrame); + if (sourceElement == null) { + try { + if (locator instanceof ISourceLookupDirector + && !stackFrame.isStatic()) { + IJavaType thisType = stackFrame.getThis().getJavaType(); + if (thisType instanceof IJavaReferenceType) { + String[] sourcePaths = ((IJavaReferenceType) thisType) + .getSourcePaths(null); + if (sourcePaths != null && sourcePaths.length > 0) { + sourceElement = ((ISourceLookupDirector) locator) + .getSourceElement(sourcePaths[0]); + } } } + } catch (DebugException e) { + DebugPlugin.log(e); } - } catch (DebugException e) { - DebugPlugin.log(e); - } - if (sourceElement == null) { - sourceElement = locator.getSourceElement(stackFrame); } if (!(sourceElement instanceof IJavaElement) && sourceElement instanceof IAdaptable) { diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/JavaLogicalStructure.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/JavaLogicalStructure.java index 7280d1d2b..495c21e70 100644 --- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/JavaLogicalStructure.java +++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/JavaLogicalStructure.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2011 IBM Corporation and others. + * Copyright (c) 2004, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Igor Fedorenko - Bug 368212 - JavaLineBreakpoint.computeJavaProject does not let ISourceLocator evaluate the stackFrame *******************************************************************************/ package org.eclipse.jdt.internal.debug.core.logicalstructures; @@ -290,21 +291,15 @@ public class JavaLogicalStructure implements ILogicalStructureType { // find the project the snippets will be compiled in. ISourceLocator locator = javaValue.getLaunch().getSourceLocator(); - Object sourceElement = null; - if (locator instanceof ISourceLookupDirector) { + Object sourceElement = locator.getSourceElement(stackFrame); + if (sourceElement == null && locator instanceof ISourceLookupDirector) { String[] sourcePaths = type.getSourcePaths(null); if (sourcePaths != null && sourcePaths.length > 0) { sourceElement = ((ISourceLookupDirector) locator) .getSourceElement(sourcePaths[0]); } - if (!(sourceElement instanceof IJavaElement) - && sourceElement instanceof IAdaptable) { - sourceElement = ((IAdaptable) sourceElement) - .getAdapter(IJavaElement.class); - } } - if (sourceElement == null) { - sourceElement = locator.getSourceElement(stackFrame); + if (sourceElement != null) { if (!(sourceElement instanceof IJavaElement) && sourceElement instanceof IAdaptable) { sourceElement = ((IAdaptable) sourceElement) |
