# HG changeset patch # User Eugene Ostroukhov # Date 1276541308 25200 # Node ID 85c2a2a29aad585c7ce30b03d5e635c411635ff5 # Parent 1e408ee32d8a8654d2715d578f5ecc9a5650334d Snippets support introduced diff -r 1e408ee32d8a -r 85c2a2a29aad org.symbian.tools.wrttools.product/launch/WRT IDE Product (Windows).launch --- a/org.symbian.tools.wrttools.product/launch/WRT IDE Product (Windows).launch Fri Jun 11 13:33:03 2010 -0700 +++ b/org.symbian.tools.wrttools.product/launch/WRT IDE Product (Windows).launch Mon Jun 14 11:48:28 2010 -0700 @@ -22,8 +22,8 @@ - - + + diff -r 1e408ee32d8a -r 85c2a2a29aad org.symbian.tools.wrttools.product/plugin.xml --- a/org.symbian.tools.wrttools.product/plugin.xml Fri Jun 11 13:33:03 2010 -0700 +++ b/org.symbian.tools.wrttools.product/plugin.xml Mon Jun 14 11:48:28 2010 -0700 @@ -248,6 +248,9 @@ + + diff -r 1e408ee32d8a -r 85c2a2a29aad org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/perspective/WRTPerspective.java --- a/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/perspective/WRTPerspective.java Fri Jun 11 13:33:03 2010 -0700 +++ b/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/perspective/WRTPerspective.java Mon Jun 14 11:48:28 2010 -0700 @@ -19,6 +19,9 @@ IFolderLayout folder= layout.createFolder("left", IPageLayout.LEFT, (float)0.15, editorArea); //$NON-NLS-1$ folder.addView(Activator.NAVIGATOR_ID); folder.addView(JavaScriptUI.ID_TYPE_HIERARCHY); + + IFolderLayout snippetsFolder = layout.createFolder("snippets", IPageLayout.BOTTOM, (float) 0.5, "left"); //$NON-NLS-1$ + snippetsFolder.addView("org.eclipse.wst.common.snippets.internal.ui.SnippetsView"); IFolderLayout outputfolder= layout.createFolder("bottom", IPageLayout.BOTTOM, (float)0.75, editorArea); //$NON-NLS-1$ outputfolder.addView(IPageLayout.ID_PROBLEM_VIEW); @@ -54,6 +57,7 @@ layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW); layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST); layout.addShowViewShortcut(PreviewerPlugin.PREVIEW_VIEW); + layout.addShowViewShortcut("org.eclipse.wst.common.snippets.internal.ui.SnippetsView"); // new actions - Java project creation wizard layout.addNewWizardShortcut("org.symbian.tools.wrttools.core.wrtwidgetwizard"); //$NON-NLS-1$ diff -r 1e408ee32d8a -r 85c2a2a29aad org.symbian.tools.wrttools/META-INF/MANIFEST.MF --- a/org.symbian.tools.wrttools/META-INF/MANIFEST.MF Fri Jun 11 13:33:03 2010 -0700 +++ b/org.symbian.tools.wrttools/META-INF/MANIFEST.MF Mon Jun 14 11:48:28 2010 -0700 @@ -26,7 +26,8 @@ org.eclipse.core.expressions;bundle-version="3.4.101", org.eclipse.wst.xml.ui;bundle-version="1.1.2", org.eclipse.ltk.core.refactoring, - org.eclipse.ui.editors + org.eclipse.ui.editors, + org.eclipse.wst.common.snippets Bundle-RequiredExecutionEnvironment: J2SE-1.5, JavaSE-1.6 Bundle-ActivationPolicy: lazy diff -r 1e408ee32d8a -r 85c2a2a29aad org.symbian.tools.wrttools/plugin.xml --- a/org.symbian.tools.wrttools/plugin.xml Fri Jun 11 13:33:03 2010 -0700 +++ b/org.symbian.tools.wrttools/plugin.xml Mon Jun 14 11:48:28 2010 -0700 @@ -246,9 +246,6 @@ - - @@ -888,5 +885,140 @@ + + + + + +function locationUpdated(transactionId, code, result) { + if (result.ErrorCode == 0) { + var longitude = result.ReturnValue.Longitude; // Longitude estimate in degrees. The value range is [+180, -180]. + var latitude = result.ReturnValue.Latitude; // Latitude estimate in degrees. The value range is [+90, -90]. + var altitude = result.ReturnValue.Altitude; // Elevation estimate in meters relative to the WGS 84 datum. + var satelliteNumView = result.ReturnValue.SatelliteNumView; // Number of satellites currently in view. + var satelliteNumViewUsed = result.ReturnValue.SatelliteNumViewUsed; // Number of satellites used to obtain the location fix. + 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. + var horizontalSpeedError = result.ReturnValue.HorizontalSpeedError; // Horizontal speed error in meters per second. + var trueCourse = result.ReturnValue.TrueCourse; // Current direction of movement in degrees in relation to true north. + var trueCourseError = result.ReturnValue.TrueCourseError; // TrueCourse error in degrees. + var magneticHeading = result.ReturnValue.MagneticHeading; // Current direction of movement in degrees in relation to magnetic north. + var magneticHeadingError = result.ReturnValue.MagneticHeadingError; // MagneticHeading error in degrees. + var heading = result.ReturnValue.Heading; // Current instantaneous direction of movement in degrees in relation to true north. + var headingError = result.ReturnValue.HeadingError; // Heading error in degrees. + var magneticCourse = result.ReturnValue.MagneticCourse; // Current instantaneous direction of movement in degrees in relation to magnetic north. + var magneticCourseError = result.ReturnValue.MagneticCourseError; // MagneticCourse error in degrees + // TODO Location information was received + } else { + var errorCode = result.ErrorCode; + var errorMessage = result.ErrorMessage; + // TODO Failed to retrieve location information + } +} + + + +var contactService = device.getServiceObject("Service.Contact", + "IDataSource"); + var result = contactService.IDataSource.GetList( + { Type : "Contact", Sort : { Order : "Ascending" } } + ); + if (result.ErrorCode == 0) { + var contacts = result.ReturnValue; + for ( var contact = contacts.getNext(); contact != null; contact = contacts.getNext()) { + var firstName = contact.FirstName; + var lastName = contact.LastName; + var mobile = contact.MobilePhoneGen; + var landPhone = contact.LandPhoneGen; + var jobTitle = contact.JobTitle; + // Consult WRT documentation for possible values + // TODO Process contact information + } + } else { + var errorCode = result.ErrorCode; + var errorMessage = result.ErrorMessage; + // TODO Cannot retrieve contacts list + } + + + + +var phoneNumber = "+6505551214"; + var text = "Sent from WRT application"; + var messaging = device.getServiceObject("Service.Messaging", "IMessaging"); + var result = messaging.IMessaging.Send({ MessageType : "SMS", To : phoneNumber, BodyText : text }); + if (result.ErrorCode != null) { + var errorCode = result.ErrorCode; + var errorMessage = result.ErrorMessage; + } + + + + +var sensors = device.getServiceObject("Service.Sensor", "ISensor"); + var SensorParams = { + SearchCriterion : "Orientation" + }; + var result = sensors.ISensor.FindSensorChannel(SensorParams); + + if (result.ErrorCode == 0) { + var result2 = sensors.ISensor.RegisterForNotification({ ChannelInfoMap : result.ReturnValue[0], ListeningType : "ChannelData" }, ${orientationCallback}); + if (result.ErrorCode == 0) { + var transactionId = result.TransactionID; + // TODO Use this transaction ID to cancel notifications when watching orientation is no longer needed + } else { + var errorCode = result.ErrorCode; + var errorMessage = result.ErrorMessage; + // TODO Handle error + } + } else { + var errorCode = result.ErrorCode; + var errorMessage = result.ErrorMessage; + // TODO Handle error + } + + + + +function orientationCallback(transactionId, code, result) { + if (result.ErrorCode == 0) { + var orientation = result.ReturnValue.DeviceOrientation; + // TODO Possible values: + // "Undefined" + // "DisplayUp" + // "DisplayDown" + // "DisplayLeftUp" + // "DisplayRightUp" + // "DisplayUpwards" + // "DisplayDownwards" + } else { + var errorCode = result.ErrorCode; + var errorMessage = result.ErrorMessage; + // TODO Handle error + } +} + + + diff -r 1e408ee32d8a -r 85c2a2a29aad org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/WRTInferEngine.java --- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/WRTInferEngine.java Fri Jun 11 13:33:03 2010 -0700 +++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/WRTInferEngine.java Mon Jun 14 11:48:28 2010 -0700 @@ -27,6 +27,7 @@ import org.eclipse.wst.jsdt.core.ast.IFunctionDeclaration; import org.eclipse.wst.jsdt.core.infer.InferEngine; import org.eclipse.wst.jsdt.core.infer.InferredType; +import org.eclipse.wst.jsdt.internal.compiler.ast.LocalDeclaration; import org.eclipse.wst.jsdt.internal.compiler.ast.SingleNameReference; import org.eclipse.wst.jsdt.internal.compiler.ast.StringLiteral; @@ -48,6 +49,14 @@ } @Override + protected boolean handleFunctionCall(IFunctionCall messageSend, LocalDeclaration assignmentExpression) { + if (assignmentExpression != null) { + assignmentExpression.setInferredType(getTypeOf(messageSend)); + } + return super.handleFunctionCall(messageSend, assignmentExpression); + } + + @Override protected InferredType getTypeOf(IExpression expression) { if (expression.getASTType() == IASTNode.FUNCTION_CALL) { IFunctionCall call = (IFunctionCall) expression; diff -r 1e408ee32d8a -r 85c2a2a29aad org.symbian.tools.wrttools/templates/default-templates.xml --- a/org.symbian.tools.wrttools/templates/default-templates.xml Fri Jun 11 13:33:03 2010 -0700 +++ b/org.symbian.tools.wrttools/templates/default-templates.xml Mon Jun 14 11:48:28 2010 -0700 @@ -47,7 +47,7 @@ var ${locationService} = device.getServiceObject("Service.Location", "ILocation"); @@ -62,7 +62,7 @@ var ${messaging} = device.getServiceObject("Service.Messaging", "IMessaging");