--- a/org.symbian.tools.wrttools.debug.core/plugin.xml Tue Mar 16 18:01:11 2010 -0700
+++ b/org.symbian.tools.wrttools.debug.core/plugin.xml Thu Mar 18 09:51:41 2010 -0700
@@ -305,5 +305,12 @@
label="chrome debug widget">
</keyword>
</extension>
+ <extension
+ point="org.symbian.tools.wrttools.previewer.commands">
+ <command
+ handler="org.symbian.tools.wrttools.debug.internal.session.TerminateSession"
+ name="terminateDebug">
+ </command>
+ </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/session/TerminateSession.java Thu Mar 18 09:51:41 2010 -0700
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.wrttools.debug.internal.session;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+import org.symbian.tools.wrttools.debug.internal.Activator;
+import org.symbian.tools.wrttools.debug.internal.IConstants;
+import org.symbian.tools.wrttools.debug.internal.launch.WidgetLaunchDelegate;
+import org.symbian.tools.wrttools.previewer.IPreviewerCommandHandler;
+
+public class TerminateSession implements IPreviewerCommandHandler {
+ @SuppressWarnings("unchecked")
+ public void handle(String commandName, String projectName, Map parameters) {
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ for (ILaunch launch : launchManager.getLaunches()) {
+ try {
+ if (!launch.isTerminated()) {
+ ILaunchConfiguration lc = launch.getLaunchConfiguration();
+ if (WidgetLaunchDelegate.ID.equals(lc.getType().getIdentifier())
+ && projectName.equals(lc.getAttribute(IConstants.PROP_PROJECT_NAME, ""))) {
+ launch.terminate();
+ }
+ }
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ }
+ }
+
+}
--- a/org.symbian.tools.wrttools.previewer/plugin.xml Tue Mar 16 18:01:11 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/plugin.xml Thu Mar 18 09:51:41 2010 -0700
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
+ <extension-point id="commands" name="Previewer Command" schema="schema/commands.exsd"/>
<extension
point="org.eclipse.ui.views">
<view
--- a/org.symbian.tools.wrttools.previewer/preview/css/style.css Tue Mar 16 18:01:11 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/css/style.css Thu Mar 18 09:51:41 2010 -0700
@@ -303,6 +303,7 @@
top: 10px;
left: 10px;
background-position: left bottom;
+ cursor: pointer;
z-index: 200;
}
@@ -311,6 +312,25 @@
background-position: left top;
}
+div#InspectorBtn{
+ width: 75px;
+ height: 85px;
+/* background-image: url(../images/settings-icon.png); */
+ background-image: url(../images/inspector.png);
+ position: absolute;
+ top: 10px;
+ right: 10px;
+ float: right;
+ background-position: left bottom;
+ z-index: 200;
+ cursor: pointer;
+}
+
+div#InspectorBtn:hover{
+ background-image: url(../images/inspector_hover.png);
+ background-position: left top;
+}
+
div#loaderDiv{
padding: 10px;
font-size: 1.1em;
Binary file org.symbian.tools.wrttools.previewer/preview/images/inspector.png has changed
Binary file org.symbian.tools.wrttools.previewer/preview/images/inspector_hover.png has changed
--- a/org.symbian.tools.wrttools.previewer/preview/script/nokia.js Tue Mar 16 18:01:11 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/script/nokia.js Thu Mar 18 09:51:41 2010 -0700
@@ -607,9 +607,13 @@
$("#DeviceDisplayLayout").show();
$("#PreferencesTab").show();
+ $("#InspectorTab").show();
if(!NOKIA.menu.is_dimmed)
$("#PreferencesBtn").show();
+ if (/chrome/.test( navigator.userAgent.toLowerCase())) {
+ $("#InspectorBtn").show();
+ }
},
setWidgetStyle : function()
@@ -660,6 +664,7 @@
path : document.location.pathname,
errorDailog : null,
prefDailog : null,
+ inspectorDailog : null,
intervalId : null,
infoPlistCounter : false,
IconFileCounter : false,
@@ -1053,6 +1058,32 @@
}
}
});
+ /*
+ * Render Emulator for Interaction
+ */
+ NOKIA.helper.inspectorDailog = $("#InspectorTab").dialog({
+ width: 370, minWidth: 300, minHeight: 200, height: 250, autoOpen: false, position : top, title : ' ',
+ buttons : {
+ "Close" : function(){
+ $("#InspectorTab").dialog('close');
+
+ // Hack for Mac firefox
+ if(/Mac/i.test(navigator.userAgent))
+ {
+ $("#WidgetArea iframe").css({overflow:'auto'});
+ }
+ },
+ "Disconnect Debugger" : function(){
+ $.ajax({url : "__sym_command/terminateDebug"});
+ $("#InspectorTab").dialog('close');
+
+ // Hack for Mac firefox
+ if(/Mac/i.test(navigator.userAgent))
+ {
+ $("#WidgetArea iframe").css({overflow:'auto'});
+ }
+ }}
+ });
$('#PreferencesBtn').click(function(){
// Load preferences
@@ -1065,6 +1096,14 @@
$("#WidgetArea iframe").css({overflow:'hidden'});
}
});
+ $('#InspectorBtn').click(function(){
+ $('#InspectorTab').dialog('open');
+ // Hack for Mac firefox
+ if(/Mac/i.test(navigator.userAgent))
+ {
+ $("#WidgetArea iframe").css({overflow:'hidden'});
+ }
+ });
$('#input_portrait').change(function(){
NOKIA.helper.toggle(this);
--- a/org.symbian.tools.wrttools.previewer/preview/wrt_preview.html Tue Mar 16 18:01:11 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/wrt_preview.html Thu Mar 18 09:51:41 2010 -0700
@@ -209,6 +209,14 @@
</div>
</div>
</div>
+ <div id="InspectorTab" class="hide">
+ <div>To open Google Chrome Developer Tolls you need to:
+ <ol>
+ <li>Disconnect debugger from Chrome browser.</li>
+ <li>Press Ctrl+Shift+I to open inspector.</li>
+ </ol>
+ </div>
+ </div>
</div>
<div id="preview-ui-bottom">
<div id="preview-ui-bottom-header">
@@ -221,6 +229,7 @@
</div>
</div>
<div id="PreferencesBtn" class="hide"></div>
+ <div id="InspectorBtn" class="hide"></div>
<div id="orientationIcon"></div>
<div id="loaderDiv"></div>
<div id="NotificationDiv" class="hide">
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.previewer/schema/commands.exsd Thu Mar 18 09:51:41 2010 -0700
@@ -0,0 +1,112 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.symbian.tools.wrttools.previewer" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.symbian.tools.wrttools.previewer" id="commands" name="Previewer Commands"/>
+ </appInfo>
+ <documentation>
+ This extension point allows customizing the previewer by handling special commands. To call command from previewer send AJAX GET request to following URL:
+http://${host}:${port}/preview/${project}/__sym_command/${commandname}[?${params}]
+
+${project} and ${params} will be passed to command handler.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="command"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="command">
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ One-word command name
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="handler" type="string" use="required">
+ <annotation>
+ <documentation>
+ Class that will handle commands
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.symbian.tools.wrttools.previewer.IPreviewerCommandHandler"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/CommandHandlerManager.java Thu Mar 18 09:51:41 2010 -0700
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.wrttools.previewer;
+
+import java.text.MessageFormat;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.InvalidRegistryObjectException;
+import org.eclipse.core.runtime.Platform;
+
+public class CommandHandlerManager {
+
+ private Map<String, IPreviewerCommandHandler> handlers = null;
+
+ @SuppressWarnings("unchecked")
+ public void handle(String commandName, String projectName, Map parameters) {
+ final IPreviewerCommandHandler commandHandler = getCommandMap().get(commandName);
+ if (commandHandler == null) {
+ PreviewerPlugin.log(MessageFormat.format("Command {0} is not handled", commandName), null);
+ } else {
+ commandHandler.handle(commandName, projectName, parameters);
+ }
+ }
+
+ private synchronized Map<String, IPreviewerCommandHandler> getCommandMap() {
+ if (handlers == null) {
+ handlers = new TreeMap<String, IPreviewerCommandHandler>();
+ IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(
+ PreviewerPlugin.PLUGIN_ID, "commands");
+ for (IConfigurationElement element : elements) {
+ final String name = element.getAttribute("name");
+ try {
+ handlers.put(name, (IPreviewerCommandHandler) element.createExecutableExtension("handler"));
+ } catch (InvalidRegistryObjectException e) {
+ PreviewerPlugin.log(MessageFormat.format("Command: {0}, handler: {1}", name, element
+ .getAttribute("handler")), e);
+ } catch (CoreException e) {
+ PreviewerPlugin.log(MessageFormat.format("Command: {0}, handler: {1}", name, element
+ .getAttribute("handler")), e);
+ }
+ }
+ }
+ return handlers;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/IPreviewerCommandHandler.java Thu Mar 18 09:51:41 2010 -0700
@@ -0,0 +1,26 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.wrttools.previewer;
+
+import java.util.Map;
+
+public interface IPreviewerCommandHandler {
+ @SuppressWarnings("unchecked")
+ void handle(String commandName, String projectName, Map parameters);
+}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/PreviewerPlugin.java Tue Mar 16 18:01:11 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/PreviewerPlugin.java Thu Mar 18 09:51:41 2010 -0700
@@ -53,7 +53,8 @@
// The shared instance
private static PreviewerPlugin plugin;
- private HttpPreviewer previewer = new HttpPreviewer();
+ private final CommandHandlerManager handlerManager = new CommandHandlerManager();
+ private final HttpPreviewer previewer = new HttpPreviewer();
/*
* (non-Javadoc)
@@ -118,4 +119,7 @@
return previewer;
}
+ public CommandHandlerManager getCommandHandlerManager() {
+ return handlerManager;
+ }
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WorkspaceResourcesServlet.java Tue Mar 16 18:01:11 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WorkspaceResourcesServlet.java Thu Mar 18 09:51:41 2010 -0700
@@ -29,6 +29,7 @@
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.text.MessageFormat;
+import java.util.Map;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -52,6 +53,7 @@
public class WorkspaceResourcesServlet extends HttpServlet {
private static final String PREVIEW_START = "/preview/wrt_preview.html";
private static final String PREVIEW_PATH = "preview";
+ private static final Object COMMAND_PATH = "__sym_command";
private static final String STARTING_PAGE = "preview-frame.html";
private static final String INDEX_PAGE = "wrt_preview_main.html";
private static final long serialVersionUID = -3217197074249607950L;
@@ -69,7 +71,7 @@
IPath path = new Path(req.getPathInfo());
InputStream contents = null;
try {
- contents = getSpecialResource(path);
+ contents = getSpecialResource(path, req.getParameterMap());
if (contents == null) {
contents = getWorkspaceResourceContents(path);
}
@@ -92,7 +94,8 @@
}
}
- private InputStream getSpecialResource(IPath path) throws IOException,
+ @SuppressWarnings("unchecked")
+ private InputStream getSpecialResource(IPath path, Map parameters) throws IOException,
CoreException {
IPath relativePath = path.removeFirstSegments(1);
if (relativePath.segmentCount() == 1) {
@@ -104,6 +107,11 @@
}
} else if (PREVIEW_PATH.equals(relativePath.segment(0))) {
return getPluginResourceStream(relativePath.makeAbsolute());
+ } else if (COMMAND_PATH.equals(relativePath.segment(0))) {
+ if (path.segmentCount() == 3) {
+ PreviewerPlugin.getDefault().getCommandHandlerManager().handle(path.segment(2), path.segment(0),
+ parameters);
+ }
}
return null;
}
--- a/org.symbian.tools.wrttools/plugin.xml Tue Mar 16 18:01:11 2010 -0700
+++ b/org.symbian.tools.wrttools/plugin.xml Thu Mar 18 09:51:41 2010 -0700
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
+ <extension-point id="projectTemplates" name="WRT Project Templates" schema="schema/projectTemplates.exsd"/>
<!-- Generic Project Builder and Project Natures -->
@@ -127,7 +128,6 @@
</extension>
<!-- WRT Project Templates - CSS Validator -->
- <extension-point id="projectTemplates" name="WRT application project templates" schema="schema/projectTemplates.exsd"/>
<extension id="org.symbian.tools.wrttools.core.cssvalidator"
name="CSS Validator" point="org.eclipse.wst.validation.validatorV2">
<validator build="true"