Minor refactoring to make API more clear
authorEugene Ostroukhov <eugeneo@symbian.org>
Tue, 31 Aug 2010 11:58:53 -0700
changeset 479 518afa7c6d2f
parent 478 6c07c755d0c7
child 480 b6d992b9b998
Minor refactoring to make API more clear
plugins/org.symbian.tools.tmw.core/META-INF/MANIFEST.MF
plugins/org.symbian.tools.tmw.core/plugin.xml
plugins/org.symbian.tools.tmw.core/schema/runtimeAppLayout.exsd
plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/projects/LibraryAdditionConfigObject.java
plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/projects/TMWFacetedProject.java
plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileWebRuntime.java
plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/RuntimesManagerImpl.java
plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/projects/IProjectSetupConfig.java
plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IApplicationLayoutProvider.java
plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IMobileWebRuntime.java
plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IMobileWebRuntimeManager.java
plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/LibraryInstallDelegate.java
plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/ProjectCreationConfigFactory.java
plugins/org.symbian.tools.tmw.previewer/META-INF/MANIFEST.MF
plugins/org.symbian.tools.tmw.previewer/plugin.xml
plugins/org.symbian.tools.tmw.previewer/schema/layoutProviders.exsd
plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/PreviewerPlugin.java
plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/core/IApplicationLayoutProvider.java
plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/core/IPreviewerExtensionsManager.java
plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/http/WorkspaceResourcesServlet.java
plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/http/handlers/WorkspaceResourceProvider.java
plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/internal/PreviewerExtensionsManagerImpl.java
plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/internal/PreviewerUtil.java
plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preview/PreviewView.java
plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/WizardContext.java
plugins/org.symbian.tools.wrttools/plugin.xml
plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/InstallPhoneGapDelegate.java
plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/LibrariesUtils.java
plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/project/WRT11ApplicationLayout.java
plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/CoreUtil.java
plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/ProjectUtils.java
--- a/plugins/org.symbian.tools.tmw.core/META-INF/MANIFEST.MF	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/META-INF/MANIFEST.MF	Tue Aug 31 11:58:53 2010 -0700
@@ -11,7 +11,9 @@
  org.eclipse.core.expressions;bundle-version="3.4.200",
  org.eclipse.wst.common.project.facet.core;bundle-version="1.4.100",
  org.eclipse.wst.jsdt.core;bundle-version="1.1.0",
- org.eclipse.wst.validation;bundle-version="1.2.200"
+ org.eclipse.wst.validation;bundle-version="1.2.200",
+ org.eclipse.wst.sse.core;bundle-version="1.1.500",
+ org.eclipse.wst.xml.core;bundle-version="1.1.500"
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Bundle-ActivationPolicy: lazy
 Export-Package: org.symbian.tools.tmw.core,
--- a/plugins/org.symbian.tools.tmw.core/plugin.xml	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/plugin.xml	Tue Aug 31 11:58:53 2010 -0700
@@ -5,6 +5,7 @@
    <extension-point id="packagers" name="Application Packagers" schema="schema/packagers.exsd"/>
    <extension-point id="projectProvider" name="Project provider" schema="schema/projectProvider.exsd"/>
    <extension-point id="runtimeIncludePath" name="Include path providers" schema="schema/runtimeIncludePath.exsd"/>
