Several minor bugfixes in HTML debugging
authorEugene Ostroukhov <eugeneo@symbian.org>
Tue, 09 Feb 2010 13:35:06 -0800
changeset 121 9e91633d1ef9
parent 120 94a8b7890e14
child 122 8bb5bc59bfcf
Several minor bugfixes in HTML debugging
org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/HtmlBreakpointProvider.java
org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WorkspaceResourcesServlet.java
--- a/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/HtmlBreakpointProvider.java	Tue Feb 09 11:28:31 2010 -0800
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/HtmlBreakpointProvider.java	Tue Feb 09 13:35:06 2010 -0800
@@ -21,10 +21,11 @@
 	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);
+
+		if (hasScript) {
+			ChromiumLineBreakpoint breakpoint = new ChromiumLineBreakpoint(getResource(input), lineNumber);
+			DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(breakpoint);
+		}
 		return Status.OK_STATUS;
 	}
 
@@ -34,9 +35,12 @@
 				IStructuredDocument doc = (IStructuredDocument) document;
 				int lineOffset = doc.getLineOffset(lineNumber - 1);
 				int lineLength = doc.getLineLength(lineNumber - 1);
-				ITypedRegion[] computePartitioning = doc.computePartitioning(lineOffset, lineLength);
+				ITypedRegion[] computePartitioning = doc.computePartitioning(
+						lineOffset, lineLength);
 				for (ITypedRegion region : computePartitioning) {
-					if (IHTMLPartitions.SCRIPT.equals(region.getType()) || IHTMLPartitions.SCRIPT_EVENTHANDLER.equals(region.getType())) {
+					if (IHTMLPartitions.SCRIPT.equals(region.getType())
+							|| IHTMLPartitions.SCRIPT_EVENTHANDLER
+									.equals(region.getType())) {
 						return true;
 					}
 				}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WorkspaceResourcesServlet.java	Tue Feb 09 11:28:31 2010 -0800
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WorkspaceResourcesServlet.java	Tue Feb 09 13:35:06 2010 -0800
@@ -226,7 +226,7 @@
 		IPath path = null;
 		try {
 			String root = getHttpUrl(null);
-			if (uri.startsWith(root)) {
+			if (uri != null && uri.startsWith(root)) {
 				String fileName = uri.substring(root.length());
 				fileName = URLDecoder.decode(fileName, "UTF-8");
 				path = new Path(fileName);
@@ -263,16 +263,18 @@
 	public static File getPreviewerResource(String name) {
 		try {
 			IPath path = getProjectRelativePath(name);
-			if (path.segmentCount() == 2 && STARTING_PAGE.equals(path.segment(1))) {
-				path = new Path(PREVIEW_START);
-			} else
-			if (path.segmentCount() > 2 && PREVIEW_PATH.equals(path.segment(1))) {
-				path = path.removeFirstSegments(1);
-			} else {
-				path = null;
-			}
 			if (path != null) {
-				URL pluginResource = FileLocator.find(PreviewerPlugin.getDefault().getBundle(), path, null);
+				if (path.segmentCount() == 2
+						&& STARTING_PAGE.equals(path.segment(1))) {
+					path = new Path(PREVIEW_START);
+				} else if (path.segmentCount() > 2
+						&& PREVIEW_PATH.equals(path.segment(1))) {
+					path = path.removeFirstSegments(1);
+				} else {
+					return null;
+				}
+				URL pluginResource = FileLocator.find(PreviewerPlugin
+						.getDefault().getBundle(), path, null);
 				if (pluginResource != null) {
 					URL url = FileLocator.toFileURL(pluginResource);
 					if (url != null) {