Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 207810 Details for
Bug 365343
Use new IScriptResolver API during source lookup
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
better fix
source-lookup2.patch (text/plain), 3.95 KB, created by
Michael Rennie
on 2011-12-01 15:45:13 EST
(
hide
)
Description:
better fix
Filename:
MIME Type:
Creator:
Michael Rennie
Created:
2011-12-01 15:45:13 EST
Size:
3.95 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.jsdt.debug.core >Index: src/org/eclipse/wst/jsdt/debug/internal/core/launching/JavaScriptSourceLookupParticipant.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.debug.core/src/org/eclipse/wst/jsdt/debug/internal/core/launching/JavaScriptSourceLookupParticipant.java,v >retrieving revision 1.15 >diff -u -r1.15 JavaScriptSourceLookupParticipant.java >--- src/org/eclipse/wst/jsdt/debug/internal/core/launching/JavaScriptSourceLookupParticipant.java 10 Mar 2011 02:03:19 -0000 1.15 >+++ src/org/eclipse/wst/jsdt/debug/internal/core/launching/JavaScriptSourceLookupParticipant.java 1 Dec 2011 20:44:25 -0000 >@@ -12,13 +12,21 @@ > > import java.net.URI; > import java.util.HashMap; >+import java.util.Iterator; >+import java.util.List; > > import org.eclipse.core.resources.IFile; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IPath; > import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant; > import org.eclipse.debug.core.sourcelookup.ISourceContainer; >+import org.eclipse.wst.jsdt.debug.core.jsdi.ScriptReference; >+import org.eclipse.wst.jsdt.debug.core.model.IJavaScriptStackFrame; >+import org.eclipse.wst.jsdt.debug.core.model.IScript; > import org.eclipse.wst.jsdt.debug.internal.core.JavaScriptDebugPlugin; >+import org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget; >+import org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptStackFrame; >+import org.eclipse.wst.jsdt.debug.internal.core.model.Script; > > /** > * Default source lookup participant >@@ -45,6 +53,10 @@ > * @see org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant#findSourceElements(java.lang.Object) > */ > public Object[] findSourceElements(Object object) throws CoreException { >+ IFile file = resolveFile(object); >+ if(file != null && file.exists()) { >+ return new IFile[] {file}; >+ } > ISourceContainer[] containers = getSourceContainers(); > if(containers != null && containers.length > 0) { > String name = getSourceName(object); >@@ -61,7 +73,7 @@ > //in the external source project and show it > URI sourceURI = SourceLookup.getSourceURI(object); > if (sourceURI != null) { >- IFile file = (IFile) sourcemap.get(sourceURI); >+ file = (IFile) sourcemap.get(sourceURI); > if(file != null && file.exists()) { > return new IFile[] { file }; > } >@@ -72,6 +84,41 @@ > } > > /** >+ * Tries to resolve the workspace local {@link IFile}(s) that match the underlying {@link ScriptReference} >+ * for either an {@link IJavaScriptStackFrame} or an {@link IScript} >+ * >+ * @param object the object to try and resolve the {@link IFile} from >+ * @return the corresponding {@link IFile} for the object or <code>null</code> if one could not be determined >+ * @since 1.4 >+ */ >+ IFile resolveFile(Object object) { >+ String uri = null; >+ JavaScriptDebugTarget target = null; >+ if(object instanceof JavaScriptStackFrame) { >+ JavaScriptStackFrame frame = (JavaScriptStackFrame) object; >+ uri = frame.getSourcePath(); >+ target = (JavaScriptDebugTarget) frame.getDebugTarget(); >+ } >+ if(object instanceof Script) { >+ Script script = (Script) object; >+ uri = script.sourceURI().toString(); >+ target = (JavaScriptDebugTarget) script.getDebugTarget(); >+ } >+ if(uri != null && target != null) { >+ List scripts = target.getVM().allScripts(); >+ for (Iterator i = scripts.iterator(); i.hasNext();) { >+ ScriptReference ref = (ScriptReference) i.next(); >+ if(uri.equals(ref.sourceURI().toString())) { >+ return JavaScriptDebugPlugin.getResolutionManager().getFile(ref); >+ } >+ } >+ } >+ return null; >+ } >+ >+ >+ >+ /** > * Shows the source in an external editor > * > * @param sourceuri >@@ -106,4 +153,4 @@ > public boolean isFindDuplicates() { > return true; > } >-} >+} >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 365343
:
207809
|
207810
|
207939