+   <extension-point id="runtimeAppLayout" name="Runtime Application Layout" schema="schema/runtimeAppLayout.exsd"/>
    <extension
          point="org.eclipse.wst.common.project.facet.core.runtimeBridges">
       <bridge
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.core/schema/runtimeAppLayout.exsd	Tue Aug 31 11:58:53 2010 -0700
@@ -0,0 +1,119 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.symbian.tools.tmw.previewer" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+      <appInfo>
+         <meta.schema plugin="org.symbian.tools.tmw.previewer" id="runtimeAppLayout" name="Runtime Application Layout"/>
+      </appInfo>
+      <documentation>
+         [Enter description of this extension point.]
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <annotation>
+         <appInfo>
+            <meta.element />
+         </appInfo>
+      </annotation>
+      <complexType>
+         <choice minOccurs="1" maxOccurs="unbounded">
+            <element ref="layout-provider"/>
+         </choice>
+         <attribute name="point" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appInfo>
+                  <meta.attribute translatable="true"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="layout-provider">
+      <complexType>
+         <attribute name="runtime-id" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appInfo>
+                  <meta.attribute kind="identifier" basedOn="org.symbian.tools.tmw.core.runtimes/runtime/@component-id"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+         <attribute name="runtime-version" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="class" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appInfo>
+                  <meta.attribute kind="java" basedOn=":org.symbian.tools.tmw.core.runtimes.IApplicationLayoutProvider"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="since"/>
+      </appInfo>
+      <documentation>
+         [Enter the first release in which this extension point appears.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="examples"/>
+      </appInfo>
+      <documentation>
+         [Enter extension point usage example here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="apiinfo"/>
+      </appInfo>
+      <documentation>
+         [Enter API information here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="implementation"/>
+      </appInfo>
+      <documentation>
+         [Enter information about supplied implementation of this extension point.]
+      </documentation>
+   </annotation>
+
+
+</schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/projects/LibraryAdditionConfigObject.java	Tue Aug 31 11:58:53 2010 -0700
@@ -0,0 +1,96 @@
+/**
+ * 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.tmw.core.internal.projects;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.symbian.tools.tmw.core.TMWCore;
+import org.symbian.tools.tmw.core.projects.IProjectSetupConfig;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+@SuppressWarnings("restriction")
+public class LibraryAdditionConfigObject implements IProjectSetupConfig {
+
+    public void initialize(IProject project, IProgressMonitor monitor) {
+        // Do nothing
+    }
+
+    public IFile addFile(IProject project, IPath name, InputStream contents, IProgressMonitor monitor)
+            throws CoreException {
+        IFile file = project.getFile(name);
+        if (!file.exists()) {
+            file.create(contents, false, monitor);
+        }
+        return file;
+    }
+
+    public void addIncludedJsFile(IProject project, IFile file) {
+        // It is highly likely this code is extremely specific to Symbian web runtime.
+        // Please open a bug and clarify the requirements
+        final ITMWProject tmwProject = TMWCore.create(project);
+        if (tmwProject != null && tmwProject.getTargetRuntime() != null) {
+            final IFile page = tmwProject.getTargetRuntime().getLayoutProvider().getIndexPage(tmwProject.getProject());
+            if (page != null && page.exists()) {
+                IStructuredModel model = null;
+                try {
+                    model = StructuredModelManager.getModelManager().getModelForEdit(page);
+                    if (model instanceof IDOMModel) {
+                        IDOMDocument document = ((IDOMModel) model).getDocument();
+                        String path = file.getProjectRelativePath().makeAbsolute().toString();
+
+                        NodeList scripts = document.getElementsByTagName("script");
+                        for (int i = 0; i < scripts.getLength(); i++) {
+
+                        }
+
+                        NodeList heads = document.getElementsByTagName("head");
+                        if (heads.getLength() > 0) {
+                            Element el = document.createElement("script");
+                            el.setAttribute("type", "text/javascript");
+                            el.setAttribute("src", path);
+                            heads.item(0).appendChild(el);
+                            model.save();
+                        }
+                    }
+                } catch (IOException e) {
+                    TMWCore.log(null, e);
+                } catch (CoreException e) {
+                    TMWCore.log(null, e);
+                } finally {
+                    if (model != null) {
+                        model.releaseFromEdit();
+                    }
+                }
+            }
+        }
+    }
+
+}
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/projects/TMWFacetedProject.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/projects/TMWFacetedProject.java	Tue Aug 31 11:58:53 2010 -0700
@@ -18,6 +18,7 @@
  */
 package org.symbian.tools.tmw.core.internal.projects;
 
+import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IMarker;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
@@ -79,4 +80,8 @@
         return "240x320";
     }
 
+    public IFile getMainHtmlPage() {
+        return null;
+    }
+
 }
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileWebRuntime.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileWebRuntime.java	Tue Aug 31 11:58:53 2010 -0700
@@ -22,37 +22,45 @@
 import java.util.TreeMap;
 
 import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.symbian.tools.tmw.core.TMWCore;
+import org.symbian.tools.tmw.core.internal.runtimes.RuntimesManagerImpl.LazyProvider;
+import org.symbian.tools.tmw.core.runtimes.IApplicationLayoutProvider;
 import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
 import org.symbian.tools.tmw.core.utilities.CoreUtil;
 
 public final class MobileWebRuntime implements IMobileWebRuntime {
     private final IConfigurationElement element;
+    private IApplicationLayoutProvider layout;
 
     public MobileWebRuntime(IConfigurationElement element) {
         this.element = element;
-    }
-
-    public String getId() {
-        return element.getAttribute("component-id");
+        checkRegistry();
     }
 
-    public String getVersion() {
-        return element.getAttribute("component-version");
-    }
-
-    public String getName() {
-        return element.getAttribute("name");
+    private synchronized void checkRegistry() {
+        if (layout == null) {
+            final IConfigurationElement[] configuration = Platform.getExtensionRegistry().getConfigurationElementsFor(
+                    TMWCore.PLUGIN_ID, "runtimeAppLayout");
+            for (IConfigurationElement element : configuration) {
+                final String runtimeId = element.getAttribute("runtime-id");
+                final String version = element.getAttribute("runtime-version");
+                if (getId().endsWith(runtimeId) && getVersion().endsWith(version)) {
+                    layout = new LazyProvider(element);
+                    break;
+                }
+            }
+            if (layout == null) {
+                TMWCore.log("No layout provider for runtime %s:%s (from plugin %s)", getId(), getVersion(), element
+                        .getContributor().getName());
+            }
+        }
     }
 
     public IConfigurationElement[] getComponentElements() {
         return element.getChildren("runtime-component");
     }
 
-    @Override
-    public String toString() {
-        return getId() + ":" + getVersion();
-    }
-
     public Map<String, String> getFixedFacets() {
         final Map<String, String> facets = new TreeMap<String, String>();
         final IConfigurationElement[] children = element.getChildren("fixed-facet");
@@ -62,4 +70,25 @@
         return facets;
     }
 
+    public String getId() {
+        return element.getAttribute("component-id");
+    }
+
+    public IApplicationLayoutProvider getLayoutProvider() {
+        return layout;
+    }
+
+    public String getName() {
+        return element.getAttribute("name");
+    }
+
+    public String getVersion() {
+        return element.getAttribute("component-version");
+    }
+
+    @Override
+    public String toString() {
+        return getId() + ":" + getVersion();
+    }
+
 }
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/RuntimesManagerImpl.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/RuntimesManagerImpl.java	Tue Aug 31 11:58:53 2010 -0700
@@ -18,15 +18,21 @@
  */
 package org.symbian.tools.tmw.core.internal.runtimes;
 
+import java.io.InputStream;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.TreeMap;
 
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Platform;
 import org.symbian.tools.tmw.core.TMWCore;
 import org.symbian.tools.tmw.core.projects.ITMWProject;
+import org.symbian.tools.tmw.core.runtimes.IApplicationLayoutProvider;
 import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
 import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntimeManager;
 import org.symbian.tools.tmw.core.runtimes.IPackager;
@@ -102,4 +108,57 @@
         return id + ":" + version;
     }
 
+    public static final class LazyProvider implements IApplicationLayoutProvider {
+        private final IConfigurationElement element;
+        private IApplicationLayoutProvider instance;
+
+        public LazyProvider(IConfigurationElement element) {
+            this.element = element;
+        }
+
+        public IPath getResourcePath(IFile file) {
+            return getDelegate().getResourcePath(file);
+        }
+
+        private IApplicationLayoutProvider getDelegate() {
+            if (instance == null) {
+                try {
+                    instance = (IApplicationLayoutProvider) element.createExecutableExtension("class");
+                } catch (CoreException e) {
+                    TMWCore.log(null, e);
+                    instance = new IApplicationLayoutProvider() {
+
+                        public IPath getResourcePath(IFile file) {
+                            return null;
+                        }
+
+                        public InputStream getResourceFromPath(IProject project, IPath path) {
+                            return null;
+                        }
+
+                        public IFile getWorkspaceFile(IProject project, IPath applicationPath) {
+                            return null;
+                        }
+
+                        public IFile getIndexPage(IProject project) {
+                            return null;
+                        }
+                    };
+                }
+            }
+            return instance;
+        }
+
+        public InputStream getResourceFromPath(IProject project, IPath path) throws CoreException {
+            return getDelegate().getResourceFromPath(project, path);
+        }
+
+        public IFile getWorkspaceFile(IProject project, IPath applicationPath) throws CoreException {
+            return getDelegate().getWorkspaceFile(project, applicationPath);
+        }
+
+        public IFile getIndexPage(IProject project) {
+            return getDelegate().getIndexPage(project);
+        }
+    }
 }
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/projects/IProjectSetupConfig.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/projects/IProjectSetupConfig.java	Tue Aug 31 11:58:53 2010 -0700
@@ -57,5 +57,5 @@
      * @param file workspace file. Framework is responsible to create proper 
      * application root-relative path
      */
