# HG changeset patch # User Eugene Ostroukhov # Date 1278711438 25200 # Node ID 413d1cc4e88adcf297ec53f84e4f49400990c975 # Parent d2f02b279cdd8f8a137bb75e7b8d5f6411f0183f# Parent c9364c38809d08e8dc056f322f95a40632a5e69f Bugfix and heads merge Fixed Bug 3026 - Content Assist not working for phonegap APIs diff -r d2f02b279cdd -r 413d1cc4e88a org.symbian.tools.wrttools.previewer/preview/script/lib/systeminfo.js --- a/org.symbian.tools.wrttools.previewer/preview/script/lib/systeminfo.js Fri Jul 09 11:29:32 2010 -0700 +++ b/org.symbian.tools.wrttools.previewer/preview/script/lib/systeminfo.js Fri Jul 09 14:37:18 2010 -0700 @@ -28,9 +28,6 @@ */ sysObject.language = 'EN'; - - - /* * Power information services */ @@ -43,14 +40,12 @@ sysObject.onchargelevel = null; sysObject.onchargerconnected = null; - - /* * Beep tone control services */ - sysObject.beep = function(frequency, duration){ } - - + sysObject.beep = function(frequency, duration){ + alert("Beep is not implemented in the previewer."); + }; /* * Network Information services @@ -63,8 +58,6 @@ // value range between: {0-7} sysObject.networkregistrationstatus = 0; - - /* * Display and keypad illumination information and control services @@ -87,8 +80,6 @@ sysObject.lightblink = function(lighttarget, duration, onduration, offduration, intensity){ } sysObject.lightoff = function(lighttarget, duration, fadeout){ } - - /* * Vibration information and control services */ @@ -99,12 +90,13 @@ // Vibration setting in the user profile is off. sysObject.vibrasettings = 2; - sysObject.startvibra = function(duration, intensity){ } + sysObject.startvibra = function(duration, intensity){ + alert("Vibrate is not implemented in the previewer."); + }; - sysObject.stopvibra = function(){ } - - - + sysObject.stopvibra = function(){ + alert("Vibrate is not implemented in the previewer."); + }; /* * Memory and file system information services diff -r d2f02b279cdd -r 413d1cc4e88a org.symbian.tools.wrttools.product/launch/WRT IDE Product (Mac OS X).launch --- a/org.symbian.tools.wrttools.product/launch/WRT IDE Product (Mac OS X).launch Fri Jul 09 11:29:32 2010 -0700 +++ b/org.symbian.tools.wrttools.product/launch/WRT IDE Product (Mac OS X).launch Fri Jul 09 14:37:18 2010 -0700 @@ -21,8 +21,8 @@ - - + + diff -r d2f02b279cdd -r 413d1cc4e88a 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 Jul 09 11:29:32 2010 -0700 +++ b/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/perspective/WRTPerspective.java Fri Jul 09 14:37:18 2010 -0700 @@ -18,7 +18,6 @@ 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"); diff -r d2f02b279cdd -r 413d1cc4e88a org.symbian.tools.wrttools/plugin.xml --- a/org.symbian.tools.wrttools/plugin.xml Fri Jul 09 11:29:32 2010 -0700 +++ b/org.symbian.tools.wrttools/plugin.xml Fri Jul 09 14:37:18 2010 -0700 @@ -859,14 +859,6 @@ - - - - serviceIdToType = new TreeMap(); + private static final char[] NAVIGATOR_TYPE = "Navigator".toCharArray(); public WRTInferEngine() { serviceIdToType.put("Service.AppManager:IAppManager", "AppManager".toCharArray()); @@ -85,4 +87,15 @@ } return super.getTypeOf(expression); } + + @Override + protected InferredType getInferredType2(IExpression fieldReceiver) { + if (fieldReceiver.getASTType() == IASTNode.SINGLE_NAME_REFERENCE) { + ISingleNameReference nameReference = (ISingleNameReference) fieldReceiver; + if ("navigator".equals(String.valueOf(nameReference.getToken()))) { + return addType(NAVIGATOR_TYPE, true); + } + } + return super.getInferredType2(fieldReceiver); + } } diff -r d2f02b279cdd -r 413d1cc4e88a org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/jsdt/PhoneGapInferEngine.java --- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/jsdt/PhoneGapInferEngine.java Fri Jul 09 11:29:32 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +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.core.libraries.jsdt; - -import org.eclipse.wst.jsdt.core.ast.IASTNode; -import org.eclipse.wst.jsdt.core.ast.IExpression; -import org.eclipse.wst.jsdt.core.ast.ISingleNameReference; -import org.eclipse.wst.jsdt.core.infer.InferEngine; -import org.eclipse.wst.jsdt.core.infer.InferredType; - -public class PhoneGapInferEngine extends InferEngine { - private static final char[] NAVIGATOR_TYPE = "Navigator".toCharArray(); - - @Override - protected InferredType getInferredType2(IExpression fieldReceiver) { - if (fieldReceiver.getASTType() == IASTNode.SINGLE_NAME_REFERENCE) { - ISingleNameReference nameReference = (ISingleNameReference) fieldReceiver; - if ("navigator".equals(String.valueOf(nameReference.getToken()))) { - return addType(NAVIGATOR_TYPE, true); - } - } - return super.getInferredType2(fieldReceiver); - } -} diff -r d2f02b279cdd -r 413d1cc4e88a org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/jsdt/PhoneGapInferrenceProvider.java --- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/jsdt/PhoneGapInferrenceProvider.java Fri Jul 09 11:29:32 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +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.core.libraries.jsdt; - -import java.util.Arrays; -import java.util.Collection; -import java.util.TreeSet; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Path; -import org.eclipse.wst.jsdt.core.IJavaScriptUnit; -import org.eclipse.wst.jsdt.core.IType; -import org.eclipse.wst.jsdt.core.JavaScriptCore; -import org.eclipse.wst.jsdt.core.JavaScriptModelException; -import org.eclipse.wst.jsdt.core.infer.IInferenceFile; -import org.eclipse.wst.jsdt.core.infer.InferEngine; -import org.eclipse.wst.jsdt.core.infer.InferrenceProvider; -import org.eclipse.wst.jsdt.core.infer.RefactoringSupport; -import org.eclipse.wst.jsdt.core.infer.ResolutionConfiguration; -import org.symbian.tools.wrttools.Activator; - -public class PhoneGapInferrenceProvider implements InferrenceProvider { - public static final String ID = "org.symbian.tools.wrttools.phonegap"; - private static final Collection PHONEGAP_TYPES = new TreeSet(Arrays.asList("Acceleration", - "AccelerationOptions", "Accelerometer", "Camera", "DeviceError", "Contacts", "Contact", "Geolocation", - "PositionOptions", "Coordinates", "Media", "Notification", "Orientation", "Position", "PositionError", - "Sms", "Storage")); - - public int applysTo(IInferenceFile scriptFile) { - Path path = new Path(String.valueOf(scriptFile.getFileName())); - if (path.segmentCount() > 1) { - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); - if (file != null && file.isAccessible()) { - IJavaScriptUnit unit = (IJavaScriptUnit) JavaScriptCore.create(file); - try { - IType[] types = unit.getAllTypes(); - int typeCount = 0; - for (IType type : types) { - if (PHONEGAP_TYPES.contains(type.getElementName())) { - typeCount += 1; - } - } - if (typeCount > 1) { - return ONLY_THIS; - } - } catch (JavaScriptModelException e) { - Activator.log(e); - } - } - } - return NOT_THIS; - } - - public String getID() { - return ID; - } - - public InferEngine getInferEngine() { - final InferEngine engine = new PhoneGapInferEngine(); - engine.inferenceProvider = this; - return engine; - } - - public RefactoringSupport getRefactoringSupport() { - // TODO Auto-generated method stub - return null; - } - - public ResolutionConfiguration getResolutionConfiguration() { - final ResolutionConfiguration configuration = new ResolutionConfiguration(); - return configuration; - } - -}