Partial fix for Bug 3026 - Content Assist not working for phonegap APIs
authorEugene Ostroukhov <eugeneo@symbian.org>
Fri, 09 Jul 2010 11:29:32 -0700
changeset 432 d2f02b279cdd
parent 429 d1f103499eee
child 433 413d1cc4e88a
Partial fix for Bug 3026 - Content Assist not working for phonegap APIs
org.symbian.tools.wrttools/META-INF/MANIFEST.MF
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/Activator.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/AddLibraryPopupMenu.java
--- a/org.symbian.tools.wrttools/META-INF/MANIFEST.MF	Thu Jul 08 13:58:10 2010 -0700
+++ b/org.symbian.tools.wrttools/META-INF/MANIFEST.MF	Fri Jul 09 11:29:32 2010 -0700
@@ -28,7 +28,8 @@
  org.eclipse.ltk.core.refactoring,
  org.eclipse.ui.editors,
  org.eclipse.wst.common.snippets,
- org.eclipse.jface.text;bundle-version="3.6.0"
+ org.eclipse.jface.text;bundle-version="3.6.0",
+ org.eclipse.wst.jsdt.web.core;bundle-version="1.0.300"
 Bundle-RequiredExecutionEnvironment: J2SE-1.5,
  JavaSE-1.6
 Bundle-ActivationPolicy: lazy
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/Activator.java	Thu Jul 08 13:58:10 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/Activator.java	Fri Jul 09 11:29:32 2010 -0700
@@ -29,6 +29,7 @@
 import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.resource.ImageRegistry;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.wst.jsdt.web.core.javascript.search.JsIndexManager;
 import org.osgi.framework.BundleContext;
 import org.symbian.tools.wrttools.core.WRTImages;
 import org.symbian.tools.wrttools.core.libraries.JSLibrary;
@@ -73,6 +74,7 @@
 		String param = Integer.toString(65*1024);
 		System.setProperty("bluecove.obex.mtu", param);
 		BlueCoveImpl.setConfigProperty("bluecove.obex.mtu", param);
+        JsIndexManager.getInstance();
 	}
 
 	/*
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/AddLibraryPopupMenu.java	Thu Jul 08 13:58:10 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/AddLibraryPopupMenu.java	Fri Jul 09 11:29:32 2010 -0700
@@ -23,8 +23,11 @@
 import java.util.Map;
 
 import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.ActionContributionItem;
@@ -136,13 +139,21 @@
         item.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
-                Map<String, String> empty = Collections.emptyMap();
                 try {
-                    jsLibrary.install(jsProject.getProject(), empty, new NullProgressMonitor());
+                    ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
+                        public void run(IProgressMonitor arg0) throws CoreException {
+                            Map<String, String> empty = Collections.emptyMap();
+                            try {
+                                jsLibrary.install(jsProject.getProject(), empty, new NullProgressMonitor());
+                            } catch (CoreException e1) {
+                                Activator.log(e1);
+                            } catch (IOException e1) {
+                                Activator.log(e1);
+                            }
+                        }
+                    }, new NullProgressMonitor());
                 } catch (CoreException e1) {
                     Activator.log(e1);
-                } catch (IOException e1) {
-                    Activator.log(e1);
                 }
             }
         });