-    void addIncludedJsFile(IFile file);
+    void addIncludedJsFile(IProject project, IFile file);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IApplicationLayoutProvider.java	Tue Aug 31 11:58:53 2010 -0700
@@ -0,0 +1,59 @@
+/**
+ * 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.tmw.core.runtimes;
+
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * This interface provides application structure as it will be used in web 
+ * runtime. Note that project layout may not directly correspond to application
+ * layout.
+ * 
+ * @author Eugene Ostroukhov (eugeneo@symbian.org)
+ */
+public interface IApplicationLayoutProvider {
+    /**
+     * @param file workspace resource
+     * @return path relative to application package root
+     */
+    IPath getResourcePath(IFile file);
+
+    /**
+     * @param path path relative to application root
+     * @return workspace resource
+     * @throws CoreException if cannot access resource contents 
+     */
+    InputStream getResourceFromPath(IProject project, IPath path) throws CoreException;
+
+    /**
+     * @return workspace file that corresponds to applicationPath or 
+     * <code>null</code> if none
+     */
+    IFile getWorkspaceFile(IProject project, IPath applicationPath) throws CoreException;
+
+    /**
+     * @return main HTML page (application entry point)
+     */
+    IFile getIndexPage(IProject project);
+}
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IMobileWebRuntime.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IMobileWebRuntime.java	Tue Aug 31 11:58:53 2010 -0700
@@ -45,4 +45,10 @@
      * @return fixed facets (that are always enabled for the runtime) as id-version pairs
      */
     Map<String, String> getFixedFacets();
+
+    /**
+     * @return layout provider that bridges application runtime structure and 
+     * workspace project structure
+     */
+    IApplicationLayoutProvider getLayoutProvider();
 }
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IMobileWebRuntimeManager.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IMobileWebRuntimeManager.java	Tue Aug 31 11:58:53 2010 -0700
@@ -53,4 +53,5 @@
      * @return list of all runtimes known to an IDE
      */
     IMobileWebRuntime[] getAllRuntimes();
