Heads merge
authorEugene Ostroukhov <eugeneo@symbian.org>
Fri, 09 Jul 2010 14:37:56 -0700
changeset 434 37c0bd2359e7
parent 433 413d1cc4e88a (diff)
parent 431 5cf1f07c055f (current diff)
child 435 06f96e75b79b
Heads merge
--- a/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/perspective/WRTPerspective.java	Fri Jul 09 14:28:18 2010 -0700
+++ b/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/perspective/WRTPerspective.java	Fri Jul 09 14:37:56 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");
--- a/org.symbian.tools.wrttools/META-INF/MANIFEST.MF	Fri Jul 09 14:28:18 2010 -0700
+++ b/org.symbian.tools.wrttools/META-INF/MANIFEST.MF	Fri Jul 09 14:37:56 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/plugin.xml	Fri Jul 09 14:28:18 2010 -0700
+++ b/org.symbian.tools.wrttools/plugin.xml	Fri Jul 09 14:37:56 2010 -0700
@@ -859,14 +859,6 @@
     </library>
  </extension>
  <extension
-       id="org.symbian.tools.wrttools.phonegap"
-       name="PhoneGap Library Support"
-       point="org.eclipse.wst.jsdt.core.inferrenceSupport">
-    <inferenceProvider
-          class="org.symbian.tools.wrttools.core.libraries.jsdt.PhoneGapInferrenceProvider">
-    </inferenceProvider>
- </extension>
- <extension
        point="org.eclipse.ltk.core.refactoring.renameParticipants">
     <renameParticipant
           class="org.symbian.tools.wrttools.core.project.ProjectRenameParticipant"
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/Activator.java	Fri Jul 09 14:28:18 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/Activator.java	Fri Jul 09 14:37:56 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	Fri Jul 09 14:28:18 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/AddLibraryPopupMenu.java	Fri Jul 09 14:37:56 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);
                 }
             }
         });
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/WRTInferEngine.java	Fri Jul 09 14:28:18 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/WRTInferEngine.java	Fri Jul 09 14:37:56 2010 -0700
@@ -25,6 +25,7 @@
 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.ast.ISingleNameReference;
 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;
@@ -34,6 +35,7 @@
 @SuppressWarnings("restriction")
 public class WRTInferEngine extends InferEngine {
     private final Map<String, char[]> serviceIdToType = new TreeMap<String, char[]>();
+    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);
+    }
 }
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/jsdt/PhoneGapInferEngine.java	Fri Jul 09 14:28:18 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);
-    }
-}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/jsdt/PhoneGapInferrenceProvider.java	Fri Jul 09 14:28:18 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<String> PHONEGAP_TYPES = new TreeSet<String>(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;
-    }
-
-}