--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/documentation/.project Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Documentation</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/documentation/tmw_overview.uxf Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><umlet_diagram><help_text>// Uncomment the following line to change the fontsize:
+// fontsize=14
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Welcome to UMLet!
+//
+// Double-click on UML elements to add them to the diagram, or to copy them
+// Edit elements by modifying the text in this panel
+// Hold Ctrl to select multiple elements
+// Use Ctrl+mouse to select via lasso
+//
+// Use ± or Ctrl+mouse wheel to zoom
+// Drag a whole relation at its central square icon
+//
+// Press Ctrl+C to copy the whole diagram to the system clipboard (then just paste it to, eg, Word)
+// Edit the files in the "palettes" directory to create your own element palettes
+//
+// Select "Custom Elements > New..." to create new element types
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+
+// This text will be stored with each diagram; use it for notes.</help_text><zoom_level>10</zoom_level><element><type>com.umlet.element.base.Class</type><coordinates><x>160</x><y>260</y><w>150</w><h>30</h></coordinates><panel_attributes>Mobile Web Runtime</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Package</type><coordinates><x>80</x><y>20</y><w>750</w><h>140</h></coordinates><panel_attributes>Faceted Project Framework
+bg=orange</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>170</x><y>80</y><w>140</w><h>30</h></coordinates><panel_attributes>Runtime</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>370</x><y>80</y><w>140</w><h>30</h></coordinates><panel_attributes>Runtime Component</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>590</x><y>80</y><w>150</w><h>30</h></coordinates><panel_attributes>Project Facet</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>280</x><y>60</y><w>110</w><h>50</h></coordinates><panel_attributes>lt=<<<<-</panel_attributes><additional_attributes>30;30;90;30</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>250</x><y>80</y><w>200</w><h>200</h></coordinates><panel_attributes>lt=<<<<-
+m1=0..n
+m2=0..n
+consists of</panel_attributes><additional_attributes>30;180;30;110;180;110;180;30</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>150</x><y>80</y><w>158</w><h>200</h></coordinates><panel_attributes>lt=<.
+m1=1
+m2=1
+<<instanceOf>></panel_attributes><additional_attributes>80;30;80;180</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>480</x><y>40</y><w>130</w><h>70</h></coordinates><panel_attributes>lt=<.
+Supports</panel_attributes><additional_attributes>110;50;30;50</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>590</x><y>260</y><w>150</w><h>30</h></coordinates><panel_attributes>TMW Project</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>280</x><y>220</y><w>330</w><h>70</h></coordinates><panel_attributes>lt=<.
+m1=1
+m2=m
+Targets
+</panel_attributes><additional_attributes>30;50;310;50</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>630</x><y>80</y><w>70</w><h>200</h></coordinates><panel_attributes>lt=<.
+m1=1..n
+has</panel_attributes><additional_attributes>40;30;40;180</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>160</x><y>400</y><w>150</w><h>30</h></coordinates><panel_attributes>Packager</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>120</x><y>260</y><w>136</w><h>160</h></coordinates><panel_attributes>lt=<.
+from runtime
+m1=1
+m2=0..n</panel_attributes><additional_attributes>70;30;70;140</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>220</x><y>260</y><w>110</w><h>160</h></coordinates><panel_attributes>lt=<.
+to runtime
+m1=1
+m2=0..n</panel_attributes><additional_attributes>60;30;60;140</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>160</x><y>660</y><w>150</w><h>30</h></coordinates><panel_attributes>Deployment target type</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>0</x><y>240</y><w>180</w><h>450</h></coordinates><panel_attributes>lt=<.
+accepts
+m1=0..n
+m2=0..n</panel_attributes><additional_attributes>160;30;60;30;60;430;160;430</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>160</x><y>530</y><w>150</w><h>30</h></coordinates><panel_attributes>Deployment target</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>250</x><y>260</y><w>440</w><h>290</h></coordinates><panel_attributes>lt=<.
+deploys to</panel_attributes><additional_attributes>30;270;30;210;420;210;420;30</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>180</x><y>400</y><w>88</w><h>150</h></coordinates><panel_attributes>lt=<.
+uses</panel_attributes><additional_attributes>50;30;50;130</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>170</x><y>530</y><w>114</w><h>150</h></coordinates><panel_attributes>lt=<.
+m1=1
+m2=0..n
+is of type</panel_attributes><additional_attributes>60;130;60;30</additional_attributes></element><element><type>com.umlet.element.base.Package</type><coordinates><x>80</x><y>210</y><w>750</w><h>230</h></coordinates><panel_attributes>TMW Project Model
+bg=yellow</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Package</type><coordinates><x>80</x><y>490</y><w>330</w><h>230</h></coordinates><panel_attributes>Application Deployment
+bg=red</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Package</type><coordinates><x>1230</x><y>290</y><w>140</w><h>70</h></coordinates><panel_attributes>EmptyPackage
+bg=orange</panel_attributes><additional_attributes/></element></umlet_diagram>
\ No newline at end of file
Binary file plugins/org.symbian.tools.tmw.core/bin/org/symbian/tools/tmw/core/internal/runtimes/LazyPackager.class has changed
Binary file plugins/org.symbian.tools.tmw.core/bin/org/symbian/tools/tmw/core/internal/runtimes/MobileWebRuntime.class has changed
--- a/plugins/org.symbian.tools.tmw.core/plugin.xml Thu Aug 19 17:48:04 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/plugin.xml Mon Aug 23 09:55:57 2010 -0700
@@ -142,7 +142,7 @@
id="org.symbian.tools.tmw.core"
namespace="org.symbian.tools.tmw"
properties="istmwproject"
- type="org.eclipse.core.resources.IProject">
+ type="org.eclipse.core.resources.IResource">
</propertyTester>
</extension>
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/LazyPackager.java Thu Aug 19 17:48:04 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/LazyPackager.java Mon Aug 23 09:55:57 2010 -0700
@@ -67,17 +67,20 @@
public IMobileWebRuntime getTargetRuntime() {
String id = element.getAttribute("target-runtime");
if (id != null) {
- return TMWCore.getRuntimesManager()
- .getRuntime(id, element.getAttribute("target-runtime-version"));
+ return TMWCore.getRuntimesManager().getRuntime(id, element.getAttribute("target-runtime-version"));
} else {
return getSourceRuntime();
}
}
public IMobileWebRuntime getSourceRuntime() {
- IMobileWebRuntime runtime = TMWCore.getRuntimesManager()
- .getRuntime(element.getAttribute("source-runtime"), element.getAttribute("source-runtime-version"));
- return runtime;
+ IMobileWebRuntime runtime = TMWCore.getRuntimesManager().getRuntime(element.getAttribute("source-runtime"),
+ element.getAttribute("source-runtime-version"));
+ if (runtime == null) {
+ return getTargetRuntime();
+ } else {
+ return runtime;
+ }
}
}
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileWebRuntime.java Thu Aug 19 17:48:04 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileWebRuntime.java Mon Aug 23 09:55:57 2010 -0700
@@ -44,4 +44,9 @@
return element.getChildren("runtime-component");
}
+ @Override
+ public String toString() {
+ return getId() + ":" + getVersion();
+ }
+
}
--- a/plugins/org.symbian.tools.tmw.debug/.options Thu Aug 19 17:48:04 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/.options Mon Aug 23 09:55:57 2010 -0700
@@ -1,4 +1,4 @@
-org.symbian.tools.wrttools.debug.core/debug=false
-org.symbian.tools.wrttools.debug.core/debugConnection=false
-org.symbian.tools.wrttools.debug.core/debugResources=false
-org.symbian.tools.wrttools.debug.core/debugBreakpoints=false
\ No newline at end of file
+org.symbian.tools.tmw.debug.core/debug=false
+org.symbian.tools.tmw.debug.core/debugConnection=false
+org.symbian.tools.tmw.debug.core/debugResources=false
+org.symbian.tools.tmw.debug.core/debugBreakpoints=false
\ No newline at end of file
--- a/plugins/org.symbian.tools.tmw.debug/.project Thu Aug 19 17:48:04 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/.project Mon Aug 23 09:55:57 2010 -0700
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.symbian.tools.wrttools.debug.core</name>
+ <name>org.symbian.tools.tmw.debug.core</name>
<comment></comment>
<projects>
</projects>
--- a/plugins/org.symbian.tools.tmw.debug/META-INF/MANIFEST.MF Thu Aug 19 17:48:04 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/META-INF/MANIFEST.MF Mon Aug 23 09:55:57 2010 -0700
@@ -1,9 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: WRT Debugger Plug-In
-Bundle-SymbolicName: org.symbian.tools.wrttools.debug.core;singleton:=true
+Bundle-SymbolicName: org.symbian.tools.tmw.debug.core;singleton:=true
Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.symbian.tools.wrttools.debug.internal.Activator
+Bundle-Activator: org.symbian.tools.tmw.debug.internal.Activator
Bundle-Vendor: Symbian Foundation
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/Activator.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/BreakpointAdapterFactory.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/ChromeDebugUtils.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/HtmlBreakpointProvider.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/IConstants.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/Images.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/PreferenceInitializer.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/WorkspaceLineBreakpointAdapter.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/ChromeInstancesManager$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/ChromeInstancesManager.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/DebugConnectionJob$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/DebugConnectionJob$2.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/DebugConnectionJob$3.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/DebugConnectionJob.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/DebugUtil.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/PortPolicy$NewPortEachTime.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/PortPolicy.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/ResourcesChangeListener$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/ResourcesChangeListener.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/WRTProjectWorkspaceBridge$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/WRTProjectWorkspaceBridge$Factory.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/WRTProjectWorkspaceBridge$VmResourceImpl.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/WRTProjectWorkspaceBridge.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/WebApplicationSourceLocator$WebApplicationSourceLookupParticipant.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/WebApplicationSourceLocator.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/WidgetLaunchDelegate$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/WidgetLaunchDelegate.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/WidgetTabSelector.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/launch/WrtLabelProvider.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/model/JsWatchExpressionDelegate$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/model/JsWatchExpressionDelegate$2.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/model/JsWatchExpressionDelegate$BadWatchExpressionResult.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/model/JsWatchExpressionDelegate$GoodWatchExpressionResult.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/model/JsWatchExpressionDelegate.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/model/ResourceManager.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/model/SymbianDebugModelPresentation.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/model/WorkspaceBreakpointHandler$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/model/WorkspaceBreakpointHandler$2.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/model/WorkspaceBreakpointHandler.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/property/LaunchableFactory.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/property/PropertyTester.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/internal/session/TerminateSession.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/ui/DebugPreferencePage$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/ui/DebugPreferencePage.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/ui/actions/DebugAction.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/ui/actions/JsBreakpointPropertiesRulerAction$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/ui/actions/JsBreakpointPropertiesRulerAction.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/ui/actions/JsBreakpointPropertiesRulerActionDelegate.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/ui/actions/WatchExpression$FindNode.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/ui/actions/WatchExpression.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/ui/launch/WidgetBasicTab$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/ui/launch/WidgetBasicTab.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/ui/launch/WidgetLaunchConfigurationTabGroup.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/tmw/debug/ui/launch/WidgetLaunchShortcut.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/Activator.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/BreakpointAdapterFactory.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/ChromeDebugUtils.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/HtmlBreakpointProvider.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/IConstants.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/Images.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/PreferenceInitializer.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/WorkspaceLineBreakpointAdapter.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/ChromeInstancesManager$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/ChromeInstancesManager.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/DebugConnectionJob$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/DebugConnectionJob$2.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/DebugConnectionJob$3.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/DebugConnectionJob.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/DebugUtil.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/PortPolicy$NewPortEachTime.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/PortPolicy.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/ResourcesChangeListener$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/ResourcesChangeListener.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/WRTProjectWorkspaceBridge$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/WRTProjectWorkspaceBridge$Factory.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/WRTProjectWorkspaceBridge$VmResourceImpl.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/WRTProjectWorkspaceBridge.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/WebApplicationSourceLocator$WebApplicationSourceLookupParticipant.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/WebApplicationSourceLocator.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/WidgetLaunchDelegate$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/WidgetLaunchDelegate.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/WidgetTabSelector.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/launch/WrtLabelProvider.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/model/JsWatchExpressionDelegate$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/model/JsWatchExpressionDelegate$2.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/model/JsWatchExpressionDelegate$BadWatchExpressionResult.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/model/JsWatchExpressionDelegate$GoodWatchExpressionResult.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/model/JsWatchExpressionDelegate.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/model/ResourceManager.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/model/SymbianDebugModelPresentation.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/model/WorkspaceBreakpointHandler$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/model/WorkspaceBreakpointHandler$2.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/model/WorkspaceBreakpointHandler.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/property/LaunchableFactory.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/property/PropertyTester.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/internal/session/TerminateSession.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/ui/DebugPreferencePage$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/ui/DebugPreferencePage.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/ui/actions/DebugAction.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/ui/actions/JsBreakpointPropertiesRulerAction$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/ui/actions/JsBreakpointPropertiesRulerAction.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/ui/actions/JsBreakpointPropertiesRulerActionDelegate.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/ui/actions/WatchExpression$FindNode.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/ui/actions/WatchExpression.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/ui/launch/WidgetBasicTab$1.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/ui/launch/WidgetBasicTab.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/ui/launch/WidgetLaunchConfigurationTabGroup.class has changed
Binary file plugins/org.symbian.tools.tmw.debug/bin/org/symbian/tools/wrttools/debug/ui/launch/WidgetLaunchShortcut.class has changed
--- a/plugins/org.symbian.tools.tmw.debug/plugin.xml Thu Aug 19 17:48:04 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/plugin.xml Mon Aug 23 09:55:57 2010 -0700
@@ -4,14 +4,14 @@
<extension
point="org.eclipse.core.runtime.preferences">
<initializer
- class="org.symbian.tools.wrttools.debug.internal.PreferenceInitializer">
+ class="org.symbian.tools.tmw.debug.internal.PreferenceInitializer">
</initializer>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
<page
category="org.eclipse.debug.ui.DebugPreferencePage"
- class="org.symbian.tools.wrttools.debug.ui.DebugPreferencePage"
+ class="org.symbian.tools.tmw.debug.ui.DebugPreferencePage"
id="org.symbian.tools.wrttools.debug"
name="Tools for Mobile Web">
<keywordReference
@@ -25,7 +25,7 @@
<extension
point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
- delegate="org.symbian.tools.wrttools.debug.internal.launch.WidgetLaunchDelegate"
+ delegate="org.symbian.tools.tmw.debug.internal.launch.WidgetLaunchDelegate"
id="org.symbian.tools.wrttools.debug.widget"
modes="debug,run"
name="Mobile Web Application"
@@ -35,7 +35,7 @@
<extension
point="org.eclipse.debug.ui.launchConfigurationTabGroups">
<launchConfigurationTabGroup
- class="org.symbian.tools.wrttools.debug.ui.launch.WidgetLaunchConfigurationTabGroup"
+ class="org.symbian.tools.tmw.debug.ui.launch.WidgetLaunchConfigurationTabGroup"
description="Mobile Web Application"
id="org.symbian.tools.wrttools.debug.wrtTabGroup"
type="org.symbian.tools.wrttools.debug.widget">
@@ -52,7 +52,7 @@
<extension
point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
- class="org.symbian.tools.wrttools.debug.ui.launch.WidgetLaunchShortcut"
+ class="org.symbian.tools.tmw.debug.ui.launch.WidgetLaunchShortcut"
icon="icons/main16.gif"
id="org.symbian.tools.wrttools.debug.wrtshortcut"
label="Mobile Web Application"
@@ -91,7 +91,7 @@
<extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
- class="org.symbian.tools.wrttools.debug.internal.property.PropertyTester"
+ class="org.symbian.tools.tmw.debug.internal.property.PropertyTester"
id="org.symbian.tools.wrttools.debug.projectTester"
namespace="org.symbian"
properties="isWrtProject"
@@ -116,7 +116,7 @@
menubarPath="debug">
</action>
<action
- class="org.symbian.tools.wrttools.debug.ui.actions.JsBreakpointPropertiesRulerActionDelegate"
+ class="org.symbian.tools.tmw.debug.ui.actions.JsBreakpointPropertiesRulerActionDelegate"
id="org.symbian.tools.wrttools.debug.core.js.JavaBreakpointPropertiesRulerActionDelegate"
label="Breakpoint Properties..."
menubarPath="group.properties">
@@ -138,7 +138,7 @@
menubarPath="debug">
</action>
<action
- class="org.symbian.tools.wrttools.debug.ui.actions.JsBreakpointPropertiesRulerActionDelegate"
+ class="org.symbian.tools.tmw.debug.ui.actions.JsBreakpointPropertiesRulerActionDelegate"
id="org.symbian.tools.wrttools.debug.core.ro.JavaBreakpointPropertiesRulerActionDelegate"
label="Breakpoint Properties..."
menubarPath="group.properties">
@@ -181,7 +181,7 @@
</or>
</enablement>
<action
- class="org.symbian.tools.wrttools.debug.ui.actions.DebugAction"
+ class="org.symbian.tools.tmw.debug.ui.actions.DebugAction"
enablesFor="+"
icon="icons/debug_exc.gif"
id="org.eclipse.debug.ui.contextualLaunch.debug.submenu"
@@ -194,7 +194,7 @@
id="org.symbian.tools.wrttools.debug.core.watch"
targetID="#JavaScriptEditorContext">
<action
- class="org.symbian.tools.wrttools.debug.ui.actions.WatchExpression"
+ class="org.symbian.tools.tmw.debug.ui.actions.WatchExpression"
icon="icons/watch.gif"
id="org.symbian.tools.wrttools.debug.core.watchExpression"
label="Add to Expressions View"
@@ -206,7 +206,7 @@
point="org.eclipse.core.runtime.adapters">
<factory
adaptableType="org.eclipse.wst.jsdt.internal.ui.javaeditor.JavaEditor"
- class="org.symbian.tools.wrttools.debug.internal.BreakpointAdapterFactory">
+ class="org.symbian.tools.tmw.debug.internal.BreakpointAdapterFactory">
<adapter
type="org.eclipse.debug.ui.actions.IToggleBreakpointsTarget">
</adapter>
@@ -259,21 +259,21 @@
<extension
point="org.eclipse.debug.ui.debugModelPresentations">
<debugModelPresentation
- class="org.symbian.tools.wrttools.debug.internal.model.SymbianDebugModelPresentation"
+ class="org.symbian.tools.tmw.debug.internal.model.SymbianDebugModelPresentation"
id="org.symbian.debug">
</debugModelPresentation>
</extension>
<extension point="org.eclipse.debug.core.watchExpressionDelegates">
<watchExpressionDelegate
debugModel="org.symbian.debug"
- delegateClass="org.symbian.tools.wrttools.debug.internal.model.JsWatchExpressionDelegate"/>
+ delegateClass="org.symbian.tools.tmw.debug.internal.model.JsWatchExpressionDelegate"/>
</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"
+ class="org.symbian.tools.tmw.debug.internal.HtmlBreakpointProvider"
contentTypes="org.eclipse.wst.html.core.htmlsource"
id="org.symbian.tools.wrttools.debug.htmlbreakpoints">
</provider>
@@ -282,12 +282,12 @@
<extension
point="org.eclipse.core.runtime.adapters">
<factory
- class="org.symbian.tools.wrttools.debug.internal.property.LaunchableFactory"
+ class="org.symbian.tools.tmw.debug.internal.property.LaunchableFactory"
adaptableType="org.eclipse.wst.jsdt.core.IJavaScriptElement">
<adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
</factory>
<factory
- class="org.symbian.tools.wrttools.debug.internal.property.LaunchableFactory"
+ class="org.symbian.tools.tmw.debug.internal.property.LaunchableFactory"
adaptableType="org.eclipse.core.resources.IResource">
<adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
</factory>
@@ -299,7 +299,7 @@
id="org.symbian.tools.wrttools.debug.core.mainActions"
label="Mobile Web Debug">
<action
- class="org.symbian.tools.wrttools.debug.ui.actions.DebugAction"
+ class="org.symbian.tools.tmw.debug.ui.actions.DebugAction"
helpContextId="debug_last_action_context"
icon="icons/debug_exc.gif"
id="org.symbian.tools.wrttools.debug.core.debug"
@@ -320,7 +320,7 @@
<extension
point="org.symbian.tools.tmw.previewer.commands">
<command
- handler="org.symbian.tools.wrttools.debug.internal.session.TerminateSession"
+ handler="org.symbian.tools.tmw.debug.internal.session.TerminateSession"
name="terminateDebug">
</command>
</extension>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/Activator.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tmw.debug.internal;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+import org.symbian.tools.tmw.debug.internal.launch.ChromeInstancesManager;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.symbian.tools.wrttools.debug.core";
+
+ public static final boolean DEBUG = Platform.inDebugMode() && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debug"));
+ public static final boolean DEBUG_CONNECTION = DEBUG && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debugConnection"));
+ public static final boolean DEBUG_RESOURCES = DEBUG && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debugResources"));
+ public static final boolean DEBUG_BREAKPOINTS = DEBUG
+ && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID
+ + "/debugBreakpoints"));
+
+ // The shared instance
+ private static Activator plugin;
+
+ private final ChromeInstancesManager chromes = new ChromeInstancesManager();
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ Logger.getLogger("org.chromium.sdk").setLevel(Level.WARNING);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ chromes.shutdown();
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ public ChromeInstancesManager getChromeInstancesManager() {
+ return chromes;
+ }
+
+ public static void log(Throwable e) {
+ log(e.getLocalizedMessage(), e);
+ }
+
+ private static void log(String message, Throwable exception) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
+ }
+
+ @Override
+ protected void initializeImageRegistry(ImageRegistry reg) {
+ Images.initImageRegistry(reg);
+ }
+
+ public static void log(String message) {
+ log(message, null);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/BreakpointAdapterFactory.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tmw.debug.internal;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
+import org.eclipse.ui.IEditorPart;
+
+@SuppressWarnings("rawtypes")
+public class BreakpointAdapterFactory implements IAdapterFactory {
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof IEditorPart) {
+ IResource resource = (IResource) ((IEditorPart) adaptableObject)
+ .getEditorInput().getAdapter(IResource.class);
+ if (resource != null) {
+ return new WorkspaceLineBreakpointAdapter();
+ }
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return new Class[] { IToggleBreakpointsTarget.class };
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/ChromeDebugUtils.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tmw.debug.internal;
+
+import java.io.File;
+
+import org.symbian.tools.wrttools.util.CoreUtil;
+
+public final class ChromeDebugUtils {
+ public static String getExecutablePath(String folder) {
+ File file = new File(folder);
+ if (file.isDirectory()) {
+ File chromeExecutable = new File(file, getExecutable());
+ if (chromeExecutable.isFile()) {
+ return chromeExecutable.getAbsolutePath();
+ } else if (CoreUtil.isMac() && file.getName().equals("Google Chrome.app")) {
+ return getExecutablePath(file.getParent());
+ }
+ } else if (file.isFile()) {
+ if (file.getName().equalsIgnoreCase(getExecutable())) {
+ return file.getAbsolutePath();
+ }
+ }
+ return null;
+ }
+
+ private static String getExecutable() {
+ // Add more ifs as we add support for new platforms
+ if (CoreUtil.isMac()) {
+ return "Google Chrome.app/Contents/MacOS/Google Chrome";
+ } else if (CoreUtil.isLinux()) {
+ return "chrome";
+ } else {
+ return "chrome.exe";
+ }
+ }
+
+ private ChromeDebugUtils() {
+ // No instantiating
+ }
+
+ public static String getChromeExecutible() {
+ return getExecutablePath(Activator.getDefault().getPreferenceStore().getString(IConstants.PREF_NAME_CHROME_LOCATION));
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/HtmlBreakpointProvider.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,64 @@
+package org.symbian.tools.tmw.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;
+import org.symbian.tools.tmw.debug.internal.launch.WRTProjectWorkspaceBridge;
+
+@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);
+
+ if (hasScript) {
+ ChromiumLineBreakpoint breakpoint = new ChromiumLineBreakpoint(getResource(input), lineNumber,
+ WRTProjectWorkspaceBridge.DEBUG_MODEL_ID);
+ 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
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/IConstants.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tmw.debug.internal;
+
+public interface IConstants {
+ String PREF_NAME_CHROME_LOCATION="chrome.location";
+ String PROP_PROJECT_NAME = "projectName";
+ String PREF_SHOW_RESOURCE_CHANGE_ERROR = "show.resourceChange.warning";
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/Images.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tmw.debug.internal;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+
+public class Images {
+ private static final String WRT16 = "main16.gif";
+
+ public static void initImageRegistry(ImageRegistry registry) {
+ setImage(registry, WRT16);
+ }
+
+ private static void setImage(ImageRegistry registry, String image) {
+ ImageDescriptor img = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/" + image);
+ registry.put(image, img);
+ }
+
+ public static ImageDescriptor getWrtIcon() {
+ return getImageDescriptor(WRT16);
+ }
+
+ private static ImageDescriptor getImageDescriptor(String image) {
+ return Activator.getDefault().getImageRegistry().getDescriptor(image);
+ }
+
+ public static Image getWrtIconImage() {
+ return getImage(WRT16);
+ }
+
+ private static Image getImage(String image) {
+ return Activator.getDefault().getImageRegistry().get(image);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/PreferenceInitializer.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tmw.debug.internal;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.symbian.tools.wrttools.util.CoreUtil;
+
+public class PreferenceInitializer extends AbstractPreferenceInitializer {
+ private final static String DEFAULT_CHROME_LOCATION = "Local Settings/Application Data/Google/Chrome/Application";
+
+ @Override
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ File folder = getDefaultFolder();
+ if (ChromeDebugUtils.getExecutablePath(folder.getAbsolutePath()) != null) {
+ store.setDefault(IConstants.PREF_NAME_CHROME_LOCATION, folder
+ .getAbsolutePath());
+ }
+ }
+
+ private File getDefaultFolder() {
+ if (CoreUtil.isMac()) {
+ return new File("/Applications");
+ } else if (CoreUtil.isLinux()) {
+ return new File("/opt/google/chrome");
+ }
+ String property = System.getProperty("user.home");
+ File folder = new File(property, DEFAULT_CHROME_LOCATION);
+ if (!folder.exists()) {
+ folder = new File("C:/Program Files/Google/Chrome/Application/");
+ }
+ return folder;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/WorkspaceLineBreakpointAdapter.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tmw.debug.internal;
+
+import org.chromium.debug.core.model.LineBreakpointAdapter;
+import org.chromium.debug.core.model.VProjectWorkspaceBridge;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.wst.jsdt.internal.ui.javaeditor.JavaEditor;
+
+@SuppressWarnings("restriction")
+public class WorkspaceLineBreakpointAdapter extends LineBreakpointAdapter {
+ @Override
+ protected ITextEditor getEditor(IWorkbenchPart part) {
+ if (part instanceof JavaEditor) {
+ return (ITextEditor) part;
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ protected String getDebugModelId() {
+ return VProjectWorkspaceBridge.DEBUG_MODEL_ID;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/ChromeInstancesManager.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tmw.debug.internal.launch;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.symbian.tools.tmw.debug.internal.Activator;
+import org.symbian.tools.tmw.debug.internal.ChromeDebugUtils;
+import org.symbian.tools.wrttools.util.CoreUtil;
+
+public class ChromeInstancesManager {
+ private static final String[] CHROME_ARGS = { "%s", "--remote-shell-port=%d", // Here we will set port
+ "--user-data-dir=%s", // Here we will set profile folder so user settings have no effect
+ "--disk-cache-dir=%s", // We don't care
+ "--disable-web-security", // Widgets can use network now
+ "--disable-extenions", // Use standard UI, should also improve speed and stability
+ "--activate-on-launch", // Bring to front on Mac
+ "--disable-geolocation", // Use our own Geolocation (needed to emulate Geolocation in phonegap)
+ "--disable-local-storage", // Disable local storage (needed to emulate Geolocation in phonegap)
+ "--disable-session-storage", // Disable local storage (needed to emulate Geolocation in phonegap)
+ "--no-default-browser-check", // Our users don't need this nagging
+ "--disable-hang-monitor", // Fix for Bug 2682 - The debugger should disable "unresponsive" error message from chrome
+ "--no-first-run", // We don't care
+ "--app=%s" // Here we will have widget URI as --app argument
+ };
+ private final Map<Object, Process> chromes = Collections.synchronizedMap(new HashMap<Object, Process>());
+
+ private static final int EXECUTIBLE_INDEX = 0;
+ private static final int PORT_INDEX = 1;
+ private static final int USER_DATA_INDEX = 2;
+ private static final int CACHE_INDEX = 3;
+ private static final int URL_INDEX = CHROME_ARGS.length - 1;
+
+ private int profileNum = 0;
+
+ public void startChrome(final Object key, int port, final String url) throws CoreException {
+ final String browserExecutable = ChromeDebugUtils.getChromeExecutible();
+ if (browserExecutable == null) {
+ throw createCoreException("No Chrome browser available", null);
+ }
+
+ String[] commandline = new String[CHROME_ARGS.length];
+ System.arraycopy(CHROME_ARGS, 0, commandline, 0, CHROME_ARGS.length);
+ commandline[EXECUTIBLE_INDEX] = String.format(CHROME_ARGS[EXECUTIBLE_INDEX], browserExecutable);
+ commandline[PORT_INDEX] = String.format(CHROME_ARGS[PORT_INDEX], port);
+ commandline[USER_DATA_INDEX] = String.format(CHROME_ARGS[USER_DATA_INDEX], getChromeProfilePath());
+ commandline[CACHE_INDEX] = String.format(CHROME_ARGS[CACHE_INDEX], getChromeCachePath());
+ commandline[URL_INDEX] = String.format(CHROME_ARGS[URL_INDEX], url);
+
+ // 2. Start Chrome
+ try {
+ Process process = Runtime.getRuntime().exec(commandline);
+ chromes.put(key, process);
+ } catch (IOException e) {
+ StringBuilder builder = new StringBuilder();
+ for (String string : commandline) {
+ builder.append(" ").append(string);
+ }
+ throw createCoreException("Cannot execute: {0}", builder.toString().trim(), e);
+ }
+
+ }
+
+ private String getChromeCachePath() {
+ return getChromeSpecialDir(".chromecache");
+ }
+
+ /**
+ * Terminate Chrome instance associated with given key.
+ */
+ public synchronized void stopChrome(final Object key) {
+
+ }
+
+ public synchronized void forgetChrome(final Object key) {
+
+ }
+
+ public synchronized void shutdown() {
+ String dir = getChromeSpecialDir("");
+ File directory = new File(dir);
+ File[] files = directory.listFiles(new FileFilter() {
+ public boolean accept(File pathname) {
+ return pathname.isDirectory() && pathname.getName().matches("\\.chr\\d{3}")
+ && !isChromeRunning(pathname);
+ }
+ });
+ boolean removedAll = true;
+ for (File file : files) {
+ removedAll = delete(file) && removedAll;
+ }
+ if (removedAll) {
+ String cachePath = getChromeCachePath();
+ delete(new File(cachePath));
+ }
+
+ }
+
+ private boolean delete(File file) {
+ if (!file.exists()) {
+ return true;
+ } else if (file.isDirectory()) {
+ File[] files = file.listFiles();
+ for (File f : files) {
+ if (!delete(f)) {
+ return false;
+ }
+ }
+ }
+ return file.delete();
+ }
+
+ private CoreException createCoreException(String pattern, String arg, Throwable exeption) {
+ return createCoreException(MessageFormat.format(pattern, arg), exeption);
+ }
+
+ private CoreException createCoreException(String message, Throwable exeption) {
+ return new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, message, exeption));
+ }
+
+ private String getChromeProfilePath() {
+ while (true) {
+ String dir = getChromeSpecialDir(String.format(".chr%03d", profileNum++));
+ if (!new File(dir).exists()) {
+ return dir;
+ }
+ }
+ }
+
+ private boolean isChromeRunning(File pathname) {
+ File file = new File(pathname, "Default/Cookies");
+ try {
+ // Note: it is ok to delete cookies file - if it can be deleted then Chrome is not running.
+ // If Chrome is running then we will not be able to delete the file.
+ // We do not need to preserve state between launches. So it is ok to delete coockies.
+ return file.exists() && !file.delete();
+ } catch (Exception e) {
+ Activator.log(e);
+ return true;
+ }
+ }
+
+ private String getChromeSpecialDir(String subdir) {
+ IPath location = ResourcesPlugin.getWorkspace().getRoot().getLocation();
+ if (CoreUtil.isLinux() && location.toString().length() > 50) {
+ location = new Path(System.getProperty("user.home")).append(".wrtdebug");
+ }
+ return location.append(subdir).toOSString();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/DebugConnectionJob.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tmw.debug.internal.launch;
+
+import java.net.URI;
+
+import org.chromium.debug.core.model.DebugTargetImpl;
+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.sdk.ConnectionLogger;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.symbian.tools.tmw.debug.internal.Activator;
+import org.symbian.tools.tmw.previewer.http.IPreviewStartupListener;
+
+public class DebugConnectionJob implements IPreviewStartupListener {
+ static final NamedConnectionLoggerFactory NO_CONNECTION_LOGGER_FACTORY = new NamedConnectionLoggerFactory() {
+ public ConnectionLogger createLogger(String title) {
+ return null;
+ }
+ };
+ private final int port;
+ private final ILaunch launch;
+ private final IProject project;
+
+ public DebugConnectionJob(IProject project, final int port,
+ final ILaunch launch) {
+ if (Activator.DEBUG_CONNECTION) {
+ System.out.println("Debugging " + project.getName() + " on port "
+ + port + ", launch: " + launch.getLaunchConfiguration());
+ }
+ this.project = project;
+ this.port = port;
+ this.launch = launch;
+ }
+
+ protected ConnectionToRemote createConnectionToRemote(int port,
+ ILaunch launch, URI uri) throws CoreException {
+ return JavascriptVmEmbedderFactory.connectToChromeDevTools(port,
+ NO_CONNECTION_LOGGER_FACTORY, new WidgetTabSelector(uri));
+ }
+
+ private static void terminateTarget(DebugTargetImpl target) {
+ target.setDisconnected(true);
+ target.fireTerminateEvent();
+ }
+
+ public boolean browserRunning(URI uri, String sId) throws CoreException {
+ if (Activator.DEBUG_CONNECTION) {
+ System.out.println("Browser running, connecting @" + hashCode());
+ }
+ DestructingGuard destructingGuard = new DestructingGuard();
+ try {
+ JavascriptVmEmbedder.ConnectionToRemote remoteServer = createConnectionToRemote(
+ port, launch, uri);
+ Destructable lauchDestructor = new Destructable() {
+ public void destruct() {
+ if (!launch.hasChildren()) {
+ DebugPlugin.getDefault().getLaunchManager()
+ .removeLaunch(launch);
+ }
+ }
+ };
+ if (Activator.DEBUG_CONNECTION) {
+ System.out.println("Setting up 1@" + hashCode());
+ }
+ destructingGuard.addValue(lauchDestructor);
+
+ WorkspaceBridge.Factory bridgeFactory = new WRTProjectWorkspaceBridge.Factory(
+ project);
+ final DebugTargetImpl target = new DebugTargetImpl(launch,
+ bridgeFactory);
+ if (Activator.DEBUG_CONNECTION) {
+ System.out.println("Setting up 2@" + hashCode());
+ }
+
+ Destructable targetDestructor = new Destructable() {
+ public void destruct() {
+ terminateTarget(target);
+ }
+ };
+ destructingGuard.addValue(targetDestructor);
+
+ if (Activator.DEBUG_CONNECTION) {
+ System.out.println("Setting up 3@" + hashCode());
+ }
+ boolean attached = target.attach(remoteServer, destructingGuard,
+ null, new NullProgressMonitor());
+ if (Activator.DEBUG_CONNECTION) {
+ System.out.printf("Is attached: %b, @%d\n", attached, hashCode());
+ }
+ if (!attached) {
+ // Error
+ return false;
+ }
+
+ launch.addDebugTarget(target);
+ launch.setAttribute("http.service.id", sId);
+ // All OK
+ destructingGuard.discharge();
+ addResourceListenerIfNotInstalled();
+ } catch (CoreException e) {
+ DebugPlugin.getDefault().getLaunchManager().removeLaunch(launch);
+ throw e;
+ } finally {
+ destructingGuard.doFinally();
+ }
+ return true;
+ }
+
+ private static boolean listenerAdded = false;
+
+ private void addResourceListenerIfNotInstalled() {
+ synchronized (DebugConnectionJob.class) {
+ if (!listenerAdded) {
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(new ResourcesChangeListener());
+ listenerAdded = true;
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/DebugUtil.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,89 @@
+/**
+ * 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.tmw.debug.internal.launch;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+import org.symbian.tools.tmw.debug.internal.Activator;
+import org.symbian.tools.tmw.debug.internal.IConstants;
+
+public class DebugUtil {
+ public static CoreException createCoreException(String message, Throwable exeption) {
+ return new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, message, exeption));
+ }
+
+ public static IProject getProject(ILaunch configuration) {
+ try {
+ if (WidgetLaunchDelegate.ID.equals(configuration.getLaunchConfiguration().getType().getIdentifier())) {
+ String projectName = configuration.getLaunchConfiguration().getAttribute(IConstants.PROP_PROJECT_NAME,
+ (String) null);
+ if (projectName != null) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (project.isAccessible()) {
+ return project;
+ }
+ }
+ }
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ return null;
+ }
+
+ public static IProject getProject(ILaunchConfiguration configuration) throws CoreException {
+ if (!WidgetLaunchDelegate.ID.equals(configuration.getType().getIdentifier())) {
+ return null;
+ }
+ String projectName = configuration.getAttribute(IConstants.PROP_PROJECT_NAME, (String) null);
+ if (projectName == null) {
+ throw createCoreException("Project is not selected", null);
+ }
+
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (!project.isAccessible()) {
+ throw createCoreException(MessageFormat.format("Project {0} is not opened", projectName), null);
+ }
+ return project;
+ }
+
+ public static boolean isProjectDebugged(IProject project, ILaunchManager launchManager, ILaunch l)
+ throws CoreException {
+ ILaunch[] launches = launchManager.getLaunches();
+ for (ILaunch launch : launches) {
+ ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration();
+ if ((l == null || !l.equals(launch)) && !launch.isTerminated()
+ && WidgetLaunchDelegate.ID.equals(launchConfiguration.getType().getIdentifier())) {
+ IProject p2 = getProject(launchConfiguration);
+ if (project.equals(p2)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/PortPolicy.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tmw.debug.internal.launch;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+
+import org.symbian.tools.tmw.debug.internal.Activator;
+
+public abstract class PortPolicy {
+ // private static class ReuseSamePort extends PortPolicy {
+ // private int port = -1;
+ //
+ // @Override
+ // protected int getPort() {
+ // if (port < 0) {
+ // port = getOpenPort();
+ // }
+ // return port;
+ // }
+ // }
+
+ private static class NewPortEachTime extends PortPolicy {
+ @Override
+ protected int getPort() {
+ return getOpenPort();
+ }
+ }
+
+ public static final PortPolicy INSTANCE;
+ static {
+ // if (CoreUtil.isMac()) {
+ INSTANCE = new NewPortEachTime();
+ // } else {
+ // INSTANCE = new ReuseSamePort();
+ // }
+ }
+
+ public static synchronized int getPortNumber() {
+ return INSTANCE.getPort();
+ }
+
+ public int getOpenPort() {
+ try {
+ final ServerSocket socket = new ServerSocket(0);
+ int port = socket.getLocalPort();
+ socket.close();
+ return port;
+ } catch (IOException e) {
+ Activator.log(e);
+ return 7222;
+ }
+ }
+
+ protected abstract int getPort();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/ResourcesChangeListener.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,234 @@
+/**
+ * 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.tmw.debug.internal.launch;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.ResourcesPlugin;
+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.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.symbian.tools.tmw.debug.internal.Activator;
+import org.symbian.tools.tmw.debug.internal.IConstants;
+import org.symbian.tools.tmw.previewer.internal.PreviewerUtil;
+
+public class ResourcesChangeListener implements IResourceChangeListener {
+ public void resourceChanged(IResourceChangeEvent event) {
+ if (event.getDelta() != null
+ && !MessageDialogWithToggle.ALWAYS.equals(Activator.getDefault().getPreferenceStore().getString(
+ IConstants.PREF_SHOW_RESOURCE_CHANGE_ERROR))) {
+ IFile[] changes = PreviewerUtil.getWebChanges(event.getDelta());
+ if (changes.length > 0 && isWrtResourceChanges(changes)) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ String message = "Debug browser is not updated when the files are updated. You may notice discrepancies between your workspace contents and debug session. You should either refresh the browser or restart debugging session to see the latest changes made to the workspace.";
+ MessageDialogWithToggle.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell(), "Mobile Web Debugger", message,
+ "Do not show this warning on code changes", false, Activator.getDefault()
+ .getPreferenceStore(), IConstants.PREF_SHOW_RESOURCE_CHANGE_ERROR);
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(ResourcesChangeListener.this);
+ }
+ });
+ }
+ }
+ }
+
+ private boolean isWrtResourceChanges(IFile[] changes) {
+ Collection<IProject> projects = new HashSet<IProject>();
+ ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
+ for (ILaunch launch : launches) {
+ if (!launch.isTerminated()) {
+ final ILaunchConfiguration config = launch.getLaunchConfiguration();
+ try {
+ if (WidgetLaunchDelegate.ID.equals(config.getType().getIdentifier())) {
+ String projectName = config.getAttribute(IConstants.PROP_PROJECT_NAME, (String) null);
+ if (projectName != null && projectName.trim().length() > 0) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ projects.add(project);
+ }
+ }
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ }
+ }
+ for (IFile file : changes) {
+ if (projects.contains(file.getProject())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // // TODO Progress indicator - ... files updated of ...
+ //
+ // public void resourceChanged(IResourceChangeEvent event) {
+ // try {
+ // if (event.getDelta() != null) {
+ //
+ // processDelta(event.getDelta());
+ // } else {
+ // // TODO Can't refresh
+ // }
+ // } catch (CoreException e) {
+ // Activator.log(e);
+ // }
+ //
+ // }
+ //
+ // private static final class DeltaProcessor implements IResourceDeltaVisitor {
+ // private final Map<IProject, DebugTargetImpl> targets;
+ // private final Map<IFile, Script> updateList = new HashMap<IFile, Script>();
+ // private boolean hasUnupdatables = false;
+ //
+ // public DeltaProcessor(Map<IProject, DebugTargetImpl> targets) {
+ // this.targets = targets;
+ // }
+ //
+ // public boolean visit(IResourceDelta delta) throws CoreException {
+ // final IResource resource = delta.getResource();
+ // switch (resource.getType()) {
+ // case IResource.PROJECT:
+ // return targets.containsKey(resource);
+ // case IResource.FILE:
+ // processFile((IFile) resource, targets.get(resource.getProject()));
+ // return false;
+ // default:
+ // return true;
+ // }
+ // }
+ //
+ // private void processFile(final IFile resource, final DebugTargetImpl debugTargetImpl) throws CoreException {
+ // if (!ProjectUtils.isExcluded(resource)) {
+ // final VmResource vmResource = debugTargetImpl.getVmResource(resource);
+ // if (vmResource != null) {
+ // updateList.put(resource, vmResource.getScript());
+ // } else {
+ // if (!JavaScriptCore.isJavaScriptLikeFileName(resource.getName())) {
+ // hasUnupdatables = true;
+ // }
+ // }
+ // }
+ // }
+ //
+ // public Map<IFile, Script> getUpdateList() {
+ // return updateList;
+ // }
+ //
+ // public boolean hasUnupdatables() {
+ // return hasUnupdatables;
+ // }
+ // }
+ //
+ // private void processDelta(final IResourceDelta delta) throws CoreException {
+ // final ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
+ // final Map<IProject, DebugTargetImpl> targets = new HashMap<IProject, DebugTargetImpl>();
+ // for (ILaunch launch : launches) {
+ // final IDebugTarget target = launch.getDebugTarget();
+ // if (!launch.isTerminated() && target instanceof DebugTargetImpl) {
+ // IProject project = DebugUtil.getProject(launch);
+ // if (project != null) {
+ // targets.put(project, (DebugTargetImpl) target);
+ // }
+ // }
+ // }
+ //
+ // DeltaProcessor processor = new DeltaProcessor(targets);
+ // delta.accept(processor);
+ //
+ // if (processor.getUpdateList().size() > 0) {
+ // final Collection<IStatus> statuses = new LinkedList<IStatus>();
+ // for (Entry<IFile, Script> entry : processor.getUpdateList().entrySet()) {
+ // statuses.add(updateScript(entry.getValue(), entry.getKey()));
+ // }
+ // } else if (processor.hasUnupdatables()) {
+ //
+ // }
+ // }
+ //
+ // private IStatus updateScript(Script script, final IFile file) {
+ // UpdatableScript updatableScript = LiveEditExtension.castToUpdatableScript(script);
+ //
+ // if (updatableScript == null) {
+ // throw new RuntimeException();
+ // }
+ //
+ // byte[] fileData;
+ // try {
+ // fileData = readFileContents(file);
+ // } catch (IOException e) {
+ // throw new RuntimeException(e);
+ // } catch (CoreException e) {
+ // throw new RuntimeException(e);
+ // }
+ // final IStatus[] res = new IStatus[1];
+ // // We are using default charset here like usually.
+ // String newSource = new String(fileData);
+ //
+ // UpdatableScript.UpdateCallback callback = new UpdatableScript.UpdateCallback() {
+ // public void success(Object report) {
+ // res[0] = new Status(
+ // IStatus.OK,
+ // ChromiumDebugPlugin.PLUGIN_ID,
+ // String.format(
+ // "Script %s was successfully updated on remote: %s", file.getProjectRelativePath().toString(), report)); //$NON-NLS-1$
+ // }
+ //
+ // public void failure(String message) {
+ // res[0] = new Status(IStatus.ERROR, ChromiumDebugPlugin.PLUGIN_ID, String.format(
+ // "Script %s cannot be updated: %s", file.getProjectRelativePath().toString(), message)); //$NON-NLS-1$
+ // }
+ // };
+ //
+ // updatableScript.setSourceOnRemote(newSource, callback, null);
+ // return res[0];
+ // }
+ //
+ // private static byte[] readFileContents(IFile file) throws IOException, CoreException {
+ // InputStream inputStream = file.getContents();
+ // try {
+ // return readBytes(inputStream);
+ // } finally {
+ // inputStream.close();
+ // }
+ // }
+ //
+ // private static byte[] readBytes(InputStream inputStream) throws IOException {
+ // ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ // byte[] array = new byte[1024];
+ // while (true) {
+ // int len = inputStream.read(array);
+ // if (len == -1) {
+ // break;
+ // }
+ // buffer.write(array, 0, len);
+ // }
+ // return buffer.toByteArray();
+ // }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/WRTProjectWorkspaceBridge.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,185 @@
+package org.symbian.tools.tmw.debug.internal.launch;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.chromium.debug.core.model.BreakpointSynchronizer.Callback;
+import org.chromium.debug.core.model.BreakpointSynchronizer.Direction;
+import org.chromium.debug.core.model.ChromiumLineBreakpoint;
+import org.chromium.debug.core.model.DebugTargetImpl;
+import org.chromium.debug.core.model.VmResource;
+import org.chromium.debug.core.model.VmResourceId;
+import org.chromium.debug.core.model.WorkspaceBridge;
+import org.chromium.sdk.CallFrame;
+import org.chromium.sdk.JavascriptVm;
+import org.chromium.sdk.JavascriptVm.ScriptsCallback;
+import org.chromium.sdk.Script;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
+import org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer;
+import org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer;
+import org.symbian.tools.tmw.debug.internal.Activator;
+import org.symbian.tools.tmw.debug.internal.model.ResourceManager;
+import org.symbian.tools.tmw.debug.internal.model.WorkspaceBreakpointHandler;
+
+public class WRTProjectWorkspaceBridge implements WorkspaceBridge {
+ public static final class Factory implements WorkspaceBridge.Factory {
+ private final IProject project;
+
+ public Factory(IProject project) {
+ this.project = project;
+ }
+
+ public WorkspaceBridge attachedToVm(DebugTargetImpl debugTargetImpl, JavascriptVm javascriptVm) {
+ return new WRTProjectWorkspaceBridge(debugTargetImpl, javascriptVm, project);
+ }
+
+ public String getDebugModelIdentifier() {
+ return DEBUG_MODEL_ID;
+ }
+
+ public JsLabelProvider getLabelProvider() {
+ return new WrtLabelProvider();
+ }
+ }
+
+ public final static String DEBUG_MODEL_ID = "org.symbian.debug";
+
+ private final BreakpointHandler breakpointHandler;
+ private final JavascriptVm javascriptVm;
+ private final IProject project;
+ private final ResourceManager resourceManager;
+
+ public WRTProjectWorkspaceBridge(DebugTargetImpl debugTargetImpl, JavascriptVm javascriptVm, IProject project) {
+ this.javascriptVm = javascriptVm;
+ this.project = project;
+ this.resourceManager = new ResourceManager();
+ this.sourceLocator = new WebApplicationSourceLocator(resourceManager);
+ breakpointHandler = new WorkspaceBreakpointHandler(debugTargetImpl, resourceManager);
+ ILaunch launch = debugTargetImpl.getLaunch();
+ try {
+ sourceLocator.initializeDefaults(launch.getLaunchConfiguration());
+ sourceLocator.setSourceContainers(new ISourceContainer[] { new ProjectSourceContainer(project, false),
+ new DirectorySourceContainer(Activator.getDefault().getStateLocation(), true) });
+ } catch (CoreException e) {
+ throw new RuntimeException(e);
+ }
+ launch.setSourceLocator(sourceLocator);
+ }
+
+ public void beforeDetach() {
+ // Do nothing
+ }
+
+ public BreakpointHandler getBreakpointHandler() {
+ return breakpointHandler;
+ }
+
+ public void handleVmResetEvent() {
+ resourceManager.clear();
+ }
+
+ public void launchRemoved() {
+ // Do nothing
+ }
+
+ public void reloadScriptsAtStart() {
+ javascriptVm.getScripts(new ScriptsCallback() {
+ public void failure(String errorMessage) {
+ Activator.log(errorMessage);
+ }
+
+ public void success(Collection<Script> scripts) {
+ if (!javascriptVm.isAttached()) {
+ return;
+ }
+ for (Script script : scripts) {
+ resourceManager.addScript(script);
+ }
+
+ IMarker[] markers;
+ try {
+ markers = project.findMarkers(ChromiumLineBreakpoint.BREAKPOINT_MARKER, true,
+ IResource.DEPTH_INFINITE);
+ Collection<ChromiumLineBreakpoint> breakpoints = new ArrayList<ChromiumLineBreakpoint>(
+ markers.length);
+ for (IMarker marker : markers) {
+ // If it is not ChromiumLineBreakpoint -
+ // something's gone horribly wrong. Better get
+ // ClassCastException
+ ChromiumLineBreakpoint breakpoint = (ChromiumLineBreakpoint) DebugPlugin.getDefault()
+ .getBreakpointManager().getBreakpoint(marker);
+ breakpointHandler.breakpointAdded(breakpoint);
+ breakpoints.add(breakpoint);
+ }
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+
+ }
+ });
+ }
+
+ public void scriptLoaded(Script newScript) {
+ 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;
+ }
+
+ private final ISourceLookupDirector sourceLocator;
+
+ public VmResource findVmResourceFromWorkspaceFile(IFile file) throws CoreException {
+ return new VmResourceImpl(resourceManager.findVmResource(file), resourceManager.getScript(file), file.getName());
+ }
+
+ private static final class VmResourceImpl implements VmResource {
+ private final String name;
+ private final Script script;
+ private final VmResourceId id;
+
+ public VmResourceImpl(VmResourceId id, Script script, String name) {
+ super();
+ this.id = id;
+ this.script = script;
+ this.name = name;
+ }
+
+ public VmResourceId getId() {
+ return id;
+ }
+
+ public Script getScript() {
+ return script;
+ }
+
+ public String getFileName() {
+ return name;
+ }
+
+ }
+
+ public void reloadScript(Script script) {
+ System.out.println(script);
+
+ }
+
+ public void synchronizeBreakpoints(Direction direction, Callback callback) {
+ System.out.println(direction);
+
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/WebApplicationSourceLocator.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,147 @@
+/**
+ * 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.tmw.debug.internal.launch;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.chromium.debug.core.model.StackFrame;
+import org.chromium.sdk.Script;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.model.ISourceLocator;
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
+import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
+import org.symbian.tools.tmw.debug.internal.Activator;
+import org.symbian.tools.tmw.debug.internal.model.ResourceManager;
+import org.symbian.tools.tmw.previewer.PreviewerPlugin;
+import org.symbian.tools.tmw.previewer.http.WebappManager;
+
+public final class WebApplicationSourceLocator extends AbstractSourceLookupDirector implements ISourceLocator,
+ ISourceLookupDirector {
+ public static final class WebApplicationSourceLookupParticipant extends AbstractSourceLookupParticipant {
+ private final ResourceManager resourceManager;
+ private final WebApplicationSourceLocator locator;
+
+ public WebApplicationSourceLookupParticipant(WebApplicationSourceLocator locator,
+ ResourceManager resourceManager) {
+ this.locator = locator;
+ this.resourceManager = resourceManager;
+ }
+
+ public String getSourceName(Object object) throws CoreException {
+ Script script = null;
+ if (object instanceof StackFrame) {
+ script = ((StackFrame) object).getCallFrame().getScript();
+ } else if (object instanceof Script) {
+ script = (Script) object;
+ } else {
+ System.out.println("Source lookup request for " + object.getClass());
+ }
+ if (script != null) {
+ IFile resource = resourceManager.getResource(script);
+ if (resource != null) {
+ return resource.getProjectRelativePath().toString();
+ } else {
+ return locator.fileUrl(script);
+ }
+ }
+ return null;
+ }
+ }
+
+ private final ResourceManager resourceManager;
+
+ public WebApplicationSourceLocator(ResourceManager resourceManager) {
+ this.resourceManager = resourceManager;
+ }
+
+ public String fileUrl(Script script) throws CoreException {
+ String name = script.getName();
+ try {
+ URI uri = new URI(name);
+ if ("http".equals(uri.getScheme()) && WebappManager.getHost().equals(uri.getHost())
+ && WebappManager.getPort() == uri.getPort()) {
+ final IPath stateLocation = Activator.getDefault().getStateLocation();
+ final IPath path = stateLocation.append("systemlibraries")
+ .append(new Path(uri.getPath()).lastSegment());
+ final File file = path.toFile();
+ file.getParentFile().mkdirs();
+ final String source = script.getSource();
+ final BufferedWriter writer = new BufferedWriter(new FileWriter(file));
+ try {
+ writer.write(source);
+ } finally {
+ writer.close();
+ }
+ return new Path(file.getParentFile().getName()).append(file.getName()).toString();
+ }
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ } catch (IOException e) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ "Cannot load web runtime system libraries", e));
+ }
+ return null;
+ }
+
+ public Object getSourceElement(IStackFrame stackFrame) {
+ if (stackFrame instanceof StackFrame == false) {
+ return null;
+ }
+ StackFrame jsStackFrame = (StackFrame) stackFrame;
+
+ Script script = jsStackFrame.getCallFrame().getScript();
+ if (script == null) {
+ return null;
+ }
+
+ IFile resource = resourceManager.getResource(script);
+ if (resource != null) {
+ return resource;
+ } else {
+ File file = PreviewerPlugin.getDefault().getHttpPreviewer().getLocalFile(script.getName());
+ if (file != null) {
+ try {
+ return EFS.getStore(file.toURI());
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ }
+ }
+ return null;
+ }
+
+ public void initializeParticipants() {
+ addParticipants(new ISourceLookupParticipant[] { new WebApplicationSourceLookupParticipant(this,
+ resourceManager) });
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/WidgetLaunchDelegate.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tmw.debug.internal.launch;
+
+import java.net.URI;
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+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.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.symbian.tools.tmw.debug.internal.Activator;
+import org.symbian.tools.tmw.previewer.PreviewerPlugin;
+
+public class WidgetLaunchDelegate implements ILaunchConfigurationDelegate {
+ public static final String ID = "org.symbian.tools.wrttools.debug.widget";
+
+ public void launch(ILaunchConfiguration configuration, String mode, final ILaunch launch, IProgressMonitor monitor)
+ throws CoreException {
+ monitor.beginTask("Preparing Mobile Web Debugger", IProgressMonitor.UNKNOWN);
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ final IWorkbenchWindow window = workbench.getWorkbenchWindows()[0];
+ final boolean[] retvalue = new boolean[1];
+ window.getShell().getDisplay().syncExec(new Runnable() {
+ public void run() {
+ retvalue[0] = workbench.saveAllEditors(true);
+ }
+ });
+ if (!retvalue[0]) {
+ launchManager.removeLaunch(launch);
+ return;
+ }
+ boolean debug = mode.equals(ILaunchManager.DEBUG_MODE);
+ try {
+ // 1. Load all parameters
+ IProject project = DebugUtil.getProject(configuration);
+ if (DebugUtil.isProjectDebugged(project, launchManager, launch)) {
+ throw DebugUtil.createCoreException(MessageFormat.format("Project {0} is already running.", project.getName()),
+ null);
+ }
+
+ int port = PortPolicy.getPortNumber();
+ final URI uri = prepareDebugger(project, debug, launch, port);
+
+ Activator.getDefault().getChromeInstancesManager().startChrome(launch, port, uri.toASCIIString());
+ } catch (CoreException e) {
+ launchManager.removeLaunch(launch);
+ throw e;
+ }
+ if (!debug) {
+ launchManager.removeLaunch(launch);
+ }
+ monitor.done();
+ }
+
+ private URI prepareDebugger(IProject project, boolean debug, final ILaunch launch, final int port) {
+ DebugConnectionJob job = null;
+ if (debug) {
+ job = new DebugConnectionJob(project, port, launch);
+ }
+ return PreviewerPlugin.getDefault().getHttpPreviewer().previewProject(project, job);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/WidgetTabSelector.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tmw.debug.internal.launch;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import org.chromium.debug.core.model.TabSelector;
+import org.chromium.sdk.Browser.TabConnector;
+import org.chromium.sdk.Browser.TabFetcher;
+
+public class WidgetTabSelector implements TabSelector {
+ private final URI uri;
+ private TabConnector connector;
+
+ public WidgetTabSelector(URI uri) {
+ this.uri = uri;
+ }
+
+ public TabConnector selectTab(TabFetcher tabFetcher) throws IOException {
+ // Give it time to start the process/tab. 5 retries, 500 ms inbetween.
+ for (int i = 0; i < 5; i++) {
+ List<? extends TabConnector> tabs = tabFetcher.getTabs();
+ for (TabConnector tabConnector : tabs) {
+ String url = tabConnector.getUrl();
+ try {
+ if (uri.toURL().equals(new URL(url))) {
+ connector = tabConnector;
+ return tabConnector;
+ }
+ } catch (MalformedURLException e) {
+ // Ignore - fails because of "chrome" protocol, we should ignore these tabs anyways
+ }
+ }
+ }
+ return null;
+ }
+
+ public TabConnector getConnector() {
+ return connector;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/WrtLabelProvider.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,64 @@
+package org.symbian.tools.tmw.debug.internal.launch;
+
+import org.chromium.debug.core.model.DebugTargetImpl;
+import org.chromium.debug.core.model.JavascriptThread;
+import org.chromium.debug.core.model.Messages;
+import org.chromium.debug.core.model.StackFrame;
+import org.chromium.debug.core.model.WorkspaceBridge.JsLabelProvider;
+import org.chromium.sdk.CallFrame;
+import org.chromium.sdk.DebugContext;
+import org.chromium.sdk.ExceptionData;
+import org.chromium.sdk.Script;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.osgi.util.NLS;
+
+public class WrtLabelProvider implements JsLabelProvider {
+
+ public String getStackFrameLabel(StackFrame stackFrame) throws DebugException {
+ CallFrame callFrame = stackFrame.getCallFrame();
+ String name = callFrame.getFunctionName();
+ Script script = callFrame.getScript();
+ if (script == null) {
+ return "<unknown>";
+ }
+ Object element = stackFrame.getLaunch().getSourceLocator().getSourceElement(stackFrame);
+ if (element instanceof IFile) {
+ IFile resource = (IFile) element;
+ int line = script.getStartLine() + stackFrame.getLineNumber();
+ if (line != -1) {
+ String resourcePath = resource != null ? resource.getProjectRelativePath().toString() : script
+ .getName();
+ name = NLS.bind("{0} [{1}:{2}]", new Object[] { name, resourcePath, line });
+ }
+ } else if (element instanceof IFileStore) {
+ return "(WRT System Library)";
+ }
+ return name;
+ }
+
+ public String getTargetLabel(DebugTargetImpl debugTarget) throws DebugException {
+ return "WRT Runtime";
+ }
+
+ public String getThreadLabel(JavascriptThread thread) throws DebugException {
+ return NLS.bind("JavaScript Thread ({0})", getThreadStateLabel(thread));
+ }
+
+ private String getThreadStateLabel(JavascriptThread thread) {
+ if (thread.isSuspended()) {
+ DebugContext context = thread.getDebugTarget().getDebugContext();
+ ExceptionData exceptionData = context.getExceptionData();
+ if (exceptionData != null) {
+ return NLS.bind(Messages.JsThread_ThreadLabelSuspendedExceptionFormat,
+ exceptionData.getExceptionMessage());
+ } else {
+ return Messages.JsThread_ThreadLabelSuspended;
+ }
+ } else {
+ return Messages.JsThread_ThreadLabelRunning;
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/model/JsWatchExpressionDelegate.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,170 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.symbian.tools.tmw.debug.internal.model;
+
+import org.chromium.debug.core.model.DebugElementImpl;
+import org.chromium.debug.core.model.EvaluateContext;
+import org.chromium.debug.core.model.Variable;
+import org.chromium.sdk.JsEvaluateContext;
+import org.chromium.sdk.JsVariable;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IWatchExpressionDelegate;
+import org.eclipse.debug.core.model.IWatchExpressionListener;
+import org.eclipse.debug.core.model.IWatchExpressionResult;
+import org.symbian.tools.tmw.debug.internal.Activator;
+
+/**
+ * Performs the Watch expression evaluation while debugging Chromium JavaScript.
+ */
+public class JsWatchExpressionDelegate implements IWatchExpressionDelegate {
+
+ private static final String[] EMPTY_STRINGS = new String[0];
+
+ private static final class GoodWatchExpressionResult implements IWatchExpressionResult {
+
+ private final Variable variable;
+
+ private final String expression;
+
+ private IValue value;
+
+ private DebugException exception;
+
+ private GoodWatchExpressionResult(Variable variable, String expression) {
+ this.variable = variable;
+ this.expression = expression;
+ }
+
+ public String[] getErrorMessages() {
+ return exception == null
+ ? EMPTY_STRINGS
+ : new String[] { exception.getStatus().getMessage() };
+ }
+
+ public DebugException getException() {
+ getValue();
+ return exception;
+ }
+
+ public String getExpressionText() {
+ return expression;
+ }
+
+ public synchronized IValue getValue() {
+ if (value == null && exception == null) {
+ try {
+ value = variable.getValue();
+ } catch (DebugException e) {
+ this.exception = e;
+ }
+ }
+ return value;
+ }
+
+ public boolean hasErrors() {
+ getValue();
+ return exception != null;
+ }
+ }
+
+ private static final class BadWatchExpressionResult implements IWatchExpressionResult {
+
+ private final DebugException exception;
+
+ private final String expressionText;
+
+ private BadWatchExpressionResult(DebugException exception, String expressionText) {
+ this.exception = exception;
+ this.expressionText = expressionText;
+ }
+
+ public String[] getErrorMessages() {
+ return new String[] { exception.getStatus().getMessage() };
+ }
+
+ public DebugException getException() {
+ return exception;
+ }
+
+ public String getExpressionText() {
+ return expressionText;
+ }
+
+ public IValue getValue() {
+ return null;
+ }
+
+ public boolean hasErrors() {
+ return true;
+ }
+ }
+
+ public void evaluateExpression(final String expression, final IDebugElement context,
+ final IWatchExpressionListener listener) {
+ final DebugElementImpl contextImpl = (DebugElementImpl) context;
+ if (!contextImpl.getDebugTarget().isSuspended()) {
+ // can only evaluate while suspended. Notify empty result.
+ listener.watchEvaluationFinished(new IWatchExpressionResult() {
+
+ public String[] getErrorMessages() {
+ return EMPTY_STRINGS;
+ }
+
+ public DebugException getException() {
+ return null;
+ }
+
+ public String getExpressionText() {
+ return expression;
+ }
+
+ public IValue getValue() {
+ return null;
+ }
+
+ public boolean hasErrors() {
+ return false;
+ }
+ });
+ return;
+ }
+
+ final EvaluateContext evaluateContext =
+ (EvaluateContext) contextImpl.getAdapter(EvaluateContext.class);
+ if (evaluateContext == null) {
+ listener.watchEvaluationFinished(new BadWatchExpressionResult(
+ new DebugException(
+ new Status(Status.ERROR, Activator.PLUGIN_ID, "Bad debug context")), //$NON-NLS-1$
+ expression));
+ return;
+ }
+
+ evaluateContext.getJsEvaluateContext().evaluateAsync(
+ expression,
+ new JsEvaluateContext.EvaluateCallback() {
+ public void success(JsVariable variable) {
+ final Variable var = new Variable(contextImpl.getDebugTarget(), variable, false);
+ listener.watchEvaluationFinished(new GoodWatchExpressionResult(var, expression));
+ }
+
+ public void failure(String message) {
+ listener.watchEvaluationFinished(new BadWatchExpressionResult(new DebugException(
+ createErrorStatus(message == null
+ ? "Error evaluating expression"
+ : message, null)), expression));
+ return;
+ }
+ },
+ null);
+ }
+
+ private static Status createErrorStatus(String message, Exception e) {
+ return new Status(Status.ERROR, Activator.PLUGIN_ID, message, e);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/model/ResourceManager.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,71 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.symbian.tools.tmw.debug.internal.model;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.chromium.debug.core.model.VmResourceId;
+import org.chromium.sdk.Script;
+import org.eclipse.core.resources.IFile;
+import org.symbian.tools.tmw.previewer.PreviewerPlugin;
+
+/**
+ * This object handles the mapping between {@link Script}s and their
+ * corresponding resources inside Eclipse.
+ */
+public class ResourceManager {
+ private final Map<IFile, Script> resourceToScript = new HashMap<IFile, Script>();
+ private final Map<VmResourceId, IFile> scriptIdToResource = new HashMap<VmResourceId, IFile>();
+
+ public synchronized void addScript(Script script) {
+ IFile scriptFile = getResource(script);
+ if (scriptFile == null) {
+ scriptFile = getFile(script.getName());
+ if (scriptFile != null) {
+ VmResourceId scriptId = VmResourceId.forScript(script);
+ resourceToScript.put(scriptFile, script);
+ scriptIdToResource.put(scriptId, scriptFile);
+ }
+ }
+ }
+
+ public synchronized void clear() {
+ resourceToScript.clear();
+ scriptIdToResource.clear();
+ }
+
+ private IFile getFile(String name) {
+ if (name == null) {
+ return null;
+ }
+ IFile file = PreviewerPlugin.getDefault().getHttpPreviewer().getFileFromUrl(name);
+ if (file != null && !file.isAccessible()) {
+ file = null;
+ }
+ return file;
+ }
+
+ public synchronized IFile getResource(Script script) {
+ return scriptIdToResource.get(VmResourceId.forScript(script));
+ }
+
+ public synchronized boolean scriptHasResource(Script script) {
+ return getResource(script) != null;
+ }
+
+ public String translateResourceToScript(IFile resource) {
+ return PreviewerPlugin.getDefault().getHttpPreviewer().getHttpUrl(resource);
+ }
+
+ public VmResourceId findVmResource(IFile resource) {
+ Script script = resourceToScript.get(resource);
+ return script != null ? VmResourceId.forScript(script) : null;
+ }
+
+ public Script getScript(IFile file) {
+ return resourceToScript.get(file);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/model/SymbianDebugModelPresentation.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,172 @@
+package org.symbian.tools.tmw.debug.internal.model;
+
+import java.util.Collection;
+
+import org.chromium.debug.core.model.Value;
+import org.chromium.sdk.JsValue;
+import org.chromium.sdk.JsVariable;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.core.model.ILineBreakpoint;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.debug.ui.IValueDetailListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.ide.FileStoreEditorInput;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.wst.jsdt.core.JavaScriptCore;
+import org.eclipse.wst.jsdt.internal.ui.javaeditor.JarEntryEditorInput;
+import org.eclipse.wst.jsdt.ui.JavaScriptUI;
+
+@SuppressWarnings("restriction")
+public class SymbianDebugModelPresentation extends LabelProvider implements
+ IDebugModelPresentation {
+ private static final int DETAILS_DEPTH = 2;
+
+ public void setAttribute(String attribute, Object value) {
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ // use default image
+ return null;
+ }
+
+ @Override
+ public String getText(Object element) {
+ // use default label text
+ return null;
+ }
+
+ public void computeDetail(IValue value, IValueDetailListener listener) {
+ String detail = ""; //$NON-NLS-1$
+ if (value instanceof Value) {
+ // Avoid quoting string JavaScript values by getting the value
+ // string
+ // from the underlying JsValue.
+ final JsValue jsValue = ((Value) value).getJsValue();
+ detail = printJSON(jsValue, 0);
+ }
+
+ listener.detailComputed(value, detail);
+ }
+
+ private String printJSON(final JsValue value, int depth) {
+ if (depth < DETAILS_DEPTH) {
+ switch (value.getType()) {
+ case TYPE_OBJECT:
+ return printObject(value, depth);
+ case TYPE_ARRAY:
+ return printArray(value, depth);
+ }
+ }
+ if (depth > 0) {
+ if (value.getType() == JsValue.Type.TYPE_STRING) {
+ return "\"" + value.getValueString() + "\"";
+ }
+ }
+ return value.getValueString();
+ }
+
+ private String printArray(JsValue value, int depth) {
+ final StringBuilder builder = new StringBuilder("{ ");
+ String sep = "";
+
+ Collection<? extends JsVariable> properties = value.asObject().asArray().toSparseArray().values();
+
+ for (JsVariable jsVariable : properties) {
+ builder.append(sep).append(printJSON(jsVariable.getValue(), depth + 1));
+ sep = ", ";
+ }
+
+ builder.append(" }");
+ return builder.toString();
+ }
+
+ private String printObject(final JsValue value, final int depth) {
+ final StringBuilder builder = new StringBuilder("{ ");
+
+ String sep = "";
+
+ Collection<? extends JsVariable> properties = value.asObject().getProperties();
+ for (JsVariable jsVariable : properties) {
+ builder.append(sep).append(jsVariable.getName()).append(" : ");
+ builder.append(printJSON(jsVariable.getValue(), depth + 1));
+ sep = ", ";
+ }
+
+ builder.append(" }");
+ return builder.toString();
+ }
+
+ public IEditorInput getEditorInput(Object element) {
+ return toEditorInput(element);
+ }
+
+ public static IEditorInput toEditorInput(Object element) {
+ if (element instanceof IFile) {
+ return new FileEditorInput((IFile) element);
+ }
+ if (element instanceof IFileStore) {
+ return new FileStoreEditorInput((IFileStore) element);
+ }
+ if (element instanceof IStorage) {
+ return new JarEntryEditorInput((IStorage) element);
+ }
+
+ if (element instanceof ILineBreakpoint) {
+ return new FileEditorInput((IFile) ((ILineBreakpoint) element)
+ .getMarker().getResource());
+ }
+
+ return null;
+ }
+
+ public String getEditorId(IEditorInput input, Object element) {
+ if (input instanceof IFileEditorInput) {
+ IFile file;
+ if (element instanceof IFile) {
+ file = (IFile) element;
+ } else if (element instanceof IBreakpoint) {
+ IBreakpoint breakpoint = (IBreakpoint) element;
+ IResource resource = breakpoint.getMarker().getResource();
+ // Can the breakpoint resource be folder or project? Better
+ // check for it.
+ if (resource instanceof IFile == false) {
+ return null;
+ }
+ file = (IFile) resource;
+ } else {
+ return null;
+ }
+
+ // Pick the editor based on the file extension, taking user
+ // preferences into account.
+ try {
+ return IDE.getEditorDescriptor(file).getId();
+ } catch (PartInitException e) {
+ // TODO(peter.rybin): should it really be the default case?
+ // There might be no virtual project.
+ return null;
+ }
+ } else {
+ if (element instanceof IStorage) {
+ IStorage store = (IStorage) element;
+ if (JavaScriptCore.isJavaScriptLikeFileName(store.getName())) {
+ return JavaScriptUI.ID_CU_EDITOR;
+ } else {
+ return "org.eclipse.wst.html.core.htmlsource.source";
+ }
+ }
+ }
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/model/WorkspaceBreakpointHandler.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,195 @@
+/**
+ *
+ */
+package org.symbian.tools.tmw.debug.internal.model;
+
+import java.util.Collection;
+
+import org.chromium.debug.core.ChromiumDebugPlugin;
+import org.chromium.debug.core.model.BreakpointMap;
+import org.chromium.debug.core.model.BreakpointSynchronizer.BreakpointHelper.CreateCallback;
+import org.chromium.debug.core.model.ChromiumLineBreakpoint;
+import org.chromium.debug.core.model.DebugTargetImpl;
+import org.chromium.debug.core.model.VProjectWorkspaceBridge;
+import org.chromium.debug.core.model.VmResourceId;
+import org.chromium.debug.core.model.WorkspaceBridge.BreakpointHandler;
+import org.chromium.sdk.Breakpoint;
+import org.chromium.sdk.JavascriptVm;
+import org.chromium.sdk.SyncCallback;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.symbian.tools.tmw.debug.internal.launch.WRTProjectWorkspaceBridge;
+import org.symbian.tools.tmw.previewer.PreviewerPlugin;
+
+public final class WorkspaceBreakpointHandler implements BreakpointHandler {
+ private final BreakpointMap.InTargetMap breakpointInTargetMap = new BreakpointMap.InTargetMap();
+ private final DebugTargetImpl debugTarget;
+ private final ResourceManager resourceManager;
+
+ public WorkspaceBreakpointHandler(DebugTargetImpl debugTarget, ResourceManager resourceManager) {
+ this.debugTarget = debugTarget;
+ // this.vm = vm;
+ this.resourceManager = resourceManager;
+ }
+
+ public void breakpointAdded(IBreakpoint breakpoint) {
+ ChromiumLineBreakpoint lineBreakpoint = tryCastBreakpoint(breakpoint);
+ if (lineBreakpoint == null) {
+ return;
+ }
+ if (ChromiumLineBreakpoint.getIgnoreList().contains(breakpoint)) {
+ return;
+ }
+ if (!lineBreakpoint.isEnabled()) {
+ return;
+ }
+ IFile file = (IFile) lineBreakpoint.getMarker().getResource();
+ VmResourceId vmResourceId;
+ try {
+ vmResourceId = findVmResourceIdFromWorkspaceFile(file);
+ } catch (CoreException e) {
+ ChromiumDebugPlugin.log(new Exception("Failed to resolve script for the file " + file, e)); //$NON-NLS-1$
+ return;
+ }
+ if (vmResourceId == null) {
+ // Might be a script from a different debug target
+ return;
+ }
+ createBreakpointOnRemote(lineBreakpoint, vmResourceId, null, null);
+ }
+
+ public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
+ ChromiumLineBreakpoint lineBreakpoint = tryCastBreakpoint(breakpoint);
+ if (lineBreakpoint == null) {
+ return;
+ }
+ if (ChromiumLineBreakpoint.getIgnoreList().contains(lineBreakpoint)) {
+ return;
+ }
+ Breakpoint sdkBreakpoint = breakpointInTargetMap.getSdkBreakpoint(lineBreakpoint);
+ if (sdkBreakpoint == null) {
+ return;
+ }
+
+ try {
+ ChromiumLineBreakpoint.Helper.updateOnRemote(sdkBreakpoint, lineBreakpoint);
+ } catch (RuntimeException e) {
+ ChromiumDebugPlugin.log(new Exception("Failed to change breakpoint in " + //$NON-NLS-1$
+ getTargetNameSafe(), e));
+ }
+
+ }
+
+ public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
+ ChromiumLineBreakpoint lineBreakpoint = tryCastBreakpoint(breakpoint);
+ if (lineBreakpoint == null) {
+ return;
+ }
+ if (ChromiumLineBreakpoint.getIgnoreList().contains(lineBreakpoint)) {
+ return;
+ }
+
+ Breakpoint sdkBreakpoint = breakpointInTargetMap.getSdkBreakpoint(lineBreakpoint);
+ if (sdkBreakpoint == null) {
+ return;
+ }
+
+ try {
+ if (!breakpoint.isEnabled()) {
+ return;
+ }
+ } catch (CoreException e) {
+ ChromiumDebugPlugin.log(e);
+ return;
+ }
+ JavascriptVm.BreakpointCallback callback = new JavascriptVm.BreakpointCallback() {
+ public void failure(String errorMessage) {
+ ChromiumDebugPlugin.log(new Exception("Failed to remove breakpoint in " + //$NON-NLS-1$
+ getTargetNameSafe() + ": " + errorMessage)); //$NON-NLS-1$
+ }
+
+ public void success(Breakpoint breakpoint) {
+ }
+ };
+ try {
+ sdkBreakpoint.clear(callback, null);
+ } catch (RuntimeException e) {
+ ChromiumDebugPlugin.log(new Exception("Failed to remove breakpoint in " + //$NON-NLS-1$
+ getTargetNameSafe(), e));
+ }
+ breakpointInTargetMap.remove(lineBreakpoint);
+ }
+
+ public void breakpointsHit(Collection<? extends Breakpoint> breakpointsHit) {
+ if (breakpointsHit.isEmpty()) {
+ return;
+ }
+
+ for (Breakpoint sdkBreakpoint : breakpointsHit) {
+ ChromiumLineBreakpoint uiBreakpoint = breakpointInTargetMap.getUiBreakpoint(sdkBreakpoint);
+ if (uiBreakpoint != null) {
+ uiBreakpoint.setIgnoreCount(-1); // reset ignore count as we've hit it
+ }
+ }
+ }
+
+ public void createBreakpointOnRemote(final ChromiumLineBreakpoint lineBreakpoint, final VmResourceId vmResourceId,
+ final CreateCallback createCallback, SyncCallback syncCallback) {
+ try {
+ ChromiumLineBreakpoint.Helper.CreateOnRemoveCallback callback = new ChromiumLineBreakpoint.Helper.CreateOnRemoveCallback() {
+ public void failure(String errorMessage) {
+ if (createCallback == null) {
+ ChromiumDebugPlugin.logError(errorMessage);
+ } else {
+ createCallback.failure(new Exception(errorMessage));
+ }
+ }
+
+ public void success(Breakpoint breakpoint) {
+ breakpointInTargetMap.add(breakpoint, lineBreakpoint);
+ if (createCallback != null) {
+ createCallback.success();
+ }
+ }
+ };
+
+ ChromiumLineBreakpoint.Helper.createOnRemote(lineBreakpoint, vmResourceId, debugTarget, callback,
+ syncCallback);
+ } catch (CoreException e) {
+ ChromiumDebugPlugin.log(new Exception("Failed to create breakpoint in " + //$NON-NLS-1$
+ getTargetNameSafe(), e));
+ }
+ }
+
+ private VmResourceId findVmResourceIdFromWorkspaceFile(IFile resource) throws CoreException {
+ return VmResourceId.forName(PreviewerPlugin.getDefault().getHttpPreviewer().getHttpUrl(resource));
+ }
+
+ private String getTargetNameSafe() {
+ try {
+ return debugTarget.getLaunch().getLaunchConfiguration().getName();
+ } catch (RuntimeException e) {
+ return "<unknown>"; //$NON-NLS-1$
+ }
+ }
+
+ public boolean supportsBreakpoint(IBreakpoint breakpoint) {
+ return (WRTProjectWorkspaceBridge.DEBUG_MODEL_ID.equals(breakpoint
+ .getModelIdentifier()) || VProjectWorkspaceBridge.DEBUG_MODEL_ID
+ .equals(breakpoint.getModelIdentifier()))
+ && !debugTarget.isDisconnected();
+ }
+
+ public ChromiumLineBreakpoint tryCastBreakpoint(IBreakpoint breakpoint) {
+ if (!supportsBreakpoint(breakpoint)) {
+ return null;
+ }
+ if (breakpoint instanceof ChromiumLineBreakpoint == false) {
+ return null;
+ }
+ return (ChromiumLineBreakpoint) breakpoint;
+ }
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/property/LaunchableFactory.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,19 @@
+package org.symbian.tools.tmw.debug.internal.property;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+
+public class LaunchableFactory implements IAdapterFactory {
+
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ // It is only needed to exist
+ return null;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Class[] getAdapterList() {
+ // It is only needed to exist
+ return null;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/property/PropertyTester.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tmw.debug.internal.property;
+
+import org.eclipse.core.resources.IResource;
+import org.symbian.tools.wrttools.util.ProjectUtils;
+
+public class PropertyTester extends org.eclipse.core.expressions.PropertyTester {
+
+ public boolean test(Object receiver, String property, Object[] args,
+ Object expectedValue) {
+ if (property.equals("isWrtProject")) {
+ return ProjectUtils.hasWrtNature(((IResource) receiver).getProject());
+ }
+ return false;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/session/TerminateSession.java Mon Aug 23 09:55:57 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.tmw.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.tmw.debug.internal.Activator;
+import org.symbian.tools.tmw.debug.internal.IConstants;
+import org.symbian.tools.tmw.debug.internal.launch.WidgetLaunchDelegate;
+import org.symbian.tools.tmw.previewer.IPreviewerCommandHandler;
+
+public class TerminateSession implements IPreviewerCommandHandler {
+ @SuppressWarnings("rawtypes")
+ 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);
+ }
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/DebugPreferencePage.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tmw.debug.ui;
+
+import java.io.File;
+
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.preference.DirectoryFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.symbian.tools.tmw.debug.internal.Activator;
+import org.symbian.tools.tmw.debug.internal.ChromeDebugUtils;
+import org.symbian.tools.tmw.debug.internal.IConstants;
+
+public class DebugPreferencePage extends FieldEditorPreferencePage implements
+ IWorkbenchPreferencePage {
+
+ private Button check;
+
+ public DebugPreferencePage() {
+ super(GRID);
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ setDescription("Mobile Web debugger settings");
+ }
+
+ @Override
+ protected void createFieldEditors() {
+ DirectoryFieldEditor editor = new DirectoryFieldEditor(IConstants.PREF_NAME_CHROME_LOCATION,
+ "Chrome Install Location:",
+ getFieldEditorParent()) {
+ @Override
+ protected boolean doCheckState() {
+ if (super.doCheckState()) {
+ String message = validate(getStringValue());
+ setErrorMessage(message);
+ return message == null;
+ } else {
+ return false;
+ }
+ }
+ };
+ editor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
+ editor.setEmptyStringAllowed(false);
+ addField(editor);
+
+ check = new Button(getFieldEditorParent(), SWT.CHECK);
+ check.setText("Show warning dialog when resources in the debugged project were changed");
+ check.setLayoutData(new GridData(GridData.BEGINNING, GridData.END, false, false, 3, 1));
+
+ check.setSelection(!MessageDialogWithToggle.ALWAYS.equals(getPreferenceStore().getString(
+ IConstants.PREF_SHOW_RESOURCE_CHANGE_ERROR)));
+ }
+
+
+ protected String validate(String newValue) {
+ String error = null;
+ if (newValue == null || newValue.trim().length() == 0) {
+ error = "Chrome install location is not specified";
+ } else if (!new File(newValue).exists()) {
+ error = String.format("%s does not exist", newValue);
+ } else if (ChromeDebugUtils.getExecutablePath(newValue) == null) {
+ error = String.format("%s does not contain Chrome executable", newValue);
+ }
+ return error;
+ }
+
+ @Override
+ protected void performDefaults() {
+ super.performDefaults();
+ check.setSelection(false);
+ }
+
+ @Override
+ public boolean performOk() {
+ if (check.getSelection()) {
+ getPreferenceStore().setToDefault(IConstants.PREF_SHOW_RESOURCE_CHANGE_ERROR);
+ } else {
+ getPreferenceStore().setValue(IConstants.PREF_SHOW_RESOURCE_CHANGE_ERROR, MessageDialogWithToggle.ALWAYS);
+ }
+ return super.performOk();
+ }
+
+ public void init(IWorkbench workbench) {
+ // Do nothing
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/actions/DebugAction.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,47 @@
+/**
+ * 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.tmw.debug.ui.actions;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.debug.internal.ui.actions.DebugLastAction;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.symbian.tools.wrttools.util.ProjectUtils;
+
+@SuppressWarnings("restriction")
+public class DebugAction extends DebugLastAction {
+ @Override
+ public void run(IAction action) {
+ boolean hasWrtProjects = false;
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for (IProject project : projects) {
+ if (project.isAccessible() && ProjectUtils.hasWrtNature(project)) {
+ hasWrtProjects = true;
+ break;
+ }
+ }
+ if (hasWrtProjects) {
+ super.run(action);
+ } else {
+ MessageDialog.openInformation(getShell(), "Cannot launch debugger",
+ "There are no open projects in your workspace");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/actions/JsBreakpointPropertiesRulerAction.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ *******************************************************************************/
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.symbian.tools.tmw.debug.ui.actions;
+
+import org.chromium.debug.core.model.ChromiumLineBreakpoint;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.ui.actions.RulerBreakpointAction;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.dialogs.PropertyDialogAction;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.IUpdate;
+
+/**
+ * Action to bring up the breakpoint properties dialog.
+ */
+public class JsBreakpointPropertiesRulerAction extends RulerBreakpointAction
+ implements IUpdate {
+ private IBreakpoint breakpoint;
+
+ public JsBreakpointPropertiesRulerAction(ITextEditor editor,
+ IVerticalRulerInfo rulerInfo) {
+ super(editor, rulerInfo);
+ setText("Breakpoint Properties...");
+ }
+
+ @Override
+ public void run() {
+ if (getBreakpoint() != null) {
+ PropertyDialogAction action = new PropertyDialogAction(getEditor()
+ .getEditorSite(), new ISelectionProvider() {
+ public void addSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ }
+
+ public ISelection getSelection() {
+ return new StructuredSelection(getBreakpoint());
+ }
+
+ public void removeSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ }
+
+ public void setSelection(ISelection selection) {
+ }
+ });
+ action.run();
+ }
+ }
+
+ public void update() {
+ breakpoint = null;
+ IBreakpoint activeBreakpoint = getBreakpoint();
+ if (activeBreakpoint != null
+ && activeBreakpoint instanceof ChromiumLineBreakpoint) {
+ breakpoint = activeBreakpoint;
+ }
+ setEnabled(breakpoint != null);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/actions/JsBreakpointPropertiesRulerActionDelegate.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ *******************************************************************************/
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.symbian.tools.tmw.debug.ui.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+/**
+ * Delegate for JsBreakpointPropertiesRulerAction.
+ */
+public class JsBreakpointPropertiesRulerActionDelegate extends AbstractRulerActionDelegate {
+
+ @Override
+ protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
+ return new JsBreakpointPropertiesRulerAction(editor, rulerInfo);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/actions/WatchExpression.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,132 @@
+/**
+ * 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.tmw.debug.ui.actions;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IExpressionManager;
+import org.eclipse.debug.core.model.IWatchExpression;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.actions.ActionDelegate;
+import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
+import org.eclipse.wst.jsdt.core.dom.AST;
+import org.eclipse.wst.jsdt.core.dom.ASTNode;
+import org.eclipse.wst.jsdt.core.dom.ASTParser;
+import org.eclipse.wst.jsdt.core.dom.ASTVisitor;
+import org.eclipse.wst.jsdt.core.dom.SimpleName;
+import org.eclipse.wst.jsdt.internal.ui.JavaScriptPlugin;
+import org.eclipse.wst.jsdt.internal.ui.javaeditor.WorkingCopyManager;
+import org.symbian.tools.tmw.debug.internal.Activator;
+
+@SuppressWarnings("restriction")
+public class WatchExpression extends ActionDelegate implements IEditorActionDelegate {
+ private final class FindNode extends ASTVisitor {
+ private final int offset;
+ private final int length;
+
+ private ASTNode node;
+
+ private FindNode(int offset, int length) {
+ super(false);
+ this.offset = offset;
+ this.length = length;
+ }
+
+ @Override
+ public boolean visit(SimpleName node) {
+ checkNode(node);
+ return true;
+ }
+
+ public void checkNode(ASTNode node) {
+ final int end = node.getStartPosition() + node.getLength();
+ if (node.getStartPosition() <= offset && end >= offset + length) {
+ this.node = node;
+ }
+ }
+
+ @Override
+ public void postVisit(ASTNode node) {
+ if (this.node == null) {
+ checkNode(node);
+ }
+ }
+
+ public ASTNode getNode() {
+ return node;
+ }
+ }
+
+ private IEditorPart targetEditor;
+
+ public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+ this.targetEditor = targetEditor;
+ }
+
+ @Override
+ public void run(IAction action) {
+ ISelection selection = targetEditor.getEditorSite().getSelectionProvider().getSelection();
+ if (selection instanceof ITextSelection) {
+ final ITextSelection textSelection = (ITextSelection) selection;
+ final WorkingCopyManager manager = JavaScriptPlugin.getDefault().getWorkingCopyManager();
+ final IEditorInput editorInput = targetEditor.getEditorInput();
+ final IJavaScriptUnit workingCopy = manager.getWorkingCopy(editorInput);
+ final ASTParser parser = ASTParser.newParser(AST.JLS3);
+
+ parser.setSource(workingCopy);
+ final ASTNode ast = parser.createAST(null);
+ final FindNode visitor = new FindNode(textSelection.getOffset(), textSelection.getLength());
+ ast.accept(visitor);
+
+ final ASTNode node = visitor.getNode();
+ if (node != null) {
+ final String jsString;
+ if (node.getNodeType() == ASTNode.SIMPLE_NAME) {
+ switch (node.getParent().getNodeType()) {
+ case ASTNode.FIELD_ACCESS:
+ case ASTNode.FUNCTION_INVOCATION:
+ jsString = node.getParent().toString();
+ break;
+ default:
+ jsString = node.toString();
+ break;
+ }
+ } else {
+ jsString = node.toString();
+ }
+ IExpressionManager expressionManager = DebugPlugin.getDefault().getExpressionManager();
+ IWatchExpression expression = expressionManager.newWatchExpression(jsString);
+ expressionManager.addExpression(expression);
+
+ try {
+ targetEditor.getSite().getPage().showView(IDebugUIConstants.ID_EXPRESSION_VIEW);
+ } catch (PartInitException e) {
+ Activator.log(e);
+ }
+ }
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/launch/WidgetBasicTab.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tmw.debug.ui.launch;
+
+import java.util.LinkedList;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.symbian.tools.tmw.debug.internal.Activator;
+import org.symbian.tools.tmw.debug.internal.ChromeDebugUtils;
+import org.symbian.tools.tmw.debug.internal.IConstants;
+import org.symbian.tools.tmw.debug.internal.Images;
+import org.symbian.tools.wrttools.util.ProjectUtils;
+
+public class WidgetBasicTab extends AbstractLaunchConfigurationTab {
+ private ComboViewer project;
+ private boolean canSave;
+
+ @Override
+ public Image getImage() {
+ return Images.getWrtIconImage();
+ }
+
+ public void createControl(Composite parent) {
+ Composite root = new Composite(parent, SWT.NONE);
+ FormLayout layout = new FormLayout();
+ layout.marginWidth = 5;
+ layout.marginHeight = 5;
+ layout.spacing = 5;
+ root.setLayout(layout);
+
+ Label label = new Label(root, SWT.NONE);
+ label.setText("WRT Widget Project:");
+
+ project = new ComboViewer(root, SWT.READ_ONLY);
+ project.setContentProvider(new ArrayContentProvider());
+ project.setLabelProvider(new WorkbenchLabelProvider());
+
+ FormData formData = new FormData();
+ formData.left = new FormAttachment(label);
+ formData.right = new FormAttachment(100, 0);
+ project.getControl().setLayoutData(formData);
+
+ project.setInput(getWidgetProjects());
+ project.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ setDirty(true);
+ validate();
+ }
+ });
+ setControl(root);
+ }
+
+ private IProject[] getWidgetProjects() {
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot()
+ .getProjects();
+ LinkedList<IProject> filtered = new LinkedList<IProject>();
+ for (IProject p : projects) {
+ if (ProjectUtils.hasWrtNature(p)) {
+ filtered.add(p);
+ }
+ }
+ return filtered.toArray(new IProject[filtered.size()]);
+ }
+
+ public String getName() {
+ return "WRT Widget";
+ }
+
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ project.setSelection(getSelectedProject(configuration), true);
+ validate();
+ setErrorMessage(null);
+ }
+
+ private ISelection getSelectedProject(ILaunchConfiguration configuration) {
+ ISelection selected = StructuredSelection.EMPTY;
+ try {
+ String projectName = configuration.getAttribute(
+ IConstants.PROP_PROJECT_NAME, (String) null);
+ if (projectName != null) {
+ IProject p = ResourcesPlugin.getWorkspace().getRoot()
+ .getProject(projectName);
+ if (p.isAccessible()) {
+ selected = new StructuredSelection(p);
+ }
+ }
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ return selected;
+ }
+
+ @Override
+ public boolean canSave() {
+ return canSave;
+ }
+
+ private void validate() {
+ String error = null;
+ if (getWidgetProjects().length == 0) {
+ error = "No WRT widget projects found in the workspace";
+ } else if (project.getSelection().isEmpty()) {
+ error = "Select WRT widget project to debug";
+ } else if (ChromeDebugUtils.getChromeExecutible() == null) {
+ error = "No Chrome browser configured in the preferences";
+ }
+ canSave = error == null;
+ setErrorMessage(error);
+ getLaunchConfigurationDialog().updateButtons();
+ }
+
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ ISelection selection = project.getSelection();
+ if (selection.isEmpty()) {
+ setDefaults(configuration);
+ } else {
+ IProject p = (IProject) ((IStructuredSelection) selection)
+ .getFirstElement();
+ configuration.setAttribute(IConstants.PROP_PROJECT_NAME, p
+ .getName());
+ configuration.setMappedResources(new IResource[] { p });
+ }
+ }
+
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.removeAttribute(IConstants.PROP_PROJECT_NAME);
+ }
+
+ @Override
+ public boolean isValid(ILaunchConfiguration launchConfig) {
+ return !getSelectedProject(launchConfig).isEmpty();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/launch/WidgetLaunchConfigurationTabGroup.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tmw.debug.ui.launch;
+
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.CommonTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+
+public class WidgetLaunchConfigurationTabGroup extends
+ AbstractLaunchConfigurationTabGroup {
+
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ setTabs(new ILaunchConfigurationTab[] {new WidgetBasicTab(), new CommonTab()});
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/launch/WidgetLaunchShortcut.java Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tmw.debug.ui.launch;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.ILaunchShortcut2;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.symbian.tools.tmw.debug.internal.Activator;
+import org.symbian.tools.tmw.debug.internal.IConstants;
+import org.symbian.tools.tmw.debug.internal.launch.WidgetLaunchDelegate;
+
+public class WidgetLaunchShortcut implements ILaunchShortcut2 {
+
+ public IResource getLaunchableResource(IEditorPart editorpart) {
+ IEditorInput input = editorpart.getEditorInput();
+ return (IResource) input.getAdapter(IResource.class);
+ }
+
+ public IResource getLaunchableResource(ISelection selection) {
+ if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
+ Object object = ((IStructuredSelection) selection).getFirstElement();
+ IResource resource = null;
+ if (object instanceof IResource) {
+ resource = (IResource) object;
+ } else if (object instanceof IAdaptable) {
+ resource = (IResource) ((IAdaptable) object).getAdapter(IResource.class);
+ }
+ return resource;
+ }
+ return null;
+ }
+
+ public ILaunchConfiguration[] getLaunchConfigurations(IEditorPart editorpart) {
+ return getLaunchConfigurations(getLaunchableResource(editorpart));
+ }
+
+ private ILaunchConfiguration getLaunchConfigurations(IProject project) throws CoreException {
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(WidgetLaunchDelegate.ID);
+ ILaunchConfiguration configuration = null;
+ ILaunchConfiguration[] configurations = launchManager.getLaunchConfigurations(type);
+ for (ILaunchConfiguration c : configurations) {
+ if (project.getName().equals(c.getAttribute(IConstants.PROP_PROJECT_NAME, (String) null))) {
+ configuration = c;
+ break;
+ }
+ }
+ return configuration;
+ }
+
+ private ILaunchConfiguration[] getLaunchConfigurations(IResource resource) {
+ if (resource != null) {
+ try {
+ ILaunchConfiguration launchConfigurations = getLaunchConfigurations(resource.getProject());
+ if (launchConfigurations != null) {
+ return new ILaunchConfiguration[] { launchConfigurations };
+ }
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ }
+ return null;
+ }
+
+ public ILaunchConfiguration[] getLaunchConfigurations(ISelection selection) {
+ return getLaunchConfigurations(getLaunchableResource(selection));
+ }
+
+ public void launch(IEditorPart editor, String mode) {
+ launch(getLaunchableResource(editor), mode);
+ }
+
+ private void launch(IResource launchableResource, String mode) {
+ try {
+ IProject project = launchableResource.getProject();
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(WidgetLaunchDelegate.ID);
+ ILaunchConfiguration configuration = getLaunchConfigurations(project);
+ if (configuration == null) {
+ ILaunchConfigurationWorkingCopy copy = type.newInstance(null, launchManager
+ .generateLaunchConfigurationName(project.getName()));
+ copy.setAttribute(IConstants.PROP_PROJECT_NAME, project.getName());
+ copy.setMappedResources(new IResource[] { project });
+ configuration = copy.doSave();
+ }
+ DebugUITools.launch(configuration, mode);
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ }
+
+ public void launch(ISelection selection, String mode) {
+ launch(getLaunchableResource(selection), mode);
+ }
+}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/Activator.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-import org.symbian.tools.wrttools.debug.internal.launch.ChromeInstancesManager;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.symbian.tools.wrttools.debug.core";
-
- public static final boolean DEBUG = Platform.inDebugMode() && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debug"));
- public static final boolean DEBUG_CONNECTION = DEBUG && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debugConnection"));
- public static final boolean DEBUG_RESOURCES = DEBUG && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debugResources"));
- public static final boolean DEBUG_BREAKPOINTS = DEBUG
- && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID
- + "/debugBreakpoints"));
-
- // The shared instance
- private static Activator plugin;
-
- private final ChromeInstancesManager chromes = new ChromeInstancesManager();
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- Logger.getLogger("org.chromium.sdk").setLevel(Level.WARNING);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- chromes.shutdown();
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- public ChromeInstancesManager getChromeInstancesManager() {
- return chromes;
- }
-
- public static void log(Throwable e) {
- log(e.getLocalizedMessage(), e);
- }
-
- private static void log(String message, Throwable exception) {
- getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
- }
-
- @Override
- protected void initializeImageRegistry(ImageRegistry reg) {
- Images.initImageRegistry(reg);
- }
-
- public static void log(String message) {
- log(message, null);
- }
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/BreakpointAdapterFactory.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
-import org.eclipse.ui.IEditorPart;
-
-@SuppressWarnings("rawtypes")
-public class BreakpointAdapterFactory implements IAdapterFactory {
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof IEditorPart) {
- IResource resource = (IResource) ((IEditorPart) adaptableObject)
- .getEditorInput().getAdapter(IResource.class);
- if (resource != null) {
- return new WorkspaceLineBreakpointAdapter();
- }
- }
- return null;
- }
-
- public Class[] getAdapterList() {
- return new Class[] { IToggleBreakpointsTarget.class };
- }
-
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/ChromeDebugUtils.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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;
-
-import java.io.File;
-
-import org.symbian.tools.wrttools.util.CoreUtil;
-
-public final class ChromeDebugUtils {
- public static String getExecutablePath(String folder) {
- File file = new File(folder);
- if (file.isDirectory()) {
- File chromeExecutable = new File(file, getExecutable());
- if (chromeExecutable.isFile()) {
- return chromeExecutable.getAbsolutePath();
- } else if (CoreUtil.isMac() && file.getName().equals("Google Chrome.app")) {
- return getExecutablePath(file.getParent());
- }
- } else if (file.isFile()) {
- if (file.getName().equalsIgnoreCase(getExecutable())) {
- return file.getAbsolutePath();
- }
- }
- return null;
- }
-
- private static String getExecutable() {
- // Add more ifs as we add support for new platforms
- if (CoreUtil.isMac()) {
- return "Google Chrome.app/Contents/MacOS/Google Chrome";
- } else if (CoreUtil.isLinux()) {
- return "chrome";
- } else {
- return "chrome.exe";
- }
- }
-
- private ChromeDebugUtils() {
- // No instantiating
- }
-
- public static String getChromeExecutible() {
- return getExecutablePath(Activator.getDefault().getPreferenceStore().getString(IConstants.PREF_NAME_CHROME_LOCATION));
- }
-
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/HtmlBreakpointProvider.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-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;
-import org.symbian.tools.wrttools.debug.internal.launch.WRTProjectWorkspaceBridge;
-
-@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);
-
- if (hasScript) {
- ChromiumLineBreakpoint breakpoint = new ChromiumLineBreakpoint(getResource(input), lineNumber,
- WRTProjectWorkspaceBridge.DEBUG_MODEL_ID);
- 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/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/IConstants.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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;
-
-public interface IConstants {
- String PREF_NAME_CHROME_LOCATION="chrome.location";
- String PROP_PROJECT_NAME = "projectName";
- String PREF_SHOW_RESOURCE_CHANGE_ERROR = "show.resourceChange.warning";
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/Images.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-
-public class Images {
- private static final String WRT16 = "main16.gif";
-
- public static void initImageRegistry(ImageRegistry registry) {
- setImage(registry, WRT16);
- }
-
- private static void setImage(ImageRegistry registry, String image) {
- ImageDescriptor img = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/" + image);
- registry.put(image, img);
- }
-
- public static ImageDescriptor getWrtIcon() {
- return getImageDescriptor(WRT16);
- }
-
- private static ImageDescriptor getImageDescriptor(String image) {
- return Activator.getDefault().getImageRegistry().getDescriptor(image);
- }
-
- public static Image getWrtIconImage() {
- return getImage(WRT16);
- }
-
- private static Image getImage(String image) {
- return Activator.getDefault().getImageRegistry().get(image);
- }
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/PreferenceInitializer.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.symbian.tools.wrttools.util.CoreUtil;
-
-public class PreferenceInitializer extends AbstractPreferenceInitializer {
- private final static String DEFAULT_CHROME_LOCATION = "Local Settings/Application Data/Google/Chrome/Application";
-
- @Override
- public void initializeDefaultPreferences() {
- IPreferenceStore store = Activator.getDefault().getPreferenceStore();
- File folder = getDefaultFolder();
- if (ChromeDebugUtils.getExecutablePath(folder.getAbsolutePath()) != null) {
- store.setDefault(IConstants.PREF_NAME_CHROME_LOCATION, folder
- .getAbsolutePath());
- }
- }
-
- private File getDefaultFolder() {
- if (CoreUtil.isMac()) {
- return new File("/Applications");
- } else if (CoreUtil.isLinux()) {
- return new File("/opt/google/chrome");
- }
- String property = System.getProperty("user.home");
- File folder = new File(property, DEFAULT_CHROME_LOCATION);
- if (!folder.exists()) {
- folder = new File("C:/Program Files/Google/Chrome/Application/");
- }
- return folder;
- }
-
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/WorkspaceLineBreakpointAdapter.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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;
-
-import org.chromium.debug.core.model.LineBreakpointAdapter;
-import org.chromium.debug.core.model.VProjectWorkspaceBridge;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.jsdt.internal.ui.javaeditor.JavaEditor;
-
-@SuppressWarnings("restriction")
-public class WorkspaceLineBreakpointAdapter extends LineBreakpointAdapter {
- @Override
- protected ITextEditor getEditor(IWorkbenchPart part) {
- if (part instanceof JavaEditor) {
- return (ITextEditor) part;
- } else {
- return null;
- }
- }
-
- @Override
- protected String getDebugModelId() {
- return VProjectWorkspaceBridge.DEBUG_MODEL_ID;
- }
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/launch/ChromeInstancesManager.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.launch;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.symbian.tools.wrttools.debug.internal.Activator;
-import org.symbian.tools.wrttools.debug.internal.ChromeDebugUtils;
-import org.symbian.tools.wrttools.util.CoreUtil;
-
-public class ChromeInstancesManager {
- private static final String[] CHROME_ARGS = { "%s", "--remote-shell-port=%d", // Here we will set port
- "--user-data-dir=%s", // Here we will set profile folder so user settings have no effect
- "--disk-cache-dir=%s", // We don't care
- "--disable-web-security", // Widgets can use network now
- "--disable-extenions", // Use standard UI, should also improve speed and stability
- "--activate-on-launch", // Bring to front on Mac
- "--disable-geolocation", // Use our own Geolocation (needed to emulate Geolocation in phonegap)
- "--disable-local-storage", // Disable local storage (needed to emulate Geolocation in phonegap)
- "--disable-session-storage", // Disable local storage (needed to emulate Geolocation in phonegap)
- "--no-default-browser-check", // Our users don't need this nagging
- "--disable-hang-monitor", // Fix for Bug 2682 - The debugger should disable "unresponsive" error message from chrome
- "--no-first-run", // We don't care
- "--app=%s" // Here we will have widget URI as --app argument
- };
- private final Map<Object, Process> chromes = Collections.synchronizedMap(new HashMap<Object, Process>());
-
- private static final int EXECUTIBLE_INDEX = 0;
- private static final int PORT_INDEX = 1;
- private static final int USER_DATA_INDEX = 2;
- private static final int CACHE_INDEX = 3;
- private static final int URL_INDEX = CHROME_ARGS.length - 1;
-
- private int profileNum = 0;
-
- public void startChrome(final Object key, int port, final String url) throws CoreException {
- final String browserExecutable = ChromeDebugUtils.getChromeExecutible();
- if (browserExecutable == null) {
- throw createCoreException("No Chrome browser available", null);
- }
-
- String[] commandline = new String[CHROME_ARGS.length];
- System.arraycopy(CHROME_ARGS, 0, commandline, 0, CHROME_ARGS.length);
- commandline[EXECUTIBLE_INDEX] = String.format(CHROME_ARGS[EXECUTIBLE_INDEX], browserExecutable);
- commandline[PORT_INDEX] = String.format(CHROME_ARGS[PORT_INDEX], port);
- commandline[USER_DATA_INDEX] = String.format(CHROME_ARGS[USER_DATA_INDEX], getChromeProfilePath());
- commandline[CACHE_INDEX] = String.format(CHROME_ARGS[CACHE_INDEX], getChromeCachePath());
- commandline[URL_INDEX] = String.format(CHROME_ARGS[URL_INDEX], url);
-
- // 2. Start Chrome
- try {
- Process process = Runtime.getRuntime().exec(commandline);
- chromes.put(key, process);
- } catch (IOException e) {
- StringBuilder builder = new StringBuilder();
- for (String string : commandline) {
- builder.append(" ").append(string);
- }
- throw createCoreException("Cannot execute: {0}", builder.toString().trim(), e);
- }
-
- }
-
- private String getChromeCachePath() {
- return getChromeSpecialDir(".chromecache");
- }
-
- /**
- * Terminate Chrome instance associated with given key.
- */
- public synchronized void stopChrome(final Object key) {
-
- }
-
- public synchronized void forgetChrome(final Object key) {
-
- }
-
- public synchronized void shutdown() {
- String dir = getChromeSpecialDir("");
- File directory = new File(dir);
- File[] files = directory.listFiles(new FileFilter() {
- public boolean accept(File pathname) {
- return pathname.isDirectory() && pathname.getName().matches("\\.chr\\d{3}")
- && !isChromeRunning(pathname);
- }
- });
- boolean removedAll = true;
- for (File file : files) {
- removedAll = delete(file) && removedAll;
- }
- if (removedAll) {
- String cachePath = getChromeCachePath();
- delete(new File(cachePath));
- }
-
- }
-
- private boolean delete(File file) {
- if (!file.exists()) {
- return true;
- } else if (file.isDirectory()) {
- File[] files = file.listFiles();
- for (File f : files) {
- if (!delete(f)) {
- return false;
- }
- }
- }
- return file.delete();
- }
-
- private CoreException createCoreException(String pattern, String arg, Throwable exeption) {
- return createCoreException(MessageFormat.format(pattern, arg), exeption);
- }
-
- private CoreException createCoreException(String message, Throwable exeption) {
- return new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, message, exeption));
- }
-
- private String getChromeProfilePath() {
- while (true) {
- String dir = getChromeSpecialDir(String.format(".chr%03d", profileNum++));
- if (!new File(dir).exists()) {
- return dir;
- }
- }
- }
-
- private boolean isChromeRunning(File pathname) {
- File file = new File(pathname, "Default/Cookies");
- try {
- // Note: it is ok to delete cookies file - if it can be deleted then Chrome is not running.
- // If Chrome is running then we will not be able to delete the file.
- // We do not need to preserve state between launches. So it is ok to delete coockies.
- return file.exists() && !file.delete();
- } catch (Exception e) {
- Activator.log(e);
- return true;
- }
- }
-
- private String getChromeSpecialDir(String subdir) {
- IPath location = ResourcesPlugin.getWorkspace().getRoot().getLocation();
- if (CoreUtil.isLinux() && location.toString().length() > 50) {
- location = new Path(System.getProperty("user.home")).append(".wrtdebug");
- }
- return location.append(subdir).toOSString();
- }
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/launch/DebugConnectionJob.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.launch;
-
-import java.net.URI;
-
-import org.chromium.debug.core.model.DebugTargetImpl;
-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.sdk.ConnectionLogger;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.symbian.tools.tmw.previewer.http.IPreviewStartupListener;
-import org.symbian.tools.wrttools.debug.internal.Activator;
-
-public class DebugConnectionJob implements IPreviewStartupListener {
- static final NamedConnectionLoggerFactory NO_CONNECTION_LOGGER_FACTORY = new NamedConnectionLoggerFactory() {
- public ConnectionLogger createLogger(String title) {
- return null;
- }
- };
- private final int port;
- private final ILaunch launch;
- private final IProject project;
-
- public DebugConnectionJob(IProject project, final int port,
- final ILaunch launch) {
- if (Activator.DEBUG_CONNECTION) {
- System.out.println("Debugging " + project.getName() + " on port "
- + port + ", launch: " + launch.getLaunchConfiguration());
- }
- this.project = project;
- this.port = port;
- this.launch = launch;
- }
-
- protected ConnectionToRemote createConnectionToRemote(int port,
- ILaunch launch, URI uri) throws CoreException {
- return JavascriptVmEmbedderFactory.connectToChromeDevTools(port,
- NO_CONNECTION_LOGGER_FACTORY, new WidgetTabSelector(uri));
- }
-
- private static void terminateTarget(DebugTargetImpl target) {
- target.setDisconnected(true);
- target.fireTerminateEvent();
- }
-
- public boolean browserRunning(URI uri, String sId) throws CoreException {
- if (Activator.DEBUG_CONNECTION) {
- System.out.println("Browser running, connecting @" + hashCode());
- }
- DestructingGuard destructingGuard = new DestructingGuard();
- try {
- JavascriptVmEmbedder.ConnectionToRemote remoteServer = createConnectionToRemote(
- port, launch, uri);
- Destructable lauchDestructor = new Destructable() {
- public void destruct() {
- if (!launch.hasChildren()) {
- DebugPlugin.getDefault().getLaunchManager()
- .removeLaunch(launch);
- }
- }
- };
- if (Activator.DEBUG_CONNECTION) {
- System.out.println("Setting up 1@" + hashCode());
- }
- destructingGuard.addValue(lauchDestructor);
-
- WorkspaceBridge.Factory bridgeFactory = new WRTProjectWorkspaceBridge.Factory(
- project);
- final DebugTargetImpl target = new DebugTargetImpl(launch,
- bridgeFactory);
- if (Activator.DEBUG_CONNECTION) {
- System.out.println("Setting up 2@" + hashCode());
- }
-
- Destructable targetDestructor = new Destructable() {
- public void destruct() {
- terminateTarget(target);
- }
- };
- destructingGuard.addValue(targetDestructor);
-
- if (Activator.DEBUG_CONNECTION) {
- System.out.println("Setting up 3@" + hashCode());
- }
- boolean attached = target.attach(remoteServer, destructingGuard,
- null, new NullProgressMonitor());
- if (Activator.DEBUG_CONNECTION) {
- System.out.printf("Is attached: %b, @%d\n", attached, hashCode());
- }
- if (!attached) {
- // Error
- return false;
- }
-
- launch.addDebugTarget(target);
- launch.setAttribute("http.service.id", sId);
- // All OK
- destructingGuard.discharge();
- addResourceListenerIfNotInstalled();
- } catch (CoreException e) {
- DebugPlugin.getDefault().getLaunchManager().removeLaunch(launch);
- throw e;
- } finally {
- destructingGuard.doFinally();
- }
- return true;
- }
-
- private static boolean listenerAdded = false;
-
- private void addResourceListenerIfNotInstalled() {
- synchronized (DebugConnectionJob.class) {
- if (!listenerAdded) {
- ResourcesPlugin.getWorkspace().addResourceChangeListener(new ResourcesChangeListener());
- listenerAdded = true;
- }
- }
- }
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/launch/DebugUtil.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/**
- * 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.launch;
-
-import java.text.MessageFormat;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-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;
-
-public class DebugUtil {
- public static CoreException createCoreException(String message, Throwable exeption) {
- return new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, message, exeption));
- }
-
- public static IProject getProject(ILaunch configuration) {
- try {
- if (WidgetLaunchDelegate.ID.equals(configuration.getLaunchConfiguration().getType().getIdentifier())) {
- String projectName = configuration.getLaunchConfiguration().getAttribute(IConstants.PROP_PROJECT_NAME,
- (String) null);
- if (projectName != null) {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- if (project.isAccessible()) {
- return project;
- }
- }
- }
- } catch (CoreException e) {
- Activator.log(e);
- }
- return null;
- }
-
- public static IProject getProject(ILaunchConfiguration configuration) throws CoreException {
- if (!WidgetLaunchDelegate.ID.equals(configuration.getType().getIdentifier())) {
- return null;
- }
- String projectName = configuration.getAttribute(IConstants.PROP_PROJECT_NAME, (String) null);
- if (projectName == null) {
- throw createCoreException("Project is not selected", null);
- }
-
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- if (!project.isAccessible()) {
- throw createCoreException(MessageFormat.format("Project {0} is not opened", projectName), null);
- }
- return project;
- }
-
- public static boolean isProjectDebugged(IProject project, ILaunchManager launchManager, ILaunch l)
- throws CoreException {
- ILaunch[] launches = launchManager.getLaunches();
- for (ILaunch launch : launches) {
- ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration();
- if ((l == null || !l.equals(launch)) && !launch.isTerminated()
- && WidgetLaunchDelegate.ID.equals(launchConfiguration.getType().getIdentifier())) {
- IProject p2 = getProject(launchConfiguration);
- if (project.equals(p2)) {
- return true;
- }
- }
- }
- return false;
- }
-
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/launch/PortPolicy.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.launch;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-
-import org.symbian.tools.wrttools.debug.internal.Activator;
-
-public abstract class PortPolicy {
- // private static class ReuseSamePort extends PortPolicy {
- // private int port = -1;
- //
- // @Override
- // protected int getPort() {
- // if (port < 0) {
- // port = getOpenPort();
- // }
- // return port;
- // }
- // }
-
- private static class NewPortEachTime extends PortPolicy {
- @Override
- protected int getPort() {
- return getOpenPort();
- }
- }
-
- public static final PortPolicy INSTANCE;
- static {
- // if (CoreUtil.isMac()) {
- INSTANCE = new NewPortEachTime();
- // } else {
- // INSTANCE = new ReuseSamePort();
- // }
- }
-
- public static synchronized int getPortNumber() {
- return INSTANCE.getPort();
- }
-
- public int getOpenPort() {
- try {
- final ServerSocket socket = new ServerSocket(0);
- int port = socket.getLocalPort();
- socket.close();
- return port;
- } catch (IOException e) {
- Activator.log(e);
- return 7222;
- }
- }
-
- protected abstract int getPort();
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/launch/ResourcesChangeListener.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,234 +0,0 @@
-/**
- * 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.launch;
-
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.ResourcesPlugin;
-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.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.symbian.tools.tmw.previewer.internal.PreviewerUtil;
-import org.symbian.tools.wrttools.debug.internal.Activator;
-import org.symbian.tools.wrttools.debug.internal.IConstants;
-
-public class ResourcesChangeListener implements IResourceChangeListener {
- public void resourceChanged(IResourceChangeEvent event) {
- if (event.getDelta() != null
- && !MessageDialogWithToggle.ALWAYS.equals(Activator.getDefault().getPreferenceStore().getString(
- IConstants.PREF_SHOW_RESOURCE_CHANGE_ERROR))) {
- IFile[] changes = PreviewerUtil.getWebChanges(event.getDelta());
- if (changes.length > 0 && isWrtResourceChanges(changes)) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- String message = "Debug browser is not updated when the files are updated. You may notice discrepancies between your workspace contents and debug session. You should either refresh the browser or restart debugging session to see the latest changes made to the workspace.";
- MessageDialogWithToggle.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getShell(), "Mobile Web Debugger", message,
- "Do not show this warning on code changes", false, Activator.getDefault()
- .getPreferenceStore(), IConstants.PREF_SHOW_RESOURCE_CHANGE_ERROR);
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(ResourcesChangeListener.this);
- }
- });
- }
- }
- }
-
- private boolean isWrtResourceChanges(IFile[] changes) {
- Collection<IProject> projects = new HashSet<IProject>();
- ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
- for (ILaunch launch : launches) {
- if (!launch.isTerminated()) {
- final ILaunchConfiguration config = launch.getLaunchConfiguration();
- try {
- if (WidgetLaunchDelegate.ID.equals(config.getType().getIdentifier())) {
- String projectName = config.getAttribute(IConstants.PROP_PROJECT_NAME, (String) null);
- if (projectName != null && projectName.trim().length() > 0) {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- projects.add(project);
- }
- }
- } catch (CoreException e) {
- Activator.log(e);
- }
- }
- }
- for (IFile file : changes) {
- if (projects.contains(file.getProject())) {
- return true;
- }
- }
- return false;
- }
-
- // // TODO Progress indicator - ... files updated of ...
- //
- // public void resourceChanged(IResourceChangeEvent event) {
- // try {
- // if (event.getDelta() != null) {
- //
- // processDelta(event.getDelta());
- // } else {
- // // TODO Can't refresh
- // }
- // } catch (CoreException e) {
- // Activator.log(e);
- // }
- //
- // }
- //
- // private static final class DeltaProcessor implements IResourceDeltaVisitor {
- // private final Map<IProject, DebugTargetImpl> targets;
- // private final Map<IFile, Script> updateList = new HashMap<IFile, Script>();
- // private boolean hasUnupdatables = false;
- //
- // public DeltaProcessor(Map<IProject, DebugTargetImpl> targets) {
- // this.targets = targets;
- // }
- //
- // public boolean visit(IResourceDelta delta) throws CoreException {
- // final IResource resource = delta.getResource();
- // switch (resource.getType()) {
- // case IResource.PROJECT:
- // return targets.containsKey(resource);
- // case IResource.FILE:
- // processFile((IFile) resource, targets.get(resource.getProject()));
- // return false;
- // default:
- // return true;
- // }
- // }
- //
- // private void processFile(final IFile resource, final DebugTargetImpl debugTargetImpl) throws CoreException {
- // if (!ProjectUtils.isExcluded(resource)) {
- // final VmResource vmResource = debugTargetImpl.getVmResource(resource);
- // if (vmResource != null) {
- // updateList.put(resource, vmResource.getScript());
- // } else {
- // if (!JavaScriptCore.isJavaScriptLikeFileName(resource.getName())) {
- // hasUnupdatables = true;
- // }
- // }
- // }
- // }
- //
- // public Map<IFile, Script> getUpdateList() {
- // return updateList;
- // }
- //
- // public boolean hasUnupdatables() {
- // return hasUnupdatables;
- // }
- // }
- //
- // private void processDelta(final IResourceDelta delta) throws CoreException {
- // final ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
- // final Map<IProject, DebugTargetImpl> targets = new HashMap<IProject, DebugTargetImpl>();
- // for (ILaunch launch : launches) {
- // final IDebugTarget target = launch.getDebugTarget();
- // if (!launch.isTerminated() && target instanceof DebugTargetImpl) {
- // IProject project = DebugUtil.getProject(launch);
- // if (project != null) {
- // targets.put(project, (DebugTargetImpl) target);
- // }
- // }
- // }
- //
- // DeltaProcessor processor = new DeltaProcessor(targets);
- // delta.accept(processor);
- //
- // if (processor.getUpdateList().size() > 0) {
- // final Collection<IStatus> statuses = new LinkedList<IStatus>();
- // for (Entry<IFile, Script> entry : processor.getUpdateList().entrySet()) {
- // statuses.add(updateScript(entry.getValue(), entry.getKey()));
- // }
- // } else if (processor.hasUnupdatables()) {
- //
- // }
- // }
- //
- // private IStatus updateScript(Script script, final IFile file) {
- // UpdatableScript updatableScript = LiveEditExtension.castToUpdatableScript(script);
- //
- // if (updatableScript == null) {
- // throw new RuntimeException();
- // }
- //
- // byte[] fileData;
- // try {
- // fileData = readFileContents(file);
- // } catch (IOException e) {
- // throw new RuntimeException(e);
- // } catch (CoreException e) {
- // throw new RuntimeException(e);
- // }
- // final IStatus[] res = new IStatus[1];
- // // We are using default charset here like usually.
- // String newSource = new String(fileData);
- //
- // UpdatableScript.UpdateCallback callback = new UpdatableScript.UpdateCallback() {
- // public void success(Object report) {
- // res[0] = new Status(
- // IStatus.OK,
- // ChromiumDebugPlugin.PLUGIN_ID,
- // String.format(
- // "Script %s was successfully updated on remote: %s", file.getProjectRelativePath().toString(), report)); //$NON-NLS-1$
- // }
- //
- // public void failure(String message) {
- // res[0] = new Status(IStatus.ERROR, ChromiumDebugPlugin.PLUGIN_ID, String.format(
- // "Script %s cannot be updated: %s", file.getProjectRelativePath().toString(), message)); //$NON-NLS-1$
- // }
- // };
- //
- // updatableScript.setSourceOnRemote(newSource, callback, null);
- // return res[0];
- // }
- //
- // private static byte[] readFileContents(IFile file) throws IOException, CoreException {
- // InputStream inputStream = file.getContents();
- // try {
- // return readBytes(inputStream);
- // } finally {
- // inputStream.close();
- // }
- // }
- //
- // private static byte[] readBytes(InputStream inputStream) throws IOException {
- // ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- // byte[] array = new byte[1024];
- // while (true) {
- // int len = inputStream.read(array);
- // if (len == -1) {
- // break;
- // }
- // buffer.write(array, 0, len);
- // }
- // return buffer.toByteArray();
- // }
-
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/launch/WRTProjectWorkspaceBridge.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +0,0 @@
-package org.symbian.tools.wrttools.debug.internal.launch;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.chromium.debug.core.model.BreakpointSynchronizer.Callback;
-import org.chromium.debug.core.model.BreakpointSynchronizer.Direction;
-import org.chromium.debug.core.model.ChromiumLineBreakpoint;
-import org.chromium.debug.core.model.DebugTargetImpl;
-import org.chromium.debug.core.model.VmResource;
-import org.chromium.debug.core.model.VmResourceId;
-import org.chromium.debug.core.model.WorkspaceBridge;
-import org.chromium.sdk.CallFrame;
-import org.chromium.sdk.JavascriptVm;
-import org.chromium.sdk.JavascriptVm.ScriptsCallback;
-import org.chromium.sdk.Script;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.sourcelookup.ISourceContainer;
-import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
-import org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer;
-import org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer;
-import org.symbian.tools.wrttools.debug.internal.Activator;
-import org.symbian.tools.wrttools.debug.internal.model.ResourceManager;
-import org.symbian.tools.wrttools.debug.internal.model.WorkspaceBreakpointHandler;
-
-public class WRTProjectWorkspaceBridge implements WorkspaceBridge {
- public static final class Factory implements WorkspaceBridge.Factory {
- private final IProject project;
-
- public Factory(IProject project) {
- this.project = project;
- }
-
- public WorkspaceBridge attachedToVm(DebugTargetImpl debugTargetImpl, JavascriptVm javascriptVm) {
- return new WRTProjectWorkspaceBridge(debugTargetImpl, javascriptVm, project);
- }
-
- public String getDebugModelIdentifier() {
- return DEBUG_MODEL_ID;
- }
-
- public JsLabelProvider getLabelProvider() {
- return new WrtLabelProvider();
- }
- }
-
- public final static String DEBUG_MODEL_ID = "org.symbian.debug";
-
- private final BreakpointHandler breakpointHandler;
- private final JavascriptVm javascriptVm;
- private final IProject project;
- private final ResourceManager resourceManager;
-
- public WRTProjectWorkspaceBridge(DebugTargetImpl debugTargetImpl, JavascriptVm javascriptVm, IProject project) {
- this.javascriptVm = javascriptVm;
- this.project = project;
- this.resourceManager = new ResourceManager();
- this.sourceLocator = new WebApplicationSourceLocator(resourceManager);
- breakpointHandler = new WorkspaceBreakpointHandler(debugTargetImpl, resourceManager);
- ILaunch launch = debugTargetImpl.getLaunch();
- try {
- sourceLocator.initializeDefaults(launch.getLaunchConfiguration());
- sourceLocator.setSourceContainers(new ISourceContainer[] { new ProjectSourceContainer(project, false),
- new DirectorySourceContainer(Activator.getDefault().getStateLocation(), true) });
- } catch (CoreException e) {
- throw new RuntimeException(e);
- }
- launch.setSourceLocator(sourceLocator);
- }
-
- public void beforeDetach() {
- // Do nothing
- }
-
- public BreakpointHandler getBreakpointHandler() {
- return breakpointHandler;
- }
-
- public void handleVmResetEvent() {
- resourceManager.clear();
- }
-
- public void launchRemoved() {
- // Do nothing
- }
-
- public void reloadScriptsAtStart() {
- javascriptVm.getScripts(new ScriptsCallback() {
- public void failure(String errorMessage) {
- Activator.log(errorMessage);
- }
-
- public void success(Collection<Script> scripts) {
- if (!javascriptVm.isAttached()) {
- return;
- }
- for (Script script : scripts) {
- resourceManager.addScript(script);
- }
-
- IMarker[] markers;
- try {
- markers = project.findMarkers(ChromiumLineBreakpoint.BREAKPOINT_MARKER, true,
- IResource.DEPTH_INFINITE);
- Collection<ChromiumLineBreakpoint> breakpoints = new ArrayList<ChromiumLineBreakpoint>(
- markers.length);
- for (IMarker marker : markers) {
- // If it is not ChromiumLineBreakpoint -
- // something's gone horribly wrong. Better get
- // ClassCastException
- ChromiumLineBreakpoint breakpoint = (ChromiumLineBreakpoint) DebugPlugin.getDefault()
- .getBreakpointManager().getBreakpoint(marker);
- breakpointHandler.breakpointAdded(breakpoint);
- breakpoints.add(breakpoint);
- }
- } catch (CoreException e) {
- Activator.log(e);
- }
-
- }
- });
- }
-
- public void scriptLoaded(Script newScript) {
- 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;
- }
-
- private final ISourceLookupDirector sourceLocator;
-
- public VmResource findVmResourceFromWorkspaceFile(IFile file) throws CoreException {
- return new VmResourceImpl(resourceManager.findVmResource(file), resourceManager.getScript(file), file.getName());
- }
-
- private static final class VmResourceImpl implements VmResource {
- private final String name;
- private final Script script;
- private final VmResourceId id;
-
- public VmResourceImpl(VmResourceId id, Script script, String name) {
- super();
- this.id = id;
- this.script = script;
- this.name = name;
- }
-
- public VmResourceId getId() {
- return id;
- }
-
- public Script getScript() {
- return script;
- }
-
- public String getFileName() {
- return name;
- }
-
- }
-
- public void reloadScript(Script script) {
- System.out.println(script);
-
- }
-
- public void synchronizeBreakpoints(Direction direction, Callback callback) {
- System.out.println(direction);
-
- }
-
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/launch/WebApplicationSourceLocator.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/**
- * 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.launch;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.chromium.debug.core.model.StackFrame;
-import org.chromium.sdk.Script;
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.model.ISourceLocator;
-import org.eclipse.debug.core.model.IStackFrame;
-import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
-import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant;
-import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
-import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
-import org.symbian.tools.tmw.previewer.PreviewerPlugin;
-import org.symbian.tools.tmw.previewer.http.WebappManager;
-import org.symbian.tools.wrttools.debug.internal.Activator;
-import org.symbian.tools.wrttools.debug.internal.model.ResourceManager;
-
-public final class WebApplicationSourceLocator extends AbstractSourceLookupDirector implements ISourceLocator,
- ISourceLookupDirector {
- public static final class WebApplicationSourceLookupParticipant extends AbstractSourceLookupParticipant {
- private final ResourceManager resourceManager;
- private final WebApplicationSourceLocator locator;
-
- public WebApplicationSourceLookupParticipant(WebApplicationSourceLocator locator,
- ResourceManager resourceManager) {
- this.locator = locator;
- this.resourceManager = resourceManager;
- }
-
- public String getSourceName(Object object) throws CoreException {
- Script script = null;
- if (object instanceof StackFrame) {
- script = ((StackFrame) object).getCallFrame().getScript();
- } else if (object instanceof Script) {
- script = (Script) object;
- } else {
- System.out.println("Source lookup request for " + object.getClass());
- }
- if (script != null) {
- IFile resource = resourceManager.getResource(script);
- if (resource != null) {
- return resource.getProjectRelativePath().toString();
- } else {
- return locator.fileUrl(script);
- }
- }
- return null;
- }
- }
-
- private final ResourceManager resourceManager;
-
- public WebApplicationSourceLocator(ResourceManager resourceManager) {
- this.resourceManager = resourceManager;
- }
-
- public String fileUrl(Script script) throws CoreException {
- String name = script.getName();
- try {
- URI uri = new URI(name);
- if ("http".equals(uri.getScheme()) && WebappManager.getHost().equals(uri.getHost())
- && WebappManager.getPort() == uri.getPort()) {
- final IPath stateLocation = Activator.getDefault().getStateLocation();
- final IPath path = stateLocation.append("systemlibraries")
- .append(new Path(uri.getPath()).lastSegment());
- final File file = path.toFile();
- file.getParentFile().mkdirs();
- final String source = script.getSource();
- final BufferedWriter writer = new BufferedWriter(new FileWriter(file));
- try {
- writer.write(source);
- } finally {
- writer.close();
- }
- return new Path(file.getParentFile().getName()).append(file.getName()).toString();
- }
- } catch (URISyntaxException e) {
- throw new RuntimeException(e);
- } catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
- "Cannot load web runtime system libraries", e));
- }
- return null;
- }
-
- public Object getSourceElement(IStackFrame stackFrame) {
- if (stackFrame instanceof StackFrame == false) {
- return null;
- }
- StackFrame jsStackFrame = (StackFrame) stackFrame;
-
- Script script = jsStackFrame.getCallFrame().getScript();
- if (script == null) {
- return null;
- }
-
- IFile resource = resourceManager.getResource(script);
- if (resource != null) {
- return resource;
- } else {
- File file = PreviewerPlugin.getDefault().getHttpPreviewer().getLocalFile(script.getName());
- if (file != null) {
- try {
- return EFS.getStore(file.toURI());
- } catch (CoreException e) {
- Activator.log(e);
- }
- }
- }
- return null;
- }
-
- public void initializeParticipants() {
- addParticipants(new ISourceLookupParticipant[] { new WebApplicationSourceLookupParticipant(this,
- resourceManager) });
- }
-}
\ No newline at end of file
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/launch/WidgetLaunchDelegate.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.launch;
-
-import java.net.URI;
-import java.text.MessageFormat;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-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.eclipse.debug.core.model.ILaunchConfigurationDelegate;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.symbian.tools.tmw.previewer.PreviewerPlugin;
-import org.symbian.tools.wrttools.debug.internal.Activator;
-
-public class WidgetLaunchDelegate implements ILaunchConfigurationDelegate {
- public static final String ID = "org.symbian.tools.wrttools.debug.widget";
-
- public void launch(ILaunchConfiguration configuration, String mode, final ILaunch launch, IProgressMonitor monitor)
- throws CoreException {
- monitor.beginTask("Preparing Mobile Web Debugger", IProgressMonitor.UNKNOWN);
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- final IWorkbench workbench = PlatformUI.getWorkbench();
- final IWorkbenchWindow window = workbench.getWorkbenchWindows()[0];
- final boolean[] retvalue = new boolean[1];
- window.getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- retvalue[0] = workbench.saveAllEditors(true);
- }
- });
- if (!retvalue[0]) {
- launchManager.removeLaunch(launch);
- return;
- }
- boolean debug = mode.equals(ILaunchManager.DEBUG_MODE);
- try {
- // 1. Load all parameters
- IProject project = DebugUtil.getProject(configuration);
- if (DebugUtil.isProjectDebugged(project, launchManager, launch)) {
- throw DebugUtil.createCoreException(MessageFormat.format("Project {0} is already running.", project.getName()),
- null);
- }
-
- int port = PortPolicy.getPortNumber();
- final URI uri = prepareDebugger(project, debug, launch, port);
-
- Activator.getDefault().getChromeInstancesManager().startChrome(launch, port, uri.toASCIIString());
- } catch (CoreException e) {
- launchManager.removeLaunch(launch);
- throw e;
- }
- if (!debug) {
- launchManager.removeLaunch(launch);
- }
- monitor.done();
- }
-
- private URI prepareDebugger(IProject project, boolean debug, final ILaunch launch, final int port) {
- DebugConnectionJob job = null;
- if (debug) {
- job = new DebugConnectionJob(project, port, launch);
- }
- return PreviewerPlugin.getDefault().getHttpPreviewer().previewProject(project, job);
- }
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/launch/WidgetTabSelector.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.launch;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import org.chromium.debug.core.model.TabSelector;
-import org.chromium.sdk.Browser.TabConnector;
-import org.chromium.sdk.Browser.TabFetcher;
-
-public class WidgetTabSelector implements TabSelector {
- private final URI uri;
- private TabConnector connector;
-
- public WidgetTabSelector(URI uri) {
- this.uri = uri;
- }
-
- public TabConnector selectTab(TabFetcher tabFetcher) throws IOException {
- // Give it time to start the process/tab. 5 retries, 500 ms inbetween.
- for (int i = 0; i < 5; i++) {
- List<? extends TabConnector> tabs = tabFetcher.getTabs();
- for (TabConnector tabConnector : tabs) {
- String url = tabConnector.getUrl();
- try {
- if (uri.toURL().equals(new URL(url))) {
- connector = tabConnector;
- return tabConnector;
- }
- } catch (MalformedURLException e) {
- // Ignore - fails because of "chrome" protocol, we should ignore these tabs anyways
- }
- }
- }
- return null;
- }
-
- public TabConnector getConnector() {
- return connector;
- }
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/launch/WrtLabelProvider.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-package org.symbian.tools.wrttools.debug.internal.launch;
-
-import org.chromium.debug.core.model.DebugTargetImpl;
-import org.chromium.debug.core.model.JavascriptThread;
-import org.chromium.debug.core.model.Messages;
-import org.chromium.debug.core.model.StackFrame;
-import org.chromium.debug.core.model.WorkspaceBridge.JsLabelProvider;
-import org.chromium.sdk.CallFrame;
-import org.chromium.sdk.DebugContext;
-import org.chromium.sdk.ExceptionData;
-import org.chromium.sdk.Script;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.osgi.util.NLS;
-
-public class WrtLabelProvider implements JsLabelProvider {
-
- public String getStackFrameLabel(StackFrame stackFrame) throws DebugException {
- CallFrame callFrame = stackFrame.getCallFrame();
- String name = callFrame.getFunctionName();
- Script script = callFrame.getScript();
- if (script == null) {
- return "<unknown>";
- }
- Object element = stackFrame.getLaunch().getSourceLocator().getSourceElement(stackFrame);
- if (element instanceof IFile) {
- IFile resource = (IFile) element;
- int line = script.getStartLine() + stackFrame.getLineNumber();
- if (line != -1) {
- String resourcePath = resource != null ? resource.getProjectRelativePath().toString() : script
- .getName();
- name = NLS.bind("{0} [{1}:{2}]", new Object[] { name, resourcePath, line });
- }
- } else if (element instanceof IFileStore) {
- return "(WRT System Library)";
- }
- return name;
- }
-
- public String getTargetLabel(DebugTargetImpl debugTarget) throws DebugException {
- return "WRT Runtime";
- }
-
- public String getThreadLabel(JavascriptThread thread) throws DebugException {
- return NLS.bind("JavaScript Thread ({0})", getThreadStateLabel(thread));
- }
-
- private String getThreadStateLabel(JavascriptThread thread) {
- if (thread.isSuspended()) {
- DebugContext context = thread.getDebugTarget().getDebugContext();
- ExceptionData exceptionData = context.getExceptionData();
- if (exceptionData != null) {
- return NLS.bind(Messages.JsThread_ThreadLabelSuspendedExceptionFormat,
- exceptionData.getExceptionMessage());
- } else {
- return Messages.JsThread_ThreadLabelSuspended;
- }
- } else {
- return Messages.JsThread_ThreadLabelRunning;
- }
- }
-
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/model/JsWatchExpressionDelegate.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.symbian.tools.wrttools.debug.internal.model;
-
-import org.chromium.debug.core.model.DebugElementImpl;
-import org.chromium.debug.core.model.EvaluateContext;
-import org.chromium.debug.core.model.Variable;
-import org.chromium.sdk.JsEvaluateContext;
-import org.chromium.sdk.JsVariable;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IDebugElement;
-import org.eclipse.debug.core.model.IValue;
-import org.eclipse.debug.core.model.IWatchExpressionDelegate;
-import org.eclipse.debug.core.model.IWatchExpressionListener;
-import org.eclipse.debug.core.model.IWatchExpressionResult;
-import org.symbian.tools.wrttools.debug.internal.Activator;
-
-/**
- * Performs the Watch expression evaluation while debugging Chromium JavaScript.
- */
-public class JsWatchExpressionDelegate implements IWatchExpressionDelegate {
-
- private static final String[] EMPTY_STRINGS = new String[0];
-
- private static final class GoodWatchExpressionResult implements IWatchExpressionResult {
-
- private final Variable variable;
-
- private final String expression;
-
- private IValue value;
-
- private DebugException exception;
-
- private GoodWatchExpressionResult(Variable variable, String expression) {
- this.variable = variable;
- this.expression = expression;
- }
-
- public String[] getErrorMessages() {
- return exception == null
- ? EMPTY_STRINGS
- : new String[] { exception.getStatus().getMessage() };
- }
-
- public DebugException getException() {
- getValue();
- return exception;
- }
-
- public String getExpressionText() {
- return expression;
- }
-
- public synchronized IValue getValue() {
- if (value == null && exception == null) {
- try {
- value = variable.getValue();
- } catch (DebugException e) {
- this.exception = e;
- }
- }
- return value;
- }
-
- public boolean hasErrors() {
- getValue();
- return exception != null;
- }
- }
-
- private static final class BadWatchExpressionResult implements IWatchExpressionResult {
-
- private final DebugException exception;
-
- private final String expressionText;
-
- private BadWatchExpressionResult(DebugException exception, String expressionText) {
- this.exception = exception;
- this.expressionText = expressionText;
- }
-
- public String[] getErrorMessages() {
- return new String[] { exception.getStatus().getMessage() };
- }
-
- public DebugException getException() {
- return exception;
- }
-
- public String getExpressionText() {
- return expressionText;
- }
-
- public IValue getValue() {
- return null;
- }
-
- public boolean hasErrors() {
- return true;
- }
- }
-
- public void evaluateExpression(final String expression, final IDebugElement context,
- final IWatchExpressionListener listener) {
- final DebugElementImpl contextImpl = (DebugElementImpl) context;
- if (!contextImpl.getDebugTarget().isSuspended()) {
- // can only evaluate while suspended. Notify empty result.
- listener.watchEvaluationFinished(new IWatchExpressionResult() {
-
- public String[] getErrorMessages() {
- return EMPTY_STRINGS;
- }
-
- public DebugException getException() {
- return null;
- }
-
- public String getExpressionText() {
- return expression;
- }
-
- public IValue getValue() {
- return null;
- }
-
- public boolean hasErrors() {
- return false;
- }
- });
- return;
- }
-
- final EvaluateContext evaluateContext =
- (EvaluateContext) contextImpl.getAdapter(EvaluateContext.class);
- if (evaluateContext == null) {
- listener.watchEvaluationFinished(new BadWatchExpressionResult(
- new DebugException(
- new Status(Status.ERROR, Activator.PLUGIN_ID, "Bad debug context")), //$NON-NLS-1$
- expression));
- return;
- }
-
- evaluateContext.getJsEvaluateContext().evaluateAsync(
- expression,
- new JsEvaluateContext.EvaluateCallback() {
- public void success(JsVariable variable) {
- final Variable var = new Variable(contextImpl.getDebugTarget(), variable, false);
- listener.watchEvaluationFinished(new GoodWatchExpressionResult(var, expression));
- }
-
- public void failure(String message) {
- listener.watchEvaluationFinished(new BadWatchExpressionResult(new DebugException(
- createErrorStatus(message == null
- ? "Error evaluating expression"
- : message, null)), expression));
- return;
- }
- },
- null);
- }
-
- private static Status createErrorStatus(String message, Exception e) {
- return new Status(Status.ERROR, Activator.PLUGIN_ID, message, e);
- }
-
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/model/ResourceManager.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.symbian.tools.wrttools.debug.internal.model;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.chromium.debug.core.model.VmResourceId;
-import org.chromium.sdk.Script;
-import org.eclipse.core.resources.IFile;
-import org.symbian.tools.tmw.previewer.PreviewerPlugin;
-
-/**
- * This object handles the mapping between {@link Script}s and their
- * corresponding resources inside Eclipse.
- */
-public class ResourceManager {
- private final Map<IFile, Script> resourceToScript = new HashMap<IFile, Script>();
- private final Map<VmResourceId, IFile> scriptIdToResource = new HashMap<VmResourceId, IFile>();
-
- public synchronized void addScript(Script script) {
- IFile scriptFile = getResource(script);
- if (scriptFile == null) {
- scriptFile = getFile(script.getName());
- if (scriptFile != null) {
- VmResourceId scriptId = VmResourceId.forScript(script);
- resourceToScript.put(scriptFile, script);
- scriptIdToResource.put(scriptId, scriptFile);
- }
- }
- }
-
- public synchronized void clear() {
- resourceToScript.clear();
- scriptIdToResource.clear();
- }
-
- private IFile getFile(String name) {
- if (name == null) {
- return null;
- }
- IFile file = PreviewerPlugin.getDefault().getHttpPreviewer().getFileFromUrl(name);
- if (file != null && !file.isAccessible()) {
- file = null;
- }
- return file;
- }
-
- public synchronized IFile getResource(Script script) {
- return scriptIdToResource.get(VmResourceId.forScript(script));
- }
-
- public synchronized boolean scriptHasResource(Script script) {
- return getResource(script) != null;
- }
-
- public String translateResourceToScript(IFile resource) {
- return PreviewerPlugin.getDefault().getHttpPreviewer().getHttpUrl(resource);
- }
-
- public VmResourceId findVmResource(IFile resource) {
- Script script = resourceToScript.get(resource);
- return script != null ? VmResourceId.forScript(script) : null;
- }
-
- public Script getScript(IFile file) {
- return resourceToScript.get(file);
- }
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/model/SymbianDebugModelPresentation.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-package org.symbian.tools.wrttools.debug.internal.model;
-
-import java.util.Collection;
-
-import org.chromium.debug.core.model.Value;
-import org.chromium.sdk.JsValue;
-import org.chromium.sdk.JsVariable;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.core.model.ILineBreakpoint;
-import org.eclipse.debug.core.model.IValue;
-import org.eclipse.debug.ui.IDebugModelPresentation;
-import org.eclipse.debug.ui.IValueDetailListener;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.ide.FileStoreEditorInput;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.wst.jsdt.core.JavaScriptCore;
-import org.eclipse.wst.jsdt.internal.ui.javaeditor.JarEntryEditorInput;
-import org.eclipse.wst.jsdt.ui.JavaScriptUI;
-
-@SuppressWarnings("restriction")
-public class SymbianDebugModelPresentation extends LabelProvider implements
- IDebugModelPresentation {
- private static final int DETAILS_DEPTH = 2;
-
- public void setAttribute(String attribute, Object value) {
- }
-
- @Override
- public Image getImage(Object element) {
- // use default image
- return null;
- }
-
- @Override
- public String getText(Object element) {
- // use default label text
- return null;
- }
-
- public void computeDetail(IValue value, IValueDetailListener listener) {
- String detail = ""; //$NON-NLS-1$
- if (value instanceof Value) {
- // Avoid quoting string JavaScript values by getting the value
- // string
- // from the underlying JsValue.
- final JsValue jsValue = ((Value) value).getJsValue();
- detail = printJSON(jsValue, 0);
- }
-
- listener.detailComputed(value, detail);
- }
-
- private String printJSON(final JsValue value, int depth) {
- if (depth < DETAILS_DEPTH) {
- switch (value.getType()) {
- case TYPE_OBJECT:
- return printObject(value, depth);
- case TYPE_ARRAY:
- return printArray(value, depth);
- }
- }
- if (depth > 0) {
- if (value.getType() == JsValue.Type.TYPE_STRING) {
- return "\"" + value.getValueString() + "\"";
- }
- }
- return value.getValueString();
- }
-
- private String printArray(JsValue value, int depth) {
- final StringBuilder builder = new StringBuilder("{ ");
- String sep = "";
-
- Collection<? extends JsVariable> properties = value.asObject().asArray().toSparseArray().values();
-
- for (JsVariable jsVariable : properties) {
- builder.append(sep).append(printJSON(jsVariable.getValue(), depth + 1));
- sep = ", ";
- }
-
- builder.append(" }");
- return builder.toString();
- }
-
- private String printObject(final JsValue value, final int depth) {
- final StringBuilder builder = new StringBuilder("{ ");
-
- String sep = "";
-
- Collection<? extends JsVariable> properties = value.asObject().getProperties();
- for (JsVariable jsVariable : properties) {
- builder.append(sep).append(jsVariable.getName()).append(" : ");
- builder.append(printJSON(jsVariable.getValue(), depth + 1));
- sep = ", ";
- }
-
- builder.append(" }");
- return builder.toString();
- }
-
- public IEditorInput getEditorInput(Object element) {
- return toEditorInput(element);
- }
-
- public static IEditorInput toEditorInput(Object element) {
- if (element instanceof IFile) {
- return new FileEditorInput((IFile) element);
- }
- if (element instanceof IFileStore) {
- return new FileStoreEditorInput((IFileStore) element);
- }
- if (element instanceof IStorage) {
- return new JarEntryEditorInput((IStorage) element);
- }
-
- if (element instanceof ILineBreakpoint) {
- return new FileEditorInput((IFile) ((ILineBreakpoint) element)
- .getMarker().getResource());
- }
-
- return null;
- }
-
- public String getEditorId(IEditorInput input, Object element) {
- if (input instanceof IFileEditorInput) {
- IFile file;
- if (element instanceof IFile) {
- file = (IFile) element;
- } else if (element instanceof IBreakpoint) {
- IBreakpoint breakpoint = (IBreakpoint) element;
- IResource resource = breakpoint.getMarker().getResource();
- // Can the breakpoint resource be folder or project? Better
- // check for it.
- if (resource instanceof IFile == false) {
- return null;
- }
- file = (IFile) resource;
- } else {
- return null;
- }
-
- // Pick the editor based on the file extension, taking user
- // preferences into account.
- try {
- return IDE.getEditorDescriptor(file).getId();
- } catch (PartInitException e) {
- // TODO(peter.rybin): should it really be the default case?
- // There might be no virtual project.
- return null;
- }
- } else {
- if (element instanceof IStorage) {
- IStorage store = (IStorage) element;
- if (JavaScriptCore.isJavaScriptLikeFileName(store.getName())) {
- return JavaScriptUI.ID_CU_EDITOR;
- } else {
- return "org.eclipse.wst.html.core.htmlsource.source";
- }
- }
- }
- return null;
- }
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/model/WorkspaceBreakpointHandler.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/**
- *
- */
-package org.symbian.tools.wrttools.debug.internal.model;
-
-import java.util.Collection;
-
-import org.chromium.debug.core.ChromiumDebugPlugin;
-import org.chromium.debug.core.model.BreakpointMap;
-import org.chromium.debug.core.model.BreakpointSynchronizer.BreakpointHelper.CreateCallback;
-import org.chromium.debug.core.model.ChromiumLineBreakpoint;
-import org.chromium.debug.core.model.DebugTargetImpl;
-import org.chromium.debug.core.model.VProjectWorkspaceBridge;
-import org.chromium.debug.core.model.VmResourceId;
-import org.chromium.debug.core.model.WorkspaceBridge.BreakpointHandler;
-import org.chromium.sdk.Breakpoint;
-import org.chromium.sdk.JavascriptVm;
-import org.chromium.sdk.SyncCallback;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarkerDelta;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.symbian.tools.tmw.previewer.PreviewerPlugin;
-import org.symbian.tools.wrttools.debug.internal.launch.WRTProjectWorkspaceBridge;
-
-public final class WorkspaceBreakpointHandler implements BreakpointHandler {
- private final BreakpointMap.InTargetMap breakpointInTargetMap = new BreakpointMap.InTargetMap();
- private final DebugTargetImpl debugTarget;
- private final ResourceManager resourceManager;
-
- public WorkspaceBreakpointHandler(DebugTargetImpl debugTarget, ResourceManager resourceManager) {
- this.debugTarget = debugTarget;
- // this.vm = vm;
- this.resourceManager = resourceManager;
- }
-
- public void breakpointAdded(IBreakpoint breakpoint) {
- ChromiumLineBreakpoint lineBreakpoint = tryCastBreakpoint(breakpoint);
- if (lineBreakpoint == null) {
- return;
- }
- if (ChromiumLineBreakpoint.getIgnoreList().contains(breakpoint)) {
- return;
- }
- if (!lineBreakpoint.isEnabled()) {
- return;
- }
- IFile file = (IFile) lineBreakpoint.getMarker().getResource();
- VmResourceId vmResourceId;
- try {
- vmResourceId = findVmResourceIdFromWorkspaceFile(file);
- } catch (CoreException e) {
- ChromiumDebugPlugin.log(new Exception("Failed to resolve script for the file " + file, e)); //$NON-NLS-1$
- return;
- }
- if (vmResourceId == null) {
- // Might be a script from a different debug target
- return;
- }
- createBreakpointOnRemote(lineBreakpoint, vmResourceId, null, null);
- }
-
- public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
- ChromiumLineBreakpoint lineBreakpoint = tryCastBreakpoint(breakpoint);
- if (lineBreakpoint == null) {
- return;
- }
- if (ChromiumLineBreakpoint.getIgnoreList().contains(lineBreakpoint)) {
- return;
- }
- Breakpoint sdkBreakpoint = breakpointInTargetMap.getSdkBreakpoint(lineBreakpoint);
- if (sdkBreakpoint == null) {
- return;
- }
-
- try {
- ChromiumLineBreakpoint.Helper.updateOnRemote(sdkBreakpoint, lineBreakpoint);
- } catch (RuntimeException e) {
- ChromiumDebugPlugin.log(new Exception("Failed to change breakpoint in " + //$NON-NLS-1$
- getTargetNameSafe(), e));
- }
-
- }
-
- public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
- ChromiumLineBreakpoint lineBreakpoint = tryCastBreakpoint(breakpoint);
- if (lineBreakpoint == null) {
- return;
- }
- if (ChromiumLineBreakpoint.getIgnoreList().contains(lineBreakpoint)) {
- return;
- }
-
- Breakpoint sdkBreakpoint = breakpointInTargetMap.getSdkBreakpoint(lineBreakpoint);
- if (sdkBreakpoint == null) {
- return;
- }
-
- try {
- if (!breakpoint.isEnabled()) {
- return;
- }
- } catch (CoreException e) {
- ChromiumDebugPlugin.log(e);
- return;
- }
- JavascriptVm.BreakpointCallback callback = new JavascriptVm.BreakpointCallback() {
- public void failure(String errorMessage) {
- ChromiumDebugPlugin.log(new Exception("Failed to remove breakpoint in " + //$NON-NLS-1$
- getTargetNameSafe() + ": " + errorMessage)); //$NON-NLS-1$
- }
-
- public void success(Breakpoint breakpoint) {
- }
- };
- try {
- sdkBreakpoint.clear(callback, null);
- } catch (RuntimeException e) {
- ChromiumDebugPlugin.log(new Exception("Failed to remove breakpoint in " + //$NON-NLS-1$
- getTargetNameSafe(), e));
- }
- breakpointInTargetMap.remove(lineBreakpoint);
- }
-
- public void breakpointsHit(Collection<? extends Breakpoint> breakpointsHit) {
- if (breakpointsHit.isEmpty()) {
- return;
- }
-
- for (Breakpoint sdkBreakpoint : breakpointsHit) {
- ChromiumLineBreakpoint uiBreakpoint = breakpointInTargetMap.getUiBreakpoint(sdkBreakpoint);
- if (uiBreakpoint != null) {
- uiBreakpoint.setIgnoreCount(-1); // reset ignore count as we've hit it
- }
- }
- }
-
- public void createBreakpointOnRemote(final ChromiumLineBreakpoint lineBreakpoint, final VmResourceId vmResourceId,
- final CreateCallback createCallback, SyncCallback syncCallback) {
- try {
- ChromiumLineBreakpoint.Helper.CreateOnRemoveCallback callback = new ChromiumLineBreakpoint.Helper.CreateOnRemoveCallback() {
- public void failure(String errorMessage) {
- if (createCallback == null) {
- ChromiumDebugPlugin.logError(errorMessage);
- } else {
- createCallback.failure(new Exception(errorMessage));
- }
- }
-
- public void success(Breakpoint breakpoint) {
- breakpointInTargetMap.add(breakpoint, lineBreakpoint);
- if (createCallback != null) {
- createCallback.success();
- }
- }
- };
-
- ChromiumLineBreakpoint.Helper.createOnRemote(lineBreakpoint, vmResourceId, debugTarget, callback,
- syncCallback);
- } catch (CoreException e) {
- ChromiumDebugPlugin.log(new Exception("Failed to create breakpoint in " + //$NON-NLS-1$
- getTargetNameSafe(), e));
- }
- }
-
- private VmResourceId findVmResourceIdFromWorkspaceFile(IFile resource) throws CoreException {
- return VmResourceId.forName(PreviewerPlugin.getDefault().getHttpPreviewer().getHttpUrl(resource));
- }
-
- private String getTargetNameSafe() {
- try {
- return debugTarget.getLaunch().getLaunchConfiguration().getName();
- } catch (RuntimeException e) {
- return "<unknown>"; //$NON-NLS-1$
- }
- }
-
- public boolean supportsBreakpoint(IBreakpoint breakpoint) {
- return (WRTProjectWorkspaceBridge.DEBUG_MODEL_ID.equals(breakpoint
- .getModelIdentifier()) || VProjectWorkspaceBridge.DEBUG_MODEL_ID
- .equals(breakpoint.getModelIdentifier()))
- && !debugTarget.isDisconnected();
- }
-
- public ChromiumLineBreakpoint tryCastBreakpoint(IBreakpoint breakpoint) {
- if (!supportsBreakpoint(breakpoint)) {
- return null;
- }
- if (breakpoint instanceof ChromiumLineBreakpoint == false) {
- return null;
- }
- return (ChromiumLineBreakpoint) breakpoint;
- }
-
-}
\ No newline at end of file
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/property/LaunchableFactory.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-package org.symbian.tools.wrttools.debug.internal.property;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-
-public class LaunchableFactory implements IAdapterFactory {
-
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- // It is only needed to exist
- return null;
- }
-
- @SuppressWarnings("rawtypes")
- public Class[] getAdapterList() {
- // It is only needed to exist
- return null;
- }
-
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/property/PropertyTester.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.property;
-
-import org.eclipse.core.resources.IResource;
-import org.symbian.tools.wrttools.util.ProjectUtils;
-
-public class PropertyTester extends org.eclipse.core.expressions.PropertyTester {
-
- public boolean test(Object receiver, String property, Object[] args,
- Object expectedValue) {
- if (property.equals("isWrtProject")) {
- return ProjectUtils.hasWrtNature(((IResource) receiver).getProject());
- }
- return false;
- }
-
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/internal/session/TerminateSession.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/**
- * 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.tmw.previewer.IPreviewerCommandHandler;
-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;
-
-public class TerminateSession implements IPreviewerCommandHandler {
- @SuppressWarnings("rawtypes")
- 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/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/ui/DebugPreferencePage.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.ui;
-
-import java.io.File;
-
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.jface.preference.DirectoryFieldEditor;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.StringFieldEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.symbian.tools.wrttools.debug.internal.Activator;
-import org.symbian.tools.wrttools.debug.internal.ChromeDebugUtils;
-import org.symbian.tools.wrttools.debug.internal.IConstants;
-
-public class DebugPreferencePage extends FieldEditorPreferencePage implements
- IWorkbenchPreferencePage {
-
- private Button check;
-
- public DebugPreferencePage() {
- super(GRID);
- setPreferenceStore(Activator.getDefault().getPreferenceStore());
- setDescription("Mobile Web debugger settings");
- }
-
- @Override
- protected void createFieldEditors() {
- DirectoryFieldEditor editor = new DirectoryFieldEditor(IConstants.PREF_NAME_CHROME_LOCATION,
- "Chrome Install Location:",
- getFieldEditorParent()) {
- @Override
- protected boolean doCheckState() {
- if (super.doCheckState()) {
- String message = validate(getStringValue());
- setErrorMessage(message);
- return message == null;
- } else {
- return false;
- }
- }
- };
- editor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
- editor.setEmptyStringAllowed(false);
- addField(editor);
-
- check = new Button(getFieldEditorParent(), SWT.CHECK);
- check.setText("Show warning dialog when resources in the debugged project were changed");
- check.setLayoutData(new GridData(GridData.BEGINNING, GridData.END, false, false, 3, 1));
-
- check.setSelection(!MessageDialogWithToggle.ALWAYS.equals(getPreferenceStore().getString(
- IConstants.PREF_SHOW_RESOURCE_CHANGE_ERROR)));
- }
-
-
- protected String validate(String newValue) {
- String error = null;
- if (newValue == null || newValue.trim().length() == 0) {
- error = "Chrome install location is not specified";
- } else if (!new File(newValue).exists()) {
- error = String.format("%s does not exist", newValue);
- } else if (ChromeDebugUtils.getExecutablePath(newValue) == null) {
- error = String.format("%s does not contain Chrome executable", newValue);
- }
- return error;
- }
-
- @Override
- protected void performDefaults() {
- super.performDefaults();
- check.setSelection(false);
- }
-
- @Override
- public boolean performOk() {
- if (check.getSelection()) {
- getPreferenceStore().setToDefault(IConstants.PREF_SHOW_RESOURCE_CHANGE_ERROR);
- } else {
- getPreferenceStore().setValue(IConstants.PREF_SHOW_RESOURCE_CHANGE_ERROR, MessageDialogWithToggle.ALWAYS);
- }
- return super.performOk();
- }
-
- public void init(IWorkbench workbench) {
- // Do nothing
- }
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/ui/actions/DebugAction.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/**
- * 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.ui.actions;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.debug.internal.ui.actions.DebugLastAction;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.symbian.tools.wrttools.util.ProjectUtils;
-
-@SuppressWarnings("restriction")
-public class DebugAction extends DebugLastAction {
- @Override
- public void run(IAction action) {
- boolean hasWrtProjects = false;
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- for (IProject project : projects) {
- if (project.isAccessible() && ProjectUtils.hasWrtNature(project)) {
- hasWrtProjects = true;
- break;
- }
- }
- if (hasWrtProjects) {
- super.run(action);
- } else {
- MessageDialog.openInformation(getShell(), "Cannot launch debugger",
- "There are no open projects in your workspace");
- }
- }
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/ui/actions/JsBreakpointPropertiesRulerAction.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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:
- *******************************************************************************/
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.symbian.tools.wrttools.debug.ui.actions;
-
-import org.chromium.debug.core.model.ChromiumLineBreakpoint;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.ui.actions.RulerBreakpointAction;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.IUpdate;
-
-/**
- * Action to bring up the breakpoint properties dialog.
- */
-public class JsBreakpointPropertiesRulerAction extends RulerBreakpointAction
- implements IUpdate {
- private IBreakpoint breakpoint;
-
- public JsBreakpointPropertiesRulerAction(ITextEditor editor,
- IVerticalRulerInfo rulerInfo) {
- super(editor, rulerInfo);
- setText("Breakpoint Properties...");
- }
-
- @Override
- public void run() {
- if (getBreakpoint() != null) {
- PropertyDialogAction action = new PropertyDialogAction(getEditor()
- .getEditorSite(), new ISelectionProvider() {
- public void addSelectionChangedListener(
- ISelectionChangedListener listener) {
- }
-
- public ISelection getSelection() {
- return new StructuredSelection(getBreakpoint());
- }
-
- public void removeSelectionChangedListener(
- ISelectionChangedListener listener) {
- }
-
- public void setSelection(ISelection selection) {
- }
- });
- action.run();
- }
- }
-
- public void update() {
- breakpoint = null;
- IBreakpoint activeBreakpoint = getBreakpoint();
- if (activeBreakpoint != null
- && activeBreakpoint instanceof ChromiumLineBreakpoint) {
- breakpoint = activeBreakpoint;
- }
- setEnabled(breakpoint != null);
- }
-
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/ui/actions/JsBreakpointPropertiesRulerActionDelegate.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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:
- *******************************************************************************/
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.symbian.tools.wrttools.debug.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * Delegate for JsBreakpointPropertiesRulerAction.
- */
-public class JsBreakpointPropertiesRulerActionDelegate extends AbstractRulerActionDelegate {
-
- @Override
- protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
- return new JsBreakpointPropertiesRulerAction(editor, rulerInfo);
- }
-
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/ui/actions/WatchExpression.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/**
- * 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.ui.actions;
-
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IExpressionManager;
-import org.eclipse.debug.core.model.IWatchExpression;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IEditorActionDelegate;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.actions.ActionDelegate;
-import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.ASTParser;
-import org.eclipse.wst.jsdt.core.dom.ASTVisitor;
-import org.eclipse.wst.jsdt.core.dom.SimpleName;
-import org.eclipse.wst.jsdt.internal.ui.JavaScriptPlugin;
-import org.eclipse.wst.jsdt.internal.ui.javaeditor.WorkingCopyManager;
-import org.symbian.tools.wrttools.debug.internal.Activator;
-
-@SuppressWarnings("restriction")
-public class WatchExpression extends ActionDelegate implements IEditorActionDelegate {
- private final class FindNode extends ASTVisitor {
- private final int offset;
- private final int length;
-
- private ASTNode node;
-
- private FindNode(int offset, int length) {
- super(false);
- this.offset = offset;
- this.length = length;
- }
-
- @Override
- public boolean visit(SimpleName node) {
- checkNode(node);
- return true;
- }
-
- public void checkNode(ASTNode node) {
- final int end = node.getStartPosition() + node.getLength();
- if (node.getStartPosition() <= offset && end >= offset + length) {
- this.node = node;
- }
- }
-
- @Override
- public void postVisit(ASTNode node) {
- if (this.node == null) {
- checkNode(node);
- }
- }
-
- public ASTNode getNode() {
- return node;
- }
- }
-
- private IEditorPart targetEditor;
-
- public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- this.targetEditor = targetEditor;
- }
-
- @Override
- public void run(IAction action) {
- ISelection selection = targetEditor.getEditorSite().getSelectionProvider().getSelection();
- if (selection instanceof ITextSelection) {
- final ITextSelection textSelection = (ITextSelection) selection;
- final WorkingCopyManager manager = JavaScriptPlugin.getDefault().getWorkingCopyManager();
- final IEditorInput editorInput = targetEditor.getEditorInput();
- final IJavaScriptUnit workingCopy = manager.getWorkingCopy(editorInput);
- final ASTParser parser = ASTParser.newParser(AST.JLS3);
-
- parser.setSource(workingCopy);
- final ASTNode ast = parser.createAST(null);
- final FindNode visitor = new FindNode(textSelection.getOffset(), textSelection.getLength());
- ast.accept(visitor);
-
- final ASTNode node = visitor.getNode();
- if (node != null) {
- final String jsString;
- if (node.getNodeType() == ASTNode.SIMPLE_NAME) {
- switch (node.getParent().getNodeType()) {
- case ASTNode.FIELD_ACCESS:
- case ASTNode.FUNCTION_INVOCATION:
- jsString = node.getParent().toString();
- break;
- default:
- jsString = node.toString();
- break;
- }
- } else {
- jsString = node.toString();
- }
- IExpressionManager expressionManager = DebugPlugin.getDefault().getExpressionManager();
- IWatchExpression expression = expressionManager.newWatchExpression(jsString);
- expressionManager.addExpression(expression);
-
- try {
- targetEditor.getSite().getPage().showView(IDebugUIConstants.ID_EXPRESSION_VIEW);
- } catch (PartInitException e) {
- Activator.log(e);
- }
- }
- }
- }
-
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/ui/launch/WidgetBasicTab.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.ui.launch;
-
-import java.util.LinkedList;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.symbian.tools.wrttools.debug.internal.Activator;
-import org.symbian.tools.wrttools.debug.internal.ChromeDebugUtils;
-import org.symbian.tools.wrttools.debug.internal.IConstants;
-import org.symbian.tools.wrttools.debug.internal.Images;
-import org.symbian.tools.wrttools.util.ProjectUtils;
-
-public class WidgetBasicTab extends AbstractLaunchConfigurationTab {
- private ComboViewer project;
- private boolean canSave;
-
- @Override
- public Image getImage() {
- return Images.getWrtIconImage();
- }
-
- public void createControl(Composite parent) {
- Composite root = new Composite(parent, SWT.NONE);
- FormLayout layout = new FormLayout();
- layout.marginWidth = 5;
- layout.marginHeight = 5;
- layout.spacing = 5;
- root.setLayout(layout);
-
- Label label = new Label(root, SWT.NONE);
- label.setText("WRT Widget Project:");
-
- project = new ComboViewer(root, SWT.READ_ONLY);
- project.setContentProvider(new ArrayContentProvider());
- project.setLabelProvider(new WorkbenchLabelProvider());
-
- FormData formData = new FormData();
- formData.left = new FormAttachment(label);
- formData.right = new FormAttachment(100, 0);
- project.getControl().setLayoutData(formData);
-
- project.setInput(getWidgetProjects());
- project.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- setDirty(true);
- validate();
- }
- });
- setControl(root);
- }
-
- private IProject[] getWidgetProjects() {
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot()
- .getProjects();
- LinkedList<IProject> filtered = new LinkedList<IProject>();
- for (IProject p : projects) {
- if (ProjectUtils.hasWrtNature(p)) {
- filtered.add(p);
- }
- }
- return filtered.toArray(new IProject[filtered.size()]);
- }
-
- public String getName() {
- return "WRT Widget";
- }
-
- public void initializeFrom(ILaunchConfiguration configuration) {
- project.setSelection(getSelectedProject(configuration), true);
- validate();
- setErrorMessage(null);
- }
-
- private ISelection getSelectedProject(ILaunchConfiguration configuration) {
- ISelection selected = StructuredSelection.EMPTY;
- try {
- String projectName = configuration.getAttribute(
- IConstants.PROP_PROJECT_NAME, (String) null);
- if (projectName != null) {
- IProject p = ResourcesPlugin.getWorkspace().getRoot()
- .getProject(projectName);
- if (p.isAccessible()) {
- selected = new StructuredSelection(p);
- }
- }
- } catch (CoreException e) {
- Activator.log(e);
- }
- return selected;
- }
-
- @Override
- public boolean canSave() {
- return canSave;
- }
-
- private void validate() {
- String error = null;
- if (getWidgetProjects().length == 0) {
- error = "No WRT widget projects found in the workspace";
- } else if (project.getSelection().isEmpty()) {
- error = "Select WRT widget project to debug";
- } else if (ChromeDebugUtils.getChromeExecutible() == null) {
- error = "No Chrome browser configured in the preferences";
- }
- canSave = error == null;
- setErrorMessage(error);
- getLaunchConfigurationDialog().updateButtons();
- }
-
- public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- ISelection selection = project.getSelection();
- if (selection.isEmpty()) {
- setDefaults(configuration);
- } else {
- IProject p = (IProject) ((IStructuredSelection) selection)
- .getFirstElement();
- configuration.setAttribute(IConstants.PROP_PROJECT_NAME, p
- .getName());
- configuration.setMappedResources(new IResource[] { p });
- }
- }
-
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- configuration.removeAttribute(IConstants.PROP_PROJECT_NAME);
- }
-
- @Override
- public boolean isValid(ILaunchConfiguration launchConfig) {
- return !getSelectedProject(launchConfig).isEmpty();
- }
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/ui/launch/WidgetLaunchConfigurationTabGroup.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.ui.launch;
-
-import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
-import org.eclipse.debug.ui.CommonTab;
-import org.eclipse.debug.ui.ILaunchConfigurationDialog;
-import org.eclipse.debug.ui.ILaunchConfigurationTab;
-
-public class WidgetLaunchConfigurationTabGroup extends
- AbstractLaunchConfigurationTabGroup {
-
- public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
- setTabs(new ILaunchConfigurationTab[] {new WidgetBasicTab(), new CommonTab()});
- }
-
-}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/wrttools/debug/ui/launch/WidgetLaunchShortcut.java Thu Aug 19 17:48:04 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.ui.launch;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.ILaunchShortcut2;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-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;
-
-public class WidgetLaunchShortcut implements ILaunchShortcut2 {
-
- public IResource getLaunchableResource(IEditorPart editorpart) {
- IEditorInput input = editorpart.getEditorInput();
- return (IResource) input.getAdapter(IResource.class);
- }
-
- public IResource getLaunchableResource(ISelection selection) {
- if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
- Object object = ((IStructuredSelection) selection).getFirstElement();
- IResource resource = null;
- if (object instanceof IResource) {
- resource = (IResource) object;
- } else if (object instanceof IAdaptable) {
- resource = (IResource) ((IAdaptable) object).getAdapter(IResource.class);
- }
- return resource;
- }
- return null;
- }
-
- public ILaunchConfiguration[] getLaunchConfigurations(IEditorPart editorpart) {
- return getLaunchConfigurations(getLaunchableResource(editorpart));
- }
-
- private ILaunchConfiguration getLaunchConfigurations(IProject project) throws CoreException {
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(WidgetLaunchDelegate.ID);
- ILaunchConfiguration configuration = null;
- ILaunchConfiguration[] configurations = launchManager.getLaunchConfigurations(type);
- for (ILaunchConfiguration c : configurations) {
- if (project.getName().equals(c.getAttribute(IConstants.PROP_PROJECT_NAME, (String) null))) {
- configuration = c;
- break;
- }
- }
- return configuration;
- }
-
- private ILaunchConfiguration[] getLaunchConfigurations(IResource resource) {
- if (resource != null) {
- try {
- ILaunchConfiguration launchConfigurations = getLaunchConfigurations(resource.getProject());
- if (launchConfigurations != null) {
- return new ILaunchConfiguration[] { launchConfigurations };
- }
- } catch (CoreException e) {
- Activator.log(e);
- }
- }
- return null;
- }
-
- public ILaunchConfiguration[] getLaunchConfigurations(ISelection selection) {
- return getLaunchConfigurations(getLaunchableResource(selection));
- }
-
- public void launch(IEditorPart editor, String mode) {
- launch(getLaunchableResource(editor), mode);
- }
-
- private void launch(IResource launchableResource, String mode) {
- try {
- IProject project = launchableResource.getProject();
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(WidgetLaunchDelegate.ID);
- ILaunchConfiguration configuration = getLaunchConfigurations(project);
- if (configuration == null) {
- ILaunchConfigurationWorkingCopy copy = type.newInstance(null, launchManager
- .generateLaunchConfigurationName(project.getName()));
- copy.setAttribute(IConstants.PROP_PROJECT_NAME, project.getName());
- copy.setMappedResources(new IResource[] { project });
- configuration = copy.doSave();
- }
- DebugUITools.launch(configuration, mode);
- } catch (CoreException e) {
- Activator.log(e);
- }
- }
-
- public void launch(ISelection selection, String mode) {
- launch(getLaunchableResource(selection), mode);
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.previewer/.settings/org.eclipse.wst.validation.prefs Mon Aug 23 09:55:57 2010 -0700
@@ -0,0 +1,9 @@
+#Fri Aug 20 13:11:14 PDT 2010
+DELEGATES_PREFERENCE=delegateValidatorList
+USER_BUILD_PREFERENCE=enabledBuildValidatorList
+USER_MANUAL_PREFERENCE=enabledManualValidatorList
+USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.200.v201005271900
+eclipse.preferences.version=1
+override=true
+suspend=false
+vf.version=3
--- a/plugins/org.symbian.tools.tmw.previewer/META-INF/MANIFEST.MF Thu Aug 19 17:48:04 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/META-INF/MANIFEST.MF Mon Aug 23 09:55:57 2010 -0700
@@ -3,7 +3,7 @@
Bundle-Name: Mobile Applications Preview Support
Bundle-SymbolicName: org.symbian.tools.tmw.previewer;singleton:=true
Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.symbian.tools.wrttools.previewer.PreviewerPlugin
+Bundle-Activator: org.symbian.tools.tmw.previewer.PreviewerPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources;bundle-version="3.5.0",
Binary file plugins/org.symbian.tools.tmw.previewer/bin/org/symbian/tools/tmw/previewer/PreviewerPlugin.class has changed
--- a/plugins/org.symbian.tools.tmw.previewer/plugin.xml Thu Aug 19 17:48:04 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/plugin.xml Mon Aug 23 09:55:57 2010 -0700
@@ -8,7 +8,7 @@
<view
allowMultiple="false"
category="org.symbian.tools.tmw"
- class="org.symbian.tools.wrttools.previewer.preview.PreviewView"
+ class="org.symbian.tools.tmw.previewer.preview.PreviewView"
icon="icons/obj16/preview_view.gif"
id="org.symbian.tools.wrttools.editing.wrtpreview"
name="Preview"
@@ -18,7 +18,7 @@
<extension
point="org.eclipse.ui.preferencePages">
<page
- class="org.symbian.tools.wrttools.previewer.preferences.WrtEditingPreferencePage"
+ class="org.symbian.tools.tmw.previewer.preferences.WrtEditingPreferencePage"
id="org.symbian.tools.wrttools.editing.preferences.WrtEditingPreferencePage"
name="Tools for Mobile Web">
<keywordReference
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/PreviewerPlugin.java Thu Aug 19 17:48:04 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/PreviewerPlugin.java Mon Aug 23 09:55:57 2010 -0700
@@ -43,7 +43,7 @@
// The plug-in ID
public static final String PLUGIN_ID = "org.symbian.tools.tmw.previewer";
- public static final String PREVIEW_VIEW = "org.symbian.tools.wrttools.editing.wrtpreview";
+ public static final String PREVIEW_VIEW = "org.symbian.tools.tmw.editing.wrtpreview";
public static final boolean DEBUG = Platform.inDebugMode()
&& Boolean.parseBoolean(Platform.getDebugOption(PLUGIN_ID + "/debug"));
--- a/plugins/org.symbian.tools.tmw.ui/plugin.xml Thu Aug 19 17:48:04 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/plugin.xml Mon Aug 23 09:55:57 2010 -0700
@@ -11,7 +11,7 @@
viewerId="org.eclipse.ui.navigator.ProjectExplorer">
<includes>
<actionExtension
- pattern="org.symbian.mtw.ui.navigator.MoveRename">
+ pattern="org.symbian.tmw.ui.navigator.MoveRename">
</actionExtension>
</includes>
</viewerActionBinding>
@@ -105,7 +105,7 @@
</commonWizard>
<actionProvider
class="org.symbian.tools.tmw.ui.navigator.RenameMoveActionProvider"
- id="org.symbian.mtw.ui.navigator.MoveRename"
+ id="org.symbian.tmw.ui.navigator.MoveRename"
overrides="org.eclipse.wst.jsdt.ui.navigator.actions.RefactorActions"
priority="highest">
<enablement>
@@ -120,7 +120,7 @@
<extension
point="org.eclipse.ui.views">
<category
- id="org.symbian.tools.mtw"
+ id="org.symbian.tools.tmw"
name="Tools for Mobile Web">
</category>
</extension>
@@ -141,19 +141,19 @@
<deployment-target-type
class="org.symbian.tools.tmw.ui.deployment.bluetooth.BluetoothTargetType"
icon="icons/full/obj16/bluetooth.gif"
- id="org.symbian.tools.mtw.bluetooth"
+ id="org.symbian.tools.tmw.bluetooth"
long-running="true"
priority="10">
</deployment-target-type>
<deployment-target-type
class="org.symbian.tools.tmw.internal.ui.deployment.targets.ExternalApplicationDeploymentType"
- id="org.symbian.tools.mtw.externalApp"
+ id="org.symbian.tools.tmw.externalApp"
priority="1000">
</deployment-target-type>
<deployment-target-type
class="org.symbian.tools.tmw.internal.ui.deployment.targets.FilesystemDeploymentTarget"
icon="icons/full/obj16/folder.gif"
- id="org.symbian.tools.mtw.fileSystem"
+ id="org.symbian.tools.tmw.fileSystem"
priority="900">
</deployment-target-type>
</extension>
@@ -181,7 +181,7 @@
point="org.symbian.tools.tmw.ui.targetPresentation">
<targetPresentation
detailsPane="org.symbian.tools.tmw.internal.ui.deployment.targets.LocalFileSystemPane"
- targetTypeId="org.symbian.tools.mtw.fileSystem">
+ targetTypeId="org.symbian.tools.tmw.fileSystem">
</targetPresentation>
</extension>
<extension
@@ -232,7 +232,7 @@
<adapt
type="org.eclipse.core.resources.IResource">
<test
- property="org.symbian.tools.tmw.ismtwproject">
+ property="org.symbian.tools.tmw.istmwproject">
</test>
</adapt>
</with>
--- a/plugins/org.symbian.tools.tmw.ui/schema/projectTemplate.exsd Thu Aug 19 17:48:04 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/schema/projectTemplate.exsd Mon Aug 23 09:55:57 2010 -0700
@@ -185,7 +185,7 @@
</documentation>
<appinfo>
- <meta.attribute kind="identifier" basedOn="org.eclipse.wst.common.project.facet.core.facets/action/@id"/>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.wst.common.project.facet.core.facets/project-facet/@id"/>
</appinfo>
</annotation>
</attribute>
Binary file plugins/org.symbian.tools.wrttools.product/bin/org/symbian/tools/wrttools/product/perspective/WRTPerspective.class has changed