+
 }
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/LibraryInstallDelegate.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/LibraryInstallDelegate.java	Tue Aug 31 11:58:53 2010 -0700
@@ -52,7 +52,7 @@
                         final IFile f = setupConfig.addFile(project, basePath.append(entry), stream,
                                 new NullProgressMonitor());
                         if (isIncludeFile(entry)) {
-                            setupConfig.addIncludedJsFile(f);
+                            setupConfig.addIncludedJsFile(project, f);
                         }
 
                     }
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/ProjectCreationConfigFactory.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/ProjectCreationConfigFactory.java	Tue Aug 31 11:58:53 2010 -0700
@@ -24,7 +24,7 @@
 public class ProjectCreationConfigFactory implements IActionConfigFactory {
     // Basically this is an ugly hack. Our project wizard will replace this config
     // object with WizardContext
-    public static final Object CONFIG_STANDIN = "standing_config";
+    public static final Object CONFIG_STANDIN = "standin_config";
 
     public Object create() throws CoreException {
         return CONFIG_STANDIN;
--- a/plugins/org.symbian.tools.tmw.previewer/META-INF/MANIFEST.MF	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/META-INF/MANIFEST.MF	Tue Aug 31 11:58:53 2010 -0700
@@ -18,10 +18,9 @@
  org.symbian.tools.tmw.ui;bundle-version="1.0.0"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.symbian.tools.tmw.previewer.core,
- org.symbian.tools.tmw.previewer.internal,
- org.symbian.tools.tmw.previewer,
- org.symbian.tools.tmw.previewer.http
+Export-Package: org.symbian.tools.tmw.previewer,
+ org.symbian.tools.tmw.previewer.http,
+ org.symbian.tools.tmw.previewer.internal
 Import-Package: javax.servlet;version="2.5.0",
  javax.servlet.http;version="2.5.0",
  org.eclipse.equinox.jsp.jasper;version="1.0.0",
--- a/plugins/org.symbian.tools.tmw.previewer/plugin.xml	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/plugin.xml	Tue Aug 31 11:58:53 2010 -0700
@@ -2,7 +2,6 @@
 <?eclipse version="3.2"?>
 <plugin>
    <extension-point id="commands" name="Previewer Command" schema="schema/commands.exsd"/>
-   <extension-point id="layoutProviders" name="Application Layout Providers" schema="schema/layoutProviders.exsd"/>
     <extension
          point="org.eclipse.ui.views">
       <view
--- a/plugins/org.symbian.tools.tmw.previewer/schema/layoutProviders.exsd	Tue Aug 24 17:21:16 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.symbian.tools.tmw.previewer" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
-      <appInfo>
-         <meta.schema plugin="org.symbian.tools.tmw.previewer" id="layoutProviders" name="Application Layout Providers"/>
-      </appInfo>
-      <documentation>
-         [Enter description of this extension point.]
-      </documentation>
-   </annotation>
-
-   <element name="extension">
-      <annotation>
-         <appInfo>
-            <meta.element />
-         </appInfo>
-      </annotation>
-      <complexType>
-         <choice minOccurs="1" maxOccurs="unbounded">
-            <element ref="layout-provider"/>
-         </choice>
-         <attribute name="point" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="id" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appInfo>
-                  <meta.attribute translatable="true"/>
-               </appInfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="layout-provider">
-      <complexType>
-         <attribute name="runtime-id" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appInfo>
-                  <meta.attribute kind="identifier" basedOn="org.symbian.tools.tmw.core.runtimes/runtime/@component-id"/>
-               </appInfo>
-            </annotation>
-         </attribute>
-         <attribute name="runtime-version" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="class" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appInfo>
-                  <meta.attribute kind="java" basedOn=":org.symbian.tools.tmw.previewer.core.IApplicationLayoutProvider"/>
-               </appInfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <annotation>
-      <appInfo>
-         <meta.section type="since"/>
-      </appInfo>
-      <documentation>
-         [Enter the first release in which this extension point appears.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appInfo>
-         <meta.section type="examples"/>
-      </appInfo>
-      <documentation>
-         [Enter extension point usage example here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appInfo>
-         <meta.section type="apiinfo"/>
-      </appInfo>
-      <documentation>
-         [Enter API information here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appInfo>
-         <meta.section type="implementation"/>
-      </appInfo>
-      <documentation>
-         [Enter information about supplied implementation of this extension point.]
-      </documentation>
-   </annotation>
-
-
-</schema>
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/PreviewerPlugin.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/PreviewerPlugin.java	Tue Aug 31 11:58:53 2010 -0700
@@ -32,9 +32,7 @@
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
-import org.symbian.tools.tmw.previewer.core.IPreviewerExtensionsManager;
 import org.symbian.tools.tmw.previewer.http.HttpPreviewer;
-import org.symbian.tools.tmw.previewer.internal.PreviewerExtensionsManagerImpl;
 
 /**
  * The activator class controls the plug-in life cycle
@@ -62,7 +60,6 @@
 	// The shared instance
 	private static PreviewerPlugin plugin;
 
-    private final IPreviewerExtensionsManager extensionsManager = new PreviewerExtensionsManagerImpl();
     private final CommandHandlerManager handlerManager = new CommandHandlerManager();
 	private final HttpPreviewer previewer = new HttpPreviewer();
     private MessageConsole console;
@@ -149,8 +146,4 @@
         console.newMessageStream().write(
                 message);
     }
-
-    public static IPreviewerExtensionsManager getExtensionsManager() {
-        return getDefault().extensionsManager;
-    }
 }
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/core/IApplicationLayoutProvider.java	Tue Aug 24 17:21:16 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +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.tmw.previewer.core;
-
-import java.io.InputStream;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * This interface provides application structure as it will be used in web 
- * runtime. Note that project layout may not directly correspond to application
- * layout.
- * 
- * @author Eugene Ostroukhov (eugeneo@symbian.org)
- */
-public interface IApplicationLayoutProvider {
-    /**
-     * @param file workspace resource
-     * @return path relative to application package root
-     */
-    IPath getResourcePath(IFile file);
-
-    /**
-     * @param path path relative to application root
-     * @return workspace resource
-     * @throws CoreException if cannot access resource contents 
-     */
-    InputStream getResourceFromPath(IProject project, IPath path) throws CoreException;
-
-    /**
-     * @return workspace file that corresponds to applicationPath or 
-     * <code>null</code> if none
-     */
-    IFile getWorkspaceFile(IProject project, IPath applicationPath) throws CoreException;
-}
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/core/IPreviewerExtensionsManager.java	Tue Aug 24 17:21:16 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +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.tmw.previewer.core;
-
-import org.eclipse.core.resources.IProject;
-
-public interface IPreviewerExtensionsManager {
-    IApplicationLayoutProvider getLayoutProvider(IProject project);
-}
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/http/WorkspaceResourcesServlet.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/http/WorkspaceResourcesServlet.java	Tue Aug 31 11:58:53 2010 -0700
@@ -50,16 +50,17 @@
 import org.json.simple.JSONObject;
 import org.json.simple.parser.JSONParser;
 import org.json.simple.parser.ParseException;
+import org.symbian.tools.tmw.core.TMWCore;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
+import org.symbian.tools.tmw.core.runtimes.IApplicationLayoutProvider;
 import org.symbian.tools.tmw.previewer.PreviewerException;
 import org.symbian.tools.tmw.previewer.PreviewerPlugin;
-import org.symbian.tools.tmw.previewer.core.IApplicationLayoutProvider;
 import org.symbian.tools.tmw.previewer.http.handlers.DebuggerResourceProvider;
 import org.symbian.tools.tmw.previewer.http.handlers.PreviewerStaticResourceProvider;
 import org.symbian.tools.tmw.previewer.http.handlers.Providers;
 
 public class WorkspaceResourcesServlet extends HttpServlet {
     private static final Map<String, String> EXTENSION_CONTENT_TYPE = new TreeMap<String, String>();
-
     private static final long serialVersionUID = -3217197074249607950L;
 
     static {
@@ -99,49 +100,41 @@
         }
     }
 
+    public static URI getDebugStartingPage(IProject project, String session) {
+        return getServerURIForResource(project.getFullPath().append(HttpPreviewer.DEBUG_STARTING_PAGE).makeAbsolute(),
+                session);
+    }
+
     public static IFile getFileFromUrl(String name) {
         final IPath path = getResourcePath(name);
         if (path != null) {
             final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(path.segment(0));
-            final IApplicationLayoutProvider provider = PreviewerPlugin.getExtensionsManager().getLayoutProvider(
-                    project);
-            if (provider != null) {
-                try {
-                    return provider.getWorkspaceFile(project, path.removeFirstSegments(1));
-                } catch (CoreException e) {
-                    PreviewerPlugin.log(e);
+            final ITMWProject p = TMWCore.create(project);
+            if (p != null && p.getTargetRuntime() != null) {
+                final IApplicationLayoutProvider provider = p.getTargetRuntime().getLayoutProvider();
+                if (provider != null) {
+                    try {
+                        return provider.getWorkspaceFile(project, path.removeFirstSegments(1));
+                    } catch (CoreException e) {
+                        PreviewerPlugin.log(e);
+                    }
                 }
             }
         }
         return null;
     }
 
-    private static IPath getResourcePath(String name) {
-        IPath p = null;
-        try {
-            String root = getHttpUrl(null);
-            if (name != null && name.startsWith(root)) {
-                final String fileName = URLDecoder.decode(name.substring(root.length()), "UTF-8");
-                final IPath path = new Path(fileName);
-                if (path.segmentCount() > 1) {
-                    p = path;
-                }
-            }
-        } catch (UnsupportedEncodingException e) {
-            throw new RuntimeException(e);
-        }
-        return p;
-    }
-
     public static String getHttpUrl(IFile file) {
         IPath p = new Path("/");
         if (file != null) {
-            IApplicationLayoutProvider provider = PreviewerPlugin.getExtensionsManager().getLayoutProvider(
-                    file.getProject());
-            if (provider != null) {
-                IPath path = provider.getResourcePath(file);
-                if (path != null) {
-                    p = p.append(file.getProject().getName()).append(path).makeAbsolute();
+            final ITMWProject project = TMWCore.create(file.getProject());
+            if (project != null && project.getTargetRuntime() != null) {
+                final IApplicationLayoutProvider provider = project.getTargetRuntime().getLayoutProvider();
+                if (provider != null) {
+                    IPath path = provider.getResourcePath(file);
+                    if (path != null) {
+                        p = p.append(file.getProject().getName()).append(path).makeAbsolute();
+                    }
                 }
             }
         }
@@ -192,6 +185,23 @@
                 null);
     }
 
+    private static IPath getResourcePath(String name) {
+        IPath p = null;
+        try {
+            String root = getHttpUrl(null);
+            if (name != null && name.startsWith(root)) {
+                final String fileName = URLDecoder.decode(name.substring(root.length()), "UTF-8");
+                final IPath path = new Path(fileName);
+                if (path.segmentCount() > 1) {
+                    p = path;
+                }
+            }
+        } catch (UnsupportedEncodingException e) {
+            throw new RuntimeException(e);
+        }
+        return p;
+    }
+
     private static URI getServerURIForResource(IPath resourcePath, String debugSessionId) {
         try {
             String path = encode(WebappManager.WORKSPACE_RESOURCES_CONTEXT + resourcePath);
@@ -273,9 +283,4 @@
         }
         resp.setStatus(HttpServletResponse.SC_OK);
     }
-
-    public static URI getDebugStartingPage(IProject project, String session) {
-        return getServerURIForResource(project.getFullPath().append(HttpPreviewer.DEBUG_STARTING_PAGE).makeAbsolute(),
-                session);
-    }
 }
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/http/handlers/WorkspaceResourceProvider.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/http/handlers/WorkspaceResourceProvider.java	Tue Aug 31 11:58:53 2010 -0700
@@ -26,7 +26,9 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.json.simple.JSONObject;
-import org.symbian.tools.tmw.previewer.PreviewerPlugin;
+import org.symbian.tools.tmw.core.TMWCore;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
+import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
 
 public class WorkspaceResourceProvider implements IResourceProvider {
     public String[] getPaths() {
@@ -35,7 +37,14 @@
 
     public InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters,
             String sessionId) throws CoreException {
-        return PreviewerPlugin.getExtensionsManager().getLayoutProvider(project).getResourceFromPath(project, resource);
+        final ITMWProject p = TMWCore.create(project);
+        if (p != null) {
+            final IMobileWebRuntime targetRuntime = p.getTargetRuntime();
+            if (targetRuntime != null) {
+                return targetRuntime.getLayoutProvider().getResourceFromPath(project, resource);
+            }
+        }
+        return null;
     }
 
     public void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object,
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/internal/PreviewerExtensionsManagerImpl.java	Tue Aug 24 17:21:16 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +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.tmw.previewer.internal;
-
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-import org.symbian.tools.tmw.core.TMWCore;
-import org.symbian.tools.tmw.core.projects.ITMWProject;
-import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
-import org.symbian.tools.tmw.previewer.PreviewerPlugin;
-import org.symbian.tools.tmw.previewer.core.IApplicationLayoutProvider;
-import org.symbian.tools.tmw.previewer.core.IPreviewerExtensionsManager;
-
-public class PreviewerExtensionsManagerImpl implements IPreviewerExtensionsManager {
-    public static final class LazyProvider implements IApplicationLayoutProvider {
-        private final IConfigurationElement element;
-        private IApplicationLayoutProvider instance;
-
-        public LazyProvider(IConfigurationElement element) {
-            this.element = element;
-        }
-
-        public IPath getResourcePath(IFile file) {
-            return getDelegate().getResourcePath(file);
-        }
-
-        private IApplicationLayoutProvider getDelegate() {
-            if (instance == null) {
-                try {
-                    instance = (IApplicationLayoutProvider) element.createExecutableExtension("class");
-                } catch (CoreException e) {
-                    PreviewerPlugin.log(e);
-                    instance = new IApplicationLayoutProvider() {
-
-                        public IPath getResourcePath(IFile file) {
-                            return null;
-                        }
-
-                        public InputStream getResourceFromPath(IProject project, IPath path) {
-                            return null;
-                        }
-
-                        public IFile getWorkspaceFile(IProject project, IPath applicationPath) {
-                            return null;
-                        }
-                    };
-                }
-            }
-            return instance;
-        }
-
-        public InputStream getResourceFromPath(IProject project, IPath path) throws CoreException {
-            return getDelegate().getResourceFromPath(project, path);
-        }
-
-        public IFile getWorkspaceFile(IProject project, IPath applicationPath) throws CoreException {
-            return getDelegate().getWorkspaceFile(project, applicationPath);
-        }
-    }
-
-    private Map<IMobileWebRuntime, IApplicationLayoutProvider> providers;
-
-    public IApplicationLayoutProvider getLayoutProvider(IProject project) {
-        final ITMWProject p = TMWCore.create(project);
-        if (p != null && p.getTargetRuntime() != null) {
-            checkRegistry();
-            return providers.get(p.getTargetRuntime());
-        }
-        return null;
-    }
-
-    private synchronized void checkRegistry() {
-        if (providers == null) {
-            providers = new HashMap<IMobileWebRuntime, IApplicationLayoutProvider>();
-            final IConfigurationElement[] configuration = Platform.getExtensionRegistry().getConfigurationElementsFor(
-                    PreviewerPlugin.PLUGIN_ID, "layoutProviders");
-            for (IConfigurationElement element : configuration) {
-                final String runtimeId = element.getAttribute("runtime-id");
-                final String version = element.getAttribute("runtime-version");
-                final IMobileWebRuntime runtime = TMWCore.getRuntimesManager().getRuntime(runtimeId, version);
-                if (runtime != null) {
-                    providers.put(runtime, new LazyProvider(element));
-                } else {
-                    PreviewerPlugin.log(String.format("Runtime %s:$s referenced from %s was not found", runtimeId,
-                            version, element.getContributor().getName()), null);
-                }
-            }
-        }
-    }
-}
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/internal/PreviewerUtil.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/internal/PreviewerUtil.java	Tue Aug 31 11:58:53 2010 -0700
@@ -30,8 +30,10 @@
 import org.eclipse.core.resources.IResourceDeltaVisitor;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
+import org.symbian.tools.tmw.core.TMWCore;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
+import org.symbian.tools.tmw.core.runtimes.IApplicationLayoutProvider;
 import org.symbian.tools.tmw.previewer.PreviewerPlugin;
-import org.symbian.tools.tmw.previewer.core.IApplicationLayoutProvider;
 
 public class PreviewerUtil {
     public static final class ChangedResourcesCollector implements IResourceDeltaVisitor {
@@ -53,16 +55,18 @@
                 }
                 break;
             case IResource.FILE:
-                IApplicationLayoutProvider layoutProvider = PreviewerPlugin.getExtensionsManager().getLayoutProvider(
-                        resource.getProject());
-                if (layoutProvider != null) {
-                    if (layoutProvider.getResourcePath((IFile) resource) != null) {
-                        final boolean kind = delta.getKind() == IResourceDelta.ADDED
-                                | delta.getKind() == IResourceDelta.REMOVED;
-                        final boolean flag = (delta.getFlags() & (IResourceDelta.CONTENT | IResourceDelta.ENCODING
-                                | IResourceDelta.LOCAL_CHANGED | IResourceDelta.REPLACED | IResourceDelta.SYNC)) != 0;
-                        if (kind || flag) {
-                            files.add((IFile) resource);
+                final ITMWProject p = TMWCore.create(resource.getProject());
+                if (p != null && p.getTargetRuntime() != null) {
+                    IApplicationLayoutProvider layoutProvider = p.getTargetRuntime().getLayoutProvider();
+                    if (layoutProvider != null) {
+                        if (layoutProvider.getResourcePath((IFile) resource) != null) {
+                            final boolean kind = delta.getKind() == IResourceDelta.ADDED
+                                    | delta.getKind() == IResourceDelta.REMOVED;
+                            final boolean flag = (delta.getFlags() & (IResourceDelta.CONTENT | IResourceDelta.ENCODING
+                                    | IResourceDelta.LOCAL_CHANGED | IResourceDelta.REPLACED | IResourceDelta.SYNC)) != 0;
+                            if (kind || flag) {
+                                files.add((IFile) resource);
+                            }
                         }
                     }
                 }
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preview/PreviewView.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preview/PreviewView.java	Tue Aug 31 11:58:53 2010 -0700
@@ -33,6 +33,8 @@
 import org.eclipse.ui.part.MessagePage;
 import org.eclipse.ui.part.PageBook;
 import org.eclipse.ui.part.PageBookView;
+import org.symbian.tools.tmw.core.TMWCore;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
 import org.symbian.tools.tmw.previewer.IWrtEditingPreferences;
 import org.symbian.tools.tmw.previewer.PreviewerPlugin;
 
@@ -143,7 +145,10 @@
         if (part instanceof IEditorPart) {
             IResource resource = (IResource) ((IEditorPart) part).getEditorInput().getAdapter(IResource.class);
             if (resource != null) {
-                return PreviewerPlugin.getExtensionsManager().getLayoutProvider(resource.getProject()) != null;
+                final ITMWProject project = TMWCore.create(resource.getProject());
+                if (project != null && project.getTargetRuntime() != null) {
+                    return project.getTargetRuntime().getLayoutProvider() != null;
+                }
             }
         }
         return false;
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/WizardContext.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/WizardContext.java	Tue Aug 31 11:58:53 2010 -0700
@@ -321,7 +321,7 @@
         }
     }
 
-    public void addIncludedJsFile(IFile file) {
+    public void addIncludedJsFile(IProject project, IFile file) {
         jsIncludes.add(file.getProjectRelativePath().makeRelative().toString());
     }
 }
--- a/plugins/org.symbian.tools.wrttools/plugin.xml	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/plugin.xml	Tue Aug 31 11:58:53 2010 -0700
@@ -136,18 +136,6 @@
 		</content-type>
 	</extension>
 	
-<!-- Perspective Extensions -->
-	<extension point="org.eclipse.ui.perspectiveExtensions">
-		<perspectiveExtension targetID="org.eclipse.wst.jsdt.ui.JavaPerspective">
-			<newWizardShortcut id="org.symbian.tools.wrttools.core.wrtwidgetwizard">
-			</newWizardShortcut>
-		</perspectiveExtension>
-		<perspectiveExtension targetID="org.eclipse.debug.ui.DebugPerspective">
-			<newWizardShortcut id="org.symbian.tools.wrttools.core.wrtwidgetwizard">
-			</newWizardShortcut>
-		</perspectiveExtension>
-	</extension>
-	
  <extension
        point="org.eclipse.wst.jsdt.core.JsGlobalScopeContainerInitializer">
     <JsGlobalScopeContainerInitializer
@@ -1069,7 +1057,7 @@
       </image>
    </extension>
    <extension
-         point="org.symbian.tools.tmw.previewer.layoutProviders">
+         point="org.symbian.tools.tmw.core.runtimeAppLayout">
       <layout-provider
             class="org.symbian.tools.wrttools.core.project.WRT11ApplicationLayout"
             runtime-id="org.symbian.tools.wrttools.wrt"
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/InstallPhoneGapDelegate.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/InstallPhoneGapDelegate.java	Tue Aug 31 11:58:53 2010 -0700
@@ -56,7 +56,7 @@
                     file = url.openStream();
                     final IFile f = setupConfig.addFile(project, basePath.append(PHONEGAP_JS), file,
                             new NullProgressMonitor());
-                    setupConfig.addIncludedJsFile(f);
+                    setupConfig.addIncludedJsFile(project, f);
                 }
             } catch (IOException e) {
                 Activator.log(e);
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/LibrariesUtils.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/LibrariesUtils.java	Tue Aug 31 11:58:53 2010 -0700
@@ -48,28 +48,25 @@
             return;
         }
         IModelManager modelManager = StructuredModelManager.getModelManager();
-        String indexFile = CoreUtil.getIndexFile(project);
-        if (indexFile != null) {
-            IFile file = project.getFile(indexFile);
-            if (file != null & file.exists()) {
-                IStructuredModel model = modelManager.getModelForEdit(file);
-                try {
-                    if (model instanceof IDOMModel) {
-                        ((IDOMModel) model).beginRecording(js, label);
-                        boolean needsSave = false;
-                        for (String jsLib : js) {
-                            needsSave |= change(((IDOMModel) model).getDocument(), jsLib);
-                        }
-                        model.endRecording(js);
-                        if (needsSave) {
-                            model.save();
-                        }
+        IFile file = CoreUtil.getIndexFile(project);
+        if (file != null & file.exists()) {
+            IStructuredModel model = modelManager.getModelForEdit(file);
+            try {
+                if (model instanceof IDOMModel) {
+                    ((IDOMModel) model).beginRecording(js, label);
+                    boolean needsSave = false;
+                    for (String jsLib : js) {
+                        needsSave |= change(((IDOMModel) model).getDocument(), jsLib);
                     }
-                } finally {
-                    if (model != null) {
-                        model.releaseFromEdit();
+                    model.endRecording(js);
+                    if (needsSave) {
+                        model.save();
                     }
                 }
+            } finally {
+                if (model != null) {
+                    model.releaseFromEdit();
+                }
             }
         }
     }
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/project/WRT11ApplicationLayout.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/project/WRT11ApplicationLayout.java	Tue Aug 31 11:58:53 2010 -0700
@@ -35,7 +35,7 @@
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Status;
-import org.symbian.tools.tmw.previewer.core.IApplicationLayoutProvider;
+import org.symbian.tools.tmw.core.runtimes.IApplicationLayoutProvider;
 import org.symbian.tools.wrttools.Activator;
 import org.symbian.tools.wrttools.util.CoreUtil;
 import org.symbian.tools.wrttools.util.ProjectUtils;
@@ -54,16 +54,11 @@
     private IFile getProjectIndexPage(String projectName) throws IOException, CoreException {
         IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
         if (project.isAccessible()) {
-            String indexFileName = CoreUtil.getIndexFile(project);
-            if (indexFileName != null) {
-                final IFile file = CoreUtil.getFile(project, indexFileName);
-                if (!ProjectUtils.isExcluded(file)) {
-                    return file;
-                }
+            final IFile file = CoreUtil.getIndexFile(project);
+            if (file != null && !ProjectUtils.isExcluded(file)) {
+                return file;
             }
-            Activator.log(
-                    String.format("Can not find main page (%s) in project %s.\n", indexFileName, project.getName()),
-                    null);
+            Activator.log(String.format("Can not find main page in project %s.\n", project.getName()), null);
         }
         return null;
     }
@@ -151,4 +146,13 @@
         return (file != null && file.exists()) && isFileIncluded(file) ? file : null;
     }
 
+    public IFile getIndexPage(IProject project) {
+        try {
+            return CoreUtil.getIndexFile(project);
+        } catch (CoreException e) {
+            Activator.log(e);
+            return null;
+        }
+    }
+
 }
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/CoreUtil.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/CoreUtil.java	Tue Aug 31 11:58:53 2010 -0700
@@ -115,7 +115,7 @@
 
     private static final Map<IProject, IndexFileRecord> INDEX_FILES = new HashMap<IProject, IndexFileRecord>();
 
-    public static synchronized String getIndexFile(IProject project) throws CoreException {
+    public static synchronized IFile getIndexFile(IProject project) throws CoreException {
         // There will really be a lot of calls to this method. We need to cache values.
         IFile file = getFile(project, METADATA_FILE);
         if (file == null) {
@@ -132,15 +132,19 @@
             }
         }
         String fileName = getIndexFileName(readFile(file));
-        INDEX_FILES.put(project, new IndexFileRecord(fileName, file.getModificationStamp()));
-        return fileName;
+        if (fileName != null) {
+            IFile f = getFile(project, fileName);
+            INDEX_FILES.put(project, new IndexFileRecord(f, file.getModificationStamp()));
+            return f;
+        }
+        return null;
     }
 
     private static class IndexFileRecord {
-        public final String fileName;
+        public final IFile fileName;
         public final long timeStamp;
 
-        public IndexFileRecord(String fileName, long timeStamp) {
+        public IndexFileRecord(IFile fileName, long timeStamp) {
             this.fileName = fileName;
             this.timeStamp = timeStamp;
         }
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/ProjectUtils.java	Tue Aug 24 17:21:16 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/ProjectUtils.java	Tue Aug 31 11:58:53 2010 -0700
@@ -100,12 +100,9 @@
             try {
                 final Collection<IFile> files = new HashSet<IFile>(projects.length);
                 for (IProject project : projects) {
-                    String file = CoreUtil.getIndexFile(project);
-                    if (file != null) {
-                        IFile index = project.getFile(file);
-                        if (index.isAccessible()) {
-                            files.add(index);
-                        }
+                    IFile index = CoreUtil.getIndexFile(project);
+                    if (index != null && index.isAccessible()) {
+                        files.add(index);
                     }
                 }
                 final IFile[] filesArray = files.toArray(new IFile[files.size()]);
@@ -414,8 +411,7 @@
             return false;
         }
         try {
-            IMarker[] markers = resource
-                    .findMarkers(EXCLUDE_MARKER_ID, false, IResource.DEPTH_ZERO);
+            IMarker[] markers = resource.findMarkers(EXCLUDE_MARKER_ID, false, IResource.DEPTH_ZERO);
             IPath path = resource.getProjectRelativePath();
             return markers.length != 0 || (path.segmentCount() > 1 && ".settings".equals(path.segment(0)))
                     || isExcluded(resource.getParent());
@@ -437,8 +433,7 @@
 
     public static void include(IResource resource) {
         try {
-            IMarker[] markers = resource
-                    .findMarkers(EXCLUDE_MARKER_ID, false, IResource.DEPTH_ZERO);
+            IMarker[] markers = resource.findMarkers(EXCLUDE_MARKER_ID, false, IResource.DEPTH_ZERO);
             resource.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, null);
             for (IMarker marker : markers) {
                 marker.delete();