|
1 <?xml version="1.0" encoding="UTF-8"?> |
|
2 <?eclipse version="3.4"?> |
|
3 <plugin> |
|
4 <extension-point id="projectTemplates" name="WRT Project Templates" schema="schema/projectTemplates.exsd"/> |
|
5 <extension-point id="jsLibraries" name="JavaScript Libraries" schema="schema/jsLibraries.exsd"/> |
|
6 |
|
7 <!-- Generic Project Builder and Project Natures --> |
|
8 |
|
9 <!-- Widget Project Nature --> |
|
10 <extension |
|
11 id="WidgetProjectNature" |
|
12 point="org.eclipse.core.resources.natures"> |
|
13 <runtime> |
|
14 <run class="org.symbian.tools.wrttools.WidgetProjectNature"/> |
|
15 </runtime> |
|
16 </extension> |
|
17 |
|
18 <!-- Widget Project Nature Images --> |
|
19 <extension |
|
20 point="org.eclipse.ui.ide.projectNatureImages"> |
|
21 <image |
|
22 icon="icons/WRT_main_16.png" |
|
23 id="org.symbian.tools.wrttools.natureImage" |
|
24 natureId="org.symbian.tools.wrttools.WidgetProjectNature"> |
|
25 </image> |
|
26 </extension> |
|
27 |
|
28 <!-- Web Runtime Preferences --> |
|
29 <extension |
|
30 point="org.eclipse.core.runtime.preferences"> |
|
31 <initializer |
|
32 class="org.symbian.tools.wrttools.core.WrtIdeCorePreferences"> |
|
33 </initializer> |
|
34 </extension> |
|
35 |
|
36 <!-- WRT Tool Integration (Package, Validate, Include, Exclude Settings)--> |
|
37 <extension |
|
38 point="org.eclipse.ui.popupMenus"> |
|
39 <objectContribution |
|
40 objectClass="org.eclipse.core.resources.IResource" |
|
41 id="org.symbian.tools.wrttools.widget.wrttool.packageoptions"> |
|
42 <visibility> |
|
43 <not> |
|
44 <or> |
|
45 <objectState name="persistentProperty" value="org.symbian.tools.wrttools.core.packager.exclude"/> |
|
46 <objectState name="extension" value="plist"/> |
|
47 <objectClass name="org.eclipse.core.resources.IProject"/> |
|
48 </or> |
|
49 </not> |
|
50 </visibility> |
|
51 <filter |
|
52 name="projectNature" |
|
53 value="org.symbian.tools.wrttools.WidgetProjectNature"/> |
|
54 <action |
|
55 class="org.symbian.tools.wrttools.core.packager.ExcludeFileAction" |
|
56 icon="icons/exclude_archive.gif" |
|
57 id="org.symbian.tools.wrttools.widget.wrttool.packageoptions.ExcludeFileAction" |
|
58 label="Exclude From Archive" |
|
59 menubarPath="org.symbian.tools.wrttools.contextMenuGroupMarker"> |
|
60 </action> |
|
61 </objectContribution> |
|
62 <objectContribution |
|
63 objectClass="org.eclipse.core.resources.IResource" |
|
64 id="org.symbian.tools.wrttools.widget.wrttool.packageoptions"> |
|
65 <visibility> |
|
66 <and> |
|
67 <not> |
|
68 <objectState name="extension" value="wgz"/> |
|
69 </not> |
|
70 <and> |
|
71 <objectState name="persistentProperty" value="org.symbian.tools.wrttools.core.packager.exclude"/> |
|
72 <objectState name="projectNature" value="org.symbian.tools.wrttools.WidgetProjectNature"/> |
|
73 </and> |
|
74 </and> |
|
75 </visibility> |
|
76 <action |
|
77 class="org.symbian.tools.wrttools.core.packager.IncludeFileAction" |
|
78 icon="icons/include_archive.gif" |
|
79 id="org.symbian.tools.wrttools.widget.wrttool.packageoptions.IncludeFileAction" |
|
80 label="Include in Archive" |
|
81 menubarPath="org.symbian.tools.wrttools.contextMenuGroupMarker"> |
|
82 </action> |
|
83 </objectContribution> |
|
84 </extension> |
|
85 |
|
86 <!-- CSS Validator --> |
|
87 <extension id="org.symbian.tools.wrttools.core.cssvalidator" |
|
88 name="CSS Validator" point="org.eclipse.wst.validation.validatorV2"> |
|
89 <validator build="true" |
|
90 class="org.symbian.tools.wrttools.core.internal.validation.CssBuildValidator" |
|
91 manual="true" markerId="org.symbian.tools.wrttools.core.cssValidationMarker" |
|
92 version="0.0.1"> |
|
93 <include> |
|
94 <rules> |
|
95 <contentType exactMatch="false" |
|
96 id="org.eclipse.wst.css.core.csssource"> |
|
97 </contentType> |
|
98 </rules> |
|
99 </include> |
|
100 </validator> |
|
101 </extension> |
|
102 |
|
103 <extension point="org.eclipse.ui.newWizards"> |
|
104 <category id="org.symbian.tools.wrttools.core.category" name="Mobile Web Tools"> |
|
105 </category> |
|
106 <wizard category="org.symbian.tools.wrttools.core.category" |
|
107 class="org.symbian.tools.wrttools.wizards.WrtWidgetWizard" |
|
108 finalPerspective="org.symbian.tools.wrttools.mainPerspective" |
|
109 hasPages="true" icon="icons/WRT_main_16.png" |
|
110 id="org.symbian.tools.wrttools.core.wrtwidgetwizard" name="Mobile Web Application Project" |
|
111 project="true"> |
|
112 <description> |
|
113 Creates a new Symbian WRT application project using one of the provided |
|
114 templates |
|
115 </description> |
|
116 </wizard> |
|
117 </extension> |
|
118 |
|
119 <!-- WRT Project Templates --> |
|
120 <extension point="org.symbian.tools.wrttools.projectTemplates"> |
|
121 |
|
122 <projectTemplate |
|
123 archive="projecttemplates/basic.zip" |
|
124 default-css-name="basic" |
|
125 default-html-name="index" |
|
126 default-js-name="basic" |
|
127 icon="icons/main16.gif" |
|
128 name="Minimal Project" |
|
129 order="10"> |
|
130 <description> |
|
131 This wizard generates an empty widget project with a minimal Info.plist, html,css and js. |
|
132 </description> |
|
133 </projectTemplate> |
|
134 |
|
135 <projectTemplate |
|
136 archive="projecttemplates/helloWithWRTKit.zip" |
|
137 default-css-name="HelloWithWRTKit" |
|
138 default-html-name="index" |
|
139 default-js-name="HelloWithWRTKit" |
|
140 icon="icons/WRT_main_16.png" |
|
141 name="Hello World Project" |
|
142 order="1" |
|
143 wizard-page-factory="org.symbian.tools.wrttools.wizards.HelloWithWRTKitProjectDetailsWizardPage$Factory"> |
|
144 <description> |
|
145 This wizard generates a basic Hello project with a minimal Info.plist, html,css and js along with WRTKit. |
|
146 </description> |
|
147 <requires-library>org.symbian.wrtkit</requires-library> |
|
148 </projectTemplate> |
|
149 <projectTemplate |
|
150 archive="projecttemplates/phonegap.zip" |
|
151 default-css-name="css" |
|
152 default-html-name="index" |
|
153 default-js-name="main" |
|
154 icon="icons/phonegap.png" |
|
155 name="PhoneGap Application" |
|
156 order="2" |
|
157 screen-size="360x640"> |
|
158 <description> |
|
159 This wizard generates a project based on the PhoneGap library that showcases PhoneGap API usage. PhoneGap applications require WRT 1.1 or newer. |
|
160 </description> |
|
161 <requires-library>phonegap</requires-library> |
|
162 </projectTemplate> |
|
163 |
|
164 <projectTemplate |
|
165 archive="projecttemplates/flickr.zip" |
|
166 default-css-name="Flickr" |
|
167 default-html-name="index" |
|
168 default-js-name="Flickr" |
|
169 icon="icons/flickr.gif" |
|
170 name="Flickr Project" |
|
171 order="3" |
|
172 wizard-page-factory="org.symbian.tools.wrttools.wizards.FlickrProjectDetailsWizardPage$Factory"> |
|
173 <description> |
|
174 This wizard generates an Flickr project with a minimal Info.plist, html,css and js and WRTKit. |
|
175 </description> |
|
176 <requires-library>org.symbian.wrtkit</requires-library> |
|
177 </projectTemplate> |
|
178 |
|
179 <projectTemplate |
|
180 archive="projecttemplates/rssreader.zip" |
|
181 default-css-name="RSSReader" |
|
182 default-html-name="index" |
|
183 default-js-name="RSSReader" |
|
184 icon="icons/rss.gif" |
|
185 name="RSS Reader Project" |
|
186 order="4" |
|
187 wizard-page-factory="org.symbian.tools.wrttools.wizards.RssReaderProjectDetailsWizardPage$Factory"> |
|
188 <description> |
|
189 This wizard generates an RSS Reader project with a minimal Info.plist, html,css and js and WRTKit. |
|
190 </description> |
|
191 <requires-library>org.symbian.wrtkit</requires-library> |
|
192 </projectTemplate> |
|
193 <projectTemplate |
|
194 archive="projecttemplates/uitemplate.zip" |
|
195 default-css-name="basic" |
|
196 default-html-name="index" |
|
197 default-js-name="basic" |
|
198 icon="icons/main16.gif" |
|
199 name="Various UI Templates" |
|
200 order="5" |
|
201 screen-size="360x640"> |
|
202 <description> |
|
203 Includes templates for high-end devices from Forum.Nokia. |
|
204 </description> |
|
205 </projectTemplate> |
|
206 </extension> |
|
207 |
|
208 <!-- Import Wizard --> |
|
209 <extension point="org.eclipse.ui.importWizards"> |
|
210 <category id="org.symbian.tools.wrttools.import" name="Mobile Web Tools"> |
|
211 </category> |
|
212 <wizard category="org.symbian.tools.wrttools.import" |
|
213 class="org.symbian.tools.wrttools.wizards.projectimport.WrtProjectsImportWizard" |
|
214 icon="icons/import_aptana_project.gif" id="org.symbian.tools.wrttools.import.projectImport" |
|
215 name="Existing Mobile Web Projects into Workspace"> |
|
216 <description> |
|
217 Import WRT project created in Aptana, Adobe Dreamweaver or WRT IDE |
|
218 </description> |
|
219 </wizard> |
|
220 |
|
221 <wizard |
|
222 category="org.symbian.tools.wrttools.import" |
|
223 class="org.symbian.tools.wrttools.wizards.WgzImportWizard" |
|
224 icon="icons/import_16x16px.png" |
|
225 id="org.symbian.tools.wrttools.importwgz" |
|
226 name="Application Archive (WGZ)"> |
|
227 <description> |
|
228 Create WRT project from deployable WGZ application archive |
|
229 </description> |
|
230 </wizard> |
|
231 |
|
232 </extension> |
|
233 |
|
234 <!-- WRT Content Descriptor (.plist) file --> |
|
235 <extension point="org.eclipse.core.contenttype.contentTypes"> |
|
236 <content-type base-type="org.eclipse.core.runtime.xml" |
|
237 file-extensions="plist" id="org.symbian.tools.wrttools.contenttype.plist" |
|
238 name="WebRuntime Descriptor File" priority="normal"> |
|
239 </content-type> |
|
240 </extension> |
|
241 |
|
242 <!-- Perspective Extensions --> |
|
243 <extension point="org.eclipse.ui.perspectiveExtensions"> |
|
244 <perspectiveExtension targetID="org.eclipse.wst.jsdt.ui.JavaPerspective"> |
|
245 <newWizardShortcut id="org.symbian.tools.wrttools.core.wrtwidgetwizard"> |
|
246 </newWizardShortcut> |
|
247 </perspectiveExtension> |
|
248 <perspectiveExtension targetID="org.eclipse.debug.ui.DebugPerspective"> |
|
249 <newWizardShortcut id="org.symbian.tools.wrttools.core.wrtwidgetwizard"> |
|
250 </newWizardShortcut> |
|
251 </perspectiveExtension> |
|
252 </extension> |
|
253 |
|
254 <extension |
|
255 point="org.eclipse.wst.jsdt.core.JsGlobalScopeContainerInitializer"> |
|
256 <JsGlobalScopeContainerInitializer |
|
257 class="org.symbian.tools.wrttools.core.libraries.WrtLibInitializer" |
|
258 id="org.symbian.wrt"> |
|
259 </JsGlobalScopeContainerInitializer> |
|
260 </extension> |
|
261 <extension |
|
262 point="org.eclipse.wst.jsdt.ui.JsGlobalScopeContainerPage"> |
|
263 <JsGlobalScopeContainerPage |
|
264 name="Tools for Mobile Web" |
|
265 class="org.symbian.tools.wrttools.wizards.WrtLibraryWizardPage" |
|
266 id="org.symbian.wrt"> |
|
267 </JsGlobalScopeContainerPage> |
|
268 </extension> |
|
269 <extension |
|
270 id="org.symbian.tools.wrttools.core.plistvalidator" |
|
271 name="WRT Application Descriptor Validator" |
|
272 point="org.eclipse.wst.validation.validatorV2"> |
|
273 <validator |
|
274 build="true" |
|
275 class="org.symbian.tools.wrttools.core.internal.validation.WrtApplicationValidator" |
|
276 manual="true" |
|
277 markerId="org.symbian.tools.wrttools.core.cssValidationMarker" |
|
278 version="0.0.1"> |
|
279 <include> |
|
280 <rules> |
|
281 <projectNature |
|
282 id="org.symbian.tools.wrttools.WidgetProjectNature"> |
|
283 </projectNature> |
|
284 </rules> |
|
285 </include> |
|
286 </validator> |
|
287 </extension> |
|
288 <extension |
|
289 point="org.eclipse.ui.keywords"> |
|
290 <keyword |
|
291 id="org.symbian.tools.wrttools.wrtwords" |
|
292 label="wrt, webruntime, web runtime, cwrt widget"> |
|
293 </keyword> |
|
294 </extension> |
|
295 <extension |
|
296 id="org.symbian.tools.wrttools.platformservices" |
|
297 name="Platform Services Inferrence Support" |
|
298 point="org.eclipse.wst.jsdt.core.inferrenceSupport"> |
|
299 <inferenceProvider |
|
300 class="org.symbian.tools.wrttools.core.libraries.PlatformServicesTypeProvider"> |
|
301 </inferenceProvider> |
|
302 </extension> |
|
303 <extension |
|
304 point="org.eclipse.ui.commands"> |
|
305 <category |
|
306 id="org.symbian.tools.wrttools.commands.maincategory" |
|
307 name="Tools for Mobile Web"> |
|
308 </category> |
|
309 <command |
|
310 categoryId="org.symbian.tools.wrttools.commands.maincategory" |
|
311 description="Deploys an application to phone or emulator" |
|
312 id="org.symbian.tools.wrttools.commands.deploy" |
|
313 name="Deploy Application"> |
|
314 </command> |
|
315 <command |
|
316 categoryId="org.symbian.tools.wrttools.commands.maincategory" |
|
317 defaultHandler="org.symbian.tools.wrttools.handlers.AddJSLibrary" |
|
318 description="Adds JavaScript libraries to Mobile Web projects" |
|
319 id="org.symbian.tools.wrttools.addlibrary" |
|
320 name="Add JavaScript Libraries..."> |
|
321 </command> |
|
322 </extension> |
|
323 <extension |
|
324 point="org.eclipse.ui.menus"> |
|
325 <menuContribution |
|
326 locationURI="toolbar:org.eclipse.ui.main.toolbar"> |
|
327 <toolbar |
|
328 id="org.symbian.tools.wrttools"> |
|
329 <command |
|
330 commandId="org.symbian.tools.wrttools.commands.deploy" |
|
331 icon="icons/deploy_widget.gif" |
|
332 id="org.symbian.tools.wrttools.toolbars.deploy"> |
|
333 </command> |
|
334 </toolbar> |
|
335 </menuContribution> |
|
336 <menuContribution |
|
337 locationURI="menu:project?after=additions"> |
|
338 <separator |
|
339 name="org.symbian.tools.wrttools.beginwert" |
|
340 visible="true"> |
|
341 </separator> |
|
342 <command |
|
343 commandId="org.symbian.tools.wrttools.addlibrary" |
|
344 id="org.symbian.tools.wrttools.toolbars.addlibrary" |
|
345 style="push"> |
|
346 </command> |
|
347 <separator |
|
348 name="org.symbian.tools.wrttools.deploypackage" |
|
349 visible="true"> |
|
350 </separator> |
|
351 <command |
|
352 commandId="org.symbian.tools.wrttools.commands.deploy" |
|
353 icon="icons/deploy_widget.gif" |
|
354 id="org.symbian.tools.wrttools.toolbars.deploy"> |
|
355 </command> |
|
356 <separator |
|
357 name="org.symbian.tools.wrttools.endwrt" |
|
358 visible="true"> |
|
359 </separator> |
|
360 </menuContribution> |
|
361 <menuContribution |
|
362 locationURI="popup:org.eclipse.ui.popup.any?after=sourceMenuId"> |
|
363 <separator |
|
364 name="org.symbian.tools.wrttools.beginwert" |
|
365 visible="true"> |
|
366 </separator> |
|
367 <command |
|
368 commandId="org.symbian.tools.wrttools.commands.deploy" |
|
369 icon="icons/deploy_widget.gif" |
|
370 id="org.symbian.tools.wrttools.toolbars.deploy"> |
|
371 <visibleWhen> |
|
372 <and> |
|
373 <iterate |
|
374 ifEmpty="false" |
|
375 operator="and"> |
|
376 <adapt |
|
377 type="org.eclipse.core.resources.IProject"> |
|
378 </adapt> |
|
379 </iterate> |
|
380 <count |
|
381 value="1"> |
|
382 </count> |
|
383 </and> |
|
384 </visibleWhen> |
|
385 </command> |
|
386 <separator |
|
387 name="org.symbian.tools.wrttools.endwrt" |
|
388 visible="true"> |
|
389 </separator> |
|
390 </menuContribution> |
|
391 <menuContribution |
|
392 locationURI="popup:org.eclipse.ui.popup.any?after=group.build"> |
|
393 <dynamic |
|
394 class="org.symbian.tools.wrttools.core.libraries.AddLibraryPopupMenu$LibrariesPopupMenu" |
|
395 id="org.symbian.tools.wrttools.addlibrary"> |
|
396 <visibleWhen> |
|
397 <and> |
|
398 <iterate |
|
399 ifEmpty="false" |
|
400 operator="and"> |
|
401 <adapt |
|
402 type="org.eclipse.core.resources.IProject"> |
|
403 <test |
|
404 property="org.eclipse.core.resources.projectNature" |
|
405 value="org.symbian.tools.wrttools.WidgetProjectNature"> |
|
406 </test> |
|
407 </adapt> |
|
408 </iterate> |
|
409 <count |
|
410 value="1"> |
|
411 </count> |
|
412 </and> |
|
413 </visibleWhen> |
|
414 </dynamic> |
|
415 <separator |
|
416 name="org.symbian.tools.wrttools.libs" |
|
417 visible="true"> |
|
418 </separator> |
|
419 </menuContribution> |
|
420 </extension> |
|
421 <extension |
|
422 point="org.eclipse.ui.decorators"> |
|
423 <decorator |
|
424 adaptable="true" |
|
425 class="org.symbian.tools.wrttools.navigator.PackagingInformationDecorator" |
|
426 icon="icons/main16.gif" |
|
427 id="org.symbian.tools.wrttools.packagingDeclarator" |
|
428 label="Mobile Web Packaging Information" |
|
429 lightweight="true" |
|
430 location="TOP_RIGHT" |
|
431 state="true"> |
|
432 <enablement> |
|
433 <objectClass |
|
434 name="org.eclipse.core.resources.IResource"> |
|
435 </objectClass> |
|
436 </enablement> |
|
437 </decorator> |
|
438 </extension> |
|
439 <extension |
|
440 id="org.symbian.tools.wrttools.excluded" |
|
441 name="Excluded from Mobile Web packaging marker" |
|
442 point="org.eclipse.core.resources.markers"> |
|
443 <persistent |
|
444 value="true"> |
|
445 </persistent> |
|
446 </extension> |
|
447 <extension |
|
448 point="org.symbian.tools.wrttools.jsLibraries"> |
|
449 <library |
|
450 icon="icons/main16_prev.gif" |
|
451 id="org.symbian.wrtkit" |
|
452 installer="org.symbian.tools.wrttools.core.libraries.WRTKitInstaller" |
|
453 name="WRTKit"> |
|
454 </library> |
|
455 <library |
|
456 icon="icons/phonegap.png" |
|
457 id="phonegap" |
|
458 installer="org.symbian.tools.wrttools.core.libraries.PhoneGapInstaller" |
|
459 name="PhoneGap"> |
|
460 </library> |
|
461 </extension> |
|
462 <extension |
|
463 point="org.eclipse.ltk.core.refactoring.renameParticipants"> |
|
464 <renameParticipant |
|
465 class="org.symbian.tools.wrttools.core.project.ProjectRenameParticipant" |
|
466 id="org.symbian.tools.wrttools.renameParticipant1" |
|
467 name="WRT Projects Rename Participant"> |
|
468 <enablement> |
|
469 <with variable="affectedNatures"> |
|
470 <iterate operator="or"> |
|
471 <equals value="org.symbian.tools.wrttools.WidgetProjectNature"/> |
|
472 </iterate> |
|
473 </with> |
|
474 <with variable="element"> |
|
475 <adapt |
|
476 type="org.eclipse.core.resources.IProject"> |
|
477 </adapt> |
|
478 |
|
479 </with> |
|
480 </enablement> |
|
481 |
|
482 </renameParticipant> |
|
483 </extension> |
|
484 <extension |
|
485 point="org.eclipse.ui.editors.templates"> |
|
486 <include |
|
487 file="templates/default-templates.xml"> |
|
488 </include> |
|
489 </extension> |
|
490 <extension |
|
491 point="org.eclipse.wst.common.snippets.SnippetContributions"> |
|
492 <category |
|
493 description="WRT-specific JavaScript snippets" |
|
494 id="org.symbian.tools.wrttools.wrtsnippets" |
|
495 label="Symbian Web Runtime" |
|
496 smallicon="icons/main16.gif" |
|
497 contenttypes="org.eclipse.wst.jsdt.core.jsSource"> |
|
498 <item |
|
499 class="org.symbian.tools.wrttools.util.SnippetInsertion" |
|
500 description="Retrieves list of the contacts" |
|
501 id="org.symbian.tools.wrttools.contacts" |
|
502 label="Get contacts"> |
|
503 <content> |
|
504 var contactService = device.getServiceObject("Service.Contact", |
|
505 "IDataSource"); |
|
506 var result = contactService.IDataSource.GetList( |
|
507 { Type : "Contact", Sort : { Order : "Ascending" } } |
|
508 ); |
|
509 if (result.ErrorCode == 0) { |
|
510 var contacts = result.ReturnValue; |
|
511 for ( var contact = contacts.getNext(); contact != null; contact = contacts.getNext()) { |
|
512 var firstName = contact.FirstName; |
|
513 var lastName = contact.LastName; |
|
514 var mobile = contact.MobilePhoneGen; |
|
515 var landPhone = contact.LandPhoneGen; |
|
516 var jobTitle = contact.JobTitle; |
|
517 // Consult WRT documentation for other possible fields |
|
518 // TODO Process contact information |
|
519 } |
|
520 } else { |
|
521 var errorCode = result.ErrorCode; |
|
522 var errorMessage = result.ErrorMessage; |
|
523 // TODO Cannot retrieve contacts list |
|
524 } |
|
525 </content> |
|
526 </item> |
|
527 <item |
|
528 class="org.symbian.tools.wrttools.util.SnippetInsertion" |
|
529 description="This function can be used as a callback in GetLocation and Trace calls to location service." |
|
530 id="org.symbian.tools.wrttools.location" |
|
531 label="Location callback"> |
|
532 <content> |
|
533 // This function can be passed as a callback to locationService.ILocation |
|
534 // GetLocation or Trace method |
|
535 function locationUpdated(transactionId, code, result) { |
|
536 if (result.ErrorCode == 0) { |
|
537 var longitude = result.ReturnValue.Longitude; // Longitude estimate in degrees. The value range is [+180, -180]. |
|
538 var latitude = result.ReturnValue.Latitude; // Latitude estimate in degrees. The value range is [+90, -90]. |
|
539 var altitude = result.ReturnValue.Altitude; // Elevation estimate in meters relative to the WGS 84 datum. |
|
540 var satelliteNumView = result.ReturnValue.SatelliteNumView; // Number of satellites currently in view. |
|
541 var satelliteNumViewUsed = result.ReturnValue.SatelliteNumViewUsed; // Number of satellites used to obtain the location fix. |
|
542 var horizontalSpeed = result.ReturnValue.HorizontalSpeed; // Horizontal speed estimate in meters per second. This is the speed of the device at the time the location fix was obtained. |
|
543 var horizontalSpeedError = result.ReturnValue.HorizontalSpeedError; // Horizontal speed error in meters per second. |
|
544 var trueCourse = result.ReturnValue.TrueCourse; // Current direction of movement in degrees in relation to true north. |
|
545 var trueCourseError = result.ReturnValue.TrueCourseError; // TrueCourse error in degrees. |
|
546 var magneticHeading = result.ReturnValue.MagneticHeading; // Current direction of movement in degrees in relation to magnetic north. |
|
547 var magneticHeadingError = result.ReturnValue.MagneticHeadingError; // MagneticHeading error in degrees. |
|
548 var heading = result.ReturnValue.Heading; // Current instantaneous direction of movement in degrees in relation to true north. |
|
549 var headingError = result.ReturnValue.HeadingError; // Heading error in degrees. |
|
550 var magneticCourse = result.ReturnValue.MagneticCourse; // Current instantaneous direction of movement in degrees in relation to magnetic north. |
|
551 var magneticCourseError = result.ReturnValue.MagneticCourseError; // MagneticCourse error in degrees |
|
552 // TODO Location information was received |
|
553 } else { |
|
554 var errorCode = result.ErrorCode; |
|
555 var errorMessage = result.ErrorMessage; |
|
556 // TODO Failed to retrieve location information |
|
557 } |
|
558 } </content> |
|
559 </item> |
|
560 <item |
|
561 class="org.symbian.tools.wrttools.util.SnippetInsertion" |
|
562 description="Sends SMS message" |
|
563 id="org.symbian.tools.wrttools.dial" |
|
564 label="Send SMS message"> |
|
565 <content> |
|
566 var phoneNumber = "+6505551214"; |
|
567 var text = "Sent from WRT application"; |
|
568 var messaging = device.getServiceObject("Service.Messaging", "IMessaging"); |
|
569 var result = messaging.IMessaging.Send({ MessageType : "SMS", To : phoneNumber, BodyText : text }); |
|
570 if (result.ErrorCode != null) { |
|
571 var errorCode = result.ErrorCode; |
|
572 var errorMessage = result.ErrorMessage; |
|
573 // TODO Cannot send SMS message |
|
574 } |
|
575 </content> |
|
576 </item> |
|
577 |
|
578 <item |
|
579 class="org.symbian.tools.wrttools.util.SnippetInsertion" |
|
580 description="Use this code to track battery status" |
|
581 id="org.symbian.tools.wrttools.battery" |
|
582 label="Watch battery status"> |
|
583 <content> |
|
584 function watchBatteryNotifications() { |
|
585 var sysInfo = device.getServiceObject("Service.SysInfo", "ISysInfo"); |
|
586 var result = sysInfo.ISysInfo.GetNotification( { |
|
587 Entity : "Battery", |
|
588 Key : "BatteryStrength" |
|
589 }, batteryUpdated); |
|
590 if (result.ErrorCode == 0) { |
|
591 var transactionId = result.TransactionID; |
|
592 // TODO Use this ID to cancel notifications |
|
593 } else { |
|
594 var message = result.ErrorMessage; |
|
595 // TODO Process error |
|
596 } |
|
597 } |
|
598 |
|
599 function batteryUpdated(tId, code, result) { |
|
600 if (result.ErrorCode == 0) { |
|
601 var batteryStatus = result.ReturnValue.Status; |
|
602 // TODO Process battery charge level |
|
603 } else { |
|
604 var message = result.ErrorMessage; |
|
605 // TODO Process error |
|
606 } |
|
607 } |
|
608 </content> |
|
609 </item> |
|
610 <item |
|
611 class="org.symbian.tools.wrttools.util.SnippetInsertion" |
|
612 description="Use this code to track acceleration, orientation or rotation changes" |
|
613 id="org.symbian.tools.wrttools.sensor" |
|
614 label="Watch sensor notifications"> |
|
615 <content> |
|
616 // Call this function to add a callback that will be notified of orientation changes |
|
617 function watchSensorNotifications() { |
|
618 var sensors = device.getServiceObject("Service.Sensor", "ISensor"); |
|
619 var SensorParams = { |
|
620 SearchCriterion : "Orientation" // TODO Possible values (one of): |
|
621 // SearchCriterion : "All" |
|
622 // SearchCriterion : "AccelerometerAxis" |
|
623 // SearchCriterion : "AccelerometerDoubleTapping" |
|
624 // SearchCriterion : "Rotation" |
|
625 }; |
|
626 var result = sensors.ISensor.FindSensorChannel(SensorParams); |
|
627 |
|
628 if (result.ErrorCode != 0) { |
|
629 var errorCode = result.ErrorCode; |
|
630 var errorMessage = result.ErrorMessage; |
|
631 // TODO Handle error |
|
632 return null; |
|
633 } |
|
634 // TODO Function named "sensorCallback" will be called when device orientation changes. This function should be created. |
|
635 var result2 = sensors.ISensor.RegisterForNotification( |
|
636 { ChannelInfoMap : result.ReturnValue[0], |
|
637 ListeningType : "ChannelData" }, sensorCallback); |
|
638 if (result.ErrorCode == 0) { |
|
639 var transactionId = result.TransactionID; |
|
640 // TODO Use this transaction ID to cancel notifications when watching orientation is no longer needed |
|
641 return transactionId; |
|
642 } else { |
|
643 var errorCode = result.ErrorCode; |
|
644 var errorMessage = result.ErrorMessage; |
|
645 // TODO Handle error |
|
646 return null; |
|
647 } |
|
648 } |
|
649 |
|
650 // This function can be passed as callback to |
|
651 // sensors.ISensor.RegisterForNotification method |
|
652 function sensorCallback(transactionId, code, result) { |
|
653 if (result.ErrorCode == 0) { |
|
654 // TODO Process notification |
|
655 var dataType = result.ReturnValue.DataType; // One of: "AxisData", "DoubleTappingData", "OrientationData" or "RotationData" |
|
656 var orientation = result.ReturnValue.DeviceOrientation; // Orientation |
|
657 // var xAxis = result.ReturnValue.XAxisData; // Accelerometer |
|
658 // var yAxis = result.ReturnValue.YAxisData; // Accelerometer |
|
659 // var zAxis = result.ReturnValue.ZAxisData; // Accelerometer |
|
660 // var direction = result.ReturnValue.DeviceDirection; // Accelerometer double tapping |
|
661 // var xRotation = result.ReturnValue.XRotation; // Rotation |
|
662 // var yRotation = result.ReturnValue.YRotation; // Rotation |
|
663 // var zRotation = result.ReturnValue.ZRotation; // Rotation |
|
664 } else { |
|
665 var errorCode = result.ErrorCode; |
|
666 var errorMessage = result.ErrorMessage; |
|
667 // TODO Handle error |
|
668 } |
|
669 } |
|
670 |
|
671 </content> |
|
672 </item> |
|
673 </category> |
|
674 <category |
|
675 description="Snippets using PhoneGap APIs" |
|
676 id="org.symbian.tools.wrttools.phonegapsnippets" |
|
677 label="PhoneGap" |
|
678 smallicon="icons/phonegap.png"> |
|
679 <item |
|
680 class="org.symbian.tools.wrttools.util.SnippetInsertion" |
|
681 description="Accepts accerelometer data" |
|
682 id="org.symbian.tools.wrttools.phonegap.accererometer" |
|
683 label="Accelerometer callback"> |
|
684 <content> |
|
685 // This callback can be passed as a successCallback argument to |
|
686 // navigator.accelerometer getCurrentAcceleration and watchAcceleration methods |
|
687 function updateAcceleration(accel) { |
|
688 var x = accel.x; |
|
689 var y = accel.y; |
|
690 var z = accel.z; |
|
691 |
|
692 // TODO process the data |
|
693 } |
|
694 </content> |
|
695 </item> |
|
696 <item |
|
697 class="org.symbian.tools.wrttools.util.SnippetInsertion" |
|
698 description="Accepts contacts data" |
|
699 id="org.symbian.tools.wrttools.phonegap.contacts" |
|
700 label="Contacts callback"> |
|
701 <content> |
|
702 // This method can be passed as a successCallback argument to |
|
703 // navigator.contacts.find method |
|
704 function displayContacts(contacts) { |
|
705 for (var i=0; i < contacts.length; i++) { |
|
706 var contact = contacts[i]; |
|
707 var name = contact.name.formatted; |
|
708 var phones = contact.name.phone; // Array of phone numbers |
|
709 var name = contact.name.address; |
|
710 |
|
711 // TODO Insert your code here |
|
712 } |
|
713 } |
|
714 </content> |
|
715 </item> |
|
716 <item |
|
717 class="org.symbian.tools.wrttools.util.SnippetInsertion" |
|
718 description="Accepts location data" |
|
719 id="org.symbian.tools.wrttools.phonegap.location" |
|
720 label="Location callback"> |
|
721 <content> |
|
722 // This method can be passed as a successCallback argument to |
|
723 // navigator.geolocation getCurrentPosition or watchPosition methods |
|
724 function updateLocation(position) { |
|
725 var pt = position.coords; |
|
726 var latitude = pt.latitude; |
|
727 var longitude = pt.longitude; |
|
728 var altitude = pt.altitude; |
|
729 var heading = pt.heading; |
|
730 var speed = pt.speed; |
|
731 |
|
732 // TODO Insert your code here |
|
733 } |
|
734 </content> |
|
735 </item> |
|
736 <item |
|
737 class="org.symbian.tools.wrttools.util.SnippetInsertion" |
|
738 description="Accepts orientation data" |
|
739 id="org.symbian.tools.wrttools.phonegap.orientation" |
|
740 label="Orientation callback"> |
|
741 <content> |
|
742 // This method can be passed as a successCallback argument to |
|
743 // navigator.orientation getCurrentOrientation or watchOrientation methods |
|
744 function updateOrientation(orientation) { |
|
745 switch (orientation) { |
|
746 case DisplayOrientation.PORTRAIT: break; |
|
747 case DisplayOrientation.REVERSE_PORTRAIT: break; |
|
748 case DisplayOrientation.LANDSCAPE_LEFT_UP: break; |
|
749 case DisplayOrientation.LANDSCAPE_RIGHT_UP: break; |
|
750 case DisplayOrientation.FACE_UP: break; |
|
751 case DisplayOrientation.FACE_DOWN: break; |
|
752 } |
|
753 |
|
754 // TODO Insert your code here |
|
755 } |
|
756 </content> |
|
757 </item> |
|
758 </category> |
|
759 </extension> |
|
760 <extension |
|
761 point="org.symbian.tools.tmw.core.projectProvider"> |
|
762 <projectProvider |
|
763 class="org.symbian.tools.wrttools.core.project.WRTIDEProjectProvider"> |
|
764 <enablement> |
|
765 <adapt |
|
766 type="org.eclipse.core.resources.IProject"> |
|
767 <test |
|
768 property="org.eclipse.core.resources.projectNature" |
|
769 value="org.symbian.tools.wrttools.WidgetProjectNature"> |
|
770 </test> |
|
771 </adapt> |
|
772 </enablement> |
|
773 </projectProvider> |
|
774 </extension> |
|
775 <extension |
|
776 point="org.symbian.tools.tmw.core.runtimes"> |
|
777 <runtime |
|
778 component-id="org.symbian.tools.wrttools.wrt" |
|
779 component-version="1.1" |
|
780 name="Symbian WRT 1.1"> |
|
781 <runtime-component |
|
782 id="tmw.geolocation" |
|
783 version="1.0"> |
|
784 </runtime-component> |
|
785 </runtime> |
|
786 </extension> |
|
787 <extension |
|
788 point="org.symbian.tools.tmw.core.packagers"> |
|
789 <packager |
|
790 delegate="org.symbian.tools.wrttools.core.packager.WrtPackager" |
|
791 target-runtime="org.symbian.tools.wrttools.wrt" |
|
792 target-runtime-version="1.1"> |
|
793 </packager> |
|
794 </extension> |
|
795 <extension |
|
796 point="org.symbian.tools.tmw.ui.deploymentTargetType"> |
|
797 <deployment-target-type |
|
798 class="org.symbian.tools.wrttools.core.deploy.emulator.EmulatorTargetType" |
|
799 icon="icons/deploy_settings.gif" |
|
800 id="org.symbian.tools.wrttools.symbianemulator" |
|
801 priority="50"> |
|
802 </deployment-target-type> |
|
803 </extension> |
|
804 <extension |
|
805 point="org.eclipse.wst.common.project.facet.core.runtimes"> |
|
806 <runtime-component-type |
|
807 id="org.symbian.tools.wrttools.wrt"> |
|
808 </runtime-component-type> |
|
809 <runtime-component-version |
|
810 type="org.symbian.tools.wrttools.wrt" |
|
811 version="1.1"> |
|
812 </runtime-component-version> |
|
813 <supported> |
|
814 <facet |
|
815 id="symbian.wrtkit" |
|
816 version="1.0"> |
|
817 </facet> |
|
818 <runtime-component |
|
819 id="org.symbian.tools.wrttools.wrt" |
|
820 version="1.1"> |
|
821 </runtime-component> |
|
822 <facet |
|
823 id="symbian.phonegap"> |
|
824 </facet> |
|
825 </supported> |
|
826 </extension> |
|
827 <extension |
|
828 point="org.eclipse.wst.common.project.facet.ui.images"> |
|
829 <image |
|
830 path="icons/main16_prev.gif" |
|
831 runtime-component-type="org.symbian.tools.wrttools.wrt" |
|
832 version="1.1"> |
|
833 </image> |
|
834 </extension> |
|
835 <extension |
|
836 point="org.symbian.tools.tmw.core.runtimeIncludePath"> |
|
837 <runtime-include-path |
|
838 id="org.symbian.tools.wrttools.wrt" |
|
839 version="1.1"> |
|
840 <include-path-entry |
|
841 file="libraries/core/widget.js"/> |
|
842 <include-path-entry |
|
843 file="libraries/core/services.js"/> |
|
844 <include-path-entry |
|
845 file="libraries/core/menu.js"/> |
|
846 </runtime-include-path> |
|
847 </extension> |
|
848 <extension |
|
849 point="org.symbian.tools.tmw.ui.projectTemplate"> |
|
850 <template |
|
851 icon="icons/flickr.gif" |
|
852 id="org.symbian.wrt11.flickr" |
|
853 name="Flickr Project" |
|
854 weight="3"> |
|
855 <archive |
|
856 file="projecttemplates/flickr.zip" |
|
857 open-files="${mainHtml}.html"> |
|
858 </archive> |
|
859 <description> |
|
860 This wizard generates an Flickr project with a minimal Info.plist, html,css and js and WRTKit. |
|
861 </description> |
|
862 <supported-runtime |
|
863 id="org.symbian.tools.wrttools.wrt" |
|
864 version="1.1"> |
|
865 </supported-runtime> |
|
866 <archive |
|
867 file="projecttemplates/flickr.zip"> |
|
868 </archive> |
|
869 <default-parameter-value |
|
870 name="mainCss" |
|
871 value="style"> |
|
872 </default-parameter-value> |
|
873 <default-parameter-value |
|
874 name="mainJs" |
|
875 value="flickr"> |
|
876 </default-parameter-value> |
|
877 <default-parameter-value |
|
878 name="mainHtml" |
|
879 value="flickr"> |
|
880 </default-parameter-value> |
|
881 <default-parameter-value |
|
882 name="flickrUrl" |
|
883 value="http://flickr.com/photos/symbianfoundation"> |
|
884 </default-parameter-value> |
|
885 <required-facet |
|
886 id="symbian.wrtkit" |
|
887 version="1.0"> |
|
888 </required-facet> |
|
889 </template> |
|
890 <runtime-template |
|
891 runtime-id="org.symbian.tools.wrttools.wrt" |
|
892 version="1.1"> |
|
893 <archive |
|
894 file="projecttemplates/basic.zip"> |
|
895 </archive> |
|
896 <default-parameter-value |
|
897 name="homeScreen" |
|
898 value="false"> |
|
899 </default-parameter-value> |
|
900 <default-parameter-value |
|
901 name="mainHtml" |
|
902 value="index"> |
|
903 </default-parameter-value> |
|
904 <default-parameter-value |
|
905 name="mainCss" |
|
906 value="basic"> |
|
907 </default-parameter-value> |
|
908 <default-parameter-value |
|
909 name="mainJs" |
|
910 value="basic"> |
|
911 </default-parameter-value> |
|
912 </runtime-template> |
|
913 </extension> |
|
914 <extension |
|
915 point="org.symbian.tools.tmw.ui.wizardPages"> |
|
916 <template-page |
|
917 class="org.symbian.tools.wrttools.wizards.NewFlickrApplicationWizardPage" |
|
918 template-id="org.symbian.wrt11.flickr"> |
|
919 </template-page> |
|
920 </extension> |
|
921 <extension |
|
922 point="org.eclipse.wst.common.project.facet.core.facets"> |
|
923 <project-facet |
|
924 id="symbian.wrtkit"> |
|
925 <label> |
|
926 Symbian WRTKit |
|
927 </label> |
|
928 <description> |
|
929 WRTKit UI library for Symbian WRT |
|
930 </description> |
|
931 <default-version |
|
932 version="1.0"> |
|
933 </default-version> |
|
934 </project-facet> |
|
935 <project-facet-version |
|
936 facet="symbian.wrtkit" |
|
937 version="1.0"> |
|
938 <constraint> |
|
939 <requires |
|
940 facet="tmw.core" |
|
941 version="[1.0"> |
|
942 </requires> |
|
943 </constraint> |
|
944 <action |
|
945 type="install"> |
|
946 <delegate |
|
947 class="org.symbian.tools.wrttools.core.libraries.InstallWrtKitDelegate"> |
|
948 </delegate> |
|
949 <config-factory |
|
950 class="org.symbian.tools.tmw.core.runtimes.ProjectCreationConfigFactory"> |
|
951 </config-factory> |
|
952 </action> |
|
953 </project-facet-version> |
|
954 <project-facet |
|
955 id="symbian.phonegap"> |
|
956 <label> |
|
957 PhoneGap |
|
958 </label> |
|
959 <description> |
|
960 PhoneGap application |
|
961 </description> |
|
962 </project-facet> |
|
963 <project-facet-version |
|
964 facet="symbian.phonegap" |
|
965 version="1.0"> |
|
966 <constraint> |
|
967 <requires |
|
968 facet="tmw.core" |
|
969 ignore-problems="1.0"> |
|
970 </requires> |
|
971 </constraint> |
|
972 <action |
|
973 type="install"> |
|
974 <delegate |
|
975 class="org.symbian.tools.wrttools.core.libraries.PhoneGapLibraryInstaller"> |
|
976 </delegate> |
|
977 </action> |
|
978 </project-facet-version> |
|
979 </extension> |
|
980 <extension |
|
981 point="org.eclipse.wst.common.project.facet.ui.images"> |
|
982 <image |
|
983 facet="symbian.wrtkit" |
|
984 path="icons/main16_prev.gif" |
|
985 version="1.0"> |
|
986 </image> |
|
987 </extension> |
|
988 <extension |
|
989 point="org.symbian.tools.tmw.previewer.layoutProviders"> |
|
990 <layout-provider |
|
991 class="org.symbian.tools.wrttools.core.project.WRT11ApplicationLayout" |
|
992 runtime-id="org.symbian.tools.wrttools.wrt" |
|
993 runtime-version="1.1"> |
|
994 </layout-provider> |
|
995 </extension> |
|
996 |
|
997 </plugin> |