Previewer now is TMWed (can support projects with different natures). Note: this commit does not compile. This previewer still only supports WRT libraries
--- a/org.symbian.tools.mtw.core/schema/projectProvider.exsd Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.core/schema/projectProvider.exsd Thu Aug 19 16:13:44 2010 -0700
@@ -60,7 +60,7 @@
</documentation>
<appinfo>
- <meta.attribute kind="java" basedOn=":org.symbian.tools.tmw.core.projects.IMTWProjectProvider"/>
+ <meta.attribute kind="java" basedOn=":org.symbian.tools.tmw.core.projects.ITMWProjectProvider"/>
</appinfo>
</annotation>
</attribute>
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/TMWCore.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/TMWCore.java Thu Aug 19 16:13:44 2010 -0700
@@ -10,7 +10,7 @@
import org.symbian.tools.tmw.core.internal.runtimes.RuntimeClasspathManager;
import org.symbian.tools.tmw.core.internal.runtimes.RuntimesManagerImpl;
import org.symbian.tools.tmw.core.projects.IFProjSupport;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntimeManager;
/**
@@ -59,7 +59,7 @@
return classpathManager;
}
- public static IMTWProject create(IProject project) {
+ public static ITMWProject create(IProject project) {
return getDefault().projectsSupport.create(project);
}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/LazyIncludePathProvider.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/LazyIncludePathProvider.java Thu Aug 19 16:13:44 2010 -0700
@@ -23,7 +23,7 @@
import org.eclipse.wst.jsdt.core.IIncludePathEntry;
import org.symbian.tools.tmw.core.TMWCore;
import org.symbian.tools.tmw.core.projects.IFacetIncludePathProvider;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
public class LazyIncludePathProvider implements IFacetIncludePathProvider {
private final IConfigurationElement element;
@@ -33,7 +33,7 @@
this.element = element;
}
- public IIncludePathEntry[] getEntries(IMTWProject project) {
+ public IIncludePathEntry[] getEntries(ITMWProject project) {
if (provider == null) {
try {
provider = (LazyIncludePathProvider) element.createExecutableExtension("class");
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/MTWFacetedProjectProvider.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/MTWFacetedProjectProvider.java Thu Aug 19 16:13:44 2010 -0700
@@ -26,13 +26,13 @@
import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
import org.symbian.tools.tmw.core.ITMWConstants;
import org.symbian.tools.tmw.core.TMWCore;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
-import org.symbian.tools.tmw.core.projects.IMTWProjectProvider;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProjectProvider;
-public class MTWFacetedProjectProvider implements IMTWProjectProvider {
- private final Map<IProject, IMTWProject> projects = new WeakHashMap<IProject, IMTWProject>();
+public class MTWFacetedProjectProvider implements ITMWProjectProvider {
+ private final Map<IProject, ITMWProject> projects = new WeakHashMap<IProject, ITMWProject>();
- public IMTWProject create(IProject project) {
+ public ITMWProject create(IProject project) {
if (!projects.containsKey(project)) {
projects.put(project, new TMWFacetedProject(project));
}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/ProjectProvider.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/ProjectProvider.java Thu Aug 19 16:13:44 2010 -0700
@@ -26,13 +26,13 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.symbian.tools.tmw.core.TMWCore;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
-import org.symbian.tools.tmw.core.projects.IMTWProjectProvider;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProjectProvider;
-public class ProjectProvider implements IMTWProjectProvider {
+public class ProjectProvider implements ITMWProjectProvider {
private final IConfigurationElement element;
private final Expression expression;
- private IMTWProjectProvider provider;
+ private ITMWProjectProvider provider;
public ProjectProvider(IConfigurationElement element) throws CoreException {
this.element = element;
@@ -49,14 +49,14 @@
}
}
- public IMTWProject create(IProject project) {
+ public ITMWProject create(IProject project) {
return getProvider().create(project);
}
- private IMTWProjectProvider getProvider() {
+ private ITMWProjectProvider getProvider() {
if (provider == null) {
try {
- provider = (IMTWProjectProvider) element.createExecutableExtension("class");
+ provider = (ITMWProjectProvider) element.createExecutableExtension("class");
} catch (CoreException e) {
throw new RuntimeException(e);
}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/ProjectsSupportManager.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/ProjectsSupportManager.java Thu Aug 19 16:13:44 2010 -0700
@@ -26,12 +26,12 @@
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.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
public class ProjectsSupportManager {
private Collection<ProjectProvider> providers = null;
- public IMTWProject create(IProject project) {
+ public ITMWProject create(IProject project) {
if (providers == null) {
readProviders();
}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/StaticIncludePathProvider.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/StaticIncludePathProvider.java Thu Aug 19 16:13:44 2010 -0700
@@ -32,7 +32,7 @@
import org.osgi.framework.Bundle;
import org.symbian.tools.tmw.core.TMWCore;
import org.symbian.tools.tmw.core.projects.IFacetIncludePathProvider;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
public class StaticIncludePathProvider implements IFacetIncludePathProvider {
private final IConfigurationElement element;
@@ -42,7 +42,7 @@
this.element = element;
}
- public IIncludePathEntry[] getEntries(IMTWProject project) {
+ public IIncludePathEntry[] getEntries(ITMWProject project) {
if (entries == null) {
final String name = element.getContributor().getName();
final String path = element.getAttribute("file");
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/TMWFacetedProject.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/TMWFacetedProject.java Thu Aug 19 16:13:44 2010 -0700
@@ -32,10 +32,10 @@
import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent;
import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponentVersion;
import org.symbian.tools.tmw.core.TMWCore;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
-public class TMWFacetedProject implements IMTWProject {
+public class TMWFacetedProject implements ITMWProject {
private final IProject project;
public TMWFacetedProject(IProject project) {
@@ -88,4 +88,8 @@
return false;
}
+ public String getPreferredScreenSize() {
+ return "240x320";
+ }
+
}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/runtimes/LazyPackager.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/runtimes/LazyPackager.java Thu Aug 19 16:13:44 2010 -0700
@@ -26,7 +26,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.symbian.tools.tmw.core.TMWCore;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
import org.symbian.tools.tmw.core.runtimes.IPackager;
import org.symbian.tools.tmw.core.runtimes.IPackagerDelegate;
@@ -39,7 +39,7 @@
this.element = element;
}
- public File packageApplication(IMTWProject project, IProgressMonitor monitor) throws CoreException {
+ public File packageApplication(ITMWProject project, IProgressMonitor monitor) throws CoreException {
return getPackager().packageApplication(project, monitor);
}
@@ -60,7 +60,7 @@
return getPackager().getPathInPackage(resource);
}
- public String getFileType(IMTWProject project) {
+ public String getFileType(ITMWProject project) {
return getPackager().getFileType(project);
}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileRuntimeLibraryContainer.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileRuntimeLibraryContainer.java Thu Aug 19 16:13:44 2010 -0700
@@ -27,7 +27,7 @@
import org.eclipse.wst.jsdt.core.IJavaScriptProject;
import org.eclipse.wst.jsdt.core.IJsGlobalScopeContainer;
import org.symbian.tools.tmw.core.TMWCore;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
public class MobileRuntimeLibraryContainer implements IJsGlobalScopeContainer {
@@ -40,7 +40,7 @@
}
public IIncludePathEntry[] getIncludepathEntries() {
- final IMTWProject proj = TMWCore.create(project.getProject());
+ final ITMWProject proj = TMWCore.create(project.getProject());
if (proj != null) {
try {
IFacetedProject facetedProject = ProjectFacetsManager.create(project.getProject(), false,
@@ -56,7 +56,7 @@
}
public String getDescription() {
- final IMTWProject proj = TMWCore.create(project.getProject());
+ final ITMWProject proj = TMWCore.create(project.getProject());
if (proj != null) {
final IMobileWebRuntime targetRuntime = proj.getTargetRuntime();
if (targetRuntime != null) {
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/runtimes/RuntimeClasspathManager.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/runtimes/RuntimeClasspathManager.java Thu Aug 19 16:13:44 2010 -0700
@@ -41,7 +41,7 @@
import org.symbian.tools.tmw.core.internal.projects.LazyIncludePathProvider;
import org.symbian.tools.tmw.core.internal.projects.StaticIncludePathProvider;
import org.symbian.tools.tmw.core.projects.IFacetIncludePathProvider;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
@SuppressWarnings("restriction")
@@ -110,7 +110,7 @@
public IIncludePathEntry[] getProjectClasspathEntries(IFacetedProject project) {
collectProviders();
- final IMTWProject p = TMWCore.create(project.getProject());
+ final ITMWProject p = TMWCore.create(project.getProject());
if (p != null) {
final IMobileWebRuntime runtime = p.getTargetRuntime();
final Map<String, Collection<VersionedEntry<IFacetIncludePathProvider[]>>> facetToEntry;
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/runtimes/RuntimesManagerImpl.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/runtimes/RuntimesManagerImpl.java Thu Aug 19 16:13:44 2010 -0700
@@ -26,7 +26,7 @@
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.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntimeManager;
import org.symbian.tools.tmw.core.runtimes.IPackager;
@@ -72,11 +72,11 @@
return rts.toArray(new IMobileWebRuntime[rts.size()]);
}
- public IPackager getPackager(IMTWProject project) {
+ public IPackager getPackager(ITMWProject project) {
return getPackager(project, project.getTargetRuntime());
}
- public IPackager getPackager(IMTWProject project, IMobileWebRuntime runtime) {
+ public IPackager getPackager(ITMWProject project, IMobileWebRuntime runtime) {
if (packagers == null) {
collectPackagers();
}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/projects/IFacetIncludePathProvider.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/projects/IFacetIncludePathProvider.java Thu Aug 19 16:13:44 2010 -0700
@@ -21,5 +21,5 @@
import org.eclipse.wst.jsdt.core.IIncludePathEntry;
public interface IFacetIncludePathProvider {
- IIncludePathEntry[] getEntries(IMTWProject project);
+ IIncludePathEntry[] getEntries(ITMWProject project);
}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/projects/IMTWProject.java Wed Aug 18 09:30:53 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +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.core.projects;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
-
-public interface IMTWProject {
- /**
- * @return primary target runtime of this project.
- */
- IMobileWebRuntime getTargetRuntime();
-
- /**
- * @return workspace project that back this MTW project.
- */
- IProject getProject();
-
- /**
- * @return symbolic MTW project name.
- */
- String getName();
-
- /**
- * Validate project configuration and contents.
- *
- * @return <code>true</code> if the project has no errors. Warnings do not count.
- */
- boolean validate(IProgressMonitor monitor);
-}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/projects/IMTWProjectProvider.java Wed Aug 18 09:30:53 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +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.core.projects;
-
-import org.eclipse.core.resources.IProject;
-
-/**
- * Bridges between project models.
- *
- * @author Eugene Ostroukhov (eugeneo@symbian.org)
- */
-public interface IMTWProjectProvider {
- /**
- * Returns {@link IMTWProject} object that works with specified {@link IProject} object.
- * @return non-<code>null</code> object
- */
- IMTWProject create(IProject project);
-
- /**
- * @return <code>true</code> if the {@link IMTWProject} object can be created.
- */
- boolean isSupportedProject(IProject project);
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/projects/ITMWProject.java Thu Aug 19 16:13:44 2010 -0700
@@ -0,0 +1,54 @@
+/**
+ * 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.projects;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
+
+public interface ITMWProject {
+ /**
+ * @return primary target runtime of this project.
+ */
+ IMobileWebRuntime getTargetRuntime();
+
+ /**
+ * @return workspace project that back this MTW project.
+ */
+ IProject getProject();
+
+ /**
+ * @return symbolic MTW project name.
+ */
+ String getName();
+
+ /**
+ * Validate project configuration and contents.
+ *
+ * @return <code>true</code> if the project has no errors. Warnings do not count.
+ */
+ boolean validate(IProgressMonitor monitor);
+
+ /**
+ * Return preferred screen size for the project.
+ *
+ * @return string like "240x320"
+ */
+ String getPreferredScreenSize();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/projects/ITMWProjectProvider.java Thu Aug 19 16:13:44 2010 -0700
@@ -0,0 +1,39 @@
+/**
+ * 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.projects;
+
+import org.eclipse.core.resources.IProject;
+
+/**
+ * Bridges between project models.
+ *
+ * @author Eugene Ostroukhov (eugeneo@symbian.org)
+ */
+public interface ITMWProjectProvider {
+ /**
+ * Returns {@link ITMWProject} object that works with specified {@link IProject} object.
+ * @return non-<code>null</code> object
+ */
+ ITMWProject create(IProject project);
+
+ /**
+ * @return <code>true</code> if the {@link ITMWProject} object can be created.
+ */
+ boolean isSupportedProject(IProject project);
+}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/runtimes/IMobileWebRuntimeManager.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/runtimes/IMobileWebRuntimeManager.java Thu Aug 19 16:13:44 2010 -0700
@@ -18,7 +18,7 @@
*/
package org.symbian.tools.tmw.core.runtimes;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
/**
* Manages mobile web runtimes.
@@ -29,7 +29,7 @@
/**
* Shorthand method to obtain packager for project default runtime.
*/
- IPackager getPackager(IMTWProject project);
+ IPackager getPackager(ITMWProject project);
/**
* Returns packager that can create a packaged application for provided
@@ -38,7 +38,7 @@
* @return <code>null</null> if the project cannot be packaged for
* specified runtime
*/
- IPackager getPackager(IMTWProject project, IMobileWebRuntime runtime);
+ IPackager getPackager(ITMWProject project, IMobileWebRuntime runtime);
/**
* Returns runtimes for the given ID. Runtime will not be null.
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/runtimes/IPackager.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/runtimes/IPackager.java Thu Aug 19 16:13:44 2010 -0700
@@ -24,7 +24,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
/**
* Packager creates a runtime-specific application package that can be
@@ -38,7 +38,7 @@
*
* @return {@link File} denoting location of the application package that can be deployed to targets
*/
- File packageApplication(IMTWProject project, IProgressMonitor monitor)
+ File packageApplication(ITMWProject project, IProgressMonitor monitor)
throws CoreException;
/**
@@ -49,7 +49,7 @@
/**
* @return file type of the application archive
*/
- String getFileType(IMTWProject project);
+ String getFileType(ITMWProject project);
/**
* @return target runtime that this packager packages for
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/runtimes/IPackagerDelegate.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/runtimes/IPackagerDelegate.java Thu Aug 19 16:13:44 2010 -0700
@@ -24,7 +24,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
/**
* Delegate performs application packaging.
@@ -37,7 +37,7 @@
*
* @return URI of the application package that can be deployed to targets
*/
- File packageApplication(IMTWProject project, IProgressMonitor monitor) throws CoreException;
+ File packageApplication(ITMWProject project, IProgressMonitor monitor) throws CoreException;
/**
* @return application package root-relative path where the workspace resource will be packaged. Can be <code>null</code>.
@@ -47,5 +47,5 @@
/**
* @return file type of the application archive
*/
- String getFileType(IMTWProject project);
+ String getFileType(ITMWProject project);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/utilities/CoreUtil.java Thu Aug 19 16:13:44 2010 -0700
@@ -0,0 +1,38 @@
+/**
+ * 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.utilities;
+
+import org.eclipse.core.runtime.Platform;
+
+/**
+ * Utilities used all over the TMW code base. Users can rely on this methods
+ * even though they are not specific to mobile development.
+ *
+ * @author Eugene Ostroukhov (eugeneo@symbian.org)
+ */
+public final class CoreUtil {
+
+ private CoreUtil() {
+ // Class with only static methods
+ }
+
+ public static boolean isMac() {
+ return "macosx".equals(Platform.getOS());
+ }
+}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/DeployWizardContext.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/DeployWizardContext.java Thu Aug 19 16:13:44 2010 -0700
@@ -25,15 +25,15 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.ui.TMWCoreUI;
public class DeployWizardContext {
private DeploymentTargetWrapper target;
- private final IMTWProject project;
+ private final ITMWProject project;
private boolean logging;
- public DeployWizardContext(IMTWProject project) {
+ public DeployWizardContext(ITMWProject project) {
this.project = project;
}
@@ -45,7 +45,7 @@
return target;
}
- public IMTWProject getProject() {
+ public ITMWProject getProject() {
return project;
}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/DeploymentTargetTypeDescriptor.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/DeploymentTargetTypeDescriptor.java Thu Aug 19 16:13:44 2010 -0700
@@ -26,14 +26,14 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.ui.TMWCoreUI;
import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType;
public final class DeploymentTargetTypeDescriptor implements IDeploymentTargetType {
public class NullProvider implements IDeploymentTargetType {
- public IDeploymentTarget[] getTargets(IMTWProject project) {
+ public IDeploymentTarget[] getTargets(ITMWProject project) {
return null;
}
@@ -41,7 +41,7 @@
// Do nothing
}
- public IDeploymentTarget findTarget(IMTWProject project, String id) {
+ public IDeploymentTarget findTarget(ITMWProject project, String id) {
return null;
}
@@ -64,12 +64,12 @@
this.element = element;
}
- public boolean supports(IMTWProject project) {
+ public boolean supports(ITMWProject project) {
// We will support more declarative filtering later
return true;
}
- public DeploymentTargetWrapper[] getTargets(IMTWProject project) {
+ public DeploymentTargetWrapper[] getTargets(ITMWProject project) {
final DeploymentTargetWrapper[] targets = wrap(getProvider().getTargets(project));
return targets != null ? targets : NO_TARGETS;
}
@@ -99,7 +99,7 @@
getProvider().discoverTargets(monitor);
}
- public IDeploymentTarget findTarget(IMTWProject project, String id) {
+ public IDeploymentTarget findTarget(ITMWProject project, String id) {
return wrap(getProvider().findTarget(project, id));
}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/DeploymentTargetWrapper.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/DeploymentTargetWrapper.java Thu Aug 19 16:13:44 2010 -0700
@@ -27,7 +27,7 @@
import org.eclipse.ui.IMemento;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.ui.model.IWorkbenchAdapter2;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.runtimes.IPackager;
import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
@@ -83,7 +83,7 @@
target.save(memento);
}
- public void init(IMTWProject project, IPackager packager, IMemento memento) {
+ public void init(ITMWProject project, IPackager packager, IMemento memento) {
target.init(project, packager, memento);
}
@@ -92,7 +92,7 @@
this.type = type;
}
- public IStatus deploy(IMTWProject project, IPackager packager, IProgressMonitor monitor)
+ public IStatus deploy(ITMWProject project, IPackager packager, IProgressMonitor monitor)
throws CoreException {
return target.deploy(project, packager, monitor);
}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/externalapp/FilesystemDeploymentTarget.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/externalapp/FilesystemDeploymentTarget.java Thu Aug 19 16:13:44 2010 -0700
@@ -21,7 +21,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType;
@@ -31,7 +31,7 @@
// TODO Auto-generated constructor stub
}
- public IDeploymentTarget[] getTargets(IMTWProject project) {
+ public IDeploymentTarget[] getTargets(ITMWProject project) {
// TODO Auto-generated method stub
return null;
}
@@ -41,7 +41,7 @@
}
- public IDeploymentTarget findTarget(IMTWProject project, String id) {
+ public IDeploymentTarget findTarget(ITMWProject project, String id) {
// TODO Auto-generated method stub
return null;
}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/targets/ExternalApplicationDeploymentType.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/targets/ExternalApplicationDeploymentType.java Thu Aug 19 16:13:44 2010 -0700
@@ -29,7 +29,7 @@
import org.eclipse.swt.program.Program;
import org.eclipse.ui.IMemento;
import org.symbian.tools.tmw.core.TMWCore;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.runtimes.IPackager;
import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType;
@@ -37,9 +37,9 @@
public class ExternalApplicationDeploymentType extends PlatformObject implements IDeploymentTargetType,
IDeploymentTarget {
- private IMTWProject project;
+ private ITMWProject project;
- public IStatus deploy(IMTWProject project, IPackager packager, IProgressMonitor monitor)
+ public IStatus deploy(ITMWProject project, IPackager packager, IProgressMonitor monitor)
throws CoreException {
Program app = getExternalApp(project);
File file = packager.packageApplication(project, monitor);
@@ -58,7 +58,7 @@
// Do nothing
}
- public IDeploymentTarget findTarget(IMTWProject project, String id) {
+ public IDeploymentTarget findTarget(ITMWProject project, String id) {
if (getExternalApp(project) != null) {
return this;
} else {
@@ -70,7 +70,7 @@
return getExternalApp(project).getName();
}
- private Program getExternalApp(IMTWProject project) {
+ private Program getExternalApp(ITMWProject project) {
this.project = project;
IPackager packager = TMWCore.getRuntimesManager().getPackager(project);
if (packager != null) {
@@ -96,7 +96,7 @@
return null;
}
- public IDeploymentTarget[] getTargets(IMTWProject project) {
+ public IDeploymentTarget[] getTargets(ITMWProject project) {
if (getExternalApp(project) != null) {
return new IDeploymentTarget[] { this };
} else {
@@ -104,7 +104,7 @@
}
}
- public void init(IMTWProject project, IPackager packager, IMemento memento) {
+ public void init(ITMWProject project, IPackager packager, IMemento memento) {
// Do nothing
}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/targets/FilesystemDeploymentTarget.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/targets/FilesystemDeploymentTarget.java Thu Aug 19 16:13:44 2010 -0700
@@ -36,7 +36,7 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.ui.IMemento;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.runtimes.IPackager;
import org.symbian.tools.tmw.ui.TMWCoreUI;
import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
@@ -46,7 +46,7 @@
private String defaultName;
private IPath path;
- public IStatus deploy(IMTWProject project, IPackager packager, IProgressMonitor monitor) throws CoreException {
+ public IStatus deploy(ITMWProject project, IPackager packager, IProgressMonitor monitor) throws CoreException {
final File file = packager.packageApplication(project, monitor);
try {
final InputStream inputStream = new BufferedInputStream(new FileInputStream(file));
@@ -74,7 +74,7 @@
// Do nothing
}
- public IDeploymentTarget findTarget(IMTWProject project, String id) {
+ public IDeploymentTarget findTarget(ITMWProject project, String id) {
return getId().equals(id) ? this : null;
}
@@ -102,11 +102,11 @@
return null;
}
- public IDeploymentTarget[] getTargets(IMTWProject project) {
+ public IDeploymentTarget[] getTargets(ITMWProject project) {
return new IDeploymentTarget[] { this };
}
- public void init(IMTWProject project, IPackager packager, IMemento memento) {
+ public void init(ITMWProject project, IPackager packager, IMemento memento) {
defaultName = new Path(project.getName()).addFileExtension(packager.getFileType(project)).toOSString();
path = null;
String string = memento != null ? memento.getString("path") : null;
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/libraries/TMWGlobalScopeContainerUI.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/libraries/TMWGlobalScopeContainerUI.java Thu Aug 19 16:13:44 2010 -0700
@@ -26,14 +26,14 @@
import org.eclipse.wst.jsdt.core.IJavaScriptProject;
import org.eclipse.wst.jsdt.internal.ui.IJsGlobalScopeContainerInitializerExtension;
import org.symbian.tools.tmw.core.TMWCore;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
@SuppressWarnings("restriction")
public class TMWGlobalScopeContainerUI implements IJsGlobalScopeContainerInitializerExtension {
public ImageDescriptor getImage(IPath containerPath, String element, IJavaScriptProject project) {
- final IMTWProject p = TMWCore.create(project.getProject());
+ final ITMWProject p = TMWCore.create(project.getProject());
if (p != null) {
final IMobileWebRuntime runtime = p.getTargetRuntime();
if (runtime != null) {
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/ProjectMemo.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/ProjectMemo.java Thu Aug 19 16:13:44 2010 -0700
@@ -31,7 +31,7 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.XMLMemento;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType;
@@ -41,10 +41,10 @@
private static final String TARGET_CONFIGURATION = "target";
private static final String MEMO_TYPE = "deployment";
- private final IMTWProject project;
+ private final ITMWProject project;
private XMLMemento memento;
- public ProjectMemo(IMTWProject project) {
+ public ProjectMemo(ITMWProject project) {
this.project = project;
}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/TMWCoreUI.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/TMWCoreUI.java Thu Aug 19 16:13:44 2010 -0700
@@ -9,7 +9,7 @@
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.internal.ui.deployment.DeploymentTargetPresentationsManager;
import org.symbian.tools.tmw.internal.ui.deployment.DeploymentTargetTypesRegistry;
import org.symbian.tools.tmw.internal.ui.project.ProjectTemplateManagerImpl;
@@ -68,11 +68,11 @@
log(null, e);
}
- public static ProjectMemo getMemo(IMTWProject project) {
+ public static ProjectMemo getMemo(ITMWProject project) {
return getDefault().getMemoForProject(project);
}
- private synchronized ProjectMemo getMemoForProject(IMTWProject project) {
+ private synchronized ProjectMemo getMemoForProject(ITMWProject project) {
ProjectMemo memo = MEMOS.get(project.getProject());
if (memo == null) {
memo = new ProjectMemo(project);
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/UIUtils.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/UIUtils.java Thu Aug 19 16:13:44 2010 -0700
@@ -28,10 +28,10 @@
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.handlers.HandlerUtil;
import org.symbian.tools.tmw.core.TMWCore;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
public class UIUtils {
- public static IMTWProject getProjectFromCommandContext(ExecutionEvent event) {
+ public static ITMWProject getProjectFromCommandContext(ExecutionEvent event) {
IResource resource = null;
IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
if (activePart instanceof IEditorPart) {
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/commands/DeployHandler.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/commands/DeployHandler.java Thu Aug 19 16:13:44 2010 -0700
@@ -33,7 +33,7 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.handlers.HandlerUtil;
import org.symbian.tools.tmw.core.TMWCore;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.ui.UIUtils;
import org.symbian.tools.tmw.ui.deployment.DeployWizard;
@@ -56,7 +56,7 @@
public Object execute(ExecutionEvent event) throws ExecutionException {
final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
- final IMTWProject project = UIUtils.getProjectFromCommandContext(event);
+ final ITMWProject project = UIUtils.getProjectFromCommandContext(event);
if (project != null) {
window.getActivePage().saveAllEditors(true);
if (validate(project, window)) {
@@ -67,7 +67,7 @@
return null;
}
- private boolean validate(final IMTWProject project, final IWorkbenchWindow window) {
+ private boolean validate(final ITMWProject project, final IWorkbenchWindow window) {
final boolean[] retvalue = { false };
final ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell());
try {
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/DeployWizard.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/DeployWizard.java Thu Aug 19 16:13:44 2010 -0700
@@ -30,7 +30,7 @@
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.statushandlers.StatusManager;
import org.symbian.tools.tmw.core.TMWCore;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.runtimes.IPackager;
import org.symbian.tools.tmw.internal.ui.deployment.DeployWizardContext;
import org.symbian.tools.tmw.internal.ui.deployment.DeploymentTargetWizardPage;
@@ -40,9 +40,9 @@
public final class DeployWizard extends Wizard {
private final DeployWizardContext context;
- private final IMTWProject project;
+ private final ITMWProject project;
- public DeployWizard(IMTWProject project) {
+ public DeployWizard(ITMWProject project) {
this.project = project;
setNeedsProgressMonitor(true);
setWindowTitle("Deploy Mobile Application");
@@ -91,7 +91,7 @@
return false;
}
- private IStatus doDeploy(DeploymentTargetWrapper target, IMTWProject project, IProgressMonitor monitor) {
+ private IStatus doDeploy(DeploymentTargetWrapper target, ITMWProject project, IProgressMonitor monitor) {
IStatus status;
try {
IPackager packager = TMWCore.getRuntimesManager().getPackager(project);
@@ -106,9 +106,9 @@
private final class DeployJob extends Job {
private final DeploymentTargetWrapper target;
- private final IMTWProject project;
+ private final ITMWProject project;
- private DeployJob(IMTWProject project, DeploymentTargetWrapper deploymentTarget) {
+ private DeployJob(ITMWProject project, DeploymentTargetWrapper deploymentTarget) {
super(String.format("Deploying %s to %s", project.getName(), deploymentTarget.getName()));
ISchedulingRule rule = deploymentTarget.getType().getSchedulingRule(deploymentTarget.getActualTarget());
if (rule != null) {
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/IDeploymentTarget.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/IDeploymentTarget.java Thu Aug 19 16:13:44 2010 -0700
@@ -23,7 +23,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.ui.IMemento;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.runtimes.IPackager;
/**
@@ -72,7 +72,7 @@
* @param runtime runtime that will be used to run packaged application
* @param monitor progress monitor to report deployment progress
*/
- IStatus deploy(IMTWProject project, IPackager packager, IProgressMonitor monitor) throws CoreException;
+ IStatus deploy(ITMWProject project, IPackager packager, IProgressMonitor monitor) throws CoreException;
/**
* Save project-specific settings to the memento. Workspace-wide settings
@@ -83,5 +83,5 @@
/**
* Initialize target for project deployment.
*/
- void init(IMTWProject project, IPackager packager, IMemento memento);
+ void init(ITMWProject project, IPackager packager, IMemento memento);
}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/IDeploymentTargetType.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/IDeploymentTargetType.java Thu Aug 19 16:13:44 2010 -0700
@@ -21,7 +21,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
/**
* This interface is for deployment targets providers.
@@ -35,7 +35,7 @@
* @return List of the valid deployment targets. Both <code>null</code> and
* empty array are a valid return value when there are no available targets.
*/
- IDeploymentTarget[] getTargets(IMTWProject project);
+ IDeploymentTarget[] getTargets(ITMWProject project);
/**
* Discovers targets. This can be a long-running task and in most cases
@@ -48,7 +48,7 @@
* <code>null</code> if target with given ID cannot be found or if
* the target does not accept project any longer.
*/
- IDeploymentTarget findTarget(IMTWProject project, String id);
+ IDeploymentTarget findTarget(ITMWProject project, String id);
/**
* Return <code>false</code> if user needs to trigger long-running
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/bluetooth/BluetoothTarget.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/bluetooth/BluetoothTarget.java Thu Aug 19 16:13:44 2010 -0700
@@ -51,7 +51,7 @@
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.ui.IMemento;
import org.symbian.tools.tmw.core.TMWCore;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.runtimes.IPackager;
import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
@@ -71,7 +71,7 @@
this.provider = provider;
}
- public IStatus deploy(IMTWProject project, IPackager packager, IProgressMonitor monitor) throws CoreException {
+ public IStatus deploy(ITMWProject project, IPackager packager, IProgressMonitor monitor) throws CoreException {
message = "Deployment was successful. Please follow on-screen instructions to complete application deployment on your device.";
statuses.clear();
monitor.beginTask(String.format("Deploying application %s to %s", project.getName(), name),
@@ -302,7 +302,7 @@
return serviceURL;
}
- public void init(IMTWProject project, IPackager packager, IMemento memento) {
+ public void init(ITMWProject project, IPackager packager, IMemento memento) {
// nothing
}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/bluetooth/BluetoothTargetType.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/bluetooth/BluetoothTargetType.java Thu Aug 19 16:13:44 2010 -0700
@@ -37,7 +37,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.ui.ConsoleFactory;
import org.symbian.tools.tmw.ui.TMWCoreUI;
import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
@@ -163,7 +163,7 @@
}
}
- public IDeploymentTarget findTarget(IMTWProject project, String id) {
+ public IDeploymentTarget findTarget(ITMWProject project, String id) {
if (!isBloothToothConnected()) {
return null;
}
@@ -179,7 +179,7 @@
}
}
- public IDeploymentTarget[] getTargets(IMTWProject project) {
+ public IDeploymentTarget[] getTargets(ITMWProject project) {
if (targets != null) {
final Collection<BluetoothTarget> values = targets.values();
return values.toArray(new IDeploymentTarget[values.size()]);
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/navigator/PackagingInformationDecorator.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/navigator/PackagingInformationDecorator.java Thu Aug 19 16:13:44 2010 -0700
@@ -24,7 +24,7 @@
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ILightweightLabelDecorator;
import org.symbian.tools.tmw.core.TMWCore;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.runtimes.IPackager;
import org.symbian.tools.tmw.ui.TMWCoreUI;
@@ -38,7 +38,7 @@
resource = (IResource) ((IAdaptable) element).getAdapter(IResource.class);
}
if (resource != null && resource.isAccessible()) {
- IMTWProject project = TMWCore.create(resource.getProject());
+ ITMWProject project = TMWCore.create(resource.getProject());
if (project != null) {
IPackager packager = TMWCore.getRuntimesManager().getPackager(project);
if (packager.getPathInPackage(resource) != null) {
--- a/org.symbian.tools.wrttools.debug.core/META-INF/MANIFEST.MF Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.debug.core/META-INF/MANIFEST.MF Thu Aug 19 16:13:44 2010 -0700
@@ -15,14 +15,14 @@
org.eclipse.wst.jsdt.ui;bundle-version="1.0.200",
org.eclipse.ui.editors;bundle-version="3.5.0",
org.eclipse.jface.text;bundle-version="3.5.0",
- org.symbian.tools.wrttools.previewer;bundle-version="0.9.0",
- org.symbian.tools.wrttools;bundle-version="0.9.0",
+ org.symbian.tools.tmw.previewer;bundle-version="0.9.0",
org.eclipse.core.filesystem;bundle-version="1.2.0",
org.eclipse.ui.ide;bundle-version="3.5.0",
org.eclipse.wst.sse.ui;bundle-version="1.1.100",
org.eclipse.wst.sse.core;bundle-version="1.1.400",
org.eclipse.wst.html.core;bundle-version="1.1.300",
- org.eclipse.wst.jsdt.core;bundle-version="1.0.200"
+ org.eclipse.wst.jsdt.core;bundle-version="1.0.200",
+ org.symbian.tools.wrttools;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5,
JavaSE-1.6
Bundle-ActivationPolicy: lazy
--- a/org.symbian.tools.wrttools.debug.core/plugin.xml Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.debug.core/plugin.xml Thu Aug 19 16:13:44 2010 -0700
@@ -318,7 +318,7 @@
</keyword>
</extension>
<extension
- point="org.symbian.tools.wrttools.previewer.commands">
+ point="org.symbian.tools.tmw.previewer.commands">
<command
handler="org.symbian.tools.wrttools.debug.internal.session.TerminateSession"
name="terminateDebug">
--- a/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/ResourcesChangeListener.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/ResourcesChangeListener.java Thu Aug 19 16:13:44 2010 -0700
@@ -33,9 +33,9 @@
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
+import org.symbian.tools.tmw.previewer.internal.PreviewerUtil;
import org.symbian.tools.wrttools.debug.internal.Activator;
import org.symbian.tools.wrttools.debug.internal.IConstants;
-import org.symbian.tools.wrttools.previewer.PreviewerUtil;
public class ResourcesChangeListener implements IResourceChangeListener {
public void resourceChanged(IResourceChangeEvent event) {
--- a/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/model/ResourceManager.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/model/ResourceManager.java Thu Aug 19 16:13:44 2010 -0700
@@ -10,7 +10,6 @@
import org.chromium.debug.core.model.VmResourceId;
import org.chromium.sdk.Script;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
import org.symbian.tools.wrttools.previewer.PreviewerPlugin;
/**
@@ -57,7 +56,7 @@
return getResource(script) != null;
}
- public String translateResourceToScript(IResource resource) {
+ public String translateResourceToScript(IFile resource) {
return PreviewerPlugin.getDefault().getHttpPreviewer().getHttpUrl(resource);
}
--- a/org.symbian.tools.wrttools.previewer/.project Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/.project Thu Aug 19 16:13:44 2010 -0700
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.symbian.tools.wrttools.previewer</name>
+ <name>org.symbian.tools.tmw.previewer</name>
<comment></comment>
<projects>
</projects>
--- a/org.symbian.tools.wrttools.previewer/META-INF/MANIFEST.MF Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/META-INF/MANIFEST.MF Thu Aug 19 16:13:44 2010 -0700
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: WRT Preview Support
-Bundle-SymbolicName: org.symbian.tools.wrttools.previewer;singleton:=true
+Bundle-Name: Mobile Applications Preview Support
+Bundle-SymbolicName: org.symbian.tools.tmw.previewer;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.symbian.tools.wrttools.previewer.PreviewerPlugin
Require-Bundle: org.eclipse.ui,
@@ -12,12 +12,13 @@
org.eclipse.equinox.http.jetty;bundle-version="2.0.0",
org.eclipse.wst.jsdt.core;bundle-version="1.0.200",
org.eclipse.wst.jsdt.ui;bundle-version="1.0.200",
- org.symbian.tools.wrttools;bundle-version="0.9.0",
org.mozilla.xulrunner;bundle-version="1.9.1";resolution:=optional,
- org.eclipse.ui.console;bundle-version="3.5.0"
+ org.eclipse.ui.console;bundle-version="3.5.0",
+ org.symbian.tools.tmw.core;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.symbian.tools.wrttools.previewer,
+Export-Package: org.symbian.tools.tmw.previewer.core,
+ org.symbian.tools.wrttools.previewer,
org.symbian.tools.wrttools.previewer.http
Import-Package: javax.servlet;version="2.5.0",
javax.servlet.http;version="2.5.0",
--- a/org.symbian.tools.wrttools.previewer/plugin.xml Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/plugin.xml Thu Aug 19 16:13:44 2010 -0700
@@ -2,6 +2,7 @@
<?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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.previewer/schema/layoutProviders.exsd Thu Aug 19 16:13:44 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="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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/tmw/previewer/core/IApplicationLayoutProvider.java Thu Aug 19 16:13:44 2010 -0700
@@ -0,0 +1,54 @@
+/**
+ * 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;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/tmw/previewer/core/IPreviewerExtensionsManager.java Thu Aug 19 16:13:44 2010 -0700
@@ -0,0 +1,25 @@
+/**
+ * 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);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/tmw/previewer/internal/PreviewerExtensionsManagerImpl.java Thu Aug 19 16:13:44 2010 -0700
@@ -0,0 +1,114 @@
+/**
+ * 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.core.IApplicationLayoutProvider;
+import org.symbian.tools.tmw.previewer.core.IPreviewerExtensionsManager;
+import org.symbian.tools.wrttools.previewer.PreviewerPlugin;
+
+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);
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/tmw/previewer/internal/PreviewerUtil.java Thu Aug 19 16:13:44 2010 -0700
@@ -0,0 +1,99 @@
+/**
+ * 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.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.symbian.tools.tmw.previewer.core.IApplicationLayoutProvider;
+import org.symbian.tools.wrttools.previewer.PreviewerPlugin;
+
+public class PreviewerUtil {
+ public static final class ChangedResourcesCollector implements IResourceDeltaVisitor {
+ public final Collection<IFile> files = new HashSet<IFile>();
+ public final Collection<IProject> deleted = new HashSet<IProject>();
+ public final Map<IProject, IPath> renamed = new HashMap<IProject, IPath>();
+
+ public boolean visit(IResourceDelta delta) throws CoreException {
+ IResource resource = delta.getResource();
+ switch (resource.getType()) {
+ case IResource.PROJECT:
+ if (delta.getKind() == IResourceDelta.REMOVED) {
+ if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0) {
+ renamed.put(resource.getProject(), delta.getMovedToPath());
+ } else {
+ deleted.add((IProject) resource);
+ }
+ return false;
+ }
+ 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);
+ }
+ }
+ }
+ break;
+ }
+ return true;
+ }
+ }
+
+ public static boolean isRelevantResource(IResource resource) {
+ if (resource.exists() && resource.getType() == IResource.FILE) {
+ return !resource.getFullPath().segment(1).equalsIgnoreCase("preview")
+ && !"wgz".equalsIgnoreCase(resource.getFileExtension())
+ && !(PreviewerPlugin.PLUGIN_ID + ".xml").equals(resource.getName());
+ }
+ return false;
+ }
+
+ public static IFile[] getWebChanges(final IResourceDelta delta) {
+ ChangedResourcesCollector visitor = collectResourceChanges(delta);
+ final Collection<IFile> files = visitor.files;
+ return files.toArray(new IFile[files.size()]);
+ }
+
+ public static ChangedResourcesCollector collectResourceChanges(final IResourceDelta delta) {
+ ChangedResourcesCollector visitor = new ChangedResourcesCollector();
+ try {
+ delta.accept(visitor);
+ } catch (CoreException e) {
+ PreviewerPlugin.log(e);
+ }
+ return visitor;
+ }
+}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/PreviewerPlugin.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/PreviewerPlugin.java Thu Aug 19 16:13:44 2010 -0700
@@ -32,6 +32,8 @@
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.internal.PreviewerExtensionsManagerImpl;
import org.symbian.tools.wrttools.previewer.http.HttpPreviewer;
/**
@@ -40,7 +42,7 @@
public class PreviewerPlugin extends AbstractUIPlugin {
// The plug-in ID
- public static final String PLUGIN_ID = "org.symbian.tools.wrttools.previewer";
+ public static final String PLUGIN_ID = "org.symbian.tools.tmw.previewer";
public static final String PREVIEW_VIEW = "org.symbian.tools.wrttools.editing.wrtpreview";
public static final boolean DEBUG = Platform.inDebugMode()
@@ -60,6 +62,7 @@
// 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;
@@ -146,4 +149,8 @@
console.newMessageStream().write(
message);
}
+
+ public static IPreviewerExtensionsManager getExtensionsManager() {
+ return getDefault().extensionsManager;
+ }
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/PreviewerUtil.java Wed Aug 18 09:30:53 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +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.previewer;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarkerDelta;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.symbian.tools.wrttools.util.ProjectUtils;
-
-public class PreviewerUtil {
- public static final class ChangedResourcesCollector implements IResourceDeltaVisitor {
- public final Collection<IFile> files = new HashSet<IFile>();
- public final Collection<IProject> deleted = new HashSet<IProject>();
- public final Map<IProject, IPath> renamed = new HashMap<IProject, IPath>();
-
- public boolean visit(IResourceDelta delta) throws CoreException {
- IResource resource = delta.getResource();
- if (resource.getType() == IResource.PROJECT) {
- if (delta.getKind() == IResourceDelta.REMOVED) {
- if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0) {
- renamed.put(resource.getProject(), delta.getMovedToPath());
- } else {
- deleted.add((IProject) resource);
- }
- return false;
- }
- } else if (isRelevantResource(resource)) {
- if (delta.getKind() == IResourceDelta.ADDED | delta.getKind() == IResourceDelta.REMOVED) {
- if (!ProjectUtils.isExcluded(resource)) {
- files.add((IFile) resource);
- }
- } else if ((delta.getFlags() & (IResourceDelta.CONTENT | IResourceDelta.ENCODING
- | IResourceDelta.LOCAL_CHANGED | IResourceDelta.REPLACED | IResourceDelta.SYNC)) != 0) {
- if (!ProjectUtils.isExcluded(resource)) {
- files.add((IFile) resource);
- }
- } else if (delta.getMarkerDeltas().length != 0) {
- for (IMarkerDelta markerDelta : delta.getMarkerDeltas()) {
- if (markerDelta.getType().equals(ProjectUtils.EXCLUDE_MARKER_ID)) {
- files.add((IFile) resource);
- break;
- }
- }
- }
- }
- return true;
- }
- }
-
- public static boolean isRelevantResource(IResource resource) {
- if (resource.exists() && resource.getType() == IResource.FILE) {
- return !resource.getFullPath().segment(1).equalsIgnoreCase("preview")
- && !"wgz".equalsIgnoreCase(resource.getFileExtension())
- && !(PreviewerPlugin.PLUGIN_ID + ".xml").equals(resource.getName());
- }
- return false;
- }
-
- public static IFile[] getWebChanges(final IResourceDelta delta) {
- ChangedResourcesCollector visitor = collectResourceChanges(delta);
- final Collection<IFile> files = visitor.files;
- return files.toArray(new IFile[files.size()]);
- }
-
- public static ChangedResourcesCollector collectResourceChanges(final IResourceDelta delta) {
- ChangedResourcesCollector visitor = new ChangedResourcesCollector();
- try {
- delta.accept(visitor);
- } catch (CoreException e) {
- PreviewerPlugin.log(e);
- }
- return visitor;
- }
-}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/HttpPreviewer.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/HttpPreviewer.java Thu Aug 19 16:13:44 2010 -0700
@@ -18,12 +18,10 @@
*******************************************************************************/
package org.symbian.tools.wrttools.previewer.http;
-import java.io.File;
import java.net.URI;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
public class HttpPreviewer {
public static final String PREVIEW_STARTING_PAGE = "preview-frame.html";
@@ -33,7 +31,7 @@
return WorkspaceResourcesServlet.getFileFromUrl(name);
}
- public String getHttpUrl(IResource resource) {
+ public String getHttpUrl(IFile resource) {
return WorkspaceResourcesServlet.getHttpUrl(resource);
}
@@ -45,8 +43,4 @@
return WebAppInterface.getInstance().prepareDebugger(project, listener);
}
}
-
- public File getLocalFile(String name) {
- return WorkspaceResourcesServlet.getPreviewerResource(name);
- }
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WebAppInterface.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WebAppInterface.java Thu Aug 19 16:13:44 2010 -0700
@@ -140,7 +140,7 @@
public synchronized URI prepareDebugger(IProject project, IPreviewStartupListener listener) {
String session = Long.toHexString(System.currentTimeMillis());
- URI uri = WorkspaceResourcesServlet.getDebugStartingPage(project.getName(), session);
+ URI uri = WorkspaceResourcesServlet.getDebugStartingPage(project, session);
if (listener != null) {
debuggerJobs.put(getId(project.getName(), session), new BrowserConnectionJob(listener, uri));
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WorkspaceResourcesServlet.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WorkspaceResourcesServlet.java Thu Aug 19 16:13:44 2010 -0700
@@ -18,7 +18,6 @@
*******************************************************************************/
package org.symbian.tools.wrttools.previewer.http;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -42,22 +41,18 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
+import org.symbian.tools.tmw.previewer.core.IApplicationLayoutProvider;
import org.symbian.tools.wrttools.previewer.PreviewerException;
import org.symbian.tools.wrttools.previewer.PreviewerPlugin;
import org.symbian.tools.wrttools.previewer.http.handlers.DebuggerResourceProvider;
-import org.symbian.tools.wrttools.previewer.http.handlers.PreviewerStaticResourceProvider;
-import org.symbian.tools.wrttools.previewer.http.handlers.ProjectIndexResourceProvider;
import org.symbian.tools.wrttools.previewer.http.handlers.Providers;
-import org.symbian.tools.wrttools.util.CoreUtil;
public class WorkspaceResourcesServlet extends HttpServlet {
private static final Map<String, String> EXTENSION_CONTENT_TYPE = new TreeMap<String, String>();
@@ -102,16 +97,38 @@
}
public static IFile getFileFromUrl(String name) {
- IPath path = getProjectRelativePath(name);
- if (path != null) {
- return getProjectResource(path);
- } else {
- return 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) {
+ final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(path.segment(0));
+ final IApplicationLayoutProvider provider = PreviewerPlugin.getExtensionsManager()
+ .getLayoutProvider(project);
+ if (provider != null) {
+ return provider.getWorkspaceFile(project, path.removeFirstSegments(1));
+ }
+ }
+ }
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ } catch (CoreException e) {
+ PreviewerPlugin.log(e);
}
+ return null;
}
- public static String getHttpUrl(IResource file) {
- String uri = getServerURIForResource(file != null ? file.getFullPath().toString() : "/", null).toASCIIString();
+ public static String getHttpUrl(IFile file) {
+ IPath p = new Path("/");
+ if (file != null) {
+ IApplicationLayoutProvider provider = PreviewerPlugin.getExtensionsManager().getLayoutProvider(
+ file.getProject());
+ if (provider != null) {
+ p = provider.getResourcePath(file);
+ }
+ }
+ String uri = getServerURIForResource(p, null).toASCIIString();
if (uri != null) {
return uri;
} else {
@@ -127,81 +144,12 @@
}
}
- public static File getPreviewerResource(String name) {
- try {
- IPath path = getProjectRelativePath(name);
- if (path != null) {
- if (path.segmentCount() == 2 && HttpPreviewer.PREVIEW_STARTING_PAGE.equals(path.segment(1))) {
- path = new Path(PreviewerStaticResourceProvider.PREVIEW_START);
- } else if (path.segmentCount() > 2
- && PreviewerStaticResourceProvider.PREVIEW_PATH.equals(path.segment(1))) {
- path = path.removeFirstSegments(1);
- } else {
- return null;
- }
- URL pluginResource = FileLocator.find(PreviewerPlugin.getDefault().getBundle(), path, null);
- if (pluginResource != null) {
- URL url = FileLocator.toFileURL(pluginResource);
- if (url != null) {
- return new File(url.getPath());
- }
- }
- }
- } catch (IOException e) {
- PreviewerPlugin.log(e);
- }
- return null;
- }
-
public static URI getPreviewerStartingPage(String widget) {
- return getServerURIForResource(new Path(widget).append(HttpPreviewer.PREVIEW_STARTING_PAGE).makeAbsolute()
- .toString(), null);
+ return getServerURIForResource(new Path(widget).append(HttpPreviewer.PREVIEW_STARTING_PAGE).makeAbsolute(),
+ null);
}
- private static IPath getProjectRelativePath(String uri) {
- IPath path = null;
- try {
- String root = getHttpUrl(null);
- if (uri != null && uri.startsWith(root)) {
- String fileName = uri.substring(root.length());
- fileName = URLDecoder.decode(fileName, "UTF-8");
- path = new Path(fileName);
- if (path.segmentCount() == 2 && ProjectIndexResourceProvider.INDEX.equals(path.lastSegment())) {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(path.segment(0));
- path = new Path(project.getName()).append(CoreUtil.getIndexFile(project));
- }
- }
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
- } catch (CoreException e) {
- PreviewerPlugin.log(e);
- }
- return path;
- }
-
- private static IFile getProjectResource(IPath path) {
- IFile file;
- file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
- if (!file.isAccessible()) {
- return null;
- } else {
- return file;
- }
- }
-
- private static URI getServerURIForResource(String resourcePath, String debugSessionId) {
- Path p = new Path(resourcePath);
- if (p.segmentCount() > 1) {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(p.segment(0));
- try {
- if (p.removeFirstSegments(1).toString().equals(CoreUtil.getIndexFile(project))) {
- return getServerURIForResource(new Path(p.segment(0)).append(ProjectIndexResourceProvider.INDEX)
- .makeAbsolute().toString(), debugSessionId);
- }
- } catch (Exception e1) {
- PreviewerPlugin.log(e1);
- }
- }
+ private static URI getServerURIForResource(IPath resourcePath, String debugSessionId) {
try {
String path = encode(WebappManager.WORKSPACE_RESOURCES_CONTEXT + resourcePath);
path += debugSessionId == null ? "" : (String.format("?%s=%s",
@@ -249,9 +197,8 @@
throw new ServletException(e);
}
if (PreviewerPlugin.TRACE_SERVLET) {
- System.out.println(MessageFormat.format("Resource {0} was downloaded in {1}", req.getPathInfo(), System
- .currentTimeMillis()
- - time));
+ System.out.println(MessageFormat.format("Resource {0} was downloaded in {1}", req.getPathInfo(),
+ System.currentTimeMillis() - time));
}
}
@@ -284,8 +231,8 @@
resp.setStatus(HttpServletResponse.SC_OK);
}
- public static URI getDebugStartingPage(String project, String session) {
- return getServerURIForResource(new Path(project).append(HttpPreviewer.DEBUG_STARTING_PAGE).makeAbsolute()
- .toString(), session);
+ public static URI getDebugStartingPage(IProject project, String session) {
+ return getServerURIForResource(project.getFullPath().append(HttpPreviewer.DEBUG_STARTING_PAGE).makeAbsolute(),
+ session);
}
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/PreferencesResourceProvider.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/PreferencesResourceProvider.java Thu Aug 19 16:13:44 2010 -0700
@@ -29,7 +29,8 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.json.simple.JSONObject;
-import org.symbian.tools.wrttools.WRTProject;
+import org.symbian.tools.tmw.core.TMWCore;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.wrttools.previewer.PreviewerPlugin;
import org.symbian.tools.wrttools.previewer.preview.ProjectPreferencesManager;
@@ -43,10 +44,13 @@
throws IOException, CoreException {
Properties projectPreferences = ProjectPreferencesManager.getProjectProperties(project);
if (!projectPreferences.containsKey("__SYM_NOKIA_EMULATOR_DEVICE")) {
- String resolution = new WRTProject(project).getPreferredScreenSize();
+ final ITMWProject p = TMWCore.create(project);
+ if (p != null) {
+ String resolution = p.getPreferredScreenSize();
if (resolution != null) {
projectPreferences.put("__SYM_NOKIA_EMULATOR_DEVICE", resolution);
}
+ }
}
String js = getJS(projectPreferences);
try {
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/ProjectIndexResourceProvider.java Wed Aug 18 09:30:53 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +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.previewer.http.handlers;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.json.simple.JSONObject;
-import org.symbian.tools.wrttools.previewer.PreviewerPlugin;
-import org.symbian.tools.wrttools.util.CoreUtil;
-import org.symbian.tools.wrttools.util.ProjectUtils;
-
-public class ProjectIndexResourceProvider implements IResourceProvider {
- public static final String INDEX = "wrt_preview_main.html";
- private static final Pattern HEAD_TAG_PATTERN = Pattern.compile("<head(\\s*\\w*=\"(^\")*\")*\\s*>",
- Pattern.CASE_INSENSITIVE);
- private static final String SCRIPT = "<script language=\"JavaScript\" type=\"text/javascript\" src=\"preview/script/lib/loader.js\"></script>";
-
- public String[] getPaths() {
- return new String[] { INDEX };
- }
-
- public InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters,
- String sessionId) throws IOException, CoreException {
- return getProjectIndexPage(project.getName());
- }
-
- private InputStream 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)) {
- String string = CoreUtil.readFile(project, file);
- if (string != null) {
- Matcher matcher = HEAD_TAG_PATTERN.matcher(string);
- if (matcher.find()) {
- string = matcher.replaceFirst(matcher.group() + SCRIPT);
- }
- return new ByteArrayInputStream(string.getBytes("UTF-8"));
- }
- }
- }
- PreviewerPlugin.print(String.format("Can not find main page (%s) in project %s.\n", indexFileName,
- project.getName()));
- }
- return null;
- }
-
- public void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object,
- String sessionId) throws IOException, CoreException {
- // Do nothing
- }
-
-}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/Providers.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/Providers.java Thu Aug 19 16:13:44 2010 -0700
@@ -51,7 +51,6 @@
addPaths(new MasterScriptProvider());
addPaths(new PreviewerStaticResourceProvider());
addPaths(new PreferencesResourceProvider());
- addPaths(new ProjectIndexResourceProvider());
addPaths(new CommandResourceProvider());
addPaths(new DebuggerResourceProvider());
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/WorkspaceResourceProvider.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/WorkspaceResourceProvider.java Thu Aug 19 16:13:44 2010 -0700
@@ -22,15 +22,11 @@
import java.io.InputStream;
import java.util.Map;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.json.simple.JSONObject;
import org.symbian.tools.wrttools.previewer.PreviewerPlugin;
-import org.symbian.tools.wrttools.util.ProjectUtils;
public class WorkspaceResourceProvider implements IResourceProvider {
public String[] getPaths() {
@@ -38,54 +34,12 @@
}
public InputStream getResourceStream(IProject project, IPath resource, Map<String, String[]> parameters,
- String sessionId)
- throws IOException, CoreException {
- IFile file = getFile(project, resource);
- if (file != null) {
- return file.getContents();
- } else {
- PreviewerPlugin.print(String.format(
- "%s was not found in the workspace. It was requested by the previewer.\n", resource.toString()));
- return null;
- }
- }
-
- private IFile getFile(IProject project, IPath resource) throws CoreException {
- final IFile file = project.getFile(resource);
- if (!file.isAccessible()) {
- IContainer container = project;
- for (int i = 0; i < resource.segmentCount() - 1; i++) {
- String name = resource.segment(i).toLowerCase();
- container = (IContainer) getResource(container, name, false);
- if (container == null) {
- return null;
- }
- }
- return (IFile) getResource(container, resource.lastSegment().toLowerCase(), true);
- } else {
- return file;
- }
- }
-
- private IResource getResource(final IContainer container, final String name, final boolean isFile) throws CoreException {
- IResource[] members = container.members();
- for (IResource resource : members) {
- if (resource.getName().toLowerCase().equals(name)) {
- if (resource.isAccessible() && ((resource.getType() == IResource.FILE) == isFile)
- && !ProjectUtils.isExcluded(resource)) {
- return resource;
- } else {
- return null;
- }
- }
- }
- return null;
+ String sessionId) throws CoreException {
+ return PreviewerPlugin.getExtensionsManager().getLayoutProvider(project).getResourceFromPath(project, resource);
}
public void post(IProject project, IPath resource, Map<String, String[]> parameterMap, JSONObject object,
- String sessionId)
- throws IOException, CoreException {
+ String sessionId) throws IOException, CoreException {
// Do nothing
}
-
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/AbstractPreviewPage.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/AbstractPreviewPage.java Thu Aug 19 16:13:44 2010 -0700
@@ -21,9 +21,9 @@
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.part.IPageSite;
import org.eclipse.ui.part.Page;
+import org.symbian.tools.tmw.core.utilities.CoreUtil;
import org.symbian.tools.wrttools.previewer.Images;
import org.symbian.tools.wrttools.previewer.PreviewerPlugin;
-import org.symbian.tools.wrttools.util.CoreUtil;
public abstract class AbstractPreviewPage extends Page implements IPreviewPage,
ISelectionProvider {
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/PreviewView.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/PreviewView.java Thu Aug 19 16:13:44 2010 -0700
@@ -35,229 +35,212 @@
import org.eclipse.ui.part.PageBookView;
import org.symbian.tools.wrttools.previewer.IWrtEditingPreferences;
import org.symbian.tools.wrttools.previewer.PreviewerPlugin;
-import org.symbian.tools.wrttools.util.ProjectUtils;
public class PreviewView extends PageBookView {
- private final IResourceChangeListener resourceListener = new IResourceChangeListener() {
- public void resourceChanged(IResourceChangeEvent event) {
- if (event.getDelta() != null) {
+ private final IResourceChangeListener resourceListener = new IResourceChangeListener() {
+ public void resourceChanged(IResourceChangeEvent event) {
+ if (event.getDelta() != null) {
new RefreshJob(event.getDelta(), PreviewView.this).schedule();
- }
- }
- };
+ }
+ }
+ };
- private final Map<IProject, IPreviewPage> projectToPage = new HashMap<IProject, IPreviewPage>();
- private boolean preferencesLoaded = false;
- private final Map<IProject, Boolean> autorefresh = new HashMap<IProject, Boolean>();
+ private final Map<IProject, IPreviewPage> projectToPage = new HashMap<IProject, IPreviewPage>();
+ private boolean preferencesLoaded = false;
+ private final Map<IProject, Boolean> autorefresh = new HashMap<IProject, Boolean>();
- @Override
- protected IPage createDefaultPage(PageBook book) {
- MessagePage messagePage = new MessagePage();
- messagePage.setMessage("Open an editor to preview Mobile Web App");
- initPage(messagePage);
- messagePage.createControl(book);
- return messagePage;
- }
+ @Override
+ protected IPage createDefaultPage(PageBook book) {
+ MessagePage messagePage = new MessagePage();
+ messagePage.setMessage("Open an editor to preview Mobile Web App");
+ initPage(messagePage);
+ messagePage.createControl(book);
+ return messagePage;
+ }
- @Override
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- ResourcesPlugin.getWorkspace().addResourceChangeListener(
- resourceListener);
- }
+ @Override
+ public void createPartControl(Composite parent) {
+ super.createPartControl(parent);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceListener);
+ }
- @Override
- public void dispose() {
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(
- resourceListener);
- super.dispose();
- }
+ @Override
+ public void dispose() {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceListener);
+ super.dispose();
+ }
- @Override
- protected PageRec doCreatePage(IWorkbenchPart part) {
- // All checks we need were done in isImportant method
- IResource resource = (IResource) ((IEditorPart) part).getEditorInput()
- .getAdapter(IResource.class);
-
- IProject project = resource.getProject();
- IPreviewPage page = projectToPage.get(project);
+ @Override
+ protected PageRec doCreatePage(IWorkbenchPart part) {
+ // All checks we need were done in isImportant method
+ IResource resource = (IResource) ((IEditorPart) part).getEditorInput().getAdapter(IResource.class);
- if (page == null || page.isDisposed()) {
- page = createPreviewPage(project);
- initPage(page);
- page.createControl(getPageBook());
- projectToPage.put(project, page);
- }
+ IProject project = resource.getProject();
+ IPreviewPage page = projectToPage.get(project);
- return new PageRec(part, page);
- }
+ if (page == null || page.isDisposed()) {
+ page = createPreviewPage(project);
+ initPage(page);
+ page.createControl(getPageBook());
+ projectToPage.put(project, page);
+ }
- private IPreviewPage createPreviewPage(IProject project) {
- if (Platform.getBundle(MozillaPreviewPage.XUL_RUNNER_BUNDLE) != null) {
- return new MozillaPreviewPage(project, this);
- } else {
- return new SwtBrowserPreviewPage(project, this);
- }
- }
+ return new PageRec(part, page);
+ }
- @Override
- protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) {
- // We do not need to delete the page
- }
+ private IPreviewPage createPreviewPage(IProject project) {
+ if (Platform.getBundle(MozillaPreviewPage.XUL_RUNNER_BUNDLE) != null) {
+ return new MozillaPreviewPage(project, this);
+ } else {
+ return new SwtBrowserPreviewPage(project, this);
+ }
+ }
- @Override
- protected IWorkbenchPart getBootstrapPart() {
- IEditorPart activeEditor = getSite().getPage().getActiveEditor();
- if (activeEditor != null) {
- if (isImportant(activeEditor)) {
- return activeEditor;
- }
- }
- return null;
- }
+ @Override
+ protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) {
+ // We do not need to delete the page
+ }
- private boolean getDefaultAutorefresh(IProject project) {
- IPreferenceStore preferenceStore = PreviewerPlugin.getDefault()
- .getPreferenceStore();
- String value = preferenceStore
- .getString(IWrtEditingPreferences.PREF_AUTO_REFRESH);
- boolean toggle = !MessageDialogWithToggle.NEVER.equals(value);
- if (MessageDialogWithToggle.NEVER.equals(value)
- || MessageDialogWithToggle.ALWAYS.equals(value)) {
- setProjectAutorefresh(project, toggle);
- }
- return toggle;
- }
+ @Override
+ protected IWorkbenchPart getBootstrapPart() {
+ IEditorPart activeEditor = getSite().getPage().getActiveEditor();
+ if (activeEditor != null) {
+ if (isImportant(activeEditor)) {
+ return activeEditor;
+ }
+ }
+ return null;
+ }
- private File getPreferencesFile() {
- return PreviewerPlugin.getDefault().getStateLocation().append(
- "autorefreshState.xml").toFile();
- }
+ private boolean getDefaultAutorefresh(IProject project) {
+ IPreferenceStore preferenceStore = PreviewerPlugin.getDefault().getPreferenceStore();
+ String value = preferenceStore.getString(IWrtEditingPreferences.PREF_AUTO_REFRESH);
+ boolean toggle = !MessageDialogWithToggle.NEVER.equals(value);
+ if (MessageDialogWithToggle.NEVER.equals(value) || MessageDialogWithToggle.ALWAYS.equals(value)) {
+ setProjectAutorefresh(project, toggle);
+ }
+ return toggle;
+ }
- public boolean getProjectAutorefresh(IProject project) {
- synchronized (autorefresh) {
- loadPreferences();
- if (autorefresh.containsKey(project)) {
- return autorefresh.get(project);
- } else {
- boolean value = getDefaultAutorefresh(project);
- return value;
- }
- }
- }
+ private File getPreferencesFile() {
+ return PreviewerPlugin.getDefault().getStateLocation().append("autorefreshState.xml").toFile();
+ }
+
+ public boolean getProjectAutorefresh(IProject project) {
+ synchronized (autorefresh) {
+ loadPreferences();
+ if (autorefresh.containsKey(project)) {
+ return autorefresh.get(project);
+ } else {
+ boolean value = getDefaultAutorefresh(project);
+ return value;
+ }
+ }
+ }
- @Override
- protected boolean isImportant(IWorkbenchPart part) {
- if (part instanceof IEditorPart) {
- IResource resource = (IResource) ((IEditorPart) part)
- .getEditorInput().getAdapter(IResource.class);
- if (resource != null) {
- return ProjectUtils.hasWrtNature(resource.getProject());
- }
- }
- return false;
- }
+ @Override
+ protected boolean isImportant(IWorkbenchPart part) {
+ if (part instanceof IEditorPart) {
+ IResource resource = (IResource) ((IEditorPart) part).getEditorInput().getAdapter(IResource.class);
+ if (resource != null) {
+ return PreviewerPlugin.getExtensionsManager().getLayoutProvider(resource.getProject()) != null;
+ }
+ }
+ return false;
+ }
- private void loadPreferences() {
- synchronized (autorefresh) {
- if (preferencesLoaded) {
- return;
- }
- preferencesLoaded = true;
- File preferencesFile = getPreferencesFile();
- Properties properties = new Properties();
- if (preferencesFile.exists()) {
- InputStream inputStream = null;
- try {
- inputStream = new FileInputStream(preferencesFile);
- properties.loadFromXML(inputStream);
- } catch (IOException e) {
- PreviewerPlugin.log(e);
- } finally {
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (IOException e) {
- PreviewerPlugin.log(e);
- }
- }
- }
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- for (Entry<Object, Object> entry : properties.entrySet()) {
- String projectName = entry.getKey().toString();
- String value = entry.getValue().toString();
- IProject project = root.getProject(projectName);
- if (project.exists()) {
- autorefresh.put(project, Boolean.valueOf(value));
- }
- }
- }
- }
- }
-
- protected void refreshPages(Collection<IFile> files) {
- Collection<IPreviewPage> values = projectToPage.values();
- for (IPreviewPage page : values) {
- page.process(files);
- }
- }
+ private void loadPreferences() {
+ synchronized (autorefresh) {
+ if (preferencesLoaded) {
+ return;
+ }
+ preferencesLoaded = true;
+ File preferencesFile = getPreferencesFile();
+ Properties properties = new Properties();
+ if (preferencesFile.exists()) {
+ InputStream inputStream = null;
+ try {
+ inputStream = new FileInputStream(preferencesFile);
+ properties.loadFromXML(inputStream);
+ } catch (IOException e) {
+ PreviewerPlugin.log(e);
+ } finally {
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ PreviewerPlugin.log(e);
+ }
+ }
+ }
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ for (Entry<Object, Object> entry : properties.entrySet()) {
+ String projectName = entry.getKey().toString();
+ String value = entry.getValue().toString();
+ IProject project = root.getProject(projectName);
+ if (project.exists()) {
+ autorefresh.put(project, Boolean.valueOf(value));
+ }
+ }
+ }
+ }
+ }
- public void setProjectAutorefresh(IProject project, boolean refresh) {
- synchronized (autorefresh) {
- autorefresh.put(project, refresh);
- Properties properties = new Properties();
- for (Entry<IProject, Boolean> entry : autorefresh.entrySet()) {
- properties.setProperty(entry.getKey().getName(), entry
- .getValue().toString());
- }
- File path = getPreferencesFile();
- OutputStream outputStream = null;
- try {
- outputStream = new BufferedOutputStream(new FileOutputStream(
- path));
- properties.storeToXML(outputStream, null);
- } catch (IOException e) {
- PreviewerPlugin.log(e);
- } finally {
- if (outputStream != null) {
- try {
- outputStream.close();
- } catch (IOException e) {
- PreviewerPlugin.log(e);
- }
- }
- }
- }
- }
+ protected void refreshPages(Collection<IFile> files) {
+ Collection<IPreviewPage> values = projectToPage.values();
+ for (IPreviewPage page : values) {
+ page.process(files);
+ }
+ }
- public boolean promptUserToToggle(IProject project, boolean toggle) {
- IPreferenceStore preferenceStore = PreviewerPlugin.getDefault()
- .getPreferenceStore();
- String value = preferenceStore
- .getString(IWrtEditingPreferences.PREF_AUTO_REFRESH);
- synchronized (autorefresh) {
- if (!autorefresh.containsKey(project)) {
- if (value == null || value.trim().length() == 0
- || MessageDialogWithToggle.PROMPT.equals(value)) {
- boolean setting = MessageDialogWithToggle
- .open(
- MessageDialogWithToggle.QUESTION,
- getSite().getShell(),
- "Preview",
- "The preview window can refresh (reinitialize and restart) whenever a project file is saved.\n" +
- "This setting for each project can be toggled from the preview toolbar.\n\n" +
- "Do you want to enable automatic refresh for this project?",
- "Keep this setting for new projects",
- false, preferenceStore,
- IWrtEditingPreferences.PREF_AUTO_REFRESH,
- SWT.SHEET).getReturnCode() == IDialogConstants.YES_ID;
- setProjectAutorefresh(project, setting);
- return setting;
- }
- }
- }
- return toggle;
- }
+ public void setProjectAutorefresh(IProject project, boolean refresh) {
+ synchronized (autorefresh) {
+ autorefresh.put(project, refresh);
+ Properties properties = new Properties();
+ for (Entry<IProject, Boolean> entry : autorefresh.entrySet()) {
+ properties.setProperty(entry.getKey().getName(), entry.getValue().toString());
+ }
+ File path = getPreferencesFile();
+ OutputStream outputStream = null;
+ try {
+ outputStream = new BufferedOutputStream(new FileOutputStream(path));
+ properties.storeToXML(outputStream, null);
+ } catch (IOException e) {
+ PreviewerPlugin.log(e);
+ } finally {
+ if (outputStream != null) {
+ try {
+ outputStream.close();
+ } catch (IOException e) {
+ PreviewerPlugin.log(e);
+ }
+ }
+ }
+ }
+ }
+
+ public boolean promptUserToToggle(IProject project, boolean toggle) {
+ IPreferenceStore preferenceStore = PreviewerPlugin.getDefault().getPreferenceStore();
+ String value = preferenceStore.getString(IWrtEditingPreferences.PREF_AUTO_REFRESH);
+ synchronized (autorefresh) {
+ if (!autorefresh.containsKey(project)) {
+ if (value == null || value.trim().length() == 0 || MessageDialogWithToggle.PROMPT.equals(value)) {
+ boolean setting = MessageDialogWithToggle.open(
+ MessageDialogWithToggle.QUESTION,
+ getSite().getShell(),
+ "Preview",
+ "The preview window can refresh (reinitialize and restart) whenever a project file is saved.\n"
+ + "This setting for each project can be toggled from the preview toolbar.\n\n"
+ + "Do you want to enable automatic refresh for this project?",
+ "Keep this setting for new projects", false, preferenceStore,
+ IWrtEditingPreferences.PREF_AUTO_REFRESH, SWT.SHEET).getReturnCode() == IDialogConstants.YES_ID;
+ setProjectAutorefresh(project, setting);
+ return setting;
+ }
+ }
+ }
+ return toggle;
+ }
public synchronized void projectRenamed(IProject project, IPath newPath) {
IPreviewPage page = projectToPage.remove(project);
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/RefreshJob.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/RefreshJob.java Thu Aug 19 16:13:44 2010 -0700
@@ -28,8 +28,8 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
-import org.symbian.tools.wrttools.previewer.PreviewerUtil;
-import org.symbian.tools.wrttools.previewer.PreviewerUtil.ChangedResourcesCollector;
+import org.symbian.tools.tmw.previewer.internal.PreviewerUtil;
+import org.symbian.tools.tmw.previewer.internal.PreviewerUtil.ChangedResourcesCollector;
public class RefreshJob extends Job {
private final IResourceDelta delta;
--- a/org.symbian.tools.wrttools.product/META-INF/MANIFEST.MF Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.product/META-INF/MANIFEST.MF Thu Aug 19 16:13:44 2010 -0700
@@ -16,7 +16,7 @@
org.eclipse.wst.css.ui;bundle-version="1.0.400",
org.eclipse.wst.html.ui;bundle-version="1.0.400",
org.eclipse.wst.xml.ui;bundle-version="1.1.0",
- org.symbian.tools.wrttools.previewer;bundle-version="0.9.0",
+ org.symbian.tools.tmw.previewer;bundle-version="0.9.0",
org.eclipse.ui.intro
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
--- a/org.symbian.tools.wrttools.product/launch/WRT IDE Product (Windows).launch Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools.product/launch/WRT IDE Product (Windows).launch Thu Aug 19 16:13:44 2010 -0700
@@ -5,7 +5,7 @@
<booleanAttribute key="automaticAdd" value="false"/>
<booleanAttribute key="automaticValidate" value="false"/>
<stringAttribute key="bootstrap" value=""/>
-<stringAttribute key="checked" value="org.symbian.tools.wrttools.previewer"/>
+<stringAttribute key="checked" value="[NONE]"/>
<booleanAttribute key="clearConfig" value="true"/>
<booleanAttribute key="clearws" value="false"/>
<booleanAttribute key="clearwslog" value="false"/>
@@ -21,9 +21,8 @@
<stringAttribute key="product" value="org.symbian.tools.wrttools.product.product"/>
<stringAttribute key="productFile" value="\org.symbian.tools.wrttools.product\wrt-ide.product"/>
<booleanAttribute key="restart" value="false"/>
-<stringAttribute key="selectedPlugin" value="org.symbian.tools.wrttools.previewer"/>
-<stringAttribute key="selected_target_plugins" value="org.eclipse.update.configurator@3:true,org.eclipse.equinox.http.jetty@default:default,org.eclipse.help.ui@default:default,org.eclipse.wst.validation.infopop@default:default,org.eclipse.ui.views@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.compare.win32@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.databinding.property@default:default,com.jcraft.jsch@default:default,org.apache.commons.logging*1.0.4.v200904062259@default:default,org.apache.lucene@default:default,org.eclipse.compare.core@default:default,org.eclipse.wst.common.environment@default:default,org.eclipse.update.core@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.wst.jsdt.web.ui@default:default,org.eclipse.wst.doc.user@default:default,org.apache.log4j@default:default,org.eclipse.ui.editors@default:default,org.eclipse.osgi.services@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.jem.util@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.ui.ide@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.jsch.core@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.apache.lucene.analysis@default:default,org.eclipse.ui.net@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.mozilla.xpcom@default:default,org.eclipse.wst.xml.core@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.wst.xml.xpath.core@default:default,org.mortbay.jetty.server@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.emf.ecore.edit@default:default,org.eclipse.wst.common.modulecore@default:default,org.eclipse.help@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.boot@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.wst.internet.monitor.ui@default:default,org.eclipse.wst.css.ui@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.wst.internet.cache@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.equinox.security@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.core.net@default:default,org.eclipse.gef@default:default,org.eclipse.ui.browser@default:default,org.eclipse.emf.common.ui@default:default,org.eclipse.wst.validation.ui@default:default,org.eclipse.wst.common.frameworks@default:default,org.eclipse.help.appserver@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.core.filebuffers@default:default,com.ibm.icu@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.wst.common.project.facet.core@default:default,javax.servlet@default:default,org.eclipse.debug.core@default:default,org.eclipse.platform@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.net.win32.x86@default:false,org.eclipse.equinox.util@default:default,org.eclipse.text@default:default,org.eclipse.core.resources.win32.x86@default:false,org.eclipse.wst.common.frameworks.ui@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.ui.console@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,javax.servlet.jsp@default:default,org.eclipse.wst.html.core@default:default,org.eclipse.core.jobs@default:default,org.eclipse.equinox.p2.repository@default:default,org.apache.xerces@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.eclipse.swt@default:default,org.eclipse.wst.jsdt.support.firefox@default:default,org.sat4j.pb@default:default,org.eclipse.ui.presentations.r21@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.wst.common.uriresolver@default:default,org.eclipse.wst.jsdt.ui@default:default,org.mortbay.jetty.util@default:default,org.eclipse.wst.sse.ui.infopop@default:default,org.jdom@default:default,org.apache.velocity@default:default,org.apache.commons.collections@default:default,org.apache.xalan@default:default,org.eclipse.equinox.app@default:default,org.eclipse.wst.dtd.core@default:default,org.eclipse.debug.ui@default:default,org.eclipse.ui.workbench.compatibility@default:false,org.eclipse.wst.common.infopop@default:default,org.eclipse.team.cvs.core@default:default,javax.xml@default:default,org.apache.bcel@default:default,org.eclipse.wst.common.snippets@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.update.core.win32@default:false,org.eclipse.rcp@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.equinox.common@2:true,org.eclipse.wst.css.core@default:default,org.eclipse.wst.xml.ui.infopop@default:default,org.eclipse.wst.standard.schemas@default:default,org.eclipse.swt.win32.win32.x86@default:false,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,org.eclipse.platform.doc.user@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.wst.common.ui@default:default,org.eclipse.emf.ecore@default:default,org.sat4j.core@default:default,org.eclipse.emf.edit@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.apache.commons.httpclient*3.1.0.v20080605-1935@default:default,org.eclipse.wst.sse.core@default:default,org.eclipse.wst.validation@default:default,org.eclipse.wst.xml.ui@default:default,org.eclipse.wst.jsdt.doc@default:default,org.eclipse.wst.internet.monitor.core@default:default,org.apache.commons.el@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.emf.common@default:default,org.eclipse.help.base@default:default,org.eclipse.wst.jsdt.manipulation@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.update.scheduler@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.wst.common.project.facet.ui@default:default,org.apache.commons.codec*1.3.0.v20100518-1140@default:default,org.eclipse.ui.win32@default:false,org.eclipse.team.ui@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.apache.xml.resolver@default:default,org.mozilla.xulrunner@default:default,org.eclipse.emf.edit.ui@default:default,org.apache.commons.lang@default:default,org.eclipse.equinox.launcher.win32.win32.x86@default:false,org.eclipse.team.core@default:default,org.apache.jasper@default:default,org.eclipse.wst.html.ui@default:default,org.eclipse.wst.sse.doc.user@default:default,org.eclipse.cvs@default:default,org.eclipse.core.runtime@default:true,org.eclipse.draw2d@default:default,org.eclipse.wst.xml.xpath2.processor@default:default,org.eclipse.wst.common.core@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.ui.forms@default:default,org.eclipse.ui@default:default,org.eclipse.update.ui@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.wst.xmleditor.doc.user@default:default,org.eclipse.core.variables@default:default,org.eclipse.search@default:default,org.eclipse.team.cvs.ui@default:default,org.eclipse.osgi@-1:true,org.eclipse.ecf@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.ui.intro@default:default,org.eclipse.ui.ide.application@default:default,org.apache.xml.serializer@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.equinox.security.ui@default:default,java_cup.runtime@default:default,org.apache.commons.codec*1.3.0.v20100106-1700@default:default,org.eclipse.wst.xml.xpath.ui@default:default,org.eclipse.wst.jsdt.core@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.equinox.p2.metadata.generator@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.wst.sse.ui@default:default,org.eclipse.wst.jsdt.support.ie@default:default,org.mozilla.xulrunner.win32.win32.x86@default:false,org.eclipse.wst.common.emfworkbench.integration@default:default,org.eclipse.jsch.ui@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.compare@default:default,org.eclipse.wst.common.emf@default:default,org.eclipse.help.webapp@default:default,org.eclipse.team.cvs.ssh2@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.osgi.util@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.core.commands@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.jface.text@default:default,org.eclipse.wst.jsdt.web.core@default:default,org.eclipse.wst.html.ui.infopop@default:default"/>
-<stringAttribute key="selected_workspace_plugins" value="org.symbian.tools.wrttools@default:default,org.symbian.tools.wrttools.doc.WebDeveloper@default:default,org.symbian.tools.wrttools.previewer@default:default,org.symbian.tools.wrttools.doc.WRTKit@default:default,org.chromium.debug.ui@default:default,org.w3c.css@default:default,org.symbian.tools.tmw.ui@default:default,org.chromium.sdk@default:default,org.symbian.tools.tmw.core@default:default,org.symbian.tools.wrttools.debug.core@default:default,org.chromium.debug.core@default:default,org.symbian.tools.wrttools.product@default:default"/>
+<stringAttribute key="selected_target_plugins" value="org.eclipse.wst.common.modulecore@default:default,javax.servlet@default:default,org.eclipse.wst.jsdt.web.ui@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.emf.common.ui@default:default,org.eclipse.compare.core@default:default,org.eclipse.wst.sse.core@default:default,org.eclipse.draw2d@default:default,org.eclipse.ui.forms@default:default,org.eclipse.wst.doc.user@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.ui.workbench.compatibility@default:false,org.eclipse.wst.common.project.facet.ui@default:default,org.eclipse.ui.win32@default:false,org.eclipse.update.configurator@3:true,org.eclipse.jface@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,org.eclipse.search@default:default,org.eclipse.team.cvs.ssh2@default:default,org.eclipse.platform.doc.user@default:default,org.eclipse.help.ui@default:default,org.eclipse.core.expressions@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.ltk.core.refactoring@default:default,org.apache.commons.httpclient*3.1.0.v20080605-1935@default:default,org.apache.xml.resolver@default:default,org.eclipse.wst.xml.xpath2.processor@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.ui.ide@default:default,javax.xml@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.ui.intro@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.wst.jsdt.manipulation@default:default,org.eclipse.ui.console@default:default,org.eclipse.wst.internet.monitor.core@default:default,org.apache.commons.codec*1.3.0.v20100106-1700@default:default,org.eclipse.wst.common.project.facet.core@default:default,org.apache.jasper@default:default,org.eclipse.rcp@default:default,org.eclipse.core.jobs@default:default,org.eclipse.wst.xmleditor.doc.user@default:default,org.eclipse.wst.common.ui@default:default,org.eclipse.jem.util@default:default,org.apache.lucene.analysis@default:default,org.apache.xerces@default:default,org.eclipse.wst.common.infopop@default:default,org.eclipse.wst.common.emf@default:default,org.eclipse.equinox.concurrent@default:default,org.apache.velocity@default:default,java_cup.runtime@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.wst.validation.infopop@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.wst.common.core@default:default,org.eclipse.help.appserver@default:default,org.mozilla.xulrunner@default:default,org.jdom@default:default,org.mortbay.jetty.server@default:default,org.eclipse.ui@default:default,org.apache.xml.serializer@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.ui.views@default:default,org.eclipse.wst.jsdt.ui@default:default,org.apache.commons.collections@default:default,org.eclipse.equinox.common@2:true,org.eclipse.core.net@default:default,org.eclipse.wst.dtd.core@default:default,org.eclipse.osgi.services@default:default,org.apache.lucene@default:default,org.eclipse.core.resources.win32.x86@default:false,org.eclipse.wst.standard.schemas@default:default,org.eclipse.equinox.launcher.win32.win32.x86@default:false,org.eclipse.ui.editors@default:default,org.eclipse.wst.jsdt.support.ie@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.eclipse.debug.ui@default:default,org.eclipse.equinox.app@default:default,org.eclipse.wst.jsdt.web.core@default:default,org.eclipse.wst.jsdt.core@default:default,org.apache.xalan@default:default,org.eclipse.help.base@default:default,org.eclipse.wst.xml.ui@default:default,org.eclipse.wst.xml.xpath.ui@default:default,org.eclipse.equinox.security@default:default,org.eclipse.cvs@default:default,org.eclipse.ecf@default:default,org.eclipse.osgi@-1:true,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.wst.html.core@default:default,org.eclipse.help.webapp@default:default,org.mozilla.xpcom@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.update.scheduler@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.jface.text@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.wst.html.ui@default:default,org.eclipse.jsch.ui@default:default,org.eclipse.core.runtime@default:true,org.apache.commons.lang@default:default,org.mortbay.jetty.util@default:default,org.eclipse.emf.common@default:default,org.eclipse.debug.core@default:default,org.eclipse.compare.win32@default:default,org.eclipse.gef@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.wst.sse.ui.infopop@default:default,javax.servlet.jsp@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.text@default:default,org.eclipse.update.ui@default:default,org.eclipse.wst.internet.cache@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.emf.edit@default:default,org.eclipse.wst.html.ui.infopop@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.wst.validation@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ui.browser@default:default,org.eclipse.wst.sse.ui@default:default,org.mozilla.xulrunner.win32.win32.x86@default:false,org.eclipse.emf.ecore.change@default:default,org.eclipse.wst.xml.xpath.core@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.swt.win32.win32.x86@default:false,org.eclipse.core.databinding.observable@default:default,org.eclipse.wst.internet.monitor.ui@default:default,org.eclipse.equinox.util@default:default,org.eclipse.wst.validation.ui@default:default,org.eclipse.jsch.core@default:default,org.eclipse.wst.sse.doc.user@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.core.databinding.property@default:default,org.apache.commons.logging*1.0.4.v200904062259@default:default,org.eclipse.core.commands@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.wst.xml.ui.infopop@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.boot@default:default,org.eclipse.wst.common.frameworks@default:default,org.eclipse.ui.presentations.r21@default:default,org.eclipse.wst.common.uriresolver@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.emf.ecore.edit@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.ui.net@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.team.cvs.ui@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.update.core.win32@default:false,org.eclipse.ecf.provider.filetransfer.ssl@default:false,com.ibm.icu@default:default,org.eclipse.osgi.util@default:default,org.eclipse.core.databinding.beans@default:default,org.sat4j.core@default:default,org.eclipse.core.resources@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.wst.common.frameworks.ui@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.wst.common.environment@default:default,org.eclipse.platform@default:default,org.eclipse.core.databinding@default:default,org.apache.commons.el@default:default,org.eclipse.wst.common.snippets@default:default,org.eclipse.compare@default:default,org.eclipse.swt@default:default,org.sat4j.pb@default:default,org.eclipse.equinox.p2.metadata.generator@default:default,org.eclipse.team.cvs.core@default:default,org.eclipse.wst.xml.core@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.emf.edit.ui@default:default,org.eclipse.core.net.win32.x86@default:false,org.eclipse.team.core@default:default,org.eclipse.help@default:default,com.jcraft.jsch@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.apache.bcel@default:default,org.eclipse.core.variables@default:default,org.eclipse.update.core@default:default,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.apache.commons.codec*1.3.0.v20100518-1140@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.wst.css.ui@default:default,org.eclipse.wst.jsdt.support.firefox@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.equinox.p2.metadata@default:default,org.apache.log4j@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.wst.jsdt.doc@default:default,org.eclipse.team.ui@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.wst.css.core@default:default"/>
+<stringAttribute key="selected_workspace_plugins" value="org.symbian.tools.wrttools.product@default:default,org.symbian.tools.tmw.ui@default:default,org.symbian.tools.tmw.core@default:default,org.symbian.tools.tmw.previewer@default:default,org.w3c.css@default:default,org.symbian.tools.wrttools.doc.WebDeveloper@default:default,org.symbian.tools.wrttools.debug.core@default:default,org.symbian.tools.wrttools@default:default,org.chromium.debug.ui@default:default,org.chromium.debug.core@default:default,org.chromium.sdk@default:default,org.symbian.tools.wrttools.doc.WRTKit@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="true"/>
<mapAttribute key="tracingOptions">
--- a/org.symbian.tools.wrttools/META-INF/MANIFEST.MF Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools/META-INF/MANIFEST.MF Thu Aug 19 16:13:44 2010 -0700
@@ -30,7 +30,8 @@
org.symbian.tools.tmw.core;bundle-version="1.0.0",
org.symbian.tools.tmw.ui;bundle-version="1.0.0",
org.eclipse.wst.common.project.facet.core;bundle-version="1.4.100",
- org.eclipse.wst.common.project.facet.ui;bundle-version="1.4.100"
+ org.eclipse.wst.common.project.facet.ui;bundle-version="1.4.100",
+ org.symbian.tools.tmw.previewer;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5,
JavaSE-1.6
Bundle-ActivationPolicy: lazy
--- a/org.symbian.tools.wrttools/plugin.xml Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools/plugin.xml Thu Aug 19 16:13:44 2010 -0700
@@ -819,6 +819,9 @@
id="org.symbian.tools.wrttools.wrt"
version="1.1">
</runtime-component>
+ <facet
+ id="symbian.phonegap">
+ </facet>
</supported>
</extension>
<extension
@@ -948,6 +951,31 @@
</config-factory>
</action>
</project-facet-version>
+ <project-facet
+ id="symbian.phonegap">
+ <label>
+ PhoneGap
+ </label>
+ <description>
+ PhoneGap application
+ </description>
+ </project-facet>
+ <project-facet-version
+ facet="symbian.phonegap"
+ version="1.0">
+ <constraint>
+ <requires
+ facet="tmw.core"
+ ignore-problems="1.0">
+ </requires>
+ </constraint>
+ <action
+ type="install">
+ <delegate
+ class="org.symbian.tools.wrttools.core.libraries.PhoneGapLibraryInstaller">
+ </delegate>
+ </action>
+ </project-facet-version>
</extension>
<extension
point="org.eclipse.wst.common.project.facet.ui.images">
@@ -957,5 +985,13 @@
version="1.0">
</image>
</extension>
+ <extension
+ point="org.symbian.tools.tmw.previewer.layoutProviders">
+ <layout-provider
+ class="org.symbian.tools.wrttools.core.project.WRT11ApplicationLayout"
+ runtime-id="org.symbian.tools.wrttools.wrt"
+ runtime-version="1.1">
+ </layout-provider>
+ </extension>
</plugin>
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WRTProject.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WRTProject.java Thu Aug 19 16:13:44 2010 -0700
@@ -36,10 +36,10 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.symbian.tools.tmw.core.TMWCore;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
-public class WRTProject implements IMTWProject {
+public class WRTProject implements ITMWProject {
private static final String PROP_PREFERED_SCREEN = "preferred.screen.size";
private static final IPath PROPERTIES_FILE = new Path(".settings").append(Activator.PLUGIN_ID + ".properties");
public static final String WRT11_RUNTIME = "org.symbian.tools.wrttools.wrt";
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/emulator/Emulator.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/emulator/Emulator.java Thu Aug 19 16:13:44 2010 -0700
@@ -31,7 +31,7 @@
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.IMemento;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.runtimes.IPackager;
import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
import org.symbian.tools.wrttools.Activator;
@@ -95,7 +95,7 @@
return path;
}
- public IStatus deploy(IMTWProject project, IPackager packager, IProgressMonitor monitor)
+ public IStatus deploy(ITMWProject project, IPackager packager, IProgressMonitor monitor)
throws CoreException {
final File application = packager.packageApplication(project, monitor);
final File outputFile = new File(path);
@@ -136,7 +136,7 @@
// Do nothing
}
- public void init(IMTWProject project, IPackager packager, IMemento memento) {
+ public void init(ITMWProject project, IPackager packager, IMemento memento) {
// Do nothing
}
}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/emulator/EmulatorTargetType.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/emulator/EmulatorTargetType.java Thu Aug 19 16:13:44 2010 -0700
@@ -34,7 +34,7 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType;
import org.symbian.tools.wrttools.core.IWRTConstants;
@@ -54,7 +54,7 @@
discoverTargets(new NullProgressMonitor());
}
- public IDeploymentTarget[] getTargets(IMTWProject project) {
+ public IDeploymentTarget[] getTargets(ITMWProject project) {
Collection<Emulator> values = listofEmulators.values();
return values.toArray(new Emulator[values.size()]);
}
@@ -67,7 +67,7 @@
initialize();
}
- public IDeploymentTarget findTarget(IMTWProject project, String id) {
+ public IDeploymentTarget findTarget(ITMWProject project, String id) {
// TODO Auto-generated method stub
return null;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/PhoneGapLibraryInstaller.java Thu Aug 19 16:13:44 2010 -0700
@@ -0,0 +1,56 @@
+/**
+ * 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;
+
+import java.io.InputStream;
+
+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.common.project.facet.core.IProjectFacetVersion;
+import org.symbian.tools.tmw.core.projects.IProjectSetupConfig;
+import org.symbian.tools.tmw.core.runtimes.LibraryInstallDelegate;
+
+public class PhoneGapLibraryInstaller extends LibraryInstallDelegate {
+
+ public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor)
+ throws CoreException {
+
+ }
+
+ @Override
+ protected IPath getBasePath(IProject project, IProjectSetupConfig setupConfig) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected boolean isIncludeFile(IPath entry) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ protected InputStream openInputStream() throws CoreException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/WrtPackager.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/WrtPackager.java Thu Aug 19 16:13:44 2010 -0700
@@ -29,14 +29,14 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.runtimes.IPackagerDelegate;
import org.symbian.tools.tmw.core.utilities.ZipApplicationVisitor;
import org.symbian.tools.wrttools.Activator;
import org.symbian.tools.wrttools.util.ProjectUtils;
public class WrtPackager implements IPackagerDelegate {
- public File packageApplication(IMTWProject project, IProgressMonitor monitor) throws CoreException {
+ public File packageApplication(ITMWProject project, IProgressMonitor monitor) throws CoreException {
monitor.beginTask(String.format("Packaging %s", project.getName()), IProgressMonitor.UNKNOWN);
IPath stateLocation = Activator.getDefault().getStateLocation();
@@ -54,7 +54,7 @@
return f;
}
- public String getFileType(IMTWProject project) {
+ public String getFileType(ITMWProject project) {
return "wgz";
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/project/WRT11ApplicationLayout.java Thu Aug 19 16:13:44 2010 -0700
@@ -0,0 +1,154 @@
+/**
+ * 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.project;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+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.wrttools.Activator;
+import org.symbian.tools.wrttools.previewer.PreviewerPlugin;
+import org.symbian.tools.wrttools.util.CoreUtil;
+import org.symbian.tools.wrttools.util.ProjectUtils;
+
+public class WRT11ApplicationLayout implements IApplicationLayoutProvider {
+ private static final Pattern HEAD_TAG_PATTERN = Pattern.compile("<head(\\s*\\w*=\"(^\")*\")*\\s*>",
+ Pattern.CASE_INSENSITIVE);
+ public static final String INDEX = "wrt_preview_main.html";
+ private static final String SCRIPT = "<script language=\"JavaScript\" "
+ + "type=\"text/javascript\" src=\"preview/script/lib/loader.js\"></script>";
+
+ public String[] getPaths() {
+ return new String[] { INDEX };
+ }
+
+ 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;
+ }
+ }
+ PreviewerPlugin.print(String.format("Can not find main page (%s) in project %s.\n", indexFileName,
+ project.getName()));
+ }
+ return null;
+ }
+
+ private InputStream patchIndexFile(final IFile file) throws CoreException, UnsupportedEncodingException {
+ String string = CoreUtil.readFile(file);
+ if (string != null) {
+ Matcher matcher = HEAD_TAG_PATTERN.matcher(string);
+ if (matcher.find()) {
+ string = matcher.replaceFirst(matcher.group() + SCRIPT);
+ }
+ return new ByteArrayInputStream(string.getBytes("UTF-8"));
+ }
+ return null;
+ }
+
+ public InputStream getResourceFromPath(IProject project, IPath path) throws CoreException {
+ final IFile file = getWorkspaceFile(project, path);
+ if (file == null) {
+ return null;
+ }
+ if (path.segmentCount() == 1 && INDEX.equals(path.segment(0))) {
+ try {
+ return patchIndexFile(file);
+ } catch (IOException e) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ "Can't access preview index file", e));
+ }
+ }
+ return file.getContents();
+ }
+
+ public IPath getResourcePath(IFile file) {
+ try {
+ if (file != null && file.getProjectRelativePath().equals(CoreUtil.getIndexFile(file.getProject()))) {
+ return new Path(INDEX);
+ }
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ return file != null && file.exists() && isFileIncluded(file) ? file.getProjectRelativePath().makeRelative()
+ : null;
+ }
+
+ private boolean isFileIncluded(IFile file) {
+ return !ProjectUtils.isExcluded(file);
+ }
+
+ // WRT runtime is case-insensitive so we need to properly process files in a case-insensitive way
+ private IFile tryCaseInsensitiveSearch(IContainer container, IPath path) throws CoreException {
+ if (path.segmentCount() == 0) {
+ return null;
+ }
+ final String segment = path.segment(0);
+ final IResource[] members = container.members();
+ for (IResource resource : members) {
+ if (resource.getName().equalsIgnoreCase(segment)) {
+ if (resource.getType() == IResource.FILE) {
+ return (IFile) (path.segmentCount() == 1 ? resource : null);
+ } else {
+ return tryCaseInsensitiveSearch((IContainer) resource, path.removeFirstSegments(1));
+ }
+ }
+ }
+ return null;
+ }
+
+ public IFile getWorkspaceFile(IProject project, IPath path) throws CoreException {
+ if (path.segmentCount() == 1 && INDEX.equals(path.segment(0))) {
+ try {
+ return getProjectIndexPage(project.getName());
+ } catch (IOException e) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Can't find project index file",
+ e));
+ }
+ }
+ IFile file = project.getFile(path);
+ if (!file.exists()) {
+ try {
+ file = tryCaseInsensitiveSearch(project, path);
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ }
+ return file.exists() && isFileIncluded(file) ? file : null;
+ }
+
+}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/project/WRTIDEProjectProvider.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/project/WRTIDEProjectProvider.java Thu Aug 19 16:13:44 2010 -0700
@@ -22,16 +22,16 @@
import java.util.WeakHashMap;
import org.eclipse.core.resources.IProject;
-import org.symbian.tools.tmw.core.projects.IMTWProject;
-import org.symbian.tools.tmw.core.projects.IMTWProjectProvider;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
+import org.symbian.tools.tmw.core.projects.ITMWProjectProvider;
import org.symbian.tools.wrttools.WRTProject;
import org.symbian.tools.wrttools.util.ProjectUtils;
-public class WRTIDEProjectProvider implements IMTWProjectProvider {
- private final Map<IProject, IMTWProject> projects = new WeakHashMap<IProject, IMTWProject>();
+public class WRTIDEProjectProvider implements ITMWProjectProvider {
+ private final Map<IProject, ITMWProject> projects = new WeakHashMap<IProject, ITMWProject>();
- public IMTWProject create(IProject project) {
- IMTWProject p = projects.get(project);
+ public ITMWProject create(IProject project) {
+ ITMWProject p = projects.get(project);
if (p == null) {
p = new WRTProject(project);
projects.put(project, p);
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/CoreUtil.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/CoreUtil.java Thu Aug 19 16:13:44 2010 -0700
@@ -85,7 +85,7 @@
return null;
}
- public static String readFile(IProject project, IFile file) throws CoreException {
+ public static String readFile(IFile file) throws CoreException {
try {
if (file != null && file.isAccessible()) {
final BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents(),
@@ -95,7 +95,7 @@
return null;
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, MessageFormat.format(
- "Failed to read file {0} in project {1}", file.getName(), project.getName())));
+ "Failed to read file {0} in project {1}", file.getName(), file.getProject().getName())));
}
}
@@ -131,7 +131,7 @@
return record.fileName;
}
}
- String fileName = getIndexFileName(readFile(project, file));
+ String fileName = getIndexFileName(readFile(file));
INDEX_FILES.put(project, new IndexFileRecord(fileName, file.getModificationStamp()));
return fileName;
}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/ProjectUtils.java Wed Aug 18 09:30:53 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/ProjectUtils.java Thu Aug 19 16:13:44 2010 -0700
@@ -407,6 +407,9 @@
}
public static boolean isExcluded(IResource resource) {
+ if (resource.getType() == IResource.PROJECT || resource.getType() == IResource.ROOT) {
+ return false;
+ }
if (!resource.exists()) {
return false;
}
@@ -414,7 +417,8 @@
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)));
+ return markers.length != 0 || (path.segmentCount() > 1 && ".settings".equals(path.segment(0)))
+ || isExcluded(resource.getParent());
} catch (CoreException e) {
Activator.log(e);
return false;