Merged. Fixed bug 1657
authortasneems@symbian.org
Tue, 09 Feb 2010 10:54:46 -0800
changeset 118 174ae9d017fe
parent 117 1796bc92daed (current diff)
parent 116 c60cb2ffbdc1 (diff)
child 120 94a8b7890e14
Merged. Fixed bug 1657
Chrome-Java5-Patch.txt
--- a/Chrome-Java5-Patch.txt	Tue Feb 09 10:51:25 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-### Eclipse Workspace Patch 1.0
-#P org.chromium.sdk
-Index: src/org/chromium/sdk/ChromiumIOException.java
-===================================================================
---- src/org/chromium/sdk/ChromiumIOException.java	(revision 0)
-+++ src/org/chromium/sdk/ChromiumIOException.java	(revision 0)
-@@ -0,0 +1,23 @@
-+package org.chromium.sdk;
-+
-+import java.io.IOException;
-+
-+public class ChromiumIOException extends IOException {
-+	private static final long serialVersionUID = 3412049732071131594L;
-+	private final Throwable cause;
-+
-+	public ChromiumIOException(Throwable cause) {
-+		super();
-+		this.cause = cause;
-+	}
-+	
-+	public ChromiumIOException(String message, Throwable cause) {
-+		super(message);
-+		this.cause = cause;
-+	}
-+	
-+	@Override
-+	public Throwable getCause() {
-+		return cause;
-+	}
-+}
-Index: src/org/chromium/sdk/internal/BrowserImpl.java
-===================================================================
---- src/org/chromium/sdk/internal/BrowserImpl.java	(revision 306)
-+++ src/org/chromium/sdk/internal/BrowserImpl.java	(working copy)
-@@ -17,6 +17,7 @@
- 
- import org.chromium.sdk.Browser;
- import org.chromium.sdk.BrowserTab;
-+import org.chromium.sdk.ChromiumIOException;
- import org.chromium.sdk.TabDebugEventListener;
- import org.chromium.sdk.UnsupportedVersionException;
- import org.chromium.sdk.Version;
-@@ -102,7 +103,7 @@
-       try {
-         serverVersionString = devToolsHandler.version(OPERATION_TIMEOUT_MS);
-       } catch (TimeoutException e) {
--        throw new IOException("Failed to get protocol version from remote", e);
-+        throw new ChromiumIOException("Failed to get protocol version from remote", e);
-       }
-       if (serverVersionString == null) {
-         throw new UnsupportedVersionException(BrowserImpl.PROTOCOL_VERSION, null);
-@@ -291,7 +292,7 @@
-         ticket = connectInternal();
-       } catch (UnsupportedVersionException e) {
-         // This exception should have happened on tab fetcher creation.
--        throw new IOException("Unexpected version problem", e);
-+        throw new ChromiumIOException("Unexpected version problem", e);
-       }
- 
-       Session session = ticket.getSession();
-Index: META-INF/MANIFEST.MF
-===================================================================
---- META-INF/MANIFEST.MF	(revision 306)
-+++ META-INF/MANIFEST.MF	(working copy)
-@@ -13,4 +13,5 @@
-  org.chromium.sdk.internal.tools.v8.processor;x-internal:=true,
-  org.chromium.sdk.internal.tools.v8.request;x-internal:=true,
-  org.chromium.sdk.internal.transport;x-internal:=true
--Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
-+ JavaSE-1.6
-Index: src/org/chromium/sdk/internal/BrowserTabImpl.java
-===================================================================
---- src/org/chromium/sdk/internal/BrowserTabImpl.java	(revision 306)
-+++ src/org/chromium/sdk/internal/BrowserTabImpl.java	(working copy)
-@@ -8,6 +8,7 @@
- 
- import org.chromium.sdk.Browser;
- import org.chromium.sdk.BrowserTab;
-+import org.chromium.sdk.ChromiumIOException;
- import org.chromium.sdk.DebugEventListener;
- import org.chromium.sdk.TabDebugEventListener;
- import org.chromium.sdk.internal.tools.ToolHandler;
-@@ -89,7 +90,7 @@
-       try {
-         result = devToolSessionManager.attachToTab();
-       } catch (AttachmentFailureException e) {
--        throw new IOException(e);
-+        throw new ChromiumIOException(e);
-       }
-       if (Result.OK != result) {
-         throw new IOException("Failed to attach with result: " + result);
-Index: src/org/chromium/sdk/internal/StandaloneVmImpl.java
-===================================================================
---- src/org/chromium/sdk/internal/StandaloneVmImpl.java	(revision 306)
-+++ src/org/chromium/sdk/internal/StandaloneVmImpl.java	(working copy)
-@@ -12,6 +12,7 @@
- import java.util.logging.Level;
- import java.util.logging.Logger;
- 
-+import org.chromium.sdk.ChromiumIOException;
- import org.chromium.sdk.DebugEventListener;
- import org.chromium.sdk.StandaloneVm;
- import org.chromium.sdk.UnsupportedVersionException;
-@@ -121,9 +122,9 @@
-     } catch (InterruptedException e) {
-       throw new RuntimeException(e);
-     } catch (ExecutionException e) {
--      throw new IOException("Failed to get version", e);
-+      throw new ChromiumIOException("Failed to get version", e);
-     } catch (TimeoutException e) {
--      throw new IOException("Timed out waiting for version", e);
-+      throw new ChromiumIOException("Timed out waiting for version", e);
-     }
- 
-     String versionString = remoteInfo.getProtocolVersion();
-Index: src/org/chromium/sdk/internal/transport/Handshaker.java
-===================================================================
---- src/org/chromium/sdk/internal/transport/Handshaker.java	(revision 306)
-+++ src/org/chromium/sdk/internal/transport/Handshaker.java	(working copy)
-@@ -10,8 +10,8 @@
- import java.util.concurrent.ExecutionException;
- import java.util.concurrent.Future;
- import java.util.concurrent.FutureTask;
--import java.util.concurrent.RunnableFuture;
- 
-+import org.chromium.sdk.ChromiumIOException;
- import org.chromium.sdk.LineReader;
- import org.chromium.sdk.internal.transport.Message.MalformedMessageException;
- 
-@@ -85,7 +85,7 @@
-       return runnableFuture;
-     }
- 
--    private final RunnableFuture<RemoteInfo> runnableFuture =
-+    private final FutureTask<RemoteInfo> runnableFuture =
-         new FutureTask<RemoteInfo>(new HandshakeTaks());
- 
-     private LineReader input = null;
-@@ -100,7 +100,7 @@
-       } catch (InterruptedException e) {
-         throw new RuntimeException(e);
-       } catch (ExecutionException e) {
--        throw new IOException("Failed to perform handshake", e);
-+        throw new ChromiumIOException("Failed to perform handshake", e);
-       }
- 
-     }
-@@ -111,7 +111,7 @@
-         try {
-           message = Message.fromBufferedReader(input);
-         } catch (MalformedMessageException e) {
--          throw new IOException("Unrecognized handshake message from remote", e);
-+          throw new ChromiumIOException("Unrecognized handshake message from remote", e);
-         }
-         if (message == null) {
-           throw new IOException("End of stream");
-#P org.chromium.debug.core
-Index: META-INF/MANIFEST.MF
-===================================================================
---- META-INF/MANIFEST.MF	(revision 306)
-+++ META-INF/MANIFEST.MF	(working copy)
-@@ -20,4 +20,5 @@
-  org.chromium.debug.core.model,
-  org.chromium.debug.core.util
- Eclipse-LazyStart: true
--Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
-+ JavaSE-1.6
-#P org.chromium.debug.ui
-Index: META-INF/MANIFEST.MF
-===================================================================
---- META-INF/MANIFEST.MF	(revision 306)
-+++ META-INF/MANIFEST.MF	(working copy)
-@@ -16,4 +16,5 @@
-  org.chromium.debug.core;bundle-version="0.1.5",
-  org.chromium.sdk;bundle-version="0.1.5"
- Bundle-ActivationPolicy: lazy
--Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
-+ JavaSE-1.6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/chrome-dev-tools-patches/Chrome-Java5-Patch.txt	Tue Feb 09 10:54:46 2010 -0800
@@ -0,0 +1,181 @@
+### Eclipse Workspace Patch 1.0
+#P org.chromium.sdk
+Index: src/org/chromium/sdk/ChromiumIOException.java
+===================================================================
+--- src/org/chromium/sdk/ChromiumIOException.java	(revision 0)
++++ src/org/chromium/sdk/ChromiumIOException.java	(revision 0)
+@@ -0,0 +1,23 @@
++package org.chromium.sdk;
++
++import java.io.IOException;
++
++public class ChromiumIOException extends IOException {
++	private static final long serialVersionUID = 3412049732071131594L;
++	private final Throwable cause;
++
++	public ChromiumIOException(Throwable cause) {
++		super();
++		this.cause = cause;
++	}
++	
++	public ChromiumIOException(String message, Throwable cause) {
++		super(message);
++		this.cause = cause;
++	}
++	
++	@Override
++	public Throwable getCause() {
++		return cause;
++	}
++}
+Index: src/org/chromium/sdk/internal/BrowserImpl.java
+===================================================================
+--- src/org/chromium/sdk/internal/BrowserImpl.java	(revision 306)
++++ src/org/chromium/sdk/internal/BrowserImpl.java	(working copy)
+@@ -17,6 +17,7 @@
+ 
+ import org.chromium.sdk.Browser;
+ import org.chromium.sdk.BrowserTab;
++import org.chromium.sdk.ChromiumIOException;
+ import org.chromium.sdk.TabDebugEventListener;
+ import org.chromium.sdk.UnsupportedVersionException;
+ import org.chromium.sdk.Version;
+@@ -102,7 +103,7 @@
+       try {
+         serverVersionString = devToolsHandler.version(OPERATION_TIMEOUT_MS);
+       } catch (TimeoutException e) {
+-        throw new IOException("Failed to get protocol version from remote", e);
++        throw new ChromiumIOException("Failed to get protocol version from remote", e);
+       }
+       if (serverVersionString == null) {
+         throw new UnsupportedVersionException(BrowserImpl.PROTOCOL_VERSION, null);
+@@ -291,7 +292,7 @@
+         ticket = connectInternal();
+       } catch (UnsupportedVersionException e) {
+         // This exception should have happened on tab fetcher creation.
+-        throw new IOException("Unexpected version problem", e);
++        throw new ChromiumIOException("Unexpected version problem", e);
+       }
+ 
+       Session session = ticket.getSession();
+Index: META-INF/MANIFEST.MF
+===================================================================
+--- META-INF/MANIFEST.MF	(revision 306)
++++ META-INF/MANIFEST.MF	(working copy)
+@@ -13,4 +13,5 @@
+  org.chromium.sdk.internal.tools.v8.processor;x-internal:=true,
+  org.chromium.sdk.internal.tools.v8.request;x-internal:=true,
+  org.chromium.sdk.internal.transport;x-internal:=true
+-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
++Bundle-RequiredExecutionEnvironment: J2SE-1.5,
++ JavaSE-1.6
+Index: src/org/chromium/sdk/internal/BrowserTabImpl.java
+===================================================================
+--- src/org/chromium/sdk/internal/BrowserTabImpl.java	(revision 306)
++++ src/org/chromium/sdk/internal/BrowserTabImpl.java	(working copy)
+@@ -8,6 +8,7 @@
+ 
+ import org.chromium.sdk.Browser;
+ import org.chromium.sdk.BrowserTab;
++import org.chromium.sdk.ChromiumIOException;
+ import org.chromium.sdk.DebugEventListener;
+ import org.chromium.sdk.TabDebugEventListener;
+ import org.chromium.sdk.internal.tools.ToolHandler;
+@@ -89,7 +90,7 @@
+       try {
+         result = devToolSessionManager.attachToTab();
+       } catch (AttachmentFailureException e) {
+-        throw new IOException(e);
++        throw new ChromiumIOException(e);
+       }
+       if (Result.OK != result) {
+         throw new IOException("Failed to attach with result: " + result);
+Index: src/org/chromium/sdk/internal/StandaloneVmImpl.java
+===================================================================
+--- src/org/chromium/sdk/internal/StandaloneVmImpl.java	(revision 306)
++++ src/org/chromium/sdk/internal/StandaloneVmImpl.java	(working copy)
+@@ -12,6 +12,7 @@
+ import java.util.logging.Level;
+ import java.util.logging.Logger;
+ 
++import org.chromium.sdk.ChromiumIOException;
+ import org.chromium.sdk.DebugEventListener;
+ import org.chromium.sdk.StandaloneVm;
+ import org.chromium.sdk.UnsupportedVersionException;
+@@ -121,9 +122,9 @@
+     } catch (InterruptedException e) {
+       throw new RuntimeException(e);
+     } catch (ExecutionException e) {
+-      throw new IOException("Failed to get version", e);
++      throw new ChromiumIOException("Failed to get version", e);
+     } catch (TimeoutException e) {
+-      throw new IOException("Timed out waiting for version", e);
++      throw new ChromiumIOException("Timed out waiting for version", e);
+     }
+ 
+     String versionString = remoteInfo.getProtocolVersion();
+Index: src/org/chromium/sdk/internal/transport/Handshaker.java
+===================================================================
+--- src/org/chromium/sdk/internal/transport/Handshaker.java	(revision 306)
++++ src/org/chromium/sdk/internal/transport/Handshaker.java	(working copy)
+@@ -10,8 +10,8 @@
+ import java.util.concurrent.ExecutionException;
+ import java.util.concurrent.Future;
+ import java.util.concurrent.FutureTask;
+-import java.util.concurrent.RunnableFuture;
+ 
++import org.chromium.sdk.ChromiumIOException;
+ import org.chromium.sdk.LineReader;
+ import org.chromium.sdk.internal.transport.Message.MalformedMessageException;
+ 
+@@ -85,7 +85,7 @@
+       return runnableFuture;
+     }
+ 
+-    private final RunnableFuture<RemoteInfo> runnableFuture =
++    private final FutureTask<RemoteInfo> runnableFuture =
+         new FutureTask<RemoteInfo>(new HandshakeTaks());
+ 
+     private LineReader input = null;
+@@ -100,7 +100,7 @@
+       } catch (InterruptedException e) {
+         throw new RuntimeException(e);
+       } catch (ExecutionException e) {
+-        throw new IOException("Failed to perform handshake", e);
++        throw new ChromiumIOException("Failed to perform handshake", e);
+       }
+ 
+     }
+@@ -111,7 +111,7 @@
+         try {
+           message = Message.fromBufferedReader(input);
+         } catch (MalformedMessageException e) {
+-          throw new IOException("Unrecognized handshake message from remote", e);
++          throw new ChromiumIOException("Unrecognized handshake message from remote", e);
+         }
+         if (message == null) {
+           throw new IOException("End of stream");
+#P org.chromium.debug.core
+Index: META-INF/MANIFEST.MF
+===================================================================
+--- META-INF/MANIFEST.MF	(revision 306)
++++ META-INF/MANIFEST.MF	(working copy)
+@@ -20,4 +20,5 @@
+  org.chromium.debug.core.model,
+  org.chromium.debug.core.util
+ Eclipse-LazyStart: true
+-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
++Bundle-RequiredExecutionEnvironment: J2SE-1.5,
++ JavaSE-1.6
+#P org.chromium.debug.ui
+Index: META-INF/MANIFEST.MF
+===================================================================
+--- META-INF/MANIFEST.MF	(revision 306)
++++ META-INF/MANIFEST.MF	(working copy)
+@@ -16,4 +16,5 @@
+  org.chromium.debug.core;bundle-version="0.1.5",
+  org.chromium.sdk;bundle-version="0.1.5"
+ Bundle-ActivationPolicy: lazy
+-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
++Bundle-RequiredExecutionEnvironment: J2SE-1.5,
++ JavaSE-1.6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/chrome-dev-tools-patches/stack-line-numbers-patch.txt	Tue Feb 09 10:54:46 2010 -0800
@@ -0,0 +1,76 @@
+Index: src/org/chromium/debug/core/model/DebugTargetImpl.java
+===================================================================
+--- src/org/chromium/debug/core/model/DebugTargetImpl.java	(revision 307)
++++ src/org/chromium/debug/core/model/DebugTargetImpl.java	(working copy)
+@@ -474,6 +474,10 @@
+   public WorkspaceBridge.JsLabelProvider getLabelProvider() {
+     return workspaceBridgeFactory.getLabelProvider();
+   }
++  
++  public int getLineNumber(CallFrame stackFrame) {
++    return workspaceRelations.getLineNumber(stackFrame);
++  }
+ 
+   private static class ListenerBlock {
+     private volatile boolean isBlocked = true;
+Index: src/org/chromium/debug/core/model/StackFrame.java
+===================================================================
+--- src/org/chromium/debug/core/model/StackFrame.java	(revision 307)
++++ src/org/chromium/debug/core/model/StackFrame.java	(working copy)
+@@ -194,8 +194,7 @@
+   }
+ 
+   public int getLineNumber() throws DebugException {
+-    // convert 0-based to 1-based
+-    return stackFrame.getLineNumber() + 1;
++    return getDebugTarget().getLineNumber(stackFrame);
+   }
+ 
+   public int getCharStart() throws DebugException {
+Index: src/org/chromium/debug/core/model/VProjectWorkspaceBridge.java
+===================================================================
+--- src/org/chromium/debug/core/model/VProjectWorkspaceBridge.java	(revision 307)
++++ src/org/chromium/debug/core/model/VProjectWorkspaceBridge.java	(working copy)
+@@ -230,6 +230,11 @@
+     }
+   };
+ 
++  public int getLineNumber(CallFrame stackFrame) {
++    // convert 0-based to 1-based
++    return stackFrame.getLineNumber() + 1;
++  }
++  
+   /**
+    * This very simple source locator works because we provide our own source files.
+    * We'll have to try harder, once we link with resource js files.
+@@ -282,4 +287,5 @@
+       return name;
+     }
+   };
++
+ }
+Index: src/org/chromium/debug/core/model/WorkspaceBridge.java
+===================================================================
+--- src/org/chromium/debug/core/model/WorkspaceBridge.java	(revision 307)
++++ src/org/chromium/debug/core/model/WorkspaceBridge.java	(working copy)
+@@ -7,6 +7,7 @@
+ import java.util.Collection;
+ 
+ import org.chromium.sdk.Breakpoint;
++import org.chromium.sdk.CallFrame;
+ import org.chromium.sdk.JavascriptVm;
+ import org.chromium.sdk.Script;
+ import org.eclipse.core.resources.IFile;
+@@ -86,6 +87,12 @@
+   BreakpointHandler getBreakpointHandler();
+ 
+   /**
++   * Returns editor line number for the provided call stack frame applying all required 
++   * editor-specific translations.
++   */
++  int getLineNumber(CallFrame stackFrame);
++
++  /**
+    * Breakpoint-related aspect of {@link WorkspaceBridge} interface.
+    */
+   interface BreakpointHandler extends IBreakpointListener {
--- a/org.chromium.debug.core/src/org/chromium/debug/core/model/DebugTargetImpl.java	Tue Feb 09 10:51:25 2010 -0800
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/model/DebugTargetImpl.java	Tue Feb 09 10:54:46 2010 -0800
@@ -499,4 +499,8 @@
       }
     }
   }
