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 167395 Details for
Bug 310949
Should display script URI with proper protocol
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
initial patch
310949.txt (text/plain), 23.20 KB, created by
Simon Kaegi
on 2010-05-06 16:44:35 EDT
(
hide
)
Description:
initial patch
Filename:
MIME Type:
Creator:
Simon Kaegi
Created:
2010-05-06 16:44:35 EDT
Size:
23.20 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.jsdt.debug.core >Index: src/org/eclipse/wst/jsdt/debug/internal/core/JavaScriptDebugPlugin.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.debug.core/src/org/eclipse/wst/jsdt/debug/internal/core/JavaScriptDebugPlugin.java,v >retrieving revision 1.3 >diff -u -r1.3 JavaScriptDebugPlugin.java >--- src/org/eclipse/wst/jsdt/debug/internal/core/JavaScriptDebugPlugin.java 3 Mar 2010 18:30:05 -0000 1.3 >+++ src/org/eclipse/wst/jsdt/debug/internal/core/JavaScriptDebugPlugin.java 6 May 2010 20:42:42 -0000 >@@ -10,6 +10,8 @@ > *******************************************************************************/ > package org.eclipse.wst.jsdt.debug.internal.core; > >+import java.util.HashMap; >+import java.util.Map; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Plugin; > import org.eclipse.core.runtime.Status; >@@ -49,6 +51,7 @@ > private static BreakpointParticipantManager participantmanager = null; > > private static JavaScriptPreferencesManager prefmanager = null; >+ private static Map externalScriptPaths = new HashMap(); > > /** > * Returns the singleton {@link ConnectorsManager} instance >@@ -154,4 +157,12 @@ > public static IStatus newErrorStatus(String message, Throwable exception) { > return new Status(IStatus.ERROR, PLUGIN_ID, INTERNAL_ERROR, message, exception); > } >+ >+ public static synchronized void addExternalScriptPath(String sourceName, String scriptPath) { >+ externalScriptPaths.put(sourceName, scriptPath); >+ } >+ >+ public static synchronized String getExternalScriptPath(String sourceName) { >+ return (String) externalScriptPaths.get(sourceName); >+ } > } >Index: src/org/eclipse/wst/jsdt/debug/internal/core/breakpoints/DefaultJavaScriptBreakpointParticipant.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.debug.core/src/org/eclipse/wst/jsdt/debug/internal/core/breakpoints/DefaultJavaScriptBreakpointParticipant.java,v >retrieving revision 1.1 >diff -u -r1.1 DefaultJavaScriptBreakpointParticipant.java >--- src/org/eclipse/wst/jsdt/debug/internal/core/breakpoints/DefaultJavaScriptBreakpointParticipant.java 1 Apr 2010 19:30:36 -0000 1.1 >+++ src/org/eclipse/wst/jsdt/debug/internal/core/breakpoints/DefaultJavaScriptBreakpointParticipant.java 6 May 2010 20:42:42 -0000 >@@ -44,7 +44,7 @@ > if(breakpoint instanceof IJavaScriptLoadBreakpoint) { > try { > String bpath = breakpoint.getScriptPath(); >- if(bpath.equals(script.sourceURI().getPath())) { >+ if(bpath.equals(script.sourceURI().toString())) { > return SUSPEND; > } > } catch (CoreException e) { >Index: src/org/eclipse/wst/jsdt/debug/internal/core/breakpoints/JavaScriptBreakpoint.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.debug.core/src/org/eclipse/wst/jsdt/debug/internal/core/breakpoints/JavaScriptBreakpoint.java,v >retrieving revision 1.8 >diff -u -r1.8 JavaScriptBreakpoint.java >--- src/org/eclipse/wst/jsdt/debug/internal/core/breakpoints/JavaScriptBreakpoint.java 7 Apr 2010 15:25:27 -0000 1.8 >+++ src/org/eclipse/wst/jsdt/debug/internal/core/breakpoints/JavaScriptBreakpoint.java 6 May 2010 20:42:42 -0000 >@@ -24,7 +24,6 @@ > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.Path; >-import org.eclipse.core.runtime.URIUtil; > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.model.Breakpoint; > import org.eclipse.debug.core.model.IDebugTarget; >@@ -418,8 +417,7 @@ > // TODO need something fancier in the future > // perhaps add this to the participants so each can decide what makes > // a script "equal" to suspend on >- IPath path = new Path(getScriptPath()); >- if (path.lastSegment().equals(URIUtil.lastSegment(script.sourceURI()))) { >+ if (getScriptPath().equals(script.sourceURI().toString())) { > createRequest(target, sevent.script()); > } > } catch (CoreException ce) { >Index: src/org/eclipse/wst/jsdt/debug/internal/core/breakpoints/JavaScriptLoadBreakpoint.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.debug.core/src/org/eclipse/wst/jsdt/debug/internal/core/breakpoints/JavaScriptLoadBreakpoint.java,v >retrieving revision 1.12 >diff -u -r1.12 JavaScriptLoadBreakpoint.java >--- src/org/eclipse/wst/jsdt/debug/internal/core/breakpoints/JavaScriptLoadBreakpoint.java 27 Apr 2010 18:54:02 -0000 1.12 >+++ src/org/eclipse/wst/jsdt/debug/internal/core/breakpoints/JavaScriptLoadBreakpoint.java 6 May 2010 20:42:42 -0000 >@@ -103,7 +103,7 @@ > int vote = thread.suspendForScriptLoad(this, script, suspendVote); > if(isGlobalLoadSuspend(vote) || > ((vote & IJavaScriptBreakpointParticipant.SUSPEND) > 0 || vote == IJavaScriptBreakpointParticipant.DONT_CARE)) { >- JavaScriptPreferencesManager.setGlobalSuspendOn(script.sourceURI().getPath()); >+ JavaScriptPreferencesManager.setGlobalSuspendOn(script.sourceURI().toString()); > thread.addBreakpoint(this); > return false; > } >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.3 >diff -u -r1.3 JavaScriptSourceLookupParticipant.java >--- src/org/eclipse/wst/jsdt/debug/internal/core/launching/JavaScriptSourceLookupParticipant.java 7 Apr 2010 20:31:14 -0000 1.3 >+++ src/org/eclipse/wst/jsdt/debug/internal/core/launching/JavaScriptSourceLookupParticipant.java 6 May 2010 20:42:42 -0000 >@@ -13,11 +13,12 @@ > import java.io.File; > import java.io.FileWriter; > import java.io.IOException; >+import java.net.URI; > > import org.eclipse.core.resources.IFile; >+import org.eclipse.core.resources.IWorkspaceRoot; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.Path; > import org.eclipse.core.runtime.URIUtil; > import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant; >@@ -55,20 +56,25 @@ > * @see org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant#findSourceElements(java.lang.Object) > */ > public Object[] findSourceElements(Object object) throws CoreException { >- String path = getSourcePath(object); >- if (path != null) { >- // TODO not sure if we should do a search for the member if the URI path is a miss >- IFile file = (IFile) ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path), false); >- if (file != null) { >- return new IFile[] { file }; >+ URI sourceURI = getSourceURI(object); >+ if (sourceURI != null) { >+ IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); >+ URI workspaceURI = workspaceRoot.getRawLocationURI(); >+ URI workspaceRelativeURI = workspaceURI.relativize(sourceURI); >+ if (! workspaceRelativeURI.isAbsolute()) { >+ IFile file = (IFile) ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(workspaceRelativeURI.getPath()), false); >+ if (file != null) { >+ return new IFile[] { file }; >+ } > } >+ > //try to find it using the source tab infos > Object[] sources = super.findSourceElements(object); > if(sources != null && sources.length > 0) { > return sources; > } > //else show the temp source >- return showExternalSource(getSource(object), path); >+ return showExternalSource(getSource(object), sourceURI); > } > return NO_SOURCE; > } >@@ -78,7 +84,7 @@ > * @param object > * @return the raw source or <code>null</code> > */ >- String getSource(Object object) { >+ private String getSource(Object object) { > if(object instanceof IJavaScriptStackFrame) { > IJavaScriptStackFrame jframe = (IJavaScriptStackFrame) object; > return jframe.getSource(); >@@ -91,19 +97,19 @@ > } > > /** >- * Returns the path to use to look up source >+ * Returns the uri to use to look up source > * @param object >- * @return the path or <code>null</code> >+ * @return the URI or <code>null</code> > * @since 1.1 > */ >- String getSourcePath(Object object) { >+ private URI getSourceURI(Object object) { > if(object instanceof IJavaScriptStackFrame) { > IJavaScriptStackFrame jframe = (IJavaScriptStackFrame) object; >- return jframe.getSourcePath(); >+ return URI.create(jframe.getSourcePath()); > } > if(object instanceof IScript) { > IScript script = (IScript) object; >- return script.sourceURI().getPath().toString(); >+ return script.sourceURI(); > } > return null; > } >@@ -115,14 +121,28 @@ > * @param path > * @return the collection of files to show in external editors > */ >- Object[] showExternalSource(String source, String path) { >+ private Object[] showExternalSource(String source, URI uri) { > try { > File tempdir = new File(System.getProperty("java.io.tmpdir")); //$NON-NLS-1$ >- File file = new File(tempdir, formatExternalName(path)); >+ File jsdt_debug = new File(tempdir, "jsdt_debug"); //$NON-NLS-1$ >+ jsdt_debug.mkdir(); >+ jsdt_debug.deleteOnExit(); >+ >+ String fileName = URIUtil.lastSegment(uri); >+ if (fileName.endsWith(".js")) //$NON-NLS-1$ >+ fileName = fileName.substring(0, fileName.length()-3); >+ fileName +="(" + Integer.toString(uri.toString().hashCode() + source.hashCode()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ >+ fileName += ".js"; //$NON-NLS-1$ >+ >+ File file = new File(jsdt_debug, fileName); > file.deleteOnExit(); >- FileWriter writer = new FileWriter(file); >- writer.write(source); >- writer.close(); >+ >+ if (!file.exists() || JavaScriptDebugPlugin.getExternalScriptPath(fileName) == null) { >+ FileWriter writer = new FileWriter(file); >+ writer.write(source); >+ writer.close(); >+ JavaScriptDebugPlugin.addExternalScriptPath(fileName, uri.toString()); >+ } > return new Object[] {file}; > > } catch (IOException e) { >@@ -130,28 +150,6 @@ > return NO_SOURCE; > } > } >- >- /** >- * Formats the name of the external source to be: >- * <code>[name]_[counter].js</code>.<br><br> >- * If the given name is <code>null</code> the default >- * name of <code>script_[counter].js</code> will be used >- * @param basename >- * @return the formatted external source name >- */ >- String formatExternalName(String basename) { >- IPath path = null; >- if(basename == null) { >- path = new Path("script"); //$NON-NLS-1$ >- } >- else { >- path = new Path(basename); >- } >- path = path.removeFileExtension(); >- StringBuffer buffer = new StringBuffer(path.toString()); >- buffer.append(".js"); //$NON-NLS-1$ >- return buffer.toString(); >- } > > /* > * (non-Javadoc) >Index: src/org/eclipse/wst/jsdt/debug/internal/core/model/JavaScriptStackFrame.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.debug.core/src/org/eclipse/wst/jsdt/debug/internal/core/model/JavaScriptStackFrame.java,v >retrieving revision 1.3 >diff -u -r1.3 JavaScriptStackFrame.java >--- src/org/eclipse/wst/jsdt/debug/internal/core/model/JavaScriptStackFrame.java 16 Mar 2010 20:09:12 -0000 1.3 >+++ src/org/eclipse/wst/jsdt/debug/internal/core/model/JavaScriptStackFrame.java 6 May 2010 20:42:42 -0000 >@@ -102,7 +102,7 @@ > public String getName() throws DebugException { > if (this.name == null) { > this.name = NLS.bind(ModelMessages.JSDIStackFrame_stackframe_name, new String[] { >- this.stackFrame.location().scriptReference().sourceURI().getPath(), >+ this.stackFrame.location().scriptReference().sourceURI().toString(), > Integer.toString(stackFrame.location().lineNumber()) > }); > } >@@ -331,7 +331,7 @@ > if(loc != null) { > ScriptReference script = loc.scriptReference(); > if(script != null) { >- return script.sourceURI().getPath(); >+ return script.sourceURI().toString(); > } > } > return null; >#P org.eclipse.wst.jsdt.debug.rhino >Index: src/org/eclipse/wst/jsdt/debug/internal/rhino/jsdi/ScriptReferenceImpl.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.debug.rhino/src/org/eclipse/wst/jsdt/debug/internal/rhino/jsdi/ScriptReferenceImpl.java,v >retrieving revision 1.10 >diff -u -r1.10 ScriptReferenceImpl.java >--- src/org/eclipse/wst/jsdt/debug/internal/rhino/jsdi/ScriptReferenceImpl.java 14 Apr 2010 21:46:35 -0000 1.10 >+++ src/org/eclipse/wst/jsdt/debug/internal/rhino/jsdi/ScriptReferenceImpl.java 6 May 2010 20:42:43 -0000 >@@ -138,32 +138,21 @@ > /* (non-Javadoc) > * @see org.eclipse.wst.jsdt.debug.core.jsdi.ScriptReference#sourceURI() > */ >- public URI sourceURI() { >- synchronized (vm) { >- if (this.sourceuri == null) { >- try { >- if(this.sourceProperties != null) { >- IPath path = new Path((String) this.sourceProperties.get(Constants.BUNDLE_SYMBOLICNAME)); >- path = path.append((String) this.sourceProperties.get(JSONConstants.PATH)); >- path = path.append((String) this.sourceProperties.get(JSONConstants.NAME)); >- this.sourceuri = RhinoDebugPlugin.fileURI(path); >- } >- else if(this.sourcePath != null) { >- IPath path = null; >- if(this.sourcePath.equals(org.eclipse.wst.jsdt.debug.internal.rhino.Constants.STD_IN_URI)) { >- path = new Path(org.eclipse.wst.jsdt.debug.internal.rhino.Constants.STD_IN); >- } >- else { >- path = new Path(this.sourcePath); >- } >- this.sourceuri = RhinoDebugPlugin.fileURI(path); >- } >- else { >- this.sourceuri = RhinoDebugPlugin.fileURI(new Path("script")); //$NON-NLS-1$ >- } >- } catch (URISyntaxException urise) { >- RhinoDebugPlugin.log(urise); >+ public synchronized URI sourceURI() { >+ if (this.sourceuri == null) { >+ try { >+ if (this.sourceProperties != null) { >+ IPath path = new Path((String) this.sourceProperties.get(Constants.BUNDLE_SYMBOLICNAME)); >+ path = path.append((String) this.sourceProperties.get(JSONConstants.PATH)); >+ path = path.append((String) this.sourceProperties.get(JSONConstants.NAME)); >+ this.sourceuri = URI.create(path.toString()); >+ } else if (this.sourcePath != null) { >+ this.sourceuri = URI.create(sourcePath); >+ } else { >+ this.sourceuri = RhinoDebugPlugin.fileURI(new Path("script")); //$NON-NLS-1$ > } >+ } catch (URISyntaxException urise) { >+ RhinoDebugPlugin.log(urise); > } > } > return this.sourceuri; >#P org.eclipse.wst.jsdt.debug.rhino.debugger >Index: src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/RhinoDebuggerImpl.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/RhinoDebuggerImpl.java,v >retrieving revision 1.8 >diff -u -r1.8 RhinoDebuggerImpl.java >--- src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/RhinoDebuggerImpl.java 27 Apr 2010 17:50:14 -0000 1.8 >+++ src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/RhinoDebuggerImpl.java 6 May 2010 20:42:44 -0000 >@@ -8,6 +8,7 @@ > *******************************************************************************/ > package org.eclipse.wst.jsdt.debug.internal.rhino.debugger; > >+import java.io.File; > import java.net.URI; > import java.net.URISyntaxException; > import java.util.ArrayList; >@@ -42,8 +43,8 @@ > public class RhinoDebuggerImpl implements Debugger, ContextFactory.Listener { > > public static final DebuggableScript[] NO_SCRIPTS = new DebuggableScript[0]; >- >- >+ private static final String RHINO_SCHEME = "rhino"; //$NON-NLS-1$ >+ > private final Map threadToThreadId = new HashMap(); > private final Map threadIdToData = new HashMap(); > private final Map breakpoints = new HashMap(); >@@ -170,29 +171,46 @@ > * @param properties any special properties @see {@link #parseSourceProperties(String)} > * @return the {@link URI} for the source or <code>null</code> > */ >- URI getSourceUri(DebuggableScript script, Map properties) { >- try { >+ private URI getSourceUri(DebuggableScript script, Map properties) { >+ String sourceName = script.getSourceName(); > if(properties != null) { >- return new URI((String) properties.get(JSONConstants.NAME)); >+ String jsonName = (String) properties.get(JSONConstants.NAME); >+ if (jsonName != null) >+ sourceName = jsonName; > } >- String path = script.getSourceName(); >- if("<stdin>".equals(path)) { //$NON-NLS-1$ >- path = "stdin"; //$NON-NLS-1$ >- } >- try { >+ >+ // handle null sourceName >+ if (sourceName == null) >+ return null; >+ >+ // handle input from the Rhino Shell >+ if (sourceName.equals("<stdin>")) { //$NON-NLS-1$ >+ sourceName = "stdin"; //$NON-NLS-1$ >+ } else { >+ // try to parse it as a file >+ File sourceFile = new File(sourceName); >+ if (sourceFile.exists()) >+ return sourceFile.toURI(); >+ > //try to just create a URI from the name >- return new URI(path); >+ try { >+ URI uri = new URI(sourceName); >+ if (uri.getScheme() != null && uri.isAbsolute()) >+ return uri; >+ } >+ catch(URISyntaxException e) { >+ //do nothing and fall through >+ } > } >- catch(URISyntaxException urise) { >- //do nothing >+ >+ //fall back to creating a rhino specific URI from the script source name as a path >+ try { >+ if (! (sourceName.charAt(0) == '/')) >+ sourceName = "/" + sourceName; //$NON-NLS-1$ >+ return new URI(RHINO_SCHEME, null, sourceName, null); >+ } catch (URISyntaxException e) { >+ return null; > } >- //fall back to creating a file URI >- return new URI("file:", null, path, null); //$NON-NLS-1$ >- } >- catch (URISyntaxException urise) { >- //do nothing just return null >- } >- return null; > } > > /** >Index: src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/ScriptSource.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/ScriptSource.java,v >retrieving revision 1.4 >diff -u -r1.4 ScriptSource.java >--- src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/ScriptSource.java 27 Apr 2010 18:53:58 -0000 1.4 >+++ src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/ScriptSource.java 6 May 2010 20:42:44 -0000 >@@ -172,7 +172,7 @@ > * @return if this script represents the stdin script > */ > public boolean isStdIn() { >- return this.uri.getPath().endsWith("stdin"); //$NON-NLS-1$ >+ return this.uri.toString().endsWith("stdin"); //$NON-NLS-1$ > } > > /** >@@ -239,7 +239,7 @@ > */ > public boolean equals(Object obj) { > if(obj instanceof ScriptSource) { >- return this.uri.getPath().equals(((ScriptSource)obj).uri.getPath()); >+ return this.uri.toString().equals(((ScriptSource)obj).uri.toString()); > } > return false; > } >@@ -248,7 +248,7 @@ > * @see java.lang.Object#hashCode() > */ > public int hashCode() { >- return this.uri.getPath().hashCode(); >+ return this.uri.toString().hashCode(); > } > > /** >@@ -257,7 +257,7 @@ > public Object toJSON() { > HashMap result = new HashMap(); > result.put(JSONConstants.SCRIPT_ID, this.scriptId); >- result.put(JSONConstants.LOCATION, this.uri.getPath()); >+ result.put(JSONConstants.LOCATION, this.uri.toString()); > result.put(JSONConstants.PROPERTIES, properties); > result.put(JSONConstants.SOURCE, source); > result.put(JSONConstants.GENERATED, Boolean.valueOf(generated)); >@@ -400,7 +400,7 @@ > * @return the string location of this script > */ > public String getLocation() { >- return this.uri.getPath(); >+ return this.uri.toString(); > } > > /** >#P org.eclipse.wst.jsdt.debug.ui >Index: src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/ToggleBreakpointAdapter.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/ToggleBreakpointAdapter.java,v >retrieving revision 1.5 >diff -u -r1.5 ToggleBreakpointAdapter.java >--- src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/ToggleBreakpointAdapter.java 4 May 2010 14:09:19 -0000 1.5 >+++ src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/ToggleBreakpointAdapter.java 6 May 2010 20:42:45 -0000 >@@ -18,6 +18,7 @@ > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Path; > import org.eclipse.core.runtime.Status; > import org.eclipse.core.runtime.jobs.Job; > import org.eclipse.debug.core.DebugPlugin; >@@ -52,6 +53,7 @@ > import org.eclipse.wst.jsdt.debug.core.breakpoints.IJavaScriptFunctionBreakpoint; > import org.eclipse.wst.jsdt.debug.core.breakpoints.IJavaScriptLineBreakpoint; > import org.eclipse.wst.jsdt.debug.core.model.JavaScriptDebugModel; >+import org.eclipse.wst.jsdt.debug.internal.core.JavaScriptDebugPlugin; > import org.eclipse.wst.jsdt.debug.internal.ui.DebugWCManager; > > /** >@@ -133,24 +135,35 @@ > * @return the path to the script > */ > String getScriptPath(IJavaScriptElement element) { >- switch(element.getElementType()) { >+ String scriptPath = getElementScriptPath(element); >+ if (! scriptPath.endsWith(").js")) //$NON-NLS-1$ >+ return scriptPath; >+ >+ Path path = new Path(scriptPath); >+ String scriptName = path.lastSegment(); >+ String externalScriptPath = (JavaScriptDebugPlugin.getExternalScriptPath(scriptName)); >+ return (externalScriptPath == null) ? scriptPath : externalScriptPath; >+ } >+ >+ private String getElementScriptPath(IJavaScriptElement element) { >+ switch (element.getElementType()) { > case IJavaScriptElement.TYPE: { >- return ((IType)element).getPath().toOSString(); >+ return ((IType) element).getPath().toOSString(); > } > case IJavaScriptElement.METHOD: > case IJavaScriptElement.FIELD: { > IMember member = (IMember) element; > IType type = member.getDeclaringType(); >- if(type == null) { >+ if (type == null) { > IJavaScriptElement parent = element.getParent(); >- switch(parent.getElementType()) { >- case IJavaScriptElement.TYPE: { >- return ((IType)parent).getPath().toOSString(); >- } >- case IJavaScriptElement.JAVASCRIPT_UNIT: >- case IJavaScriptElement.CLASS_FILE: { >- return ((ITypeRoot)parent).getPath().toOSString(); >- } >+ switch (parent.getElementType()) { >+ case IJavaScriptElement.TYPE: { >+ return ((IType) parent).getPath().toOSString(); >+ } >+ case IJavaScriptElement.JAVASCRIPT_UNIT: >+ case IJavaScriptElement.CLASS_FILE: { >+ return ((ITypeRoot) parent).getPath().toOSString(); >+ } > } > return element.getParent().getElementName(); > } >@@ -159,7 +172,7 @@ > default: { > return element.getElementName(); > } >- } >+ } > } > > /**
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 310949
:
167395
|
167504