--- a/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/DebugConnectionJob.java Tue Jun 01 11:21:52 2010 -0700
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/DebugConnectionJob.java Tue Jun 01 14:53:02 2010 -0700
@@ -24,10 +24,10 @@
import org.chromium.debug.core.model.Destructable;
import org.chromium.debug.core.model.DestructingGuard;
import org.chromium.debug.core.model.JavascriptVmEmbedder;
+import org.chromium.debug.core.model.JavascriptVmEmbedder.ConnectionToRemote;
import org.chromium.debug.core.model.JavascriptVmEmbedderFactory;
import org.chromium.debug.core.model.NamedConnectionLoggerFactory;
import org.chromium.debug.core.model.WorkspaceBridge;
-import org.chromium.debug.core.model.JavascriptVmEmbedder.ConnectionToRemote;
import org.chromium.sdk.ConnectionLogger;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -70,7 +70,7 @@
target.fireTerminateEvent();
}
- public boolean browserRunning(URI uri) throws CoreException {
+ public boolean browserRunning(URI uri, String sId) throws CoreException {
if (Activator.DEBUG_CONNECTION) {
System.out.println("Browser running, connecting @" + hashCode());
}
@@ -120,7 +120,7 @@
}
launch.addDebugTarget(target);
-
+ launch.setAttribute("http.service.id", sId);
// All OK
destructingGuard.discharge();
addResourceListenerIfNotInstalled();
--- a/org.symbian.tools.wrttools.previewer/META-INF/MANIFEST.MF Tue Jun 01 11:21:52 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/META-INF/MANIFEST.MF Tue Jun 01 14:53:02 2010 -0700
@@ -13,7 +13,8 @@
org.eclipse.wst.jsdt.core;bundle-version="1.0.200",
org.eclipse.wst.jsdt.ui;bundle-version="1.0.200",
org.symbian.tools.wrttools;bundle-version="0.9.0",
- org.mozilla.xulrunner;bundle-version="1.9.1";resolution:=optional
+ org.mozilla.xulrunner;bundle-version="1.9.1";resolution:=optional,
+ org.eclipse.ui.console;bundle-version="3.5.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.symbian.tools.wrttools.previewer,
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/PreviewerPlugin.java Tue Jun 01 11:21:52 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/PreviewerPlugin.java Tue Jun 01 14:53:02 2010 -0700
@@ -24,6 +24,9 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.MessageConsole;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -57,6 +60,7 @@
private final CommandHandlerManager handlerManager = new CommandHandlerManager();
private final HttpPreviewer previewer = new HttpPreviewer();
+ private MessageConsole console;
/*
* (non-Javadoc)
@@ -125,4 +129,12 @@
public CommandHandlerManager getCommandHandlerManager() {
return handlerManager;
}
+
+ public MessageConsole getConsole() {
+ if (console == null) {
+ console = new MessageConsole("WebRuntime Console", null);
+ ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { console });
+ }
+ return console;
+ }
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/BrowserConnectionJob.java Tue Jun 01 11:21:52 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/BrowserConnectionJob.java Tue Jun 01 14:53:02 2010 -0700
@@ -15,6 +15,7 @@
private boolean ready = false;
private boolean success = false;
+ private String sId = null;
public BrowserConnectionJob(IPreviewStartupListener listener, URI uri) {
super("Connecting to WRT debugger browser");
@@ -26,7 +27,7 @@
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- listener.browserRunning(uri);
+ listener.browserRunning(uri, sId);
synchronized (this) {
success = true;
}
@@ -50,4 +51,8 @@
public synchronized boolean isSuccess() {
return success;
}
+
+ public void setSessionId(String sId) {
+ this.sId = sId;
+ }
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/IPreviewStartupListener.java Tue Jun 01 11:21:52 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/IPreviewStartupListener.java Tue Jun 01 14:53:02 2010 -0700
@@ -5,5 +5,5 @@
import org.eclipse.core.runtime.CoreException;
public interface IPreviewStartupListener {
- boolean browserRunning(URI uri) throws CoreException;
+ boolean browserRunning(URI uri, String sId) throws CoreException;
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WebAppInterface.java Tue Jun 01 11:21:52 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WebAppInterface.java Tue Jun 01 14:53:02 2010 -0700
@@ -32,11 +32,11 @@
public class WebAppInterface {
private static WebAppInterface INSTANCE;
- public static void connectDebugger(String widget, String id) {
+ public static void connectDebugger(String widget, String id, String sId) {
if (PreviewerPlugin.TRACE_WEBAPP) {
System.out.println("Connecting debugger");
}
- getInstance().connect(widget, id);
+ getInstance().connect(widget, id, sId);
}
public static String decode(String value) {
@@ -101,9 +101,10 @@
return WorkspaceResourcesServlet.getPreviewerStartingPage(widget);
}
- private synchronized void connect(String widget, String id) {
+ private synchronized void connect(String widget, String id, String sId) {
if (!isConnected(widget, id)) {
BrowserConnectionJob listener = debuggerJobs.get(getId(widget, id));
+ listener.setSessionId(sId);
listener.schedule(50);
}
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WorkspaceResourcesServlet.java Tue Jun 01 11:21:52 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WorkspaceResourcesServlet.java Tue Jun 01 14:53:02 2010 -0700
@@ -234,7 +234,7 @@
time = System.currentTimeMillis();
}
try {
- InputStream stream = providers.get(req.getPathInfo(), req.getParameterMap());
+ InputStream stream = providers.get(req.getPathInfo(), req.getParameterMap(), req.getSession().getId());
String mimeType = getMimeTypeByExtension(new Path(req.getPathInfo()).getFileExtension());
if (mimeType != null) {
resp.setContentType(mimeType);
@@ -279,7 +279,7 @@
throw new ServletException(e);
}
try {
- providers.post(req.getPathInfo(), req.getParameterMap(), object);
+ providers.post(req.getPathInfo(), req.getParameterMap(), object, req.getSession().getId());
} catch (PreviewerException e) {
throw new ServletException(e);
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/CommandResourceProvider.java Tue Jun 01 11:21:52 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/CommandResourceProvider.java Tue Jun 01 14:53:02 2010 -0700
@@ -34,7 +34,8 @@
return new String[] { "__sym_command" };
}
- public InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters)
+ public InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters,
+ String sessionId)
throws IOException, CoreException {
if (resource.segmentCount() == 2) {
PreviewerPlugin.getDefault().getCommandHandlerManager().handle(resource.segment(1), project.getName(),
@@ -43,7 +44,8 @@
return null;
}
- public void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object)
+ public void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object,
+ String sessionId)
throws IOException, CoreException {
// Do nothing
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/DebuggerResourceProvider.java Tue Jun 01 11:21:52 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/DebuggerResourceProvider.java Tue Jun 01 14:53:02 2010 -0700
@@ -41,7 +41,7 @@
return new String[] { HttpPreviewer.DEBUG_STARTING_PAGE, "__sym-debug" };
}
- public InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters)
+ public InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters, String sId)
throws IOException, CoreException {
if (resource.toString().equals(HttpPreviewer.DEBUG_STARTING_PAGE)) {
URL url = FileLocator.find(PreviewerPlugin.getDefault().getBundle(), new Path(
@@ -53,7 +53,7 @@
if ("index.html".equals(resource.segment(1))) {
String[] sessionId = parameters.get(DEBUG_SESSION_ID_PARAMETER);
if (sessionId != null && sessionId.length == 1) {
- WebAppInterface.connectDebugger(project.getName(), sessionId[0]);
+ WebAppInterface.connectDebugger(project.getName(), sessionId[0], sId);
}
URL url = FileLocator.find(PreviewerPlugin.getDefault().getBundle(), new Path(
"http-content/wrtdebugger/debugger.htm"), null);
@@ -73,8 +73,8 @@
return null;
}
- public void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object)
- throws IOException, CoreException {
+ public void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object,
+ String sessionId) throws IOException, CoreException {
// TODO Auto-generated method stub
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/IResourceProvider.java Tue Jun 01 11:21:52 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/IResourceProvider.java Tue Jun 01 14:53:02 2010 -0700
@@ -29,9 +29,11 @@
public interface IResourceProvider {
String[] getPaths();
- InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters)
+
+ InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters, String sessionId)
throws IOException,
CoreException;
- void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object)
+
+ void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object, String sessionId)
throws IOException, CoreException;
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/MasterScriptProvider.java Tue Jun 01 11:21:52 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/MasterScriptProvider.java Tue Jun 01 14:53:02 2010 -0700
@@ -51,7 +51,8 @@
return new String[] { PATH_LOADER_JS, PATH_DEVICE_JS };
}
- public InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters)
+ public InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters,
+ String sessionId)
throws IOException, CoreException {
synchronized (this) {
if (WRT10 == null || PreviewerPlugin.DONT_CACHE_SCRIPT) {
@@ -111,7 +112,8 @@
WRT11_SERVICES = builder.toString();
}
- public void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object)
+ public void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object,
+ String sessionId)
throws IOException, CoreException {
// Nothing to do
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/PreferencesResourceProvider.java Tue Jun 01 11:21:52 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/PreferencesResourceProvider.java Tue Jun 01 14:53:02 2010 -0700
@@ -37,7 +37,8 @@
return new String[] { "preview/preferences.js" };
}
- public InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters)
+ public InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters,
+ String sessionId)
throws IOException, CoreException {
Properties projectPreferences = ProjectPreferencesManager.getProjectProperties(project);
String js = getJS(projectPreferences);
@@ -58,7 +59,8 @@
return builder.toString();
}
- public void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object)
+ public void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object,
+ String sessionId)
throws IOException, CoreException {
String key = (String) object.get("key");
Object value = object.get("value");
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/PreviewerStaticResourceProvider.java Tue Jun 01 11:21:52 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/PreviewerStaticResourceProvider.java Tue Jun 01 14:53:02 2010 -0700
@@ -40,7 +40,8 @@
return new String[] { HttpPreviewer.PREVIEW_STARTING_PAGE, PREVIEW_PATH };
}
- public InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters)
+ public InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters,
+ String sessionId)
throws IOException {
if (HttpPreviewer.PREVIEW_STARTING_PAGE.equals(resource.toString())
|| HttpPreviewer.DEBUG_STARTING_PAGE.equals(resource.toString())) {
@@ -54,7 +55,8 @@
}
}
- public void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object)
+ public void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object,
+ String sessionId)
throws IOException, CoreException {
// Do nothing
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/ProjectIndexResourceProvider.java Tue Jun 01 11:21:52 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/ProjectIndexResourceProvider.java Tue Jun 01 14:53:02 2010 -0700
@@ -42,7 +42,8 @@
return new String[] { INDEX };
}
- public InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters)
+ public InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters,
+ String sessionId)
throws IOException, CoreException {
return getProjectIndexPage(project.getName());
}
@@ -65,7 +66,8 @@
return null;
}
- public void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object)
+ public void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object,
+ String sessionId)
throws IOException, CoreException {
// Do nothing
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/Providers.java Tue Jun 01 11:21:52 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/Providers.java Tue Jun 01 14:53:02 2010 -0700
@@ -46,6 +46,7 @@
public class Providers {
private final Map<String, IResourceProvider> HANDLERS = new TreeMap<String, IResourceProvider>();
private final IResourceProvider defaultHandler = new WorkspaceResourceProvider();
+
public Providers() {
addPaths(new MasterScriptProvider());
addPaths(new PreviewerStaticResourceProvider());
@@ -61,12 +62,12 @@
}
}
- public InputStream get(String url, Map<String, String[]> parameters) throws PreviewerException {
+ public InputStream get(String url, Map<String, String[]> parameters, String sessionId) throws PreviewerException {
final IProject project = getProject(url);
final IPath resource = new Path(url).removeFirstSegments(1);
final IResourceProvider provider = getHandlerForPath(resource);
try {
- return provider.getResourceStream(project, resource, parameters);
+ return provider.getResourceStream(project, resource, parameters, sessionId);
} catch (IOException e) {
throw new PreviewerException(e);
} catch (CoreException e) {
@@ -106,12 +107,13 @@
return null;
}
- public void post(String url, Map<String, String[]> parameterMap, JSONObject object) throws PreviewerException {
+ public void post(String url, Map<String, String[]> parameterMap, JSONObject object, String sessionId)
+ throws PreviewerException {
final IProject project = getProject(url);
final IPath resource = new Path(url).removeFirstSegments(1);
final IResourceProvider provider = getHandlerForPath(resource);
try {
- provider.post(project, resource, parameterMap, object);
+ provider.post(project, resource, parameterMap, object, sessionId);
} catch (IOException e) {
throw new PreviewerException(e);
} catch (CoreException e) {
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/WorkspaceResourceProvider.java Tue Jun 01 11:21:52 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/WorkspaceResourceProvider.java Tue Jun 01 14:53:02 2010 -0700
@@ -26,7 +26,9 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.ui.console.MessageConsole;
import org.json.simple.JSONObject;
+import org.symbian.tools.wrttools.previewer.PreviewerPlugin;
import org.symbian.tools.wrttools.util.ProjectUtils;
public class WorkspaceResourceProvider implements IResourceProvider {
@@ -34,17 +36,24 @@
return null;
}
- public InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters)
+ public InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters,
+ String sessionId)
throws IOException, CoreException {
IFile file = project.getFile(resource);
if (file.isAccessible() && !ProjectUtils.isExcluded(file)) {
return file.getContents();
} else {
+ MessageConsole console = PreviewerPlugin.getDefault().getConsole();
+ console.activate();
+ console.newMessageStream().write(
+ String.format("%s was not found in the workspace. It was requested by the previewer.\n", file
+ .getFullPath().toString()));
return null;
}
}
- public void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object)
+ public void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object,
+ String sessionId)
throws IOException, CoreException {
// Do nothing
}