Bug 2161 - Content Assist forgets item type after event handler is assigned.
--- a/org.symbian.tools.wrttools/libraries/core/menu.js Fri Mar 05 11:31:01 2010 -0800
+++ b/org.symbian.tools.wrttools/libraries/core/menu.js Fri Mar 05 13:44:17 2010 -0800
@@ -80,7 +80,7 @@
* The onShow property of the menu object is an event handler
* for the event of when the options menu is open.
*/
-Menu.prototype.onShow = new Object();
+Menu.prototype.onShow = new Function();
/**
@@ -111,4 +111,4 @@
/**
* Event handler for the event when the menu item is selected.
*/
-MenuItem.prototype.onSelect = new Object();
\ No newline at end of file
+MenuItem.prototype.onSelect = new Function();
\ No newline at end of file
--- a/org.symbian.tools.wrttools/libraries/core/widget.js Fri Mar 05 11:31:01 2010 -0800
+++ b/org.symbian.tools.wrttools/libraries/core/widget.js Fri Mar 05 13:44:17 2010 -0800
@@ -56,20 +56,14 @@
/**
* Allows the definition of a function to be called
* when a Widget.is displayed
- * @param {Void}
- * onshow()
- * @return {Void}
*/
-Widget.prototype.onshow = new Object();
+Widget.prototype.onshow = new Function();
/**
* Allows the definition of a function to be called
* when a Widget.sent into the background (hidden)
- * @param {Void}
- * onhide()
- * @return {Void}
*/
-Widget.prototype.onhide = new Object();
+Widget.prototype.onhide = new Function();
/**
* Launches the browser with the specified url
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/PlatformServicesTypeProvider.java Fri Mar 05 11:31:01 2010 -0800
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/PlatformServicesTypeProvider.java Fri Mar 05 13:44:17 2010 -0800
@@ -35,11 +35,14 @@
public int applysTo(IInferenceFile scriptFile) {
char[] fileName = scriptFile.getFileName();
if (fileName != null) {
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(new String(fileName)));
- if (file.exists()) {
- IProject project = file.getProject();
- if (ProjectUtils.hasWrtNature(project)) {
- return InferrenceProvider.ONLY_THIS;
+ Path path = new Path(String.valueOf(fileName));
+ if (path.segmentCount() > 1) {
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ if (file.exists()) {
+ IProject project = file.getProject();
+ if (ProjectUtils.hasWrtNature(project)) {
+ return InferrenceProvider.ONLY_THIS;
+ }
}
}
}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/WRTInferEngine.java Fri Mar 05 11:31:01 2010 -0800
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/WRTInferEngine.java Fri Mar 05 13:44:17 2010 -0800
@@ -24,8 +24,10 @@
import org.eclipse.wst.jsdt.core.ast.IASTNode;
import org.eclipse.wst.jsdt.core.ast.IExpression;
import org.eclipse.wst.jsdt.core.ast.IFunctionCall;
+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.SingleNameReference;
import org.eclipse.wst.jsdt.internal.compiler.ast.StringLiteral;
@SuppressWarnings("restriction")
@@ -66,6 +68,11 @@
}
}
}
+ } else if (expression instanceof SingleNameReference) {
+ IFunctionDeclaration fun = getDefinedFunction(expression);
+ if (fun != null) {
+ return FunctionType;
+ }
}
return super.getTypeOf(expression);
}