+
+	public int getLineNumber(CallFrame stackFrame) {
+		return workspaceRelations.getLineNumber(stackFrame);
+	}
 }
--- a/org.chromium.debug.core/src/org/chromium/debug/core/model/StackFrame.java	Tue Feb 09 10:51:25 2010 -0800
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/model/StackFrame.java	Tue Feb 09 10:54:46 2010 -0800
@@ -195,7 +195,7 @@
 
   public int getLineNumber() throws DebugException {
     // convert 0-based to 1-based
-    return stackFrame.getLineNumber() + 1;
+    return getDebugTarget().getLineNumber(stackFrame);
   }
 
   public int getCharStart() throws DebugException {
--- a/org.chromium.debug.core/src/org/chromium/debug/core/model/VProjectWorkspaceBridge.java	Tue Feb 09 10:51:25 2010 -0800
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/model/VProjectWorkspaceBridge.java	Tue Feb 09 10:54:46 2010 -0800
@@ -230,6 +230,10 @@
     }
   };
 
+  public int getLineNumber(CallFrame stackFrame) {
+	  return stackFrame.getLineNumber() + 1;
+  }
+  
   /**
    * This very simple source locator works because we provide our own source files.
    * We'll have to try harder, once we link with resource js files.
@@ -282,4 +286,5 @@
       return name;
     }
   };
+
 }
--- a/org.chromium.debug.core/src/org/chromium/debug/core/model/WorkspaceBridge.java	Tue Feb 09 10:51:25 2010 -0800
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/model/WorkspaceBridge.java	Tue Feb 09 10:54:46 2010 -0800
@@ -7,6 +7,7 @@
 import java.util.Collection;
 
 import org.chromium.sdk.Breakpoint;
+import org.chromium.sdk.CallFrame;
 import org.chromium.sdk.JavascriptVm;
 import org.chromium.sdk.Script;
 import org.eclipse.core.resources.IFile;
@@ -86,6 +87,12 @@
   BreakpointHandler getBreakpointHandler();
 
   /**
+   * Returns editor line number for the provided call stack frame applying all required 
+   * editor-specific translations.
+   */
+  int getLineNumber(CallFrame stackFrame);
+
+  /**
    * Breakpoint-related aspect of {@link WorkspaceBridge} interface.
    */
   interface BreakpointHandler extends IBreakpointListener {
@@ -112,4 +119,5 @@
      */
     String getStackFrameLabel(StackFrame stackFrame) throws DebugException;
   }
+
 }
--- a/org.symbian.tools.wrttools.debug.core/META-INF/MANIFEST.MF	Tue Feb 09 10:51:25 2010 -0800
+++ b/org.symbian.tools.wrttools.debug.core/META-INF/MANIFEST.MF	Tue Feb 09 10:54:46 2010 -0800
@@ -18,7 +18,10 @@
  org.symbian.tools.wrttools.previewer;bundle-version="1.0.0",
  org.symbian.tools.wrttools;bundle-version="1.0.0",
  org.eclipse.core.filesystem;bundle-version="1.2.0",
- org.eclipse.ui.ide;bundle-version="3.5.0"
+ org.eclipse.ui.ide;bundle-version="3.5.0",
+ org.eclipse.wst.sse.ui;bundle-version="1.1.100",
+ org.eclipse.wst.sse.core;bundle-version="1.1.400",
+ org.eclipse.wst.html.core;bundle-version="1.1.300"
 Bundle-RequiredExecutionEnvironment: J2SE-1.5,
  JavaSE-1.6
 Bundle-ActivationPolicy: lazy
--- a/org.symbian.tools.wrttools.debug.core/plugin.xml	Tue Feb 09 10:51:25 2010 -0800
+++ b/org.symbian.tools.wrttools.debug.core/plugin.xml	Tue Feb 09 10:54:46 2010 -0800
@@ -220,5 +220,16 @@
       </action>
     </editorContribution>
   </extension>
+    <extension
+          point="org.eclipse.wst.sse.ui.breakpoint">
+       <breakpointContribution
+             id="org.symbian.tools.wrttools.debug.htmlbreakpoints">
+          <provider
+                class="org.symbian.tools.wrttools.debug.internal.HtmlBreakpointProvider"
+                contentTypes="org.eclipse.wst.html.core.htmlsource"
+                id="org.symbian.tools.wrttools.debug.htmlbreakpoints">
+          </provider>
+       </breakpointContribution>
+    </extension>
   
 </plugin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/HtmlBreakpointProvider.java	Tue Feb 09 10:54:46 2010 -0800
@@ -0,0 +1,58 @@
+package org.symbian.tools.wrttools.debug.internal;
+
+import org.chromium.debug.core.model.ChromiumLineBreakpoint;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITypedRegion;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.wst.html.core.text.IHTMLPartitions;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools;
+import org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint.IBreakpointProvider;
+
+@SuppressWarnings("restriction")
+public class HtmlBreakpointProvider implements IBreakpointProvider {
+
+	public IStatus addBreakpoint(IDocument document, IEditorInput input,
+			int lineNumber, int offset) throws CoreException {
+		boolean hasScript = hasJavaScript(document, lineNumber);
+		
+		System.out.println(hasScript);
+		ChromiumLineBreakpoint breakpoint = new ChromiumLineBreakpoint(getResource(input), lineNumber);
+		DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(breakpoint);
+		return Status.OK_STATUS;
+	}
+
+	private boolean hasJavaScript(IDocument document, int lineNumber) {
+		try {
+			if (document instanceof IStructuredDocument) {
+				IStructuredDocument doc = (IStructuredDocument) document;
+				int lineOffset = doc.getLineOffset(lineNumber - 1);
+				int lineLength = doc.getLineLength(lineNumber - 1);
+				ITypedRegion[] computePartitioning = doc.computePartitioning(lineOffset, lineLength);
+				for (ITypedRegion region : computePartitioning) {
+					if (IHTMLPartitions.SCRIPT.equals(region.getType()) || IHTMLPartitions.SCRIPT_EVENTHANDLER.equals(region.getType())) {
+						return true;
+					}
+				}
+			}
+		} catch (BadLocationException e) {
+			Activator.log(e);
+		}
+		return false;
+	}
+
+	public IResource getResource(IEditorInput input) {
+		return (IResource) input.getAdapter(IResource.class);
+	}
+
+	public void setSourceEditingTextTools(ISourceEditingTextTools tools) {
+		// Do nothing
+	}
+
+}
--- a/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/WRTProjectWorkspaceBridge.java	Tue Feb 09 10:51:25 2010 -0800
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/WRTProjectWorkspaceBridge.java	Tue Feb 09 10:54:46 2010 -0800
@@ -8,6 +8,7 @@
 import org.chromium.debug.core.model.DebugTargetImpl;
 import org.chromium.debug.core.model.StackFrame;
 import org.chromium.debug.core.model.WorkspaceBridge;
+import org.chromium.sdk.CallFrame;
 import org.chromium.sdk.JavascriptVm;
 import org.chromium.sdk.Script;
 import org.chromium.sdk.JavascriptVm.ScriptsCallback;
@@ -132,6 +133,15 @@
 		resourceManager.addScript(newScript);
 	}
 
+	public int getLineNumber(CallFrame stackFrame) {
+		int offset = 0;
+		Script script = stackFrame.getScript();
+		if (script != null) {
+			offset = script.getStartLine();
+		}
+		return offset + stackFrame.getLineNumber() + 1;
+	}
+
 	/**
 	 * This very simple source locator works because we provide our own source
 	 * files. We'll have to try harder, once we link with resource js files.
@@ -164,4 +174,5 @@
 			return null;
 		}
 	};
+
 }
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WorkspaceResourcesServlet.java	Tue Feb 09 10:51:25 2010 -0800
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WorkspaceResourcesServlet.java	Tue Feb 09 10:54:46 2010 -0800
@@ -159,6 +159,21 @@
 	}
 
 	private static String getServerURIForResource(String resourcePath) {
+		Path p = new Path(resourcePath);
+		if (p.segmentCount() > 1) {
+			IProject project = ResourcesPlugin.getWorkspace().getRoot()
+					.getProject(p.segment(0));
+			try {
+				if (p.removeFirstSegments(1).toString().equals(
+						CoreUtil.getIndexFileName(CoreUtil.readFile(project,
+								METADATA_FILE)))) {
+					return getServerURIForResource(new Path(p.segment(0))
+							.append(INDEX_PAGE).makeAbsolute().toString());
+				}
+			} catch (Exception e1) {
+				PreviewerPlugin.log(e1);
+			}
+		}
 		String uri = null;
 		try {
 			String path = WebappManager.WORKSPACE_RESOURCES_CONTEXT