--- a/org.symbian.tools.mtw.core/.project Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.mtw.core/.project Mon Aug 09 15:18:34 2010 -0700
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.symbian.tools.mtw.core</name>
+ <name>org.symbian.tools.tmw.core</name>
<comment></comment>
<projects>
</projects>
--- a/org.symbian.tools.mtw.core/META-INF/MANIFEST.MF Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.mtw.core/META-INF/MANIFEST.MF Mon Aug 09 15:18:34 2010 -0700
@@ -1,17 +1,19 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mobile Tools for Web Core Plug-in
-Bundle-SymbolicName: org.symbian.tools.mtw.core;singleton:=true
+Bundle-SymbolicName: org.symbian.tools.tmw.core;singleton:=true
Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.symbian.tools.mtw.core.MTWCore
+Bundle-Activator: org.symbian.tools.tmw.core.TMWCore
Bundle-Vendor: Symbian Foundation
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources;bundle-version="3.6.0",
- org.eclipse.core.expressions;bundle-version="3.4.200"
+ org.eclipse.core.expressions;bundle-version="3.4.200",
+ org.eclipse.wst.common.project.facet.core;bundle-version="1.4.100",
+ org.eclipse.wst.jsdt.core;bundle-version="1.1.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
-Export-Package: org.symbian.tools.mtw.core,
- org.symbian.tools.mtw.core.projects,
- org.symbian.tools.mtw.core.runtimes,
- org.symbian.tools.mtw.core.utilities
+Export-Package: org.symbian.tools.tmw.core,
+ org.symbian.tools.tmw.core.projects,
+ org.symbian.tools.tmw.core.runtimes,
+ org.symbian.tools.tmw.core.utilities
--- a/org.symbian.tools.mtw.core/plugin.xml Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.mtw.core/plugin.xml Mon Aug 09 15:18:34 2010 -0700
@@ -4,5 +4,143 @@
<extension-point id="runtimes" name="Mobile Web Runtimes" schema="schema/runtimes.exsd"/>
<extension-point id="packagers" name="Application Packagers" schema="schema/packagers.exsd"/>
<extension-point id="projectProvider" name="Project provider" schema="schema/projectProvider.exsd"/>
+ <extension-point id="runtimeIncludePath" name="Include path providers" schema="schema/runtimeIncludePath.exsd"/>
+ <extension
+ point="org.eclipse.wst.common.project.facet.core.runtimeBridges">
+ <bridge
+ class="org.symbian.tools.tmw.core.internal.runtimes.MobileRuntimesBridge"
+ id="org.symbian.tools.tmw.core.mobileRuntimesBridge">
+ </bridge>
+ </extension>
+ <extension
+ point="org.eclipse.wst.common.project.facet.core.runtimes">
+ <runtime-component-type
+ id="tmw.core">
+ </runtime-component-type>
+ <runtime-component-version
+ type="tmw.core"
+ version="1.0">
+ </runtime-component-version>
+ <supported>
+ <facet
+ id="tmw.geolocation"
+ version="1.0">
+ </facet>
+ <runtime-component
+ id="tmw.geolocation"
+ version="1.0"></runtime-component>
+ </supported>
+ <runtime-component-type
+ id="tmw.geolocation">
+ </runtime-component-type>
+ <runtime-component-version
+ type="tmw.geolocation"
+ version="1.0">
+ </runtime-component-version>
+ <supported>
+ <facet
+ id="tmw.core"
+ version="1.0">
+ </facet>
+ <runtime-component
+ id="tmw.core"
+ version="1.0">
+ </runtime-component>
+ </supported>
+ </extension>
+ <extension
+ point="org.eclipse.wst.common.project.facet.core.facets">
+ <project-facet
+ id="tmw.geolocation">
+ <label>
+ Location Services
+ </label>
+ <description>
+ Allows the application to query GPS location using runtime-specific APIs
+ </description>
+ <default-version
+ version="1.0">
+ </default-version>
+ </project-facet>
+ <project-facet-version
+ facet="tmw.geolocation"
+ version="1.0">
+ <constraint>
+ <requires
+ facet="tmw.core"
+ version="1.0">
+ </requires>
+ </constraint>
+ <action
+ type="install">
+ <delegate
+ class="org.symbian.tools.tmw.core.internal.facets.InstallFacetAction">
+ </delegate>
+ </action>
+ <action
+ type="uninstall">
+ <delegate
+ class="org.symbian.tools.tmw.core.internal.facets.UninstallFacetAction">
+ </delegate>
+ </action>
+ </project-facet-version>
+ <project-facet
+ id="tmw.core">
+ <default-version
+ version="1.0">
+ </default-version>
+ <label>
+ Core Mobile Web Runtime Support
+ </label>
+ <description>
+ Provides core mobile web runtime APIs
+ </description>
+ </project-facet>
+ <project-facet-version
+ facet="tmw.core"
+ version="1.0">
+ <constraint>
+ <requires
+ facet="wst.jsdt.web"
+ version="1.0">
+ </requires>
+ </constraint>
+ <action
+ type="install">
+ <delegate
+ class="org.symbian.tools.tmw.core.internal.facets.InstallFacetAction">
+ </delegate>
+ </action>
+ </project-facet-version>
+ </extension>
+ <extension
+ point="org.eclipse.wst.jsdt.core.JsGlobalScopeContainerInitializer">
+ <JsGlobalScopeContainerInitializer
+ class="org.symbian.tools.tmw.core.internal.runtimes.MobileRuntimeLibraryContainerInitializer"
+ id="tmw.coreLibrary">
+ </JsGlobalScopeContainerInitializer>
+ </extension>
+ <extension
+ point="org.symbian.tools.tmw.core.projectProvider">
+ <projectProvider
+ class="org.symbian.tools.tmw.core.internal.projects.MTWFacetedProjectProvider">
+ <enablement>
+ <test
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="tmw.core">
+ </test>
+ </enablement>
+ </projectProvider>
+ </extension>
+ <extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.symbian.tools.tmw.core.internal.projects.TMWPropertyTester"
+ id="org.symbian.tools.tmw.core"
+ namespace="org.symbian.tools.tmw"
+ properties="istmwproject"
+ type="org.eclipse.core.resources.IProject">
+ </propertyTester>
+ </extension>
</plugin>
--- a/org.symbian.tools.mtw.core/schema/packagers.exsd Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.mtw.core/schema/packagers.exsd Mon Aug 09 15:18:34 2010 -0700
@@ -1,9 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
-<schema targetNamespace="org.symbian.tools.mtw.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<schema targetNamespace="org.symbian.tools.tmw.core" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
- <meta.schema plugin="org.symbian.tools.mtw.core" id="packagers" name="Application Packagers"/>
+ <meta.schema plugin="org.symbian.tools.tmw.core" id="packagers" name="Application Packagers"/>
</appinfo>
<documentation>
Packagers can package given application for specified runtime
@@ -55,30 +55,44 @@
</documentation>
<appinfo>
- <meta.attribute kind="java" basedOn=":org.symbian.tools.mtw.core.runtimes.IPackagerDelegate"/>
+ <meta.attribute kind="java" basedOn=":org.symbian.tools.tmw.core.runtimes.IPackagerDelegate"/>
</appinfo>
</annotation>
</attribute>
- <attribute name="targetRuntime" type="string" use="required">
+ <attribute name="target-runtime" type="string" use="required">
<annotation>
<documentation>
ID of the runtime that the application will be deployed to.
</documentation>
<appinfo>
- <meta.attribute kind="identifier" basedOn="org.symbian.tools.mtw.core.runtimes/runtime/@id"/>
+ <meta.attribute kind="identifier" basedOn="org.symbian.tools.tmw.core.runtimes/runtime/@component-id"/>
</appinfo>
</annotation>
</attribute>
- <attribute name="sourceRuntime" type="string">
+ <attribute name="target-runtime-version" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="source-runtime" type="string">
<annotation>
<documentation>
ID of the runtime that the project should support so it could be deployed to targetRuntime. If this attribute is empty then the project should target the targetRuntime directly
</documentation>
<appinfo>
- <meta.attribute kind="identifier" basedOn="org.symbian.tools.mtw.core.runtimes/runtime/@id"/>
+ <meta.attribute kind="identifier" basedOn="org.symbian.tools.tmw.core.runtimes/runtime/@component-id"/>
</appinfo>
</annotation>
</attribute>
+ <attribute name="source-runtime-version" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
--- a/org.symbian.tools.mtw.core/schema/projectProvider.exsd Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.mtw.core/schema/projectProvider.exsd Mon Aug 09 15:18:34 2010 -0700
@@ -1,9 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
-<schema targetNamespace="org.symbian.tools.mtw.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<schema targetNamespace="org.symbian.tools.tmw.core" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
- <meta.schema plugin="org.symbian.tools.mtw.core" id="projectProvider" name="Project provider"/>
+ <meta.schema plugin="org.symbian.tools.tmw.core" id="projectProvider" name="Project provider"/>
</appinfo>
<documentation>
These providers enables extension providers to add support for a different project models (i.e. coming from other IDEs). MTW will not provide facilities for creating, converting and configuring non-MTW projects. MTW will only ensure that most features (like deployment and debugging) are available to those projects.
@@ -60,7 +60,7 @@
</documentation>
<appinfo>
- <meta.attribute kind="java" basedOn=":org.symbian.tools.mtw.core.projects.IMTWProjectProvider"/>
+ <meta.attribute kind="java" basedOn=":org.symbian.tools.tmw.core.projects.IMTWProjectProvider"/>
</appinfo>
</annotation>
</attribute>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/schema/runtimeIncludePath.exsd Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,182 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.symbian.tools.tmw.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.symbian.tools.tmw.core" id="runtimeIncludePath" name="Include path providers"/>
+ </appinfo>
+ <documentation>
+ This extension point will let adapters provide JSDT include path entries for their mobile web runtime. Files may be available depending on project target runtime, enabled facets or both.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element ref="runtime-include-path"/>
+ <element ref="facet-include-path"/>
+ </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="include-path-entry">
+ <complexType>
+ <attribute name="file" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="resource"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="facet-include-path">
+ <annotation>
+ <documentation>
+ Provides entries that will be shown when facet is enabled. If this element is used as a subelement of the runtime-include-path then both runtime and facet will be taken into the consideration.
+If there are several contributions for the same facet they will be joined to one.
+ </documentation>
+ </annotation>
+ <complexType>
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element ref="include-path-entry"/>
+ <element ref="include-path-provider"/>
+ </choice>
+ <attribute name="facet-id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.wst.common.project.facet.core.facets/project-facet-version/group-member/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="version" type="string">
+ <annotation>
+ <documentation>
+ Version string or empty to provide entries for any facet version
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="runtime-include-path">
+ <annotation>
+ <documentation>
+ Runtime-specific include path. If there are several contribution for the same runtime they will be combined together.
+ </documentation>
+ </annotation>
+ <complexType>
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element ref="include-path-entry"/>
+ <element ref="facet-include-path"/>
+ <element ref="include-path-provider"/>
+ </choice>
+ <attribute name="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="version" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="include-path-provider">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.symbian.tools.tmw.core.projects.IFacetIncludePathProvider"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
--- a/org.symbian.tools.mtw.core/schema/runtimes.exsd Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.mtw.core/schema/runtimes.exsd Mon Aug 09 15:18:34 2010 -0700
@@ -1,9 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
-<schema targetNamespace="org.symbian.tools.mtw.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<schema targetNamespace="org.symbian.tools.tmw.core" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
- <meta.schema plugin="org.symbian.tools.mtw.core" id="runtimes" name="Mobile Web Runtimes"/>
+ <meta.schema plugin="org.symbian.tools.tmw.core" id="runtimes" name="Mobile Web Runtimes"/>
</appinfo>
<documentation>
Mobile Web Runtimes are specific sets of JavaScript APIs, specifications and conventions that define how the application needs to be defined so it could be deployed to targets that support given runtime.
@@ -49,7 +49,20 @@
<element name="runtime">
<complexType>
- <attribute name="id" type="string" use="required">
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <element ref="runtime-component"/>
+ </sequence>
+ <attribute name="component-id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.wst.common.project.facet.core.runtimes/runtime-component-type/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="component-version" type="string" use="required">
<annotation>
<documentation>
@@ -69,6 +82,28 @@
</complexType>
</element>
+ <element name="runtime-component">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.wst.common.project.facet.core.runtimes/runtime-component-type/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="version" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
<annotation>
<appinfo>
<meta.section type="since"/>
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/mtw/core/MTWCore.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-package org.symbian.tools.mtw.core;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.BundleContext;
-import org.symbian.tools.mtw.core.internal.projects.ProjectsSupportManager;
-import org.symbian.tools.mtw.core.internal.runtimes.RuntimesManagerImpl;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.core.runtimes.IMobileWebRuntimeManager;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class MTWCore extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.symbian.tools.mtw.core"; //$NON-NLS-1$
-
- // The shared instance
- private static MTWCore plugin;
-
- private final IMobileWebRuntimeManager runtimesManager = new RuntimesManagerImpl();
- private final ProjectsSupportManager projectsSupport = new ProjectsSupportManager();
-
- /**
- * The constructor
- */
- public MTWCore() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- public IMobileWebRuntimeManager getRuntimesManager() {
- return runtimesManager;
- }
-
- public IMTWProject create(IProject project) {
- return projectsSupport.create(project);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static MTWCore getDefault() {
- return plugin;
- }
-
- public static void log(String message, Exception exception) {
- getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
- }
-
- public static void log(String message, Object... args) {
- log(String.format(message, args), (Exception) null);
- }
-}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/mtw/core/internal/projects/ProjectProvider.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +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.mtw.core.internal.projects;
-
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionConverter;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.symbian.tools.mtw.core.MTWCore;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.core.projects.IMTWProjectProvider;
-
-public class ProjectProvider implements IMTWProjectProvider {
- private final IConfigurationElement element;
- private final Expression expression;
- private IMTWProjectProvider provider;
-
- public ProjectProvider(IConfigurationElement element) throws CoreException {
- this.element = element;
- IConfigurationElement[] children = element.getChildren("enablement");
- if (children.length == 1) {
- expression = ExpressionConverter.getDefault().perform(children[0]);
- } else {
- expression = null;
- if (children.length > 1) {
- MTWCore.log(
- "Project extension in plugin %s has several <enablement> elements. All expressions will be ignored.",
- element.getNamespaceIdentifier());
- }
- }
- }
-
- public IMTWProject create(IProject project) {
- return getProvider().create(project);
- }
-
- private IMTWProjectProvider getProvider() {
- if (provider == null) {
- try {
- provider = (IMTWProjectProvider) element.createExecutableExtension("class");
- } catch (CoreException e) {
- throw new RuntimeException(e);
- }
- }
- return provider;
- }
-
- public boolean isSupportedProject(final IProject project) {
- try {
- final EvaluationResult result = expression.evaluate(new EvaluationContext(null, project));
- if (EvaluationResult.TRUE.equals(result)) {
- return getProvider().isSupportedProject(project);
- }
- } catch (CoreException e) {
- MTWCore.log(null, e);
- }
- return false;
- }
-}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/mtw/core/internal/projects/ProjectsSupportManager.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +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.mtw.core.internal.projects;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.symbian.tools.mtw.core.MTWCore;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-
-public class ProjectsSupportManager {
- private Collection<ProjectProvider> providers = null;
-
- public IMTWProject create(IProject project) {
- if (providers == null) {
- readProviders();
- }
- for (ProjectProvider provider : providers) {
- if (provider.isSupportedProject(project)) {
- return provider.create(project);
- }
- }
- return null;
- }
-
- private void readProviders() {
- providers = new LinkedList<ProjectProvider>();
- IConfigurationElement[] configurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor(
- MTWCore.PLUGIN_ID, "projectProvider");
- for (IConfigurationElement element : configurationElements) {
- if (element.getName().equals("projectProvider")) {
- try {
- providers.add(new ProjectProvider(element));
- } catch (CoreException e) {
- MTWCore.log(null, e);
- }
- }
- }
- }
-}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/mtw/core/internal/runtimes/LazyPackager.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +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.mtw.core.internal.runtimes;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.symbian.tools.mtw.core.MTWCore;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.core.runtimes.IMobileWebRuntime;
-import org.symbian.tools.mtw.core.runtimes.IPackager;
-import org.symbian.tools.mtw.core.runtimes.IPackagerDelegate;
-
-public class LazyPackager implements IPackager {
- private final IConfigurationElement element;
- private IPackagerDelegate packager;
-
- public LazyPackager(IConfigurationElement element) {
- this.element = element;
- }
-
- public File packageApplication(IMTWProject project, IProgressMonitor monitor)
- throws CoreException {
- return getPackager().packageApplication(project, monitor);
- }
-
- private IPackagerDelegate getPackager() {
- if (packager == null) {
- try {
- packager = (IPackagerDelegate) element.createExecutableExtension("delegate");
- } catch (CoreException e) {
- MTWCore.log(String.format("Cannot instantiate %s from plugin %s", element.getAttribute("delegate"),
- element.getDeclaringExtension().getNamespaceIdentifier()), e);
- throw new RuntimeException(e);
- }
- }
- return packager;
- }
-
- public IPath getPathInPackage(IResource resource) {
- return getPackager().getPathInPackage(resource);
- }
-
- public String getFileType(IMTWProject project) {
- return getPackager().getFileType(project);
- }
-
- public IMobileWebRuntime getTargetRuntime() {
- String id = element.getAttribute("targetRuntime");
- if (id != null) {
- return MTWCore.getDefault().getRuntimesManager().getRuntime(id);
- } else {
- return getSourceRuntime();
- }
- }
-
- public IMobileWebRuntime getSourceRuntime() {
- IMobileWebRuntime runtime = MTWCore.getDefault().getRuntimesManager()
- .getRuntime(element.getAttribute("sourceRuntime"));
- return runtime;
- }
-
-}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/mtw/core/internal/runtimes/MobileWebRuntime.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +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.mtw.core.internal.runtimes;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.symbian.tools.mtw.core.runtimes.IMobileWebRuntime;
-
-public final class MobileWebRuntime implements IMobileWebRuntime {
- private final IConfigurationElement element;
-
- public MobileWebRuntime(IConfigurationElement element) {
- this.element = element;
- }
-
- public String getId() {
- return element.getAttribute("id");
- }
-
- public String getName() {
- return element.getAttribute("name");
- }
-}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/mtw/core/internal/runtimes/RuntimesManagerImpl.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +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.mtw.core.internal.runtimes;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.symbian.tools.mtw.core.MTWCore;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.core.runtimes.IMobileWebRuntime;
-import org.symbian.tools.mtw.core.runtimes.IMobileWebRuntimeManager;
-import org.symbian.tools.mtw.core.runtimes.IPackager;
-
-public final class RuntimesManagerImpl implements IMobileWebRuntimeManager {
- private final Map<String, IMobileWebRuntime> runtimes = new TreeMap<String, IMobileWebRuntime>();
- private final Map<IMobileWebRuntime, Map<IMobileWebRuntime, IPackager>> packagers = new HashMap<IMobileWebRuntime, Map<IMobileWebRuntime, IPackager>>();
-
- public RuntimesManagerImpl() {
- collectRuntimes();
- collectPackagers();
- }
-
- private void collectPackagers() {
- IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(
- MTWCore.PLUGIN_ID, "packagers");
- for (IConfigurationElement element : elements) {
- final String target = element.getAttribute("targetRuntime");
- final IMobileWebRuntime targetRuntime = getRuntime(target);
- if (targetRuntime == null) {
- MTWCore.log("Runtime %s referenced from plugin %s was not found", target, element
- .getDeclaringExtension().getNamespaceIdentifier());
- break;
- }
-
- final String source = element.getAttribute("sourceRuntime");
- IMobileWebRuntime sourceRuntime;
- if (source == null) {
- sourceRuntime = targetRuntime;
- } else {
- sourceRuntime = getRuntime(source);
- if (sourceRuntime == null) {
- MTWCore.log("Runtime %s referenced from plugin %s was not found", source, element
- .getDeclaringExtension().getNamespaceIdentifier());
- break;
- }
- }
- IPackager packager = new LazyPackager(element);
- Map<IMobileWebRuntime, IPackager> map = packagers.get(targetRuntime);
- if (map == null) {
- map = new HashMap<IMobileWebRuntime, IPackager>();
- packagers.put(targetRuntime, map);
- }
- map.put(sourceRuntime, packager);
- }
- }
-
- private void collectRuntimes() {
- IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(
- MTWCore.PLUGIN_ID, "runtimes");
- for (IConfigurationElement element : elements) {
- final MobileWebRuntime runtime = new MobileWebRuntime(element);
- runtimes.put(runtime.getId(), runtime);
- }
- }
-
- public IPackager getPackager(IMTWProject project) {
- return getPackager(project, project.getTargetRuntime());
- }
-
- public IPackager getPackager(IMTWProject project, IMobileWebRuntime runtime) {
- final Map<IMobileWebRuntime, IPackager> map = packagers.get(runtime);
- if (map != null) {
- return map.get(project.getTargetRuntime());
- }
- return null;
- }
-
- public IMobileWebRuntime getRuntime(String id) {
- return runtimes.get(id);
- }
-
-}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/mtw/core/projects/IMTWProject.java Thu Jul 29 15:59:01 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.mtw.core.projects;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.symbian.tools.mtw.core.runtimes.IMobileWebRuntime;
-
-public interface IMTWProject {
- /**
- * @return primary target runtime of this project. Can never return null.
- */
- 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/mtw/core/projects/IMTWProjectProvider.java Thu Jul 29 15:59:01 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.mtw.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);
-}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/mtw/core/runtimes/IMobileWebRuntime.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +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.mtw.core.runtimes;
-
-/**
- * Represents mobile web runtimes supported by the IDE
- *
- * @author Eugene Ostroukhov (eugeneo@symbian.org)
- */
-public interface IMobileWebRuntime {
- /**
- * @return unique runtime ID
- */
- String getId();
-
- /**
- * @return user-readable runtime name
- */
- String getName();
-}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/mtw/core/runtimes/IMobileWebRuntimeManager.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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.mtw.core.runtimes;
-
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-
-/**
- * Manages mobile web runtimes.
- *
- * @author Eugene Ostroukhov (eugeneo@symbian.org)
- */
-public interface IMobileWebRuntimeManager {
- /**
- * Shorthand method to obtain packager for project default runtime.
- */
- IPackager getPackager(IMTWProject project);
-
- /**
- * Returns packager that can create a packaged application for provided
- * runtime from the given project.
- *
- * @return <code>null</null> if the project cannot be packaged for
- * specified runtime
- */
- IPackager getPackager(IMTWProject project, IMobileWebRuntime runtime);
-
- /**
- * Returns runtimes for the given ID. Runtime will not be null.
- *
- * @throws IllegalArgumentException if there is no runtime with the
- * provided ID. It is assumed that this can only be caused by a broken
- * install or coding error on IDE provider side.
- */
- IMobileWebRuntime getRuntime(String id);
-}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/mtw/core/runtimes/IPackager.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +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.mtw.core.runtimes;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-
-/**
- * Packager creates a runtime-specific application package that can be
- * deployed to compatible targets.
- *
- * @author Eugene Ostroukhov (eugeneo@symbian.org)
- */
-public interface IPackager {
- /**
- * Synchronously packages application for the specified runtime.
- *
- * @return {@link File} denoting location of the application package that can be deployed to targets
- */
- File packageApplication(IMTWProject project, IProgressMonitor monitor)
- throws CoreException;
-
- /**
- * @return application package root-relative path where the workspace resource will be packaged. Can be <code>null</code>.
- */
- IPath getPathInPackage(IResource resource);
-
- /**
- * @return file type of the application archive
- */
- String getFileType(IMTWProject project);
-
- /**
- * @return target runtime that this packager packages for
- */
- IMobileWebRuntime getTargetRuntime();
-
- /**
- * @return source runtime. It is the runtime that the project should target to be packaged with this packager.
- */
- IMobileWebRuntime getSourceRuntime();
-}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/mtw/core/runtimes/IPackagerDelegate.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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.mtw.core.runtimes;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-
-/**
- * Delegate performs application packaging.
- *
- * @author Eugene Ostroukhov (eugeneo@symbian.org)
- */
-public interface IPackagerDelegate {
- /**
- * Synchronously packages application for the specified runtime.
- *
- * @return URI of the application package that can be deployed to targets
- */
- File packageApplication(IMTWProject project, IProgressMonitor monitor) throws CoreException;
-
- /**
- * @return application package root-relative path where the workspace resource will be packaged. Can be <code>null</code>.
- */
- IPath getPathInPackage(IResource resource);
-
- /**
- * @return file type of the application archive
- */
- String getFileType(IMTWProject project);
-}
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/mtw/core/utilities/ZipApplicationVisitor.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +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.mtw.core.utilities;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.symbian.tools.mtw.core.MTWCore;
-import org.symbian.tools.mtw.core.runtimes.IPackagerDelegate;
-
-/**
- * Use this visitor to zip application if the web runtime uses zip archive as application
- * distribution format.
- *
- * @author Eugene Ostroukhov (eugeneo@symbian.org)
- */
-public class ZipApplicationVisitor implements IResourceVisitor {
- private static final int DEFAULT_BUFFER_SIZE = 65536;
- private final ZipOutputStream zipStream;
- private final IPackagerDelegate packager;
-
- public ZipApplicationVisitor(ZipOutputStream zipStream, IPackagerDelegate packager) {
- this.zipStream = zipStream;
- this.packager = packager;
- }
-
- public boolean visit(IResource resource) throws CoreException {
- IPath path = packager.getPathInPackage(resource);
- if (path != null && resource.getType() == IResource.FILE) {
- zip(path, resource);
- }
- return true;
- }
-
- private void zip(IPath path, IResource file) throws CoreException {
- ZipEntry zipEntry = new ZipEntry(path.toString());
- try {
- zipStream.putNextEntry(zipEntry);
- if (file.getType() == IResource.FILE) {
- InputStream contents = ((IFile) file).getContents();
- try {
- copy(contents, zipStream);
- } finally {
- contents.close();
- }
- }
- zipStream.closeEntry();
- } catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, MTWCore.PLUGIN_ID, String.format("Can't package %s", file
- .getFullPath().toString()), e));
- }
- }
-
- public static int copy(InputStream input, OutputStream output) throws IOException {
- long count = copyLarge(input, output);
- if (count > Integer.MAX_VALUE) {
- return -1;
- }
- return (int) count;
- }
-
- public static long copyLarge(InputStream input, OutputStream output) throws IOException {
- byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
- long count = 0;
- int n = 0;
- while (-1 != (n = input.read(buffer))) {
- output.write(buffer, 0, n);
- count += n;
- }
- return count;
- }
-
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/ITMWConstants.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,24 @@
+/**
+ * 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;
+
+public interface ITMWConstants {
+ String CORE_FACET = "tmw.core";
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/TMWCore.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,84 @@
+package org.symbian.tools.tmw.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.BundleContext;
+import org.symbian.tools.tmw.core.internal.projects.ProjectsSupportManager;
+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.IMTWProject;
+import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntimeManager;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class TMWCore extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.symbian.tools.tmw.core"; //$NON-NLS-1$
+
+ // The shared instance
+ private static TMWCore plugin;
+
+ private IMobileWebRuntimeManager runtimesManager;
+ private ProjectsSupportManager projectsSupport;
+ private RuntimeClasspathManager classpathManager;
+
+ /**
+ * The constructor
+ */
+ public TMWCore() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ runtimesManager = new RuntimesManagerImpl();
+ projectsSupport = new ProjectsSupportManager();
+ classpathManager = new RuntimeClasspathManager();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ public IMobileWebRuntimeManager getRuntimesManager() {
+ return runtimesManager;
+ }
+
+ public RuntimeClasspathManager getClasspathManager() {
+ return classpathManager;
+ }
+
+ public IMTWProject create(IProject project) {
+ return projectsSupport.create(project);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static TMWCore getDefault() {
+ return plugin;
+ }
+
+ public static void log(String message, Exception exception) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
+ }
+
+ public static void log(String message, Object... args) {
+ log(String.format(message, args), (Exception) null);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/facets/InstallFacetAction.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,55 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.internal.facets;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.jsdt.core.IIncludePathEntry;
+import org.eclipse.wst.jsdt.core.IJavaScriptProject;
+import org.eclipse.wst.jsdt.core.JavaScriptCore;
+
+public class InstallFacetAction implements IDelegate {
+
+ public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor)
+ throws CoreException {
+ final IJavaScriptProject jsProject = JavaScriptCore.create(project);
+ final IIncludePathEntry[] rawIncludepath = jsProject.getRawIncludepath();
+ final Path path = new Path("tmw.coreLibrary");
+ final int originalEntryCount = rawIncludepath.length;
+
+ IIncludePathEntry[] newIncludepath = new IIncludePathEntry[originalEntryCount + 1];
+ System.arraycopy(rawIncludepath, 0, newIncludepath, 0, originalEntryCount);
+ for (IIncludePathEntry entry : rawIncludepath) {
+ if (entry.getPath().equals(path)) {
+ newIncludepath = null;
+ break;
+ }
+ }
+ if (newIncludepath != null) {
+ final IIncludePathEntry newContainerEntry = JavaScriptCore.newContainerEntry(path, false);
+ newIncludepath[originalEntryCount] = newContainerEntry;
+ jsProject.setRawIncludepath(newIncludepath, monitor);
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/facets/UninstallFacetAction.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,35 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.internal.facets;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+public class UninstallFacetAction implements IDelegate {
+
+ public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor)
+ throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/LazyIncludePathProvider.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,48 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.internal.projects;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+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;
+
+public class LazyIncludePathProvider implements IFacetIncludePathProvider {
+ private final IConfigurationElement element;
+ private LazyIncludePathProvider provider;
+
+ public LazyIncludePathProvider(IConfigurationElement element) {
+ this.element = element;
+ }
+
+ public IIncludePathEntry[] getEntries(IMTWProject project) {
+ if (provider == null) {
+ try {
+ provider = (LazyIncludePathProvider) element.createExecutableExtension("class");
+ } catch (CoreException e) {
+ TMWCore.log(null, e);
+ return new IIncludePathEntry[0];
+ }
+ }
+ return provider.getEntries(project);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/MTWFacetedProjectProvider.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.internal.projects;
+
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+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;
+
+public class MTWFacetedProjectProvider implements IMTWProjectProvider {
+ private final Map<IProject, IMTWProject> projects = new WeakHashMap<IProject, IMTWProject>();
+
+ public IMTWProject create(IProject project) {
+ if (!projects.containsKey(project)) {
+ projects.put(project, new TMWFacetedProject(project));
+ }
+ return projects.get(project);
+ }
+
+ public boolean isSupportedProject(IProject project) {
+ try {
+ return FacetedProjectFramework.hasProjectFacet(project, ITMWConstants.CORE_FACET);
+ } catch (CoreException e) {
+ TMWCore.log(null, e);
+ return false;
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/ProjectProvider.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,78 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.internal.projects;
+
+import org.eclipse.core.expressions.EvaluationContext;
+import org.eclipse.core.expressions.EvaluationResult;
+import org.eclipse.core.expressions.Expression;
+import org.eclipse.core.expressions.ExpressionConverter;
+import org.eclipse.core.resources.IProject;
+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;
+
+public class ProjectProvider implements IMTWProjectProvider {
+ private final IConfigurationElement element;
+ private final Expression expression;
+ private IMTWProjectProvider provider;
+
+ public ProjectProvider(IConfigurationElement element) throws CoreException {
+ this.element = element;
+ IConfigurationElement[] children = element.getChildren("enablement");
+ if (children.length == 1) {
+ expression = ExpressionConverter.getDefault().perform(children[0]);
+ } else {
+ expression = null;
+ if (children.length > 1) {
+ TMWCore.log(
+ "Project extension in plugin %s has several <enablement> elements. All expressions will be ignored.",
+ element.getNamespaceIdentifier());
+ }
+ }
+ }
+
+ public IMTWProject create(IProject project) {
+ return getProvider().create(project);
+ }
+
+ private IMTWProjectProvider getProvider() {
+ if (provider == null) {
+ try {
+ provider = (IMTWProjectProvider) element.createExecutableExtension("class");
+ } catch (CoreException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return provider;
+ }
+
+ public boolean isSupportedProject(final IProject project) {
+ try {
+ final EvaluationResult result = expression.evaluate(new EvaluationContext(null, project));
+ if (!EvaluationResult.FALSE.equals(result)) {
+ return getProvider().isSupportedProject(project);
+ }
+ } catch (CoreException e) {
+ TMWCore.log(null, e);
+ }
+ return false;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/ProjectsSupportManager.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.internal.projects;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+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;
+
+public class ProjectsSupportManager {
+ private Collection<ProjectProvider> providers = null;
+
+ public IMTWProject create(IProject project) {
+ if (providers == null) {
+ readProviders();
+ }
+ for (ProjectProvider provider : providers) {
+ if (provider.isSupportedProject(project)) {
+ return provider.create(project);
+ }
+ }
+ return null;
+ }
+
+ private void readProviders() {
+ providers = new LinkedList<ProjectProvider>();
+ IConfigurationElement[] configurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor(
+ TMWCore.PLUGIN_ID, "projectProvider");
+ for (IConfigurationElement element : configurationElements) {
+ if (element.getName().equals("projectProvider")) {
+ try {
+ providers.add(new ProjectProvider(element));
+ } catch (CoreException e) {
+ TMWCore.log(null, e);
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/StaticIncludePathProvider.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.internal.projects;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.jsdt.core.IIncludePathEntry;
+import org.eclipse.wst.jsdt.core.JavaScriptCore;
+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;
+
+public class StaticIncludePathProvider implements IFacetIncludePathProvider {
+ private final IConfigurationElement element;
+ private IIncludePathEntry[] entries;
+
+ public StaticIncludePathProvider(IConfigurationElement element) {
+ this.element = element;
+ }
+
+ public IIncludePathEntry[] getEntries(IMTWProject project) {
+ if (entries == null) {
+ final String name = element.getContributor().getName();
+ final String path = element.getAttribute("file");
+ final Bundle bundle = Platform.getBundle(name);
+ final URL url = FileLocator.find(bundle, new Path(path), null);
+ try {
+ final URL fileURL = FileLocator.toFileURL(url);
+ final File file = new File(fileURL.toURI());
+ final IIncludePathEntry entry = JavaScriptCore.newLibraryEntry(new Path(file.getAbsolutePath()), null,
+ null);
+ entries = new IIncludePathEntry[] { entry };
+ } catch (IOException e) {
+ TMWCore.log(String.format("Can't find file %s in plugin %s", path, name), e);
+ } catch (URISyntaxException e) {
+ TMWCore.log(String.format("Can't find file %s in plugin %s", path, name), e);
+ }
+ }
+ return entries;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/TMWFacetedProject.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,91 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.internal.projects;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+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.runtimes.IMobileWebRuntime;
+
+public class TMWFacetedProject implements IMTWProject {
+ private final IProject project;
+
+ public TMWFacetedProject(IProject project) {
+ this.project = project;
+ }
+
+ public String getName() {
+ return project.getName();
+ }
+
+ public IProject getProject() {
+ return project;
+ }
+
+ public IMobileWebRuntime getTargetRuntime() {
+ try {
+ final IFacetedProject fproj = ProjectFacetsManager.create(project);
+ final IRuntime runtime = fproj.getPrimaryRuntime();
+ if (runtime != null) {
+ final List<IRuntimeComponent> components = runtime.getRuntimeComponents();
+ if (!components.isEmpty()) {
+ final IRuntimeComponentVersion version = components.get(0).getRuntimeComponentVersion();
+ return TMWCore.getDefault().getRuntimesManager()
+ .getRuntime(version.getRuntimeComponentType().getId(), version.getVersionString());
+ }
+ }
+ } catch (CoreException e) {
+ TMWCore.log(null, e);
+ }
+ return null;
+ }
+
+ public boolean validate(IProgressMonitor monitor) {
+ try {
+ project.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
+ IMarker[] markers = project.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
+
+ boolean hasErrors = false;
+ for (IMarker marker : markers) {
+ if (marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO) == IMarker.SEVERITY_ERROR) {
+ hasErrors = true;
+ break;
+ }
+ }
+ return !hasErrors;
+ } catch (CoreException e1) {
+ // Proofing from coding exceptions in JSDT
+ TMWCore.log(null, e1);
+ }
+ return false;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/TMWPropertyTester.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.internal.projects;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.resources.IResource;
+import org.symbian.tools.tmw.core.TMWCore;
+
+public class TMWPropertyTester extends PropertyTester {
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if ("istmwproject".equals(property)) {
+ return isTMWProject(receiver);
+ }
+ return false;
+ }
+
+ private boolean isTMWProject(Object receiver) {
+ if (receiver instanceof IResource) {
+ return TMWCore.getDefault().create(((IResource) receiver).getProject()) != null;
+ }
+ return false;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/runtimes/LazyPackager.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.internal.runtimes;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+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.runtimes.IMobileWebRuntime;
+import org.symbian.tools.tmw.core.runtimes.IPackager;
+import org.symbian.tools.tmw.core.runtimes.IPackagerDelegate;
+
+public class LazyPackager implements IPackager {
+ private final IConfigurationElement element;
+ private IPackagerDelegate packager;
+
+ public LazyPackager(IConfigurationElement element) {
+ this.element = element;
+ }
+
+ public File packageApplication(IMTWProject project, IProgressMonitor monitor) throws CoreException {
+ return getPackager().packageApplication(project, monitor);
+ }
+
+ private IPackagerDelegate getPackager() {
+ if (packager == null) {
+ try {
+ packager = (IPackagerDelegate) element.createExecutableExtension("delegate");
+ } catch (CoreException e) {
+ TMWCore.log(String.format("Cannot instantiate %s from plugin %s", element.getAttribute("delegate"),
+ element.getDeclaringExtension().getNamespaceIdentifier()), e);
+ throw new RuntimeException(e);
+ }
+ }
+ return packager;
+ }
+
+ public IPath getPathInPackage(IResource resource) {
+ return getPackager().getPathInPackage(resource);
+ }
+
+ public String getFileType(IMTWProject project) {
+ return getPackager().getFileType(project);
+ }
+
+ public IMobileWebRuntime getTargetRuntime() {
+ String id = element.getAttribute("target-runtime");
+ if (id != null) {
+ return TMWCore.getDefault().getRuntimesManager()
+ .getRuntime(id, element.getAttribute("target-runtime-version"));
+ } else {
+ return getSourceRuntime();
+ }
+ }
+
+ public IMobileWebRuntime getSourceRuntime() {
+ IMobileWebRuntime runtime = TMWCore.getDefault().getRuntimesManager()
+ .getRuntime(element.getAttribute("source-runtime"), element.getAttribute("source-runtime-version"));
+ return runtime;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileRuntimeLibraryContainer.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,81 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.internal.runtimes;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.jsdt.core.IIncludePathEntry;
+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.runtimes.IMobileWebRuntime;
+
+public class MobileRuntimeLibraryContainer implements IJsGlobalScopeContainer {
+ private final IPath containerPath;
+ private final IJavaScriptProject project;
+
+ public MobileRuntimeLibraryContainer(IJavaScriptProject project, IPath containerPath) {
+ this.project = project;
+ this.containerPath = containerPath;
+ }
+
+ public IIncludePathEntry[] getIncludepathEntries() {
+ final IMTWProject proj = TMWCore.getDefault().create(project.getProject());
+ if (proj != null) {
+ try {
+ IFacetedProject facetedProject = ProjectFacetsManager.create(project.getProject(), false,
+ new NullProgressMonitor());
+ if (facetedProject != null) {
+ return TMWCore.getDefault().getClasspathManager().getProjectClasspathEntries(facetedProject);
+ }
+ } catch (CoreException e) {
+ TMWCore.log(null, e);
+ }
+ }
+ return new IIncludePathEntry[0];
+ }
+
+ public String getDescription() {
+ final IMTWProject proj = TMWCore.getDefault().create(project.getProject());
+ if (proj != null) {
+ final IMobileWebRuntime targetRuntime = proj.getTargetRuntime();
+ if (targetRuntime != null) {
+ return String.format("%s API", targetRuntime.getName());
+ }
+ }
+ return "Mobile Web Runtime Library";
+ }
+
+ public int getKind() {
+ return K_SYSTEM;
+ }
+
+ public IPath getPath() {
+ return containerPath;
+ }
+
+ public String[] resolvedLibraryImport(String realImport) {
+ return new String[] { realImport };
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileRuntimeLibraryContainerInitializer.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,116 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.internal.runtimes;
+
+import java.net.URI;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.wst.jsdt.core.IIncludePathEntry;
+import org.eclipse.wst.jsdt.core.IJavaScriptProject;
+import org.eclipse.wst.jsdt.core.IJsGlobalScopeContainer;
+import org.eclipse.wst.jsdt.core.IJsGlobalScopeContainerInitializer;
+import org.eclipse.wst.jsdt.core.JavaScriptCore;
+import org.eclipse.wst.jsdt.core.JsGlobalScopeContainerInitializer;
+import org.eclipse.wst.jsdt.core.compiler.libraries.LibraryLocation;
+import org.symbian.tools.tmw.core.TMWCore;
+
+public class MobileRuntimeLibraryContainerInitializer extends JsGlobalScopeContainerInitializer implements
+ IJsGlobalScopeContainerInitializer {
+
+ public boolean allowAttachJsDoc() {
+ return false;
+ }
+
+ public boolean canUpdateJsGlobalScopeContainer(IPath containerPath, IJavaScriptProject project) {
+ return true;
+ }
+
+ public String[] containerSuperTypes() {
+ return new String[0];
+ }
+
+ public Object getComparisonID(IPath containerPath, IJavaScriptProject project) {
+ return containerPath.append(project.getElementName());
+ }
+
+ @Override
+ public String getDescription() {
+ return "Project library with mobile web runtime APIs";
+ }
+
+ public String getDescription(IPath containerPath, IJavaScriptProject project) {
+ return getDescription();
+ }
+
+ public IJsGlobalScopeContainer getFailureContainer(final IPath containerPath, IJavaScriptProject project) {
+ return new IJsGlobalScopeContainer() {
+
+ public String getDescription() {
+ final String description = MobileRuntimeLibraryContainerInitializer.this.getDescription();
+ return description;
+ }
+
+ public IIncludePathEntry[] getIncludepathEntries() {
+ return new IIncludePathEntry[0];
+ }
+
+ public int getKind() {
+ return K_APPLICATION;
+ }
+
+ public IPath getPath() {
+ return containerPath;
+ }
+
+ public String[] resolvedLibraryImport(String a) {
+ return new String[0];
+ }
+ };
+ }
+
+ public URI getHostPath(IPath path, IJavaScriptProject project) {
+ return null;
+ }
+
+ public String getInferenceID() {
+ return null;
+ }
+
+ public LibraryLocation getLibraryLocation() {
+ return null;
+ }
+
+ public void initialize(IPath containerPath, IJavaScriptProject project) throws CoreException {
+ if (!project.isOpen() || TMWCore.getDefault().create(project.getProject()) != null) {
+ JavaScriptCore.setJsGlobalScopeContainer(containerPath, new IJavaScriptProject[] { project },
+ new IJsGlobalScopeContainer[] { new MobileRuntimeLibraryContainer(project, containerPath) }, null);
+ }
+ }
+
+ public void removeFromProject(IJavaScriptProject project) {
+ // Do nothing
+ }
+
+ public void requestJsGlobalScopeContainerUpdate(IPath containerPath, IJavaScriptProject project,
+ IJsGlobalScopeContainer containerSuggestion) throws CoreException {
+ // TODO
+ System.out.println("abc");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileRuntimeStub.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,70 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.internal.runtimes;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeBridge;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponentType;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponentVersion;
+import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
+import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
+
+/**
+ * Integrates mobile web runtime with the faceted project runtime framework.
+ *
+ * @author Eugene Ostroukhov (eugeneo@symbian.org)
+ */
+@SuppressWarnings("unchecked")
+public class MobileRuntimeStub implements IRuntimeBridge.IStub {
+ private final IMobileWebRuntime runtime;
+ private final Map<String, String> properties = new TreeMap<String, String>();
+
+ public MobileRuntimeStub(IMobileWebRuntime runtime) {
+ this.runtime = runtime;
+ properties.put("localized-name", runtime.getName());
+ }
+
+ private IRuntimeComponent getComponent(String string, String version) {
+ final IRuntimeComponentType componentType = RuntimeManager.getRuntimeComponentType(string);
+ final IRuntimeComponentVersion v = componentType.getVersion(version);
+ return RuntimeManager.createRuntimeComponent(v, Collections.EMPTY_MAP);
+ }
+
+ public List<IRuntimeComponent> getRuntimeComponents() {
+ final List<IRuntimeComponent> components = new LinkedList<IRuntimeComponent>();
+ components.add(getComponent(runtime.getId(), runtime.getVersion()));
+ components.add(getComponent("tmw.core", "1.0"));
+ for (IConfigurationElement element : ((MobileWebRuntime) runtime).getComponentElements()) {
+ components.add(getComponent(element.getAttribute("id"), element.getAttribute("version")));
+ }
+ return components;
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileRuntimesBridge.java Mon Aug 09 15:18:34 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.tmw.core.internal.runtimes;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeBridge;
+import org.symbian.tools.tmw.core.TMWCore;
+import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
+
+public class MobileRuntimesBridge implements IRuntimeBridge {
+ private final Map<String, MobileRuntimeStub> stubs = new TreeMap<String, MobileRuntimeStub>();
+
+ public Set<String> getExportedRuntimeNames() throws CoreException {
+ final IMobileWebRuntime[] allRuntimes = TMWCore.getDefault().getRuntimesManager().getAllRuntimes();
+ final Set<String> ids = new TreeSet<String>();
+ for (IMobileWebRuntime runtime : allRuntimes) {
+ ids.add(runtime.getId() + ":" + runtime.getVersion());
+ }
+ return ids;
+ }
+
+ public IStub bridge(String name) throws CoreException {
+ if (!stubs.containsKey(name)) {
+ final int ind = name.indexOf(":");
+ if (ind > 0) {
+ stubs.put(
+ name,
+ new MobileRuntimeStub(TMWCore.getDefault().getRuntimesManager()
+ .getRuntime(name.substring(0, ind), name.substring(ind + 1))));
+ }
+ }
+ return stubs.get(name);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileWebRuntime.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.internal.runtimes;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
+
+public final class MobileWebRuntime implements IMobileWebRuntime {
+ private final IConfigurationElement element;
+
+ public MobileWebRuntime(IConfigurationElement element) {
+ this.element = element;
+ }
+
+ public String getId() {
+ return element.getAttribute("component-id");
+ }
+
+ public String getVersion() {
+ return element.getAttribute("component-version");
+ }
+
+ public String getName() {
+ return element.getAttribute("name");
+ }
+
+ public IConfigurationElement[] getComponentElements() {
+ return element.getChildren("runtime-component");
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/runtimes/RuntimeClasspathManager.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,237 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.internal.runtimes;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.IVersion;
+import org.eclipse.wst.common.project.facet.core.IVersionExpr;
+import org.eclipse.wst.common.project.facet.core.util.internal.VersionExpr;
+import org.eclipse.wst.common.project.facet.core.util.internal.Versionable;
+import org.eclipse.wst.jsdt.core.IIncludePathEntry;
+import org.symbian.tools.tmw.core.TMWCore;
+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.runtimes.IMobileWebRuntime;
+
+@SuppressWarnings("restriction")
+public class RuntimeClasspathManager {
+ private static final class VersionedEntry<T> {
+ protected final IVersionExpr versionExpression;
+ protected final T entry;
+
+ public VersionedEntry(String versionExpression, T entry) {
+ if (versionExpression == null) {
+ this.versionExpression = null;
+ } else {
+ IVersionExpr expr;
+ try {
+ expr = new VersionExpr<Version>(new VersionableObject(), versionExpression, null);
+ } catch (CoreException e) {
+ expr = null;
+ TMWCore.log(null, e);
+ }
+ this.versionExpression = expr;
+ }
+ this.entry = entry;
+ }
+
+ public boolean matches(String version) {
+ if (versionExpression == null) { // Any version
+ return true;
+ }
+ if (version == null) { // Unspecified
+ return false;
+ }
+ return versionExpression.check(new Version(version));
+ }
+ }
+
+ private static final class VersionableObject extends Versionable<Version> {
+ @Override
+ public String getPluginId() {
+ return TMWCore.PLUGIN_ID;
+ }
+
+ @Override
+ public String createVersionNotFoundErrMsg(String verstr) {
+ return "Version not found";
+ }
+ }
+
+ private static final class Version implements IVersion {
+ private final String version;
+
+ public Version(String version) {
+ this.version = version;
+ }
+
+ public int compareTo(Object o) {
+ return version.compareTo(((IVersion) o).getVersionString());
+ }
+
+ public String getVersionString() {
+ return version;
+ }
+ }
+
+ private final Map<String, Collection<VersionedEntry<Map<String, Collection<VersionedEntry<IFacetIncludePathProvider[]>>>>>> providers = new HashMap<String, Collection<VersionedEntry<Map<String, Collection<VersionedEntry<IFacetIncludePathProvider[]>>>>>>();
+ private final boolean ready = false;
+
+ public IIncludePathEntry[] getProjectClasspathEntries(IFacetedProject project) {
+ collectProviders();
+ final IMTWProject p = TMWCore.getDefault().create(project.getProject());
+ if (p != null) {
+ final IMobileWebRuntime runtime = p.getTargetRuntime();
+ final Map<String, Collection<VersionedEntry<IFacetIncludePathProvider[]>>> facetToEntry;
+ if (runtime != null) {
+ facetToEntry = join(getMatchingEntries(runtime.getId(), runtime.getVersion(), providers));
+ } else {
+ facetToEntry = join(getMatchingEntries(null, null, providers));
+ }
+ final Collection<IFacetIncludePathProvider[]> entries = getMatchingEntries(null, null, facetToEntry);
+ final Set<IProjectFacetVersion> facets = project.getProjectFacets();
+ for (IProjectFacetVersion facet : facets) {
+ entries.addAll(getMatchingEntries(facet.getProjectFacet().getId(), facet.getVersionString(),
+ facetToEntry));
+ }
+ final Collection<IIncludePathEntry> pathEntries = new HashSet<IIncludePathEntry>();
+ for (IFacetIncludePathProvider[] providers : entries) {
+ for (IFacetIncludePathProvider provider : providers) {
+ pathEntries.addAll(Arrays.asList(provider.getEntries(p)));
+ }
+ }
+ return pathEntries.toArray(new IIncludePathEntry[pathEntries.size()]);
+ }
+ return new IIncludePathEntry[0];
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private synchronized void collectProviders() {
+ if (!ready) {
+ final IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(
+ TMWCore.PLUGIN_ID, "runtimeIncludePath");
+ final Map<String, Collection<VersionedEntry<IFacetIncludePathProvider[]>>> entries = collectFaceletEntries(elements);
+ final VersionedEntry<Map<String, Collection<VersionedEntry<IFacetIncludePathProvider[]>>>> entry = new VersionedEntry(
+ null, entries);
+ providers.put(null, Collections.singleton(entry));
+ for (IConfigurationElement element : elements) {
+ if ("runtime-include-path".equals(element.getName())) {
+ final String id = element.getAttribute("id");
+ Collection<VersionedEntry<Map<String, Collection<VersionedEntry<IFacetIncludePathProvider[]>>>>> versions = providers
+ .get(id);
+ if (versions == null) {
+ versions = new LinkedList<RuntimeClasspathManager.VersionedEntry<Map<String, Collection<VersionedEntry<IFacetIncludePathProvider[]>>>>>();
+ providers.put(id, versions);
+ }
+ final Map<String, Collection<VersionedEntry<IFacetIncludePathProvider[]>>> facetProviders = new HashMap<String, Collection<VersionedEntry<IFacetIncludePathProvider[]>>>();
+ final IFacetIncludePathProvider[] collection = collectProviders(element.getChildren());
+ final VersionedEntry<IFacetIncludePathProvider[]> ent = new VersionedEntry(null, collection);
+ facetProviders.put(null, Collections.singleton(ent));
+ facetProviders.putAll(collectFaceletEntries(element.getChildren()));
+ final VersionedEntry<Map<String, Collection<VersionedEntry<IFacetIncludePathProvider[]>>>> ver = new VersionedEntry<Map<String, Collection<VersionedEntry<IFacetIncludePathProvider[]>>>>(
+ element.getAttribute("version"), facetProviders);
+ versions.add(ver);
+ }
+ }
+ }
+ }
+
+ private IFacetIncludePathProvider[] collectProviders(IConfigurationElement[] children) {
+ final Collection<IFacetIncludePathProvider> providers = new LinkedList<IFacetIncludePathProvider>();
+ for (IConfigurationElement element : children) {
+ if ("include-path-entry".equals(element.getName())) {
+ providers.add(new StaticIncludePathProvider(element));
+ } else if ("include-path-provider".equals(element.getName())) {
+ providers.add(new LazyIncludePathProvider(element));
+ }
+ }
+ return providers.toArray(new IFacetIncludePathProvider[providers.size()]);
+ }
+
+ public Map<String, Collection<VersionedEntry<IFacetIncludePathProvider[]>>> collectFaceletEntries(
+ IConfigurationElement[] elements) {
+ final Map<String, Collection<VersionedEntry<IFacetIncludePathProvider[]>>> faceletsToProviders = new HashMap<String, Collection<VersionedEntry<IFacetIncludePathProvider[]>>>();
+ for (IConfigurationElement element : elements) {
+ if ("facet-include-path".equals(element.getName())) {
+ final IFacetIncludePathProvider[] providers = collectProviders(element.getChildren());
+ final VersionedEntry<IFacetIncludePathProvider[]> versionedEntry = new VersionedEntry<IFacetIncludePathProvider[]>(
+ element.getAttribute("version"), providers);
+ final String id = element.getAttribute("facelet-id");
+ Collection<VersionedEntry<IFacetIncludePathProvider[]>> provs = faceletsToProviders.get(id);
+ if (provs == null) {
+ provs = new LinkedList<RuntimeClasspathManager.VersionedEntry<IFacetIncludePathProvider[]>>();
+ faceletsToProviders.put(id, provs);
+ }
+ provs.add(versionedEntry);
+ }
+ }
+ return faceletsToProviders;
+ }
+
+ private <T, V> Map<T, Collection<V>> join(Collection<Map<T, Collection<V>>> maps) {
+ final Map<T, Collection<V>> res = new HashMap<T, Collection<V>>();
+ for (Map<T, Collection<V>> map : maps) {
+ for (Map.Entry<T, Collection<V>> entry : map.entrySet()) {
+ if (res.containsKey(entry.getKey())) {
+ res.get(entry.getKey()).addAll(entry.getValue());
+ } else {
+ res.put(entry.getKey(), new LinkedList<V>(entry.getValue()));
+ }
+ }
+ }
+ return res;
+ }
+
+ private <T> Collection<T> getMatchingEntries(String id, String version,
+ Map<String, Collection<VersionedEntry<T>>> map) {
+ final Collection<VersionedEntry<T>> entries = new LinkedList<VersionedEntry<T>>();
+ Collection<VersionedEntry<T>> versionedEntries = map.get(null);
+ if (versionedEntries != null) {
+ entries.addAll(versionedEntries);
+ }
+ if (id != null) {
+ versionedEntries = map.get(id);
+ if (versionedEntries != null) {
+ entries.addAll(versionedEntries);
+ }
+ }
+ final Collection<T> res = new LinkedList<T>();
+ for (VersionedEntry<T> versionedEntry : entries) {
+ if (versionedEntry.matches(version)) {
+ res.add(versionedEntry.entry);
+ }
+ }
+ return res;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/runtimes/RuntimesManagerImpl.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,105 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.internal.runtimes;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.symbian.tools.tmw.core.TMWCore;
+import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
+import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntimeManager;
+import org.symbian.tools.tmw.core.runtimes.IPackager;
+
+public final class RuntimesManagerImpl implements IMobileWebRuntimeManager {
+ private Map<IMobileWebRuntime, Map<IMobileWebRuntime, IPackager>> packagers;
+ private Map<String, IMobileWebRuntime> runtimes;
+
+ public RuntimesManagerImpl() {
+ collectRuntimes();
+ }
+
+ private void collectPackagers() {
+ packagers = new HashMap<IMobileWebRuntime, Map<IMobileWebRuntime, IPackager>>();
+ IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(
+ TMWCore.PLUGIN_ID, "packagers");
+ for (IConfigurationElement element : elements) {
+ IPackager packager = new LazyPackager(element);
+ Map<IMobileWebRuntime, IPackager> map = packagers.get(packager.getTargetRuntime());
+ if (map == null) {
+ map = new HashMap<IMobileWebRuntime, IPackager>();
+ packagers.put(packager.getTargetRuntime(), map);
+ }
+ map.put(packager.getSourceRuntime(), packager);
+ }
+ }
+
+ private void collectRuntimes() {
+ runtimes = new TreeMap<String, IMobileWebRuntime>();
+ IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(
+ TMWCore.PLUGIN_ID, "runtimes");
+ for (IConfigurationElement element : elements) {
+ final MobileWebRuntime runtime = new MobileWebRuntime(element);
+ runtimes.put(getInternalId(runtime.getId(), runtime.getVersion()), runtime);
+ }
+ }
+
+ public IMobileWebRuntime[] getAllRuntimes() {
+ if (runtimes == null) {
+ collectRuntimes();
+ }
+ final Collection<IMobileWebRuntime> rts = runtimes.values();
+ return rts.toArray(new IMobileWebRuntime[rts.size()]);
+ }
+
+ public IPackager getPackager(IMTWProject project) {
+ return getPackager(project, project.getTargetRuntime());
+ }
+
+ public IPackager getPackager(IMTWProject project, IMobileWebRuntime runtime) {
+ if (packagers == null) {
+ collectPackagers();
+ }
+ final Map<IMobileWebRuntime, IPackager> map = packagers.get(runtime);
+ if (map != null) {
+ return map.get(project.getTargetRuntime());
+ }
+ return null;
+ }
+
+ public IMobileWebRuntime getRuntime(String id, String version) {
+ if (runtimes == null) {
+ collectRuntimes();
+ }
+ final IMobileWebRuntime runtime = runtimes.get(getInternalId(id, version));
+ if (runtime == null) {
+ TMWCore.log(String.format("Runtime %s@%s", id, version), new Exception());
+ }
+ return runtime;
+ }
+
+ private String getInternalId(String id, String version) {
+ return id + ":" + version;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/projects/IFacetIncludePathProvider.java Mon Aug 09 15:18:34 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.core.projects;
+
+import org.eclipse.wst.jsdt.core.IIncludePathEntry;
+
+public interface IFacetIncludePathProvider {
+ IIncludePathEntry[] getEntries(IMTWProject project);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/projects/IMTWProject.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,47 @@
+/**
+ * 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. Can never return null.
+ */
+ 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);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/projects/IMTWProjectProvider.java Mon Aug 09 15:18:34 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 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/runtimes/IMobileWebRuntime.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.runtimes;
+
+/**
+ * Represents mobile web runtimes supported by the IDE
+ *
+ * @author Eugene Ostroukhov (eugeneo@symbian.org)
+ */
+public interface IMobileWebRuntime {
+ /**
+ * @return unique runtime ID
+ */
+ String getId();
+
+ /**
+ * @return version of the primary runtime component
+ */
+ String getVersion();
+
+ /**
+ * @return user-readable runtime name
+ */
+ String getName();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/runtimes/IMobileWebRuntimeManager.java Mon Aug 09 15:18:34 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.tmw.core.runtimes;
+
+import org.symbian.tools.tmw.core.projects.IMTWProject;
+
+/**
+ * Manages mobile web runtimes.
+ *
+ * @author Eugene Ostroukhov (eugeneo@symbian.org)
+ */
+public interface IMobileWebRuntimeManager {
+ /**
+ * Shorthand method to obtain packager for project default runtime.
+ */
+ IPackager getPackager(IMTWProject project);
+
+ /**
+ * Returns packager that can create a packaged application for provided
+ * runtime from the given project.
+ *
+ * @return <code>null</null> if the project cannot be packaged for
+ * specified runtime
+ */
+ IPackager getPackager(IMTWProject project, IMobileWebRuntime runtime);
+
+ /**
+ * Returns runtimes for the given ID. Runtime will not be null.
+ *
+ * @throws IllegalArgumentException if there is no runtime with the
+ * provided ID. It is assumed that this can only be caused by a broken
+ * install or coding error on IDE provider side.
+ */
+ IMobileWebRuntime getRuntime(String id, String version);
+
+ /**
+ * @return list of all runtimes known to an IDE
+ */
+ IMobileWebRuntime[] getAllRuntimes();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/runtimes/IPackager.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,63 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.runtimes;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IResource;
+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;
+
+/**
+ * Packager creates a runtime-specific application package that can be
+ * deployed to compatible targets.
+ *
+ * @author Eugene Ostroukhov (eugeneo@symbian.org)
+ */
+public interface IPackager {
+ /**
+ * Synchronously packages application for the specified runtime.
+ *
+ * @return {@link File} denoting location of the application package that can be deployed to targets
+ */
+ File packageApplication(IMTWProject project, IProgressMonitor monitor)
+ throws CoreException;
+
+ /**
+ * @return application package root-relative path where the workspace resource will be packaged. Can be <code>null</code>.
+ */
+ IPath getPathInPackage(IResource resource);
+
+ /**
+ * @return file type of the application archive
+ */
+ String getFileType(IMTWProject project);
+
+ /**
+ * @return target runtime that this packager packages for
+ */
+ IMobileWebRuntime getTargetRuntime();
+
+ /**
+ * @return source runtime. It is the runtime that the project should target to be packaged with this packager.
+ */
+ IMobileWebRuntime getSourceRuntime();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/runtimes/IPackagerDelegate.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.runtimes;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IResource;
+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;
+
+/**
+ * Delegate performs application packaging.
+ *
+ * @author Eugene Ostroukhov (eugeneo@symbian.org)
+ */
+public interface IPackagerDelegate {
+ /**
+ * Synchronously packages application for the specified runtime.
+ *
+ * @return URI of the application package that can be deployed to targets
+ */
+ File packageApplication(IMTWProject project, IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * @return application package root-relative path where the workspace resource will be packaged. Can be <code>null</code>.
+ */
+ IPath getPathInPackage(IResource resource);
+
+ /**
+ * @return file type of the application archive
+ */
+ String getFileType(IMTWProject project);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/utilities/ZipApplicationVisitor.java Mon Aug 09 15:18:34 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.core.utilities;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.symbian.tools.tmw.core.TMWCore;
+import org.symbian.tools.tmw.core.runtimes.IPackagerDelegate;
+
+/**
+ * Use this visitor to zip application if the web runtime uses zip archive as application
+ * distribution format.
+ *
+ * @author Eugene Ostroukhov (eugeneo@symbian.org)
+ */
+public class ZipApplicationVisitor implements IResourceVisitor {
+ private static final int DEFAULT_BUFFER_SIZE = 65536;
+ private final ZipOutputStream zipStream;
+ private final IPackagerDelegate packager;
+
+ public ZipApplicationVisitor(ZipOutputStream zipStream, IPackagerDelegate packager) {
+ this.zipStream = zipStream;
+ this.packager = packager;
+ }
+
+ public boolean visit(IResource resource) throws CoreException {
+ IPath path = packager.getPathInPackage(resource);
+ if (path != null && resource.getType() == IResource.FILE) {
+ zip(path, resource);
+ }
+ return true;
+ }
+
+ private void zip(IPath path, IResource file) throws CoreException {
+ ZipEntry zipEntry = new ZipEntry(path.toString());
+ try {
+ zipStream.putNextEntry(zipEntry);
+ if (file.getType() == IResource.FILE) {
+ InputStream contents = ((IFile) file).getContents();
+ try {
+ copy(contents, zipStream);
+ } finally {
+ contents.close();
+ }
+ }
+ zipStream.closeEntry();
+ } catch (IOException e) {
+ throw new CoreException(new Status(IStatus.ERROR, TMWCore.PLUGIN_ID, String.format("Can't package %s", file
+ .getFullPath().toString()), e));
+ }
+ }
+
+ public static int copy(InputStream input, OutputStream output) throws IOException {
+ long count = copyLarge(input, output);
+ if (count > Integer.MAX_VALUE) {
+ return -1;
+ }
+ return (int) count;
+ }
+
+ public static long copyLarge(InputStream input, OutputStream output) throws IOException {
+ byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
+ long count = 0;
+ int n = 0;
+ while (-1 != (n = input.read(buffer))) {
+ output.write(buffer, 0, n);
+ count += n;
+ }
+ return count;
+ }
+
+}
--- a/org.symbian.tools.mtw.ui/.project Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.mtw.ui/.project Mon Aug 09 15:18:34 2010 -0700
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.symbian.tools.mtw.ui</name>
+ <name>org.symbian.tools.tmw.ui</name>
<comment></comment>
<projects>
</projects>
--- a/org.symbian.tools.mtw.ui/META-INF/MANIFEST.MF Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.mtw.ui/META-INF/MANIFEST.MF Mon Aug 09 15:18:34 2010 -0700
@@ -1,9 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mobile Tools for Web main UI plug-in
-Bundle-SymbolicName: org.symbian.tools.mtw.ui;singleton:=true
+Bundle-SymbolicName: org.symbian.tools.tmw.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.symbian.tools.mtw.ui.MTWCoreUI
+Bundle-Activator: org.symbian.tools.tmw.ui.TMWCoreUI
Bundle-Vendor: Symbian Foundation
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
@@ -13,11 +13,12 @@
org.eclipse.wst.jsdt.ui;bundle-version="1.1.0",
org.eclipse.wst.jsdt.core;bundle-version="1.1.0",
org.eclipse.ui.console;bundle-version="3.5.0",
- org.symbian.tools.mtw.core;bundle-version="1.0.0"
+ org.symbian.tools.tmw.core;bundle-version="1.0.0",
+ org.eclipse.wst.common.project.facet.ui;bundle-version="1.4.100",
+ org.eclipse.core.expressions;bundle-version="3.4.200"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: lib/org.bluecove_2.1.1.jar,
.
-Export-Package: org.symbian.tools.mtw.ui,
- org.symbian.tools.mtw.ui.deployment,
- org.symbian.tools.mtw.ui.deployment.bluetooth
+Export-Package: org.symbian.tools.tmw.ui,
+ org.symbian.tools.tmw.ui.deployment
--- a/org.symbian.tools.mtw.ui/plugin.xml Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.mtw.ui/plugin.xml Mon Aug 09 15:18:34 2010 -0700
@@ -102,7 +102,7 @@
</enablement>
</commonWizard>
<actionProvider
- class="org.symbian.tools.mtw.ui.navigator.RenameMoveActionProvider"
+ class="org.symbian.tools.tmw.ui.navigator.RenameMoveActionProvider"
id="org.symbian.mtw.ui.navigator.MoveRename"
overrides="org.eclipse.wst.jsdt.ui.navigator.actions.RefactorActions"
priority="highest">
@@ -125,31 +125,31 @@
<extension
point="org.eclipse.ui.handlers">
<handler
- class="org.symbian.tools.mtw.ui.commands.DeployHandler"
+ class="org.symbian.tools.tmw.ui.commands.DeployHandler"
commandId="org.symbian.tools.wrttools.commands.deploy">
<enabledWhen>
<reference
- definitionId="org.symbian.tools.wrttools.symbianproject">
+ definitionId="org.symbian.tools.tmwprojectselected">
</reference>
</enabledWhen>
</handler>
</extension>
<extension
- point="org.symbian.tools.mtw.ui.deploymentTargetType">
+ point="org.symbian.tools.tmw.ui.deploymentTargetType">
<deployment-target-type
- class="org.symbian.tools.mtw.ui.deployment.bluetooth.BluetoothTargetType"
+ class="org.symbian.tools.tmw.ui.deployment.bluetooth.BluetoothTargetType"
icon="icons/full/obj16/bluetooth.gif"
id="org.symbian.tools.mtw.bluetooth"
long-running="true"
priority="10">
</deployment-target-type>
<deployment-target-type
- class="org.symbian.tools.mtw.internal.deployment.targets.ExternalApplicationDeploymentType"
+ class="org.symbian.tools.tmw.internal.deployment.targets.ExternalApplicationDeploymentType"
id="org.symbian.tools.mtw.externalApp"
priority="1000">
</deployment-target-type>
<deployment-target-type
- class="org.symbian.tools.mtw.internal.deployment.targets.FilesystemDeploymentTarget"
+ class="org.symbian.tools.tmw.internal.deployment.targets.FilesystemDeploymentTarget"
icon="icons/full/obj16/folder.gif"
id="org.symbian.tools.mtw.fileSystem"
priority="900">
@@ -158,8 +158,8 @@
<extension
point="org.eclipse.core.runtime.adapters">
<factory
- adaptableType="org.symbian.tools.mtw.ui.deployment.bluetooth.BluetoothTarget"
- class="org.symbian.tools.mtw.ui.deployment.bluetooth.BluetoothTargetAdapterFactory">
+ adaptableType="org.symbian.tools.tmw.ui.deployment.bluetooth.BluetoothTarget"
+ class="org.symbian.tools.tmw.ui.deployment.bluetooth.BluetoothTargetAdapterFactory">
<adapter
type="org.eclipse.ui.model.IWorkbenchAdapter">
</adapter>
@@ -168,19 +168,74 @@
</adapter>
</factory>
<factory
- adaptableType="org.symbian.tools.mtw.internal.deployment.targets.ExternalApplicationDeploymentType"
- class="org.symbian.tools.mtw.internal.deployment.targets.AdapterFactory">
+ adaptableType="org.symbian.tools.tmw.internal.deployment.targets.ExternalApplicationDeploymentType"
+ class="org.symbian.tools.tmw.internal.deployment.targets.AdapterFactory">
<adapter
type="org.eclipse.ui.model.IWorkbenchAdapter">
</adapter>
</factory>
</extension>
<extension
- point="org.symbian.tools.mtw.ui.targetPresentation">
+ point="org.symbian.tools.tmw.ui.targetPresentation">
<targetPresentation
- detailsPane="org.symbian.tools.mtw.internal.deployment.targets.LocalFileSystemPane"
+ detailsPane="org.symbian.tools.tmw.internal.deployment.targets.LocalFileSystemPane"
targetTypeId="org.symbian.tools.mtw.fileSystem">
</targetPresentation>
</extension>
-
+ <extension
+ point="org.eclipse.wst.jsdt.ui.JsGlobalScopeUIInitializer">
+ <JsGlobalScopeUIInitializer
+ class="org.symbian.tools.tmw.internal.libraries.MTWGlobalScopeContainerUI"
+ id="org.symbian.tools.tmw.core.mobileWebLibrary">
+ </JsGlobalScopeUIInitializer>
+ </extension>
+ <extension
+ point="org.eclipse.wst.jsdt.ui.JsGlobalScopeContainerPage">
+ <JsGlobalScopeContainerPage
+ class="org.symbian.tools.tmw.internal.libraries.TMWContainerPage"
+ id="org.symbian.tools.tmw.core.mobileWebLibrary"
+ name="Tools for Mobile Web">
+ </JsGlobalScopeContainerPage>
+ </extension>
+ <extension
+ point="org.eclipse.core.expressions.definitions">
+ <definition
+ id="org.symbian.tools.tmwprojectselected">
+ <or>
+ <with
+ variable="selection">
+ <and>
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <test
+ property="org.symbian.tools.tmw.istmwproject">
+ </test>
+ </adapt>
+ </iterate>
+ </and>
+ </with>
+ <and>
+ <with
+ variable="activePart">
+ <instanceof
+ value="org.eclipse.ui.IEditorPart">
+ </instanceof>
+ </with>
+ <with
+ variable="activeEditorInput">
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <test
+ property="org.symbian.tools.tmw.ismtwproject">
+ </test>
+ </adapt>
+ </with>
+ </and>
+ </or>
+ </definition>
+ </extension>
</plugin>
--- a/org.symbian.tools.mtw.ui/schema/deploymentTargetType.exsd Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.mtw.ui/schema/deploymentTargetType.exsd Mon Aug 09 15:18:34 2010 -0700
@@ -1,9 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
-<schema targetNamespace="org.symbian.tools.mtw.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<schema targetNamespace="org.symbian.tools.tmw.ui" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
- <meta.schema plugin="org.symbian.tools.mtw.ui" id="deploymentTargetType" name="Provides targets for project deployments"/>
+ <meta.schema plugin="org.symbian.tools.tmw.ui" id="deploymentTargetType" name="Provides targets for project deployments"/>
</appinfo>
<documentation>
MTW extenders can provide deployment targets - these include bluetooth devices, device emulators etc.
@@ -62,7 +62,7 @@
</documentation>
<appinfo>
- <meta.attribute kind="java" basedOn=":org.symbian.tools.mtw.ui.deployment.IDeploymentTargetType"/>
+ <meta.attribute kind="java" basedOn=":org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType"/>
</appinfo>
</annotation>
</attribute>
--- a/org.symbian.tools.mtw.ui/schema/targetPresentation.exsd Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.mtw.ui/schema/targetPresentation.exsd Mon Aug 09 15:18:34 2010 -0700
@@ -1,9 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
-<schema targetNamespace="org.symbian.tools.mtw.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<schema targetNamespace="org.symbian.tools.tmw.ui" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
- <meta.schema plugin="org.symbian.tools.mtw.ui" id="targetPresentation" name="Deployment Target Presentation"/>
+ <meta.schema plugin="org.symbian.tools.tmw.ui" id="targetPresentation" name="Deployment Target Presentation"/>
</appinfo>
<documentation>
Provides UI extensions to customize deployment target presentation.
@@ -55,7 +55,7 @@
</documentation>
<appinfo>
- <meta.attribute kind="identifier" basedOn="org.symbian.tools.mtw.ui.deploymentTargetType/deployment-target-type/@id"/>
+ <meta.attribute kind="identifier" basedOn="org.symbian.tools.tmw.ui.deploymentTargetType/deployment-target-type/@id"/>
</appinfo>
</annotation>
</attribute>
@@ -65,7 +65,7 @@
Details pane that will show information about selected deployment target. This pane is limited in height.
</documentation>
<appinfo>
- <meta.attribute kind="java" basedOn=":org.symbian.tools.mtw.ui.deployment.ITargetDetailsPane"/>
+ <meta.attribute kind="java" basedOn=":org.symbian.tools.tmw.ui.deployment.ITargetDetailsPane"/>
</appinfo>
</annotation>
</attribute>
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/DefaultDeploymentTypePresentation.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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.mtw.internal.deployment;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTarget;
-import org.symbian.tools.mtw.ui.deployment.ITargetDetailsPane;
-
-public class DefaultDeploymentTypePresentation implements ITargetDetailsPane {
- private Text text;
-
- public void init(Context page) {
- }
-
- public void setTarget(IDeploymentTarget target) {
- text.setText(target.getDescription());
- }
-
- public void createControl(Composite parent) {
- text = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.READ_ONLY);
- }
-
- public Control getControl() {
- return text;
- }
-
- public IStatus validate() {
- return Status.OK_STATUS;
- }
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/DeployWizardContext.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +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.mtw.internal.deployment;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.ui.MTWCoreUI;
-
-public class DeployWizardContext {
- private DeploymentTargetWrapper target;
- private final IMTWProject project;
- private boolean logging;
-
- public DeployWizardContext(IMTWProject project) {
- this.project = project;
- }
-
- public void setTarget(DeploymentTargetWrapper target) {
- this.target = target;
- }
-
- public DeploymentTargetWrapper getTarget() {
- return target;
- }
-
- public IMTWProject getProject() {
- return project;
- }
-
- public DeploymentTargetWrapper[] getDeploymentTargets() {
- final DeploymentTargetTypeDescriptor[] providers = MTWCoreUI.getDefault().getDeploymentTypesRegistry()
- .getProviders();
- Collection<DeploymentTargetWrapper> targets = new HashSet<DeploymentTargetWrapper>();
-
- for (DeploymentTargetTypeDescriptor provider : providers) {
- if (provider.supports(project)) {
- targets.addAll(Arrays.asList(provider.getTargets(project)));
- }
- }
- return targets.toArray(new DeploymentTargetWrapper[targets.size()]);
- }
-
- public void doSearch(IProgressMonitor monitor) throws CoreException {
- final DeploymentTargetTypeDescriptor[] providers = MTWCoreUI.getDefault().getDeploymentTypesRegistry()
- .getProviders();
- monitor.beginTask("Discovering deployment targets", providers.length * 10);
- for (DeploymentTargetTypeDescriptor descriptor : providers) {
- descriptor.discoverTargets(new SubProgressMonitor(monitor, 10));
- }
- monitor.done();
- }
-
- public boolean areTargetsReady() {
- final DeploymentTargetTypeDescriptor[] providers = MTWCoreUI.getDefault().getDeploymentTypesRegistry()
- .getProviders();
- for (DeploymentTargetTypeDescriptor descriptor : providers) {
- if (!descriptor.targetsDiscovered()) {
- return false;
- }
- }
- return true;
- }
-
- public void setLogging(boolean logging) {
- this.logging = logging;
- }
-
- public boolean isLogging() {
- return logging;
- }
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/DeploymentTargetPresentationsManager.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +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.mtw.internal.deployment;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.symbian.tools.mtw.ui.MTWCoreUI;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTargetType;
-import org.symbian.tools.mtw.ui.deployment.ITargetDetailsPane;
-
-public class DeploymentTargetPresentationsManager {
- private Map<IDeploymentTargetType, IConfigurationElement> presentations;
-
- public ITargetDetailsPane createDetailsPane(IDeploymentTargetType targetType) {
- readRegistry();
- final IConfigurationElement element = presentations.get(targetType);
- if (element != null && element.getAttribute("detailsPane") != null) {
- try {
- return (ITargetDetailsPane) element.createExecutableExtension("detailsPane");
- } catch (CoreException e) {
- MTWCoreUI.log(e);
- }
- }
- return new DefaultDeploymentTypePresentation();
- }
-
- private synchronized void readRegistry() {
- if (presentations == null) {
- presentations = new HashMap<IDeploymentTargetType, IConfigurationElement>();
- final IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(
- MTWCoreUI.PLUGIN_ID, "targetPresentation");
- for (IConfigurationElement element : elements) {
- final String runtimeId = element.getAttribute("targetTypeId");
- final IDeploymentTargetType targetType = MTWCoreUI.getDefault().getDeploymentTypesRegistry()
- .getType(runtimeId);
- if (targetType == null) {
- MTWCoreUI.log("Runtime %s was not found. It is referenced from plugin %s", runtimeId, element
- .getContributor().getName());
- continue;
- } else {
- presentations.put(targetType, element);
- }
- }
- }
- }
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/DeploymentTargetTypeDescriptor.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,190 +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.mtw.internal.deployment;
-
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.ui.MTWCoreUI;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTarget;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTargetType;
-
-public final class DeploymentTargetTypeDescriptor implements IDeploymentTargetType {
- public class NullProvider implements IDeploymentTargetType {
- public IDeploymentTarget[] getTargets(IMTWProject project) {
- return null;
- }
-
- public void discoverTargets(IProgressMonitor monitor) throws CoreException {
- // Do nothing
- }
-
- public IDeploymentTarget findTarget(IMTWProject project, String id) {
- return null;
- }
-
- public boolean targetsDiscovered() {
- return true;
- }
-
- public ISchedulingRule getSchedulingRule(IDeploymentTarget target) {
- return null; // No scheduling
- }
- }
-
- private static final DeploymentTargetWrapper[] NO_TARGETS = new DeploymentTargetWrapper[0];
- private final IConfigurationElement element;
- private IDeploymentTargetType type;
- private final Map<IDeploymentTarget, DeploymentTargetWrapper> wrappers = new WeakHashMap<IDeploymentTarget, DeploymentTargetWrapper>();
- private ImageDescriptor imageDescriptor = null;
-
- public DeploymentTargetTypeDescriptor(IConfigurationElement element) {
- this.element = element;
- }
-
- public boolean supports(IMTWProject project) {
- // We will support more declarative filtering later
- return true;
- }
-
- public DeploymentTargetWrapper[] getTargets(IMTWProject project) {
- final DeploymentTargetWrapper[] targets = wrap(getProvider().getTargets(project));
- return targets != null ? targets : NO_TARGETS;
- }
-
- private DeploymentTargetWrapper[] wrap(IDeploymentTarget[] targets) {
- if (targets == null) {
- return new DeploymentTargetWrapper[0];
- } else {
- final DeploymentTargetWrapper[] w = new DeploymentTargetWrapper[targets.length];
- for (int i = 0; i < targets.length; i++) {
- w[i] = wrap(targets[i]);
- }
- return w;
- }
- }
-
- private DeploymentTargetWrapper wrap(final IDeploymentTarget target) {
- DeploymentTargetWrapper wrapper = wrappers.get(target);
- if (wrapper == null) {
- wrapper = new DeploymentTargetWrapper(target, this);
- wrappers.put(target, wrapper);
- }
- return wrapper;
- }
-
- public void discoverTargets(IProgressMonitor monitor) throws CoreException {
- getProvider().discoverTargets(monitor);
- }
-
- public IDeploymentTarget findTarget(IMTWProject project, String id) {
- return wrap(getProvider().findTarget(project, id));
- }
-
- private synchronized IDeploymentTargetType getProvider() {
- if (type == null) {
- try {
- type = (IDeploymentTargetType) element.createExecutableExtension("class");
- } catch (CoreException e) {
- MTWCoreUI.log("Cannot instantiate provider " + getId(), e);
- type = new NullProvider();
- }
- }
- return type;
- }
-
- public String getId() {
- return element.getAttribute("id");
- }
-
- public boolean targetsDiscovered() {
- return getProvider().targetsDiscovered();
- }
-
- public int getPriority() {
- final String attribute = element.getAttribute("priority");
- if (attribute != null && attribute.trim().length() > 0) {
- try {
- return Integer.parseInt(attribute);
- } catch (NumberFormatException e) {
- MTWCoreUI.log("%s is not a valid priority value for %s provider", attribute, getId());
- }
- }
- return 0;
- }
-
- public ImageDescriptor getImageDescriptor() {
- if (imageDescriptor == null) {
- final String image = element.getAttribute("icon");
- if (image == null) {
- imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
- } else {
- imageDescriptor = MTWCoreUI.imageDescriptorFromPlugin(element.getNamespaceIdentifier(), image);
- }
- }
- return imageDescriptor;
- }
-
- public ISchedulingRule getSchedulingRule(IDeploymentTarget target) {
- return type.getSchedulingRule(target);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (obj instanceof IDeploymentTargetType) {
- return obj.equals(type);
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- DeploymentTargetTypeDescriptor other = (DeploymentTargetTypeDescriptor) obj;
- if (getId() == null) {
- if (other.getId() != null) {
- return false;
- }
- } else if (!getId().equals(other.getId())) {
- return false;
- }
- return true;
- }
-
- public boolean isLongRunning() {
- return Boolean.valueOf(element.getAttribute("long-running"));
- }
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/DeploymentTargetTypesRegistry.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +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.mtw.internal.deployment;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.symbian.tools.mtw.ui.MTWCoreUI;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTargetType;
-
-public class DeploymentTargetTypesRegistry {
- private DeploymentTargetTypeDescriptor[] descriptors;
-
- public DeploymentTargetTypesRegistry() {
- readExtensions();
- }
-
- private void readExtensions() {
- final IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(
- MTWCoreUI.PLUGIN_ID, "deploymentTargetType");
- descriptors = new DeploymentTargetTypeDescriptor[elements.length];
- for (int i = 0; i < elements.length; i++) {
- descriptors[i] = new DeploymentTargetTypeDescriptor(elements[i]);
- }
- }
-
- public DeploymentTargetTypeDescriptor[] getProviders() {
- return descriptors;
- }
-
- public IDeploymentTargetType getType(String id) {
- DeploymentTargetTypeDescriptor[] providers = getProviders();
- for (DeploymentTargetTypeDescriptor descriptor : providers) {
- if (descriptor.getId().equals(id)) {
- return descriptor;
- }
- }
- return null;
- }
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/DeploymentTargetWizardPage.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,248 +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.mtw.internal.deployment;
-
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.util.Policy;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.jface.wizard.IWizardContainer;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.part.PageBook;
-import org.symbian.tools.mtw.core.MTWCore;
-import org.symbian.tools.mtw.core.runtimes.IPackager;
-import org.symbian.tools.mtw.ui.MTWCoreUI;
-import org.symbian.tools.mtw.ui.ProjectMemo;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTarget;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTargetType;
-import org.symbian.tools.mtw.ui.deployment.ITargetDetailsPane;
-
-public class DeploymentTargetWizardPage extends WizardPage implements ITargetDetailsPane.Context {
- private final DeployWizardContext context;
- private PageBook descriptions;
- private Control emptyness;
- private final Set<IDeploymentTarget> inited = new HashSet<IDeploymentTarget>();
- private TableViewer list;
- private final Map<IDeploymentTargetType, ITargetDetailsPane> panes = new HashMap<IDeploymentTargetType, ITargetDetailsPane>();
- private final IDeploymentTarget prev;
-
- public DeploymentTargetWizardPage(DeployWizardContext context, ProjectMemo memo) {
- super("TargetPage", "Select Deployment Target", null);
- this.context = context;
- prev = memo.getPreviousDeploymentTarget();
- setDescription(MessageFormat.format("Select emulator or device to deploy WRT application ''{0}''", context
- .getProject().getProject().getName()));
- }
-
- public void createControl(Composite parent) {
- Composite root = new Composite(parent, SWT.NONE);
-
- root.setLayout(new FormLayout());
-
- list = new TableViewer(root, SWT.BORDER);
- list.setContentProvider(new ArrayContentProvider());
- list.setLabelProvider(new WorkbenchLabelProvider());
- list.setSorter(new ViewerSorter() {
- @Override
- public int category(Object element) {
- return ((DeploymentTargetWrapper) element).getCategory();
- }
- });
- list.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = ((IStructuredSelection) event.getSelection());
- DeploymentTargetWrapper target = (DeploymentTargetWrapper) selection.getFirstElement();
- selectDeploymentTarget(target);
- }
- });
- list.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- if (getWizard().performFinish()) {
- IWizardContainer container = getWizard().getContainer();
- if (container instanceof WizardDialog) {
- ((WizardDialog) container).close();
- }
- }
- }
- });
- final Button search = new Button(root, SWT.NONE);
- search.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- doBluetoothSearch(search);
- }
- });
- search.setText("Discover");
- search.setImage(MTWCoreUI.getImages().getDiscoverButtonIcon());
-
- descriptions = new PageBook(root, SWT.BORDER);
- emptyness = new Composite(descriptions, SWT.NONE);
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, 5);
- data.right = new FormAttachment(100, -5);
- data.bottom = new FormAttachment(100, -5);
- data.height = 80;
- descriptions.setLayoutData(data);
-
- data = new FormData();
- data.top = new FormAttachment(0, 5);
- data.right = new FormAttachment(100, -5);
- search.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(0, 5);
- data.top = new FormAttachment(0, 5);
- data.bottom = new FormAttachment(descriptions, -10);
- data.right = new FormAttachment(search, -10);
-
- list.getControl().setLayoutData(data);
- list.setInput(context.getDeploymentTargets());
- setPageComplete(false);
-
- if (prev != null) {
- list.setSelection(new StructuredSelection(prev));
- }
- setControl(root);
- }
-
- protected void doBluetoothSearch(final Button search) {
- try {
- final ISelection sel = list.getSelection();
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- monitor.beginTask("Searching for Bluetooth devices", IProgressMonitor.UNKNOWN);
- try {
- context.doSearch(new SubProgressMonitor(monitor, 100));
- } catch (CoreException e) {
- Policy.getStatusHandler().show(e.getStatus(), "WRT Application Deployment");
- }
- monitor.done();
- search.getDisplay().asyncExec(new Runnable() {
- public void run() {
- list.setInput(context.getDeploymentTargets());
- if (!sel.isEmpty()) {
- list.setSelection(sel);
- selectDeploymentTarget((DeploymentTargetWrapper) ((IStructuredSelection) sel)
- .getFirstElement());
- } else {
- DeploymentTargetWrapper[] deploymentTargets = context.getDeploymentTargets();
- if (deploymentTargets.length == 0) {
- selectDeploymentTarget(null);
- } else {
- list.setSelection(new StructuredSelection(deploymentTargets[0]));
- selectDeploymentTarget(deploymentTargets[0]);
- }
- }
- }
- });
- }
- });
- } catch (InvocationTargetException e) {
- MTWCoreUI.log(e);
- } catch (InterruptedException e) {
- MTWCoreUI.log(e);
- }
- }
-
- private IPackager getPackager() {
- return MTWCore.getDefault().getRuntimesManager().getPackager(context.getProject());
- }
-
- protected void selectDeploymentTarget(DeploymentTargetWrapper target) {
- if (target != null) {
- if (!inited.contains(target)) {
- target.init(context.getProject(), getPackager(),
- MTWCoreUI.getMemo(context.getProject()).getMemo(target.getType().getId(), target));
- inited.add(target);
- }
- context.setTarget(target);
-
- IDeploymentTargetType type = target.getType();
- ITargetDetailsPane pane = panes.get(type);
- if (pane == null) {
- pane = MTWCoreUI.getDefault().getPresentations().createDetailsPane(type);
- pane.createControl(descriptions);
- pane.init(this);
- panes.put(type, pane);
- }
- pane.setTarget(target.getActualTarget());
- descriptions.showPage(pane.getControl());
- } else {
- descriptions.showPage(emptyness);
- context.setTarget(null);
- setPageComplete(false);
- setMessage(null);
- }
- revalidate();
- }
-
- protected void toggleLogging(boolean logging) {
- context.setLogging(logging);
- }
-
- public void revalidate() {
- String error = null;
- String warning = !context.areTargetsReady() ? "Press \"Discover\" to find more deployment targets" : null;
- if (context.getTarget() == null) {
- error = "Select device or emulator to deploy the application";
- } else {
- final IStatus validate = panes.get(context.getTarget().getType()).validate();
- if (validate.getSeverity() == IStatus.ERROR) {
- error = validate.getMessage();
- } else if (validate.getSeverity() == IStatus.WARNING) {
- warning = validate.getMessage();
- }
- }
- setErrorMessage(error);
- setMessage(warning, IStatus.WARNING);
- setPageComplete(error == null);
- }
-
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/DeploymentTargetWrapper.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +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.mtw.internal.deployment;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.model.IWorkbenchAdapter2;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.core.runtimes.IPackager;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTarget;
-
-public class DeploymentTargetWrapper implements IDeploymentTarget {
- public class WorkbenchAdapter2Wrapper implements IWorkbenchAdapter2 {
- private final IWorkbenchAdapter2 adapter;
-
- public WorkbenchAdapter2Wrapper(IWorkbenchAdapter2 adapter) {
- this.adapter = adapter;
- }
-
- public RGB getForeground(Object element) {
- return adapter.getForeground(((DeploymentTargetWrapper) element).getActualTarget());
- }
-
- public RGB getBackground(Object element) {
- return adapter.getBackground(((DeploymentTargetWrapper) element).getActualTarget());
- }
-
- public FontData getFont(Object element) {
- return adapter.getFont(((DeploymentTargetWrapper) element).getActualTarget());
- }
- }
-
- public class WorkbenchAdapterWrapper implements IWorkbenchAdapter {
- private final IWorkbenchAdapter adapter;
-
- public WorkbenchAdapterWrapper(IWorkbenchAdapter adapter) {
- this.adapter = adapter;
- }
-
- public Object[] getChildren(Object o) {
- return adapter.getChildren(((DeploymentTargetWrapper) o).getActualTarget());
- }
-
- public ImageDescriptor getImageDescriptor(Object object) {
- return adapter.getImageDescriptor(((DeploymentTargetWrapper) object).getActualTarget());
- }
-
- public String getLabel(Object o) {
- return adapter.getLabel(((DeploymentTargetWrapper) o).getActualTarget());
- }
-
- public Object getParent(Object o) {
- return adapter.getParent(((DeploymentTargetWrapper) o).getActualTarget());
- }
- }
-
- private final DeploymentTargetTypeDescriptor type;
- private final IDeploymentTarget target;
-
- public void save(IMemento memento) {
- target.save(memento);
- }
-
- public void init(IMTWProject project, IPackager packager, IMemento memento) {
- target.init(project, packager, memento);
- }
-
- public DeploymentTargetWrapper(IDeploymentTarget target, DeploymentTargetTypeDescriptor type) {
- this.target = target;
- this.type = type;
- }
-
- public IStatus deploy(IMTWProject project, IPackager packager, IProgressMonitor monitor)
- throws CoreException {
- return target.deploy(project, packager, monitor);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- DeploymentTargetWrapper other = (DeploymentTargetWrapper) obj;
- if (target == null) {
- if (other.target != null) {
- return false;
- }
- } else if (!target.equals(other.target)) {
- return false;
- }
- return true;
- }
-
- public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
- Object a = target.getAdapter(adapter);
- if (IWorkbenchAdapter.class.isAssignableFrom(adapter)) {
- return a == null ? new TargetWorkbenchAdapter(this) : new WorkbenchAdapterWrapper((IWorkbenchAdapter) a);
- } else if (IWorkbenchAdapter2.class.isAssignableFrom(adapter)) {
- return a == null ? new TargetWorkbenchAdapter(this) : new WorkbenchAdapter2Wrapper((IWorkbenchAdapter2) a);
- } else {
- return a;
- }
- }
-
- public int getCategory() {
- return type.getPriority() * 0xFFFF + (type.getId().hashCode() & 0xFFFF);
- }
-
- public String getId() {
- return target.getId();
- }
-
- public String getName() {
- return target.getName();
- }
-
- public String getProviderId() {
- return type.getId();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((target == null) ? 0 : target.hashCode());
- return result;
- }
-
- public DeploymentTargetTypeDescriptor getType() {
- return type;
- }
-
- public IDeploymentTarget getActualTarget() {
- return target;
- }
-
- public String getDescription() {
- return target.getDescription();
- }
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/TargetWorkbenchAdapter.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +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.mtw.internal.deployment;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.model.IWorkbenchAdapter2;
-
-public class TargetWorkbenchAdapter implements IWorkbenchAdapter, IWorkbenchAdapter2 {
- /**
- *
- */
- private final DeploymentTargetWrapper deploymentTargetWrapper;
-
- /**
- * @param deploymentTargetWrapper
- */
- TargetWorkbenchAdapter(DeploymentTargetWrapper deploymentTargetWrapper) {
- this.deploymentTargetWrapper = deploymentTargetWrapper;
- }
-
- public String getLabel(Object object) {
- return this.deploymentTargetWrapper.getName();
- }
-
- public ImageDescriptor getImageDescriptor(Object object) {
- return this.deploymentTargetWrapper.getType().getImageDescriptor();
- }
-
- public RGB getForeground(Object element) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public RGB getBackground(Object element) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public FontData getFont(Object element) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Object[] getChildren(Object o) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Object getParent(Object o) {
- // TODO Auto-generated method stub
- return null;
- }
-}
\ No newline at end of file
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/externalapp/FilesystemDeploymentTarget.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +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.mtw.internal.deployment.externalapp;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTarget;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTargetType;
-
-public class FilesystemDeploymentTarget implements IDeploymentTargetType {
-
- public FilesystemDeploymentTarget() {
- // TODO Auto-generated constructor stub
- }
-
- public IDeploymentTarget[] getTargets(IMTWProject project) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void discoverTargets(IProgressMonitor monitor) throws CoreException {
- // TODO Auto-generated method stub
-
- }
-
- public IDeploymentTarget findTarget(IMTWProject project, String id) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean targetsDiscovered() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public ISchedulingRule getSchedulingRule(IDeploymentTarget target) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/targets/AdapterFactory.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +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.mtw.internal.deployment.targets;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.model.WorkbenchAdapter;
-
-@SuppressWarnings("rawtypes")
-public class AdapterFactory implements IAdapterFactory {
- private final IWorkbenchAdapter adapter = new WorkbenchAdapter() {
- @Override
- public ImageDescriptor getImageDescriptor(Object object) {
- if (object instanceof ExternalApplicationDeploymentType) {
- return ImageDescriptor.createFromImageData(((ExternalApplicationDeploymentType) object).getProgram()
- .getImageData());
- }
- return super.getImageDescriptor(object);
- }
-
- public String getLabel(Object object) {
- if (object instanceof ExternalApplicationDeploymentType) {
- return ((ExternalApplicationDeploymentType) object).getName();
- }
- return super.getLabel(object);
- };
- };
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof ExternalApplicationDeploymentType
- && IWorkbenchAdapter.class.isAssignableFrom(adapterType)) {
- return adapter;
- }
- return null;
- }
-
- public Class[] getAdapterList() {
- return new Class[] { IWorkbenchAdapter.class };
- }
-
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/targets/ExternalApplicationDeploymentType.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +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.mtw.internal.deployment.targets;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.swt.program.Program;
-import org.eclipse.ui.IMemento;
-import org.symbian.tools.mtw.core.MTWCore;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.core.runtimes.IPackager;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTarget;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTargetType;
-
-public class ExternalApplicationDeploymentType extends PlatformObject implements IDeploymentTargetType,
- IDeploymentTarget {
-
- private IMTWProject project;
-
- public IStatus deploy(IMTWProject project, IPackager packager, IProgressMonitor monitor)
- throws CoreException {
- Program app = getExternalApp(project);
- File file = packager.packageApplication(project, monitor);
- if (file != null) {
- app.execute(file.toString());
- return new Status(
- IStatus.OK,
- MTWCore.PLUGIN_ID,
- "Mobile web application was passed as an argument to external application. Please follow its prompts to complete deployment.");
- } else {
- return new Status(IStatus.ERROR, MTWCore.PLUGIN_ID, "Application packaging failed");
- }
- }
-
- public void discoverTargets(IProgressMonitor monitor) throws CoreException {
- // Do nothing
- }
-
- public IDeploymentTarget findTarget(IMTWProject project, String id) {
- if (getExternalApp(project) != null) {
- return this;
- } else {
- return null;
- }
- }
-
- public String getDescription() {
- return getExternalApp(project).getName();
- }
-
- private Program getExternalApp(IMTWProject project) {
- this.project = project;
- IPackager packager = MTWCore.getDefault().getRuntimesManager().getPackager(project);
- if (packager != null) {
- return Program.findProgram(packager.getFileType(project));
- } else {
- return null;
- }
- }
-
- public String getId() {
- return "mtw.externalapp";
- }
-
- public String getName() {
- return "Use external application";
- }
-
- public Program getProgram() {
- return getExternalApp(project);
- }
-
- public ISchedulingRule getSchedulingRule(IDeploymentTarget target) {
- return null;
- }
-
- public IDeploymentTarget[] getTargets(IMTWProject project) {
- if (getExternalApp(project) != null) {
- return new IDeploymentTarget[] { this };
- } else {
- return null;
- }
- }
-
- public void init(IMTWProject project, IPackager packager, IMemento memento) {
- // Do nothing
- }
-
- public void save(IMemento memento) {
- // Do nothing
- }
-
- public boolean targetsDiscovered() {
- return true;
- }
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/targets/FilesystemDeploymentTarget.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +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.mtw.internal.deployment.targets;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.ui.IMemento;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.core.runtimes.IPackager;
-import org.symbian.tools.mtw.ui.MTWCoreUI;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTarget;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTargetType;
-
-public class FilesystemDeploymentTarget extends PlatformObject implements IDeploymentTargetType, IDeploymentTarget {
- private String defaultName;
- private IPath path;
-
- public IStatus deploy(IMTWProject project, IPackager packager, IProgressMonitor monitor) throws CoreException {
- final File file = packager.packageApplication(project, monitor);
- try {
- final InputStream inputStream = new BufferedInputStream(new FileInputStream(file));
- final OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(path.toFile()));
- try {
- final byte[] buffer = new byte[16384];
- int read = -1;
- while ((read = inputStream.read(buffer)) > 0) {
- outputStream.write(buffer, 0, read);
- }
- } finally {
- inputStream.close();
- outputStream.close();
- }
- } catch (IOException e) {
- throw new CoreException(
- new Status(IStatus.ERROR, MTWCoreUI.PLUGIN_ID, "Failed to copy application file", e));
- } finally {
- file.delete();
- }
- return Status.OK_STATUS;
- }
-
- public void discoverTargets(IProgressMonitor monitor) throws CoreException {
- // Do nothing
- }
-
- public IDeploymentTarget findTarget(IMTWProject project, String id) {
- return getId().equals(id) ? this : null;
- }
-
- public String getDefaultName() {
- return defaultName;
- }
-
- public String getDescription() {
- return "Copies application package to a location in the local filesystem";
- }
-
- public String getId() {
- return "mtw.filesystem";
- }
-
- public String getName() {
- return "Local filesystem";
- }
-
- public IPath getPath() {
- return path;
- }
-
- public ISchedulingRule getSchedulingRule(IDeploymentTarget target) {
- return null;
- }
-
- public IDeploymentTarget[] getTargets(IMTWProject project) {
- return new IDeploymentTarget[] { this };
- }
-
- public void init(IMTWProject 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;
- if (string == null) {
- string = MTWCoreUI.getDefault().getPreferenceStore().getString("path");
- if (string != null) {
- final IPath p = Path.fromPortableString(string);
- if (p.toFile().isDirectory()) {
- this.path = p.append(defaultName);
- }
- }
- } else {
- path = Path.fromPortableString(string);
- if (!path.removeLastSegments(1).toFile().isDirectory()) {
- path = null;
- }
- }
- }
-
- public void save(IMemento memento) {
- memento.putString("path", path.toPortableString());
- MTWCoreUI.getDefault().getPreferenceStore().setValue("path", path.removeLastSegments(1).toPortableString());
- }
-
- public void setPath(IPath path) {
- this.path = path;
- }
-
- public boolean targetsDiscovered() {
- return true;
- }
-
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/targets/LocalFileSystemPane.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +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.mtw.internal.deployment.targets;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-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.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.symbian.tools.mtw.ui.MTWCoreUI;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTarget;
-import org.symbian.tools.mtw.ui.deployment.ITargetDetailsPane;
-
-public class LocalFileSystemPane implements ITargetDetailsPane {
- private Composite root;
- private Text location;
- private FilesystemDeploymentTarget target;
- private Context page;
-
- public void init(Context page) {
- this.page = page;
- }
-
- public void setTarget(IDeploymentTarget target) {
- this.target = (FilesystemDeploymentTarget) target;
- IPath path = this.target.getPath();
- String string;
- if (path == null) {
- string = "";
- } else {
- string = path.toOSString();
- }
- location.setText(string);
- page.revalidate();
- }
-
- public void createControl(Composite parent) {
- root = new Composite(parent, SWT.NONE);
- root.setLayout(new GridLayout(2, false));
- Label label = new Label(root, SWT.NONE);
- label.setText("File name:");
- GridDataFactory.generate(label, 2, 1);
- location = new Text(root, SWT.BORDER);
- location.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- location.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- page.revalidate();
- }
- });
- final Button button = new Button(root, SWT.NONE);
- button.setText("Browse...");
- button.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- browse();
- }
- });
- }
-
- protected void browse() {
- final FileDialog dialog = new FileDialog(location.getShell(), SWT.SAVE);
- dialog.setText("Select Application Package Location");
- dialog.setFileName(target.getDefaultName());
- final IPath path = target.getPath();
- if (path != null) {
- dialog.setFilterPath(path.removeLastSegments(1).toOSString());
- }
- String newPath = dialog.open();
- if (newPath != null) {
- location.setText(newPath);
- page.revalidate();
- }
- }
-
- public IStatus validate() {
- target.setPath(null);
- String path = location.getText();
- if (path.trim().length() == 0) {
- return new Status(IStatus.ERROR, MTWCoreUI.PLUGIN_ID, "File name must be specified");
- } else {
- final File file = new File(path);
- if (!file.getParentFile().isDirectory()) {
- return new Status(IStatus.ERROR, MTWCoreUI.PLUGIN_ID, String.format("%s is not a valid folder",
- file.getParent()));
- } else {
- IStatus status = ResourcesPlugin.getWorkspace().validateName(file.getName(), IResource.FILE);
- if (status.getSeverity() == IStatus.ERROR) {
- return status;
- } else {
- Path p = new Path(path.trim());
- target.setPath(p);
- if (p.toFile().exists()) {
- return new Status(IStatus.WARNING, MTWCoreUI.PLUGIN_ID,
- "Target file already exists. It will be overwritten.");
- } else {
- return status;
- }
- }
- }
- }
- }
-
- public Control getControl() {
- return root;
- }
-
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/ConsoleFactory.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/**
- * Copyright (c) 2009 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.mtw.ui;
-
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IConsoleFactory;
-import org.eclipse.ui.console.IConsoleManager;
-import org.eclipse.ui.console.MessageConsole;
-import org.eclipse.ui.console.MessageConsoleStream;
-
-public class ConsoleFactory implements IConsoleFactory {
-
- private static MessageConsole console;
-
- public void openConsole() {
- getConsole();
- console.activate();
- }
-
- public static MessageConsoleStream createStream() {
- getConsole();
- return console.newMessageStream();
- }
-
- public static void activateConsole() {
- getConsole();
- console.activate();
- }
-
- private synchronized static MessageConsole getConsole() {
- if (console == null) {
- console = new MessageConsole("Mobile Web Console", null, true);
- IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
- consoleManager.addConsoles(new IConsole[]{console});
- }
- return console;
- }
-
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/Images.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +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.mtw.ui;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-
-public final class Images {
- private final String DISCOVER_ICON = "icons/full/obj16/discover.gif";
- private final String EXCLUDED_ICON = "icons/full/obj16/excluded.gif";
- private final String BLUETOOTH_ICON = "icons/full/obj16/bluetooth.gif";
-
- private final ImageRegistry registry;
-
- Images(final ImageRegistry registry) {
- this.registry = registry;
- add(registry, DISCOVER_ICON);
- add(registry, EXCLUDED_ICON);
- add(registry, BLUETOOTH_ICON);
- }
-
- private void add(final ImageRegistry registry, String icon) {
- ImageDescriptor descriptor = MTWCoreUI.imageDescriptorFromPlugin(MTWCoreUI.PLUGIN_ID, icon);
- registry.put(icon, descriptor);
- }
-
- public Image getDiscoverButtonIcon() {
- return registry.get(DISCOVER_ICON);
- }
-
- public ImageDescriptor getExcludedIconDescriptor() {
- return registry.getDescriptor(EXCLUDED_ICON);
- }
-
- public ImageDescriptor getBluetoothImageDescriptor() {
- return registry.getDescriptor(BLUETOOTH_ICON);
- }
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/MTWCoreUI.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-package org.symbian.tools.mtw.ui;
-
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.internal.deployment.DeploymentTargetPresentationsManager;
-import org.symbian.tools.mtw.internal.deployment.DeploymentTargetTypesRegistry;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class MTWCoreUI extends AbstractUIPlugin {
- private final Map<IProject, ProjectMemo> MEMOS = new WeakHashMap<IProject, ProjectMemo>();
- private final DeploymentTargetTypesRegistry typesRegistry = new DeploymentTargetTypesRegistry();
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.symbian.tools.mtw.ui"; //$NON-NLS-1$
-
- // The shared instance
- private static MTWCoreUI plugin;
- private Images images;
- private final DeploymentTargetPresentationsManager presentations = new DeploymentTargetPresentationsManager();
-
- /**
- * The constructor
- */
- public MTWCoreUI() {
- }
-
- @Override
- protected void initializeImageRegistry(ImageRegistry reg) {
- super.initializeImageRegistry(reg);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static MTWCoreUI getDefault() {
- return plugin;
- }
-
- public static void log(String message, Exception e) {
- getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, e));
- }
-
- public static void log(String message, Object... args) {
- log(String.format(message, args), (Exception) null);
- }
-
- public static void log(Exception e) {
- log(null, e);
- }
-
- public static ProjectMemo getMemo(IMTWProject project) {
- return getDefault().getMemoForProject(project);
- }
-
- private synchronized ProjectMemo getMemoForProject(IMTWProject project) {
- ProjectMemo memo = MEMOS.get(project.getProject());
- if (memo == null) {
- memo = new ProjectMemo(project);
- MEMOS.put(project.getProject(), memo);
- }
- return memo;
- }
-
- public DeploymentTargetTypesRegistry getDeploymentTypesRegistry() {
- return typesRegistry;
- }
-
- public static Images getImages() {
- if (getDefault().images == null) {
- getDefault().images = new Images(getDefault().getImageRegistry());
- }
- return getDefault().images;
- }
-
- public DeploymentTargetPresentationsManager getPresentations() {
- return presentations;
- }
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/ProjectMemo.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +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.mtw.ui;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.XMLMemento;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTarget;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTargetType;
-
-public class ProjectMemo {
- private static final String TARGET_TYPE = "typeId";
- private static final String TARGET = "targetId";
- private static final String TARGET_CONFIGURATION = "target";
- private static final String MEMO_TYPE = "deployment";
-
- private final IMTWProject project;
- private XMLMemento memento;
-
- public ProjectMemo(IMTWProject project) {
- this.project = project;
- }
-
- public synchronized void setDeploymentTarget(String providerId, IDeploymentTarget target) {
- try {
- checkMemento();
- memento.putString(TARGET_TYPE, providerId);
- memento.putString(TARGET, target.getId());
- IMemento child = null;
- IMemento[] children = memento.getChildren(TARGET_CONFIGURATION);
- for (IMemento memento : children) {
- if (providerId.equals(memento.getString(TARGET_TYPE))
- && target.getId().equals(memento.getString(TARGET))) {
- child = memento;
- }
- }
- if (child == null) {
- child = memento.createChild(TARGET_CONFIGURATION);
- child.putString(TARGET_TYPE, providerId);
- child.putString(TARGET, target.getId());
- }
- target.save(child);
- saveMemento();
- } catch (CoreException e) {
- MTWCoreUI.log(e);
- } catch (IOException e) {
- MTWCoreUI.log(e);
- }
- }
-
- private void saveMemento() throws IOException, CoreException {
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- final Writer writer = new OutputStreamWriter(os);
- memento.save(writer);
- writer.close();
- final InputStream stream = new ByteArrayInputStream(os.toByteArray());
- IFile file = getMemoFile();
- if (file.exists()) {
- file.setContents(stream, IFile.KEEP_HISTORY, null);
- } else {
- file.create(stream, false, null);
- }
- }
-
- private IFile getMemoFile() {
- return project.getProject().getFile(new Path(".settings").append(MTWCoreUI.PLUGIN_ID).addFileExtension("xml"));
- }
-
- private void checkMemento() throws CoreException, IOException {
- IFile memoFile = getMemoFile();
- if (memoFile.exists()) {
- memento = XMLMemento.createReadRoot(new InputStreamReader(memoFile.getContents(), memoFile.getCharset()));
- } else {
- memento = XMLMemento.createWriteRoot(MEMO_TYPE);
- }
- }
-
- public IDeploymentTarget getPreviousDeploymentTarget() {
- try {
- checkMemento();
- String type = memento.getString(TARGET_TYPE);
- if (type != null) {
- final IDeploymentTargetType provider = MTWCoreUI.getDefault().getDeploymentTypesRegistry()
- .getType(type);
- if (provider != null) {
- IDeploymentTarget target = provider.findTarget(project, memento.getString(TARGET));
- if (target != null) {
- return target;
- }
- }
- }
- } catch (CoreException e) {
- MTWCoreUI.log(e);
- } catch (IOException e) {
- MTWCoreUI.log(e);
- }
- return null;
- }
-
- public IMemento getMemo(String targetType, IDeploymentTarget target) {
- if (memento != null) {
- IMemento[] children = memento.getChildren(TARGET_CONFIGURATION);
- for (IMemento memento : children) {
- if (targetType.equals(memento.getString(TARGET_TYPE))
- && target.getId().equals(memento.getString(TARGET))) {
- return memento;
- }
- }
- }
- return null;
- }
-
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/UIUtils.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/**
- * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of the License "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Symbian Foundation - initial contribution.
- * Contributors:
- * Description:
- * Overview:
- * Details:
- * Platforms/Drives/Compatibility:
- * Assumptions/Requirement/Pre-requisites:
- * Failures and causes:
- */
-package org.symbian.tools.mtw.ui;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.symbian.tools.mtw.core.MTWCore;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-
-public class UIUtils {
- public static IMTWProject getProjectFromCommandContext(ExecutionEvent event) {
- IResource resource = null;
- IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
- if (activePart instanceof IEditorPart) {
- resource = (IResource) ((IEditorPart) activePart).getEditorInput().getAdapter(IResource.class);
- } else {
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
- Object[] array = ((IStructuredSelection) selection).toArray();
- if (array.length == 1 && array[0] instanceof IAdaptable) {
- resource = (IResource) ((IAdaptable) array[0]).getAdapter(IResource.class);
- }
- }
- }
- if (resource != null) {
- IProject project = resource.getProject();
- return MTWCore.getDefault().create(project);
- }
- return null;
- }
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/commands/DeployHandler.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +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.mtw.ui.commands;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.symbian.tools.mtw.core.MTWCore;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.ui.UIUtils;
-import org.symbian.tools.mtw.ui.deployment.DeployWizard;
-
-/**
- * Our sample handler extends AbstractHandler, an IHandler base class.
- * @see org.eclipse.core.commands.IHandler
- * @see org.eclipse.core.commands.AbstractHandler
- */
-public class DeployHandler extends AbstractHandler {
- /**
- * The constructor.
- */
- public DeployHandler() {
- }
-
- /**
- * the command has been executed, so extract extract the needed information
- * from the application context.
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
-
- final IMTWProject project = UIUtils.getProjectFromCommandContext(event);
- if (project != null) {
- window.getActivePage().saveAllEditors(true);
- if (validate(project, window)) {
- new WizardDialog(window.getShell(), new DeployWizard(project)).open();
- }
- }
-
- return null;
- }
-
- private boolean validate(final IMTWProject project, final IWorkbenchWindow window) {
- final boolean[] retvalue = { false };
- final ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell());
- try {
- dialog.run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- retvalue[0] = project.validate(monitor);
- }
- });
- } catch (InvocationTargetException e) {
- MTWCore.log(null, e);
- } catch (InterruptedException e) {
- MTWCore.log(null, e);
- }
- if (!retvalue[0]) {
- retvalue[0] = MessageDialog.openQuestion(window.getShell(), "Deploying Mobile Web Project",
- String.format("Project %s has errors. Are you sure you want to deploy it?", project.getName()));
- if (!retvalue[0]) {
- try {
- window.getActivePage().showView(IPageLayout.ID_PROBLEM_VIEW);
- } catch (PartInitException e) {
- MTWCore.log(null, e);
- }
- }
- }
- return retvalue[0];
- }
-
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/deployment/DeployWizard.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +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.mtw.ui.deployment;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.MultiRule;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.statushandlers.StatusManager;
-import org.symbian.tools.mtw.core.MTWCore;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.core.runtimes.IPackager;
-import org.symbian.tools.mtw.internal.deployment.DeployWizardContext;
-import org.symbian.tools.mtw.internal.deployment.DeploymentTargetWizardPage;
-import org.symbian.tools.mtw.internal.deployment.DeploymentTargetWrapper;
-import org.symbian.tools.mtw.ui.MTWCoreUI;
-import org.symbian.tools.mtw.ui.ProjectMemo;
-
-public final class DeployWizard extends Wizard {
- private final DeployWizardContext context;
- private final IMTWProject project;
-
- public DeployWizard(IMTWProject project) {
- this.project = project;
- setNeedsProgressMonitor(true);
- setWindowTitle("Deploy WRT Application");
- context = new DeployWizardContext(project);
- }
-
- @Override
- public void addPages() {
- addPage(new DeploymentTargetWizardPage(context, MTWCoreUI.getMemo(project)));
- }
-
- @Override
- public boolean performFinish() {
- final DeploymentTargetWrapper target = context.getTarget();
- if (target.getType().isLongRunning()) {
- DeployJob job = new DeployJob(context.getProject(), target);
- job.schedule();
- return true;
- } else {
- final IStatus[] retval = new IStatus[1];
- try {
- getContainer().run(false, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- retval[0] = doDeploy(target, context.getProject(), monitor);
- }
- });
- } catch (InvocationTargetException e) {
- MTWCoreUI.log(e);
- } catch (InterruptedException e) {
- MTWCoreUI.log(e);
- }
- switch (retval[0].getSeverity()) {
- case IStatus.ERROR:
- StatusManager.getManager().handle(retval[0], StatusManager.SHOW | StatusManager.BLOCK);
- return false;
- case IStatus.WARNING:
- StatusManager.getManager().handle(retval[0], StatusManager.SHOW | StatusManager.BLOCK);
- default:
- return true;
- }
- }
- }
-
- @Override
- public boolean needsPreviousAndNextButtons() {
- return false;
- }
-
- private IStatus doDeploy(DeploymentTargetWrapper target, IMTWProject project, IProgressMonitor monitor) {
- IStatus status;
- try {
- IPackager packager = MTWCore.getDefault().getRuntimesManager().getPackager(project);
- status = target.deploy(project, packager, monitor);
- } catch (CoreException e) {
- status = e.getStatus();
- }
- ProjectMemo memo = MTWCoreUI.getMemo(project);
- memo.setDeploymentTarget(target.getProviderId(), target);
- return status;
- }
-
- private final class DeployJob extends Job {
- private final DeploymentTargetWrapper target;
- private final IMTWProject project;
-
- private DeployJob(IMTWProject project, DeploymentTargetWrapper deploymentTarget) {
- super(String.format("Deploying %s to %s", project.getName(), deploymentTarget.getName()));
- ISchedulingRule rule = deploymentTarget.getType().getSchedulingRule(deploymentTarget.getActualTarget());
- if (rule != null) {
- rule = MultiRule.combine(rule, project.getProject());
- } else {
- rule = project.getProject();
- }
- setRule(rule);
- setUser(true);
- this.project = project;
- this.target = deploymentTarget;
- }
-
- public IStatus run(IProgressMonitor monitor) {
- final IStatus status = doDeploy(target, project, monitor);
- if (status.getSeverity() != IStatus.ERROR && status.getSeverity() != IStatus.WARNING) {
- StatusManager.getManager().handle(status, StatusManager.SHOW);
- }
- return status;
- }
-
- }
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/deployment/IDeploymentTarget.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +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.mtw.ui.deployment;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.ui.IMemento;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.core.runtimes.IPackager;
-
-/**
- * <p>This is particular deployment target instance. It can be a Bluetooth phone
- * connection, installed device emulator, FTP server, etc.</p>
- *
- * <p>Targets can be cached and {@link #setProject(WRTProject)} will be called
- * if active project was changed. Targets are single-threaded. This class
- * methods can be called from non-SWT thread.</p>
- *
- * <p>Following adapters can be provided by either overriding getAdapter method
- * or by contributing to org.eclipse.core.runtime.adapters extension point:</p>
- * <ul><li>{@link org.eclipse.ui.IPersistable} - to persist advanced per-
- * project target configuration</li><li>
- * {@link org.eclipse.ui.model.IWorkbenchAdapter} or
- * {@link org.eclipse.ui.model.IWorkbenchAdapter2} to customize target
- * presentation in IDE user interface.</li></ul>
- *
- * <p>Overwriting <code>equals</code> and <code>hashCode</code> might be desirable
- * if new objects are created each time user does discovery process.</p>
- * @author Eugene Ostroukhov (eugeneo@symbian.org)
- */
-public interface IDeploymentTarget extends IAdaptable {
- /**
- * Returns unique ID. There is no restriction on ID string format. Cannot
- * be <code>null</code>
- */
- String getId();
-
- /**
- * <p>Returns user-readable name. Can be null if
- * {@link org.eclipse.ui.model.IWorkbenchAdapter} is provided.<p>
- * <p>Name is not used for purposes other then presentation and may change
- * between invocations</p>
- */
- String getName();
-
- /**
- * Provides more details about target. This information is only displayed
- * to the user and is not important for the application.
- */
- String getDescription();
-
- /**
- * Deploy application to this target.
- *
- * @param project project to deploy to the target
- * @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;
-
- /**
- * Save project-specific settings to the memento. Workspace-wide settings
- * should be managed separately.
- */
- void save(IMemento memento);
-
- /**
- * Initialize target for project deployment.
- */
- void init(IMTWProject project, IPackager packager, IMemento memento);
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/deployment/IDeploymentTargetType.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +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.mtw.ui.deployment;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-
-/**
- * This interface is for deployment targets providers.
- *
- * @author Eugene
- */
-public interface IDeploymentTargetType {
- /**
- * Returns list of the targets that accept provided project. Project
- * cannot be <code>null</code>.
- * @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);
-
- /**
- * Discovers targets. This can be a long-running task and in most cases
- * will be triggered by the user.
- */
- void discoverTargets(IProgressMonitor monitor) throws CoreException;
-
- /**
- * Find target based on project and target ID. This method returns
- * <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);
-
- /**
- * Return <code>false</code> if user needs to trigger long-running
- * discovery to see all potential deployment targets.
- */
- boolean targetsDiscovered();
-
- /**
- * @param target that will be used by a {@link org.eclipse.core.runtime.jobs.Job}
- * @return scheduling rule that will be used to properly schedule jobs to
- * avoid resource access conflicts. Can be <code>null</code>
- */
- ISchedulingRule getSchedulingRule(IDeploymentTarget target);
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/deployment/ITargetDetailsPane.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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.mtw.ui.deployment;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * Objects of this class provide UI for the users to visualize or configure
- * their deployment targets. This object will not be reused between wizard
- * deployment wizard restarts.
- * There will be one instance for the target type. This object will not be
- * instantiated for each target.
- *
- * @author Eugene Ostroukhov (eugeneo@symbian.org)
- */
-public interface ITargetDetailsPane {
- interface Context {
- void revalidate();
- }
- void init(Context page);
- void setTarget(IDeploymentTarget target);
- void createControl(Composite parent);
- Control getControl();
- IStatus validate();
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/deployment/bluetooth/BluetoothRule.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-package org.symbian.tools.mtw.ui.deployment.bluetooth;
-
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-
-public class BluetoothRule implements ISchedulingRule {
- public static final ISchedulingRule INSTANCE = new BluetoothRule();
-
- private BluetoothRule() {
- // No instantiation
- }
-
- public boolean contains(ISchedulingRule rule) {
- return isConflicting(rule);
- }
-
- public boolean isConflicting(ISchedulingRule rule) {
- return rule instanceof BluetoothRule;
- }
-
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/deployment/bluetooth/BluetoothTarget.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,321 +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.mtw.ui.deployment.bluetooth;
-
-import java.io.EOFException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.text.MessageFormat;
-import java.util.Collection;
-import java.util.LinkedList;
-
-import javax.bluetooth.BluetoothConnectionException;
-import javax.bluetooth.BluetoothStateException;
-import javax.bluetooth.DeviceClass;
-import javax.bluetooth.DiscoveryListener;
-import javax.bluetooth.LocalDevice;
-import javax.bluetooth.RemoteDevice;
-import javax.bluetooth.ServiceRecord;
-import javax.bluetooth.UUID;
-import javax.microedition.io.Connector;
-import javax.obex.ClientSession;
-import javax.obex.HeaderSet;
-import javax.obex.Operation;
-import javax.obex.ResponseCodes;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.ui.IMemento;
-import org.symbian.tools.mtw.core.MTWCore;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.core.runtimes.IPackager;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTarget;
-
-public class BluetoothTarget extends PlatformObject implements IDeploymentTarget {
- private static final UUID OBEX_OBJECT_PUSH = new UUID(0x1105);
- private String serviceURL;
- private RemoteDevice device;
- protected String[] exceptionCodes = new String[] { "OBEX_HTTP_UNSUPPORTED_TYPE", "OBEX_HTTP_FORBIDDEN" };
- private String message = "Deployment was successful. Please follow on-screen instructions to complete application deployment on your device.";
- private final String name;
- private final BluetoothTargetType provider;
- private final Collection<IStatus> statuses = new LinkedList<IStatus>();
-
- public BluetoothTarget(String name, RemoteDevice device, BluetoothTargetType provider) {
- this.name = name;
- this.device = device;
- this.provider = provider;
- }
-
- public IStatus deploy(IMTWProject 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),
- IProgressMonitor.UNKNOWN);
- final File application = packager.packageApplication(project, new SubProgressMonitor(monitor, 100));
- try {
- deployWidget(application, packager.getFileType(project), new SubProgressMonitor(monitor, 10));
- } finally {
- application.delete();
- }
- monitor.done();
- MultiStatus multiStatus = new MultiStatus(MTWCore.PLUGIN_ID, 0, message, null);
- for (IStatus status : statuses) {
- multiStatus.add(status);
- }
- return multiStatus;
- }
-
- private void deployWidget(File inputWidget, String fileType, IProgressMonitor progressMonitor) throws CoreException {
- if (device == null) {
- provider.discoverTargets(new SubProgressMonitor(progressMonitor, 10));
- if (device == null) {
- throw new CoreException(new Status(IStatus.ERROR, MTWCore.PLUGIN_ID, String.format(
- "Device %s is not available", name)));
- }
- }
- progressMonitor.beginTask("Deploying application", IProgressMonitor.UNKNOWN);
- InputStream in = null;
- OutputStream os = null;
- Operation putOperation = null;
- ClientSession clientSession = null;
- try {
- if (!provider.isBloothToothConnected()) {
- String msg = "Bluetooth is either disabled or not present in the system.";
- emitStatus(IStatus.ERROR, msg, progressMonitor);
- return;
- }
-
- String message = MessageFormat.format("Searching for the service for the selected device \"{0}\"",
- new Object[] { getName() });
- emitStatus(IStatus.OK, message, progressMonitor);
- String servicesFound = getServicesFound();
- if (servicesFound == null || servicesFound.length() < 1) {
- message = MessageFormat.format("Cannot find service to the device \"{0}\"", new Object[] { getName() });
- emitStatus(IStatus.ERROR, message, progressMonitor);
- return;
- }
-
- message = MessageFormat.format("Service for the device \"{0}\" found", new Object[] { getName() });
- emitStatus(IStatus.OK, message, progressMonitor);
-
- clientSession = (ClientSession) Connector.open(servicesFound);
- HeaderSet hsConnectReply = clientSession.connect(null);
- if (hsConnectReply.getResponseCode() != ResponseCodes.OBEX_HTTP_OK) {
- emitStatus(IStatus.OK, "Failed to connect to the service", progressMonitor);
- }
-
- emitStatus(IStatus.OK, "Deployment Started", progressMonitor);
-
- HeaderSet hsOperation = clientSession.createHeaderSet();
-
- if (progressMonitor.isCanceled()) {
- emitStatus(IStatus.CANCEL, "Deployment was canceled", progressMonitor);
- return;
- }
-
- // Send widget to server
- in = new FileInputStream(inputWidget);
- message = MessageFormat.format("Deploying file from {0}", new Object[] { inputWidget.getAbsolutePath() });
- emitStatus(IStatus.OK, message, progressMonitor);
-
- hsOperation.setHeader(HeaderSet.NAME, inputWidget.getName());
- hsOperation.setHeader(HeaderSet.TYPE, fileType);
- int size = (int) inputWidget.length();
- byte file[] = new byte[size];
- hsOperation.setHeader(HeaderSet.LENGTH, new Long(file.length));
-
- // Create PUT Operation
- putOperation = clientSession.put(hsOperation);
-
- os = putOperation.openOutputStream();
-
- long start = System.currentTimeMillis();
-
- byte[] buf = new byte[16 * 1024];
- int len;
- while ((len = in.read(buf)) > 0) {
- os.write(buf, 0, len);
- if (progressMonitor.isCanceled()) {
- putOperation.abort();
- emitStatus(IStatus.CANCEL, "Deployment was canceled", progressMonitor);
- return;
- }
- }
-
- os.flush();
- os.close();
-
- long elapsed = System.currentTimeMillis() - start;
- emitStatus(IStatus.OK, "elapsed time: " + elapsed / 1000.0 + " seconds", progressMonitor);
-
- int responseCode = putOperation.getResponseCode();
- if (responseCode == ResponseCodes.OBEX_HTTP_OK) {
- message = MessageFormat.format("File deployed to {0}", new Object[] { getName() });
- emitStatus(IStatus.OK, message, progressMonitor);
- } else {
- message = "Error during deployment, OBEX error: " + responseCode;
- emitStatus(IStatus.ERROR, message, progressMonitor);
- }
-
- } catch (BluetoothConnectionException x) {
- String message = getExceptionMessage(x.getMessage());
- emitStatus(IStatus.ERROR, message, progressMonitor);
- } catch (IOException e) {
- String message = getExceptionMessage(e.getMessage());
- emitStatus(IStatus.ERROR, message, progressMonitor);
- } finally {
- try {
- if (in != null) {
- in.close();
- }
- if (putOperation != null) {
- putOperation.close();
- }
- if (clientSession != null) {
- clientSession.disconnect(null);
- clientSession.close();
- }
- } catch (EOFException eof) {
- // EOFException is now caught
- // Ignore the error since deployment has already completed
- //Activator.log(IStatus.ERROR, "EOF encountered while cleaning up Bluetooth deployment", eof);
- } catch (IOException x) {
- MTWCore.log("Error cleaning up BlueTooth deployment", x);
- }
- }
- return;
- }
-
- protected void emitStatus(int severity, String statusDescription, IProgressMonitor monitor) {
- statuses.add(new Status(severity, MTWCore.PLUGIN_ID, statusDescription));
- monitor.setTaskName(statusDescription);
- if (severity != IStatus.OK) {
- message = statusDescription;
- }
- }
-
- /**
- * Returns the customized methods from the exception error code. If it
- * matches it returns the customized message else returns the exception itself
- * @param message exception message
- * @return the customized message
- */
- protected String getExceptionMessage(String message) {
-
- if (message.contains(exceptionCodes[0])) {
- return "Device does not support the widget deployment";
- } else if (message.contains(exceptionCodes[1])) {
- return "Deployment rejected by the device";
- }
- return message;
- }
-
- public String getId() {
- return getName();
- }
-
- public String getName() {
- return name;
- }
-
- private String getServicesFound() {
- try {
- serviceURL = "";
- UUID serviceUUID = OBEX_OBJECT_PUSH;
-
- final Object serviceSearchCompletedEvent = new Object();
-
- DiscoveryListener listener = new DiscoveryListener() {
-
- public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) {
- }
-
- public void inquiryCompleted(int discType) {
- }
-
- public void servicesDiscovered(int transID, ServiceRecord[] servRecord) {
- try {
- for (int i = 0; i < servRecord.length; i++) {
- if (servRecord[i].getHostDevice().getFriendlyName(false).equals(name)) {
- serviceURL = servRecord[i].getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT,
- false);
- }
- }
- } catch (BluetoothStateException e) {
- MTWCore.log(e.getMessage(), e);
- } catch (IOException e) {
- MTWCore.log(e.getMessage(), e);
- }
- }
-
- public void serviceSearchCompleted(int transID, int respCode) {
- synchronized (serviceSearchCompletedEvent) {
- serviceSearchCompletedEvent.notifyAll();
- }
- }
-
- };
-
- UUID[] searchUuidSet = new UUID[] { serviceUUID };
- int[] attrIDs = new int[] { 0x0100 }; // Service name
-
- synchronized (serviceSearchCompletedEvent) {
- LocalDevice.getLocalDevice().getDiscoveryAgent()
- .searchServices(attrIDs, searchUuidSet, device, listener);
- serviceSearchCompletedEvent.wait();
- }
-
- } catch (IOException e) {
- MTWCore.log("Error in Bluetooth service discovery", e);
- } catch (InterruptedException e) {
- MTWCore.log("Error in Bluetooth service discovery", e);
- }
- return serviceURL;
- }
-
- public void init(IMTWProject project, IPackager packager, IMemento memento) {
- // nothing
- }
-
- public void save(IMemento memento) {
- // nothing
- }
-
- public void setAddress(RemoteDevice device) {
- this.device = device;
- }
-
- public boolean isDiscovered() {
- return device != null;
- }
-
- public String getDescription() {
- return device == null ? "This device was remembered from past sessions and may not be available" : String
- .format("Remote device with address %s", device.getBluetoothAddress());
- }
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/deployment/bluetooth/BluetoothTargetAdapterFactory.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +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.mtw.ui.deployment.bluetooth;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.model.IWorkbenchAdapter2;
-
-@SuppressWarnings({ "unchecked", "rawtypes" })
-public class BluetoothTargetAdapterFactory implements IAdapterFactory {
- private final BluetoothTargetWorkbenchAdapter workbenchAdapter = new BluetoothTargetWorkbenchAdapter();
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if ((adapterType.isAssignableFrom(IWorkbenchAdapter.class) || adapterType
- .isAssignableFrom(IWorkbenchAdapter2.class)) && adaptableObject instanceof BluetoothTarget) {
- return workbenchAdapter;
- }
- return null;
- }
-
- public Class[] getAdapterList() {
- return new Class[] { IWorkbenchAdapter2.class, IWorkbenchAdapter.class };
- }
-
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/deployment/bluetooth/BluetoothTargetType.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +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.mtw.ui.deployment.bluetooth;
-
-import java.io.IOException;
-import java.io.PrintStream;
-import java.util.Collection;
-import java.util.Map;
-import java.util.TreeMap;
-
-import javax.bluetooth.BluetoothStateException;
-import javax.bluetooth.DeviceClass;
-import javax.bluetooth.DiscoveryAgent;
-import javax.bluetooth.DiscoveryListener;
-import javax.bluetooth.LocalDevice;
-import javax.bluetooth.RemoteDevice;
-import javax.bluetooth.ServiceRecord;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.ui.ConsoleFactory;
-import org.symbian.tools.mtw.ui.MTWCoreUI;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTarget;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTargetType;
-
-import com.intel.bluetooth.BlueCoveImpl;
-
-/**
- * Discovers Bluetooth-enabled devices. This code is generic and will not
- * perform any checks if the discovered device can run application being
- * deployed.
- *
- * @author Eugene Ostroukhov (eugeneo@symbian.org)
- */
-public class BluetoothTargetType implements IDeploymentTargetType {
- private final class WrtDiscoveryListener implements DiscoveryListener {
- final Object inquiryCompletedEvent;
- boolean isCanceled;
- final Map<String, BluetoothTarget> prevTargets;
- final IProgressMonitor progressMonitor;
-
- private WrtDiscoveryListener(Map<String, BluetoothTarget> previousTargets, Object inquiryCompletedEvent,
- IProgressMonitor progressMonitor) {
- this.prevTargets = previousTargets;
- this.inquiryCompletedEvent = inquiryCompletedEvent;
- this.progressMonitor = progressMonitor;
- }
-
- private void checkCanceled() {
- if (!isCanceled && progressMonitor != null) {
- if (progressMonitor.isCanceled()) {
- try {
- LocalDevice.getLocalDevice().getDiscoveryAgent().cancelInquiry(listener);
- } catch (BluetoothStateException e) {
- MTWCoreUI.log(e);
- }
- }
- }
- }
-
- public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) {
- try {
- final String name = btDevice.getFriendlyName(false);
- if (name != null && name.length() > 0) {
- final BluetoothTarget target = prevTargets.get(name);
- if (target != null) {
- target.setAddress(btDevice);
- targets.put(name, target);
- } else {
- targets.put(name, new BluetoothTarget(name, btDevice, BluetoothTargetType.this));
- }
- checkCanceled();
- }
- } catch (BluetoothStateException e) {
- MTWCoreUI.log(e.getMessage(), e);
- } catch (IOException e) {
- MTWCoreUI.log(e.getMessage(), e);
- }
- }
-
- public void inquiryCompleted(int discType) {
- synchronized (inquiryCompletedEvent) {
- inquiryCompletedEvent.notifyAll();
- }
- }
-
- public void servicesDiscovered(int transID, ServiceRecord[] servRecord) {
- }
-
- public void serviceSearchCompleted(int transID, int respCode) {
- }
- }
-
- private static PrintStream savedSysOut;
- private boolean discovered = false;
- private WrtDiscoveryListener listener;
- private Map<String, BluetoothTarget> targets = new TreeMap<String, BluetoothTarget>();
-
- public BluetoothTargetType() {
- // set parameters for BlueCove
- String param = Integer.toString(65 * 1024);
- System.setProperty("bluecove.obex.mtu", param);
- BlueCoveImpl.setConfigProperty("bluecove.obex.mtu", param);
- }
-
- public void discoverTargets(IProgressMonitor monitor) throws CoreException {
- if (!isBloothToothConnected()) {
- throw new CoreException(new Status(IStatus.ERROR, MTWCoreUI.PLUGIN_ID, "Bluetooth is not available"));
- }
- monitor.beginTask("Discovering Bluetooth devices", IProgressMonitor.UNKNOWN);
- final Object inquiryCompletedEvent = new Object();
- final Map<String, BluetoothTarget> previousTargets = targets;
- targets = new TreeMap<String, BluetoothTarget>();
-
- listener = new WrtDiscoveryListener(previousTargets, inquiryCompletedEvent, monitor);
-
- synchronized (inquiryCompletedEvent) {
- boolean started;
- try {
- started = LocalDevice.getLocalDevice().getDiscoveryAgent().startInquiry(DiscoveryAgent.GIAC, listener);
- if (started) {
- inquiryCompletedEvent.wait();
- discovered = true;
- }
- } catch (BluetoothStateException e) {
- MTWCoreUI.log(e.getMessage(), e);
- } catch (InterruptedException e) {
- MTWCoreUI.log(e.getMessage(), e);
- }
- }
- monitor.done();
- }
-
- /** Toggle BlueCove logging
- */
- public void enableBlueCoveDiagnostics(boolean enable) {
- System.setProperty("bluecove.debug", Boolean.valueOf(enable).toString());
- BlueCoveImpl.instance().enableNativeDebug(enable);
- if (enable) {
- System.setOut(new PrintStream(ConsoleFactory.createStream()));
- } else {
- System.setOut(savedSysOut);
- }
- }
-
- public IDeploymentTarget findTarget(IMTWProject project, String id) {
- if (!isBloothToothConnected()) {
- return null;
- }
- if (discovered) {
- return targets.get(id);
- } else {
- BluetoothTarget target = targets.get(id);
- if (target == null) {
- target = new BluetoothTarget(id, null, this);
- targets.put(id, target);
- }
- return target;
- }
- }
-
- public IDeploymentTarget[] getTargets(IMTWProject project) {
- if (targets != null) {
- final Collection<BluetoothTarget> values = targets.values();
- return values.toArray(new IDeploymentTarget[values.size()]);
- } else {
- return null;
- }
- }
-
- /**
- * Check whether the bluetooth is on or not.
- *
- * @return whether the device is on.
- */
- public boolean isBloothToothConnected() {
- return LocalDevice.isPowerOn();
- }
-
- public boolean targetsDiscovered() {
- return discovered;
- }
-
- public ISchedulingRule getSchedulingRule(IDeploymentTarget target) {
- return BluetoothRule.INSTANCE;
- }
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/deployment/bluetooth/BluetoothTargetWorkbenchAdapter.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +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.mtw.ui.deployment.bluetooth;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.model.IWorkbenchAdapter2;
-import org.symbian.tools.mtw.ui.MTWCoreUI;
-
-public class BluetoothTargetWorkbenchAdapter implements IWorkbenchAdapter, IWorkbenchAdapter2 {
- public RGB getForeground(Object element) {
- final BluetoothTarget target = (BluetoothTarget) element;
- if (!target.isDiscovered()) {
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getDisplay()
- .getSystemColor(SWT.COLOR_DARK_GRAY).getRGB();
- }
- return null;
- }
-
- public RGB getBackground(Object element) {
- return null;
- }
-
- public FontData getFont(Object element) {
- return null;
- }
-
- public Object[] getChildren(Object o) {
- return null;
- }
-
- public ImageDescriptor getImageDescriptor(Object object) {
- return MTWCoreUI.getImages().getBluetoothImageDescriptor();
- }
-
- public String getLabel(Object o) {
- final BluetoothTarget target = (BluetoothTarget) o;
- return target.getName();
- }
-
- public Object getParent(Object o) {
- return null;
- }
-
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/navigator/PackagingInformationDecorator.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +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.mtw.ui.navigator;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.IDecoration;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ILightweightLabelDecorator;
-import org.symbian.tools.mtw.core.MTWCore;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.core.runtimes.IPackager;
-import org.symbian.tools.mtw.ui.MTWCoreUI;
-
-public class PackagingInformationDecorator implements ILightweightLabelDecorator {
-
- public void decorate(Object element, IDecoration decoration) {
- IResource resource = null;
- if (element instanceof IResource) {
- resource = (IResource) element;
- } else if (element instanceof IAdaptable) {
- resource = (IResource) ((IAdaptable) element).getAdapter(IResource.class);
- }
- if (resource != null && resource.isAccessible()) {
- IMTWProject project = MTWCore.getDefault().create(resource.getProject());
- if (project != null) {
- IPackager packager = MTWCore.getDefault().getRuntimesManager().getPackager(project);
- if (packager.getPathInPackage(resource) != null) {
- decoration.addOverlay(MTWCoreUI.getImages().getExcludedIconDescriptor(), IDecoration.TOP_RIGHT);
- }
- }
- }
- }
-
- public void addListener(ILabelProviderListener listener) {
- // Do nothing
-
- }
-
- public void dispose() {
- // Do nothing
-
- }
-
- public boolean isLabelProperty(Object element, String property) {
- // Do nothing
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- // Do nohing
-
- }
-
-}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/navigator/RenameMoveActionProvider.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +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.mtw.ui.navigator;
-
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.navigator.CommonActionProvider;
-import org.eclipse.ui.navigator.ICommonActionExtensionSite;
-import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
-import org.eclipse.wst.jsdt.ui.IContextMenuConstants;
-import org.eclipse.wst.jsdt.ui.actions.IJavaEditorActionDefinitionIds;
-import org.eclipse.wst.jsdt.ui.actions.JdtActionConstants;
-import org.eclipse.wst.jsdt.ui.actions.MoveAction;
-import org.eclipse.wst.jsdt.ui.actions.RenameAction;
-import org.eclipse.wst.jsdt.ui.actions.SelectionDispatchAction;
-
-public class RenameMoveActionProvider extends CommonActionProvider {
- private SelectionDispatchAction fMoveAction;
- private SelectionDispatchAction fRenameAction;
-
- private final Collection<IAction> fActions = new HashSet<IAction>();
-
- public void fillActionBars(IActionBars actionBars) {
- if (fActions.size() > 0) {
- actionBars.setGlobalActionHandler(JdtActionConstants.RENAME, fRenameAction);
- actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), fRenameAction);
-
- actionBars.setGlobalActionHandler(JdtActionConstants.MOVE, fMoveAction);
- actionBars.setGlobalActionHandler(ActionFactory.MOVE.getId(), fMoveAction);
- }
- }
-
- public void fillContextMenu(IMenuManager menu) {
- menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, new Separator());
- for (IAction action : fActions) {
- menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, action);
- }
- }
-
- public void init(ICommonActionExtensionSite site) {
- ICommonViewerWorkbenchSite workbenchSite= null;
- if (site.getViewSite() instanceof ICommonViewerWorkbenchSite) {
- workbenchSite= (ICommonViewerWorkbenchSite) site.getViewSite();
- }
-
- // we only initialize the refactor group when in a view part
- // (required for the constructor)
- if (workbenchSite != null) {
- if (workbenchSite.getPart() != null && workbenchSite.getPart() instanceof IViewPart) {
- IViewPart viewPart= (IViewPart) workbenchSite.getPart();
- IWorkbenchPartSite s = viewPart.getSite();
-
- fRenameAction= new RenameAction(s);
- initUpdatingAction(fRenameAction, workbenchSite.getSelectionProvider(), workbenchSite.getSelectionProvider().getSelection(), IJavaEditorActionDefinitionIds.RENAME_ELEMENT);
- fMoveAction= new MoveAction(s);
- initUpdatingAction(fMoveAction, workbenchSite.getSelectionProvider(), workbenchSite.getSelectionProvider().getSelection(), IJavaEditorActionDefinitionIds.RENAME_ELEMENT);
- }
- }
- }
-
- private void initUpdatingAction(SelectionDispatchAction action, ISelectionProvider provider, ISelection selection, String actionDefinitionId){
- action.setActionDefinitionId(actionDefinitionId);
- action.update(selection);
- if (provider != null) {
- provider.addSelectionChangedListener(action);
- }
- fActions.add(action);
- }
-
-
- public void setContext(ActionContext context) {
- // Do nothing
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/deployment/DefaultDeploymentTypePresentation.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,51 @@
+/**
+ * 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.internal.deployment;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
+import org.symbian.tools.tmw.ui.deployment.ITargetDetailsPane;
+
+public class DefaultDeploymentTypePresentation implements ITargetDetailsPane {
+ private Text text;
+
+ public void init(Context page) {
+ }
+
+ public void setTarget(IDeploymentTarget target) {
+ text.setText(target.getDescription());
+ }
+
+ public void createControl(Composite parent) {
+ text = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.READ_ONLY);
+ }
+
+ public Control getControl() {
+ return text;
+ }
+
+ public IStatus validate() {
+ return Status.OK_STATUS;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/deployment/DeployWizardContext.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,93 @@
+/**
+ * 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.internal.deployment;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+
+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.ui.TMWCoreUI;
+
+public class DeployWizardContext {
+ private DeploymentTargetWrapper target;
+ private final IMTWProject project;
+ private boolean logging;
+
+ public DeployWizardContext(IMTWProject project) {
+ this.project = project;
+ }
+
+ public void setTarget(DeploymentTargetWrapper target) {
+ this.target = target;
+ }
+
+ public DeploymentTargetWrapper getTarget() {
+ return target;
+ }
+
+ public IMTWProject getProject() {
+ return project;
+ }
+
+ public DeploymentTargetWrapper[] getDeploymentTargets() {
+ final DeploymentTargetTypeDescriptor[] providers = TMWCoreUI.getDefault().getDeploymentTypesRegistry()
+ .getProviders();
+ Collection<DeploymentTargetWrapper> targets = new HashSet<DeploymentTargetWrapper>();
+
+ for (DeploymentTargetTypeDescriptor provider : providers) {
+ if (provider.supports(project)) {
+ targets.addAll(Arrays.asList(provider.getTargets(project)));
+ }
+ }
+ return targets.toArray(new DeploymentTargetWrapper[targets.size()]);
+ }
+
+ public void doSearch(IProgressMonitor monitor) throws CoreException {
+ final DeploymentTargetTypeDescriptor[] providers = TMWCoreUI.getDefault().getDeploymentTypesRegistry()
+ .getProviders();
+ monitor.beginTask("Discovering deployment targets", providers.length * 10);
+ for (DeploymentTargetTypeDescriptor descriptor : providers) {
+ descriptor.discoverTargets(new SubProgressMonitor(monitor, 10));
+ }
+ monitor.done();
+ }
+
+ public boolean areTargetsReady() {
+ final DeploymentTargetTypeDescriptor[] providers = TMWCoreUI.getDefault().getDeploymentTypesRegistry()
+ .getProviders();
+ for (DeploymentTargetTypeDescriptor descriptor : providers) {
+ if (!descriptor.targetsDiscovered()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void setLogging(boolean logging) {
+ this.logging = logging;
+ }
+
+ public boolean isLogging() {
+ return logging;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/deployment/DeploymentTargetPresentationsManager.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,66 @@
+/**
+ * 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.internal.deployment;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.symbian.tools.tmw.ui.TMWCoreUI;
+import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType;
+import org.symbian.tools.tmw.ui.deployment.ITargetDetailsPane;
+
+public class DeploymentTargetPresentationsManager {
+ private Map<IDeploymentTargetType, IConfigurationElement> presentations;
+
+ public ITargetDetailsPane createDetailsPane(IDeploymentTargetType targetType) {
+ readRegistry();
+ final IConfigurationElement element = presentations.get(targetType);
+ if (element != null && element.getAttribute("detailsPane") != null) {
+ try {
+ return (ITargetDetailsPane) element.createExecutableExtension("detailsPane");
+ } catch (CoreException e) {
+ TMWCoreUI.log(e);
+ }
+ }
+ return new DefaultDeploymentTypePresentation();
+ }
+
+ private synchronized void readRegistry() {
+ if (presentations == null) {
+ presentations = new HashMap<IDeploymentTargetType, IConfigurationElement>();
+ final IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(
+ TMWCoreUI.PLUGIN_ID, "targetPresentation");
+ for (IConfigurationElement element : elements) {
+ final String runtimeId = element.getAttribute("targetTypeId");
+ final IDeploymentTargetType targetType = TMWCoreUI.getDefault().getDeploymentTypesRegistry()
+ .getType(runtimeId);
+ if (targetType == null) {
+ TMWCoreUI.log("Runtime %s was not found. It is referenced from plugin %s", runtimeId, element
+ .getContributor().getName());
+ continue;
+ } else {
+ presentations.put(targetType, element);
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/deployment/DeploymentTargetTypeDescriptor.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,190 @@
+/**
+ * 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.internal.deployment;
+
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+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.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) {
+ return null;
+ }
+
+ public void discoverTargets(IProgressMonitor monitor) throws CoreException {
+ // Do nothing
+ }
+
+ public IDeploymentTarget findTarget(IMTWProject project, String id) {
+ return null;
+ }
+
+ public boolean targetsDiscovered() {
+ return true;
+ }
+
+ public ISchedulingRule getSchedulingRule(IDeploymentTarget target) {
+ return null; // No scheduling
+ }
+ }
+
+ private static final DeploymentTargetWrapper[] NO_TARGETS = new DeploymentTargetWrapper[0];
+ private final IConfigurationElement element;
+ private IDeploymentTargetType type;
+ private final Map<IDeploymentTarget, DeploymentTargetWrapper> wrappers = new WeakHashMap<IDeploymentTarget, DeploymentTargetWrapper>();
+ private ImageDescriptor imageDescriptor = null;
+
+ public DeploymentTargetTypeDescriptor(IConfigurationElement element) {
+ this.element = element;
+ }
+
+ public boolean supports(IMTWProject project) {
+ // We will support more declarative filtering later
+ return true;
+ }
+
+ public DeploymentTargetWrapper[] getTargets(IMTWProject project) {
+ final DeploymentTargetWrapper[] targets = wrap(getProvider().getTargets(project));
+ return targets != null ? targets : NO_TARGETS;
+ }
+
+ private DeploymentTargetWrapper[] wrap(IDeploymentTarget[] targets) {
+ if (targets == null) {
+ return new DeploymentTargetWrapper[0];
+ } else {
+ final DeploymentTargetWrapper[] w = new DeploymentTargetWrapper[targets.length];
+ for (int i = 0; i < targets.length; i++) {
+ w[i] = wrap(targets[i]);
+ }
+ return w;
+ }
+ }
+
+ private DeploymentTargetWrapper wrap(final IDeploymentTarget target) {
+ DeploymentTargetWrapper wrapper = wrappers.get(target);
+ if (wrapper == null) {
+ wrapper = new DeploymentTargetWrapper(target, this);
+ wrappers.put(target, wrapper);
+ }
+ return wrapper;
+ }
+
+ public void discoverTargets(IProgressMonitor monitor) throws CoreException {
+ getProvider().discoverTargets(monitor);
+ }
+
+ public IDeploymentTarget findTarget(IMTWProject project, String id) {
+ return wrap(getProvider().findTarget(project, id));
+ }
+
+ private synchronized IDeploymentTargetType getProvider() {
+ if (type == null) {
+ try {
+ type = (IDeploymentTargetType) element.createExecutableExtension("class");
+ } catch (CoreException e) {
+ TMWCoreUI.log("Cannot instantiate provider " + getId(), e);
+ type = new NullProvider();
+ }
+ }
+ return type;
+ }
+
+ public String getId() {
+ return element.getAttribute("id");
+ }
+
+ public boolean targetsDiscovered() {
+ return getProvider().targetsDiscovered();
+ }
+
+ public int getPriority() {
+ final String attribute = element.getAttribute("priority");
+ if (attribute != null && attribute.trim().length() > 0) {
+ try {
+ return Integer.parseInt(attribute);
+ } catch (NumberFormatException e) {
+ TMWCoreUI.log("%s is not a valid priority value for %s provider", attribute, getId());
+ }
+ }
+ return 0;
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ if (imageDescriptor == null) {
+ final String image = element.getAttribute("icon");
+ if (image == null) {
+ imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
+ } else {
+ imageDescriptor = TMWCoreUI.imageDescriptorFromPlugin(element.getNamespaceIdentifier(), image);
+ }
+ }
+ return imageDescriptor;
+ }
+
+ public ISchedulingRule getSchedulingRule(IDeploymentTarget target) {
+ return type.getSchedulingRule(target);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (obj instanceof IDeploymentTargetType) {
+ return obj.equals(type);
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ DeploymentTargetTypeDescriptor other = (DeploymentTargetTypeDescriptor) obj;
+ if (getId() == null) {
+ if (other.getId() != null) {
+ return false;
+ }
+ } else if (!getId().equals(other.getId())) {
+ return false;
+ }
+ return true;
+ }
+
+ public boolean isLongRunning() {
+ return Boolean.valueOf(element.getAttribute("long-running"));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/deployment/DeploymentTargetTypesRegistry.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,55 @@
+/**
+ * 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.internal.deployment;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.symbian.tools.tmw.ui.TMWCoreUI;
+import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType;
+
+public class DeploymentTargetTypesRegistry {
+ private DeploymentTargetTypeDescriptor[] descriptors;
+
+ public DeploymentTargetTypesRegistry() {
+ readExtensions();
+ }
+
+ private void readExtensions() {
+ final IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(
+ TMWCoreUI.PLUGIN_ID, "deploymentTargetType");
+ descriptors = new DeploymentTargetTypeDescriptor[elements.length];
+ for (int i = 0; i < elements.length; i++) {
+ descriptors[i] = new DeploymentTargetTypeDescriptor(elements[i]);
+ }
+ }
+
+ public DeploymentTargetTypeDescriptor[] getProviders() {
+ return descriptors;
+ }
+
+ public IDeploymentTargetType getType(String id) {
+ DeploymentTargetTypeDescriptor[] providers = getProviders();
+ for (DeploymentTargetTypeDescriptor descriptor : providers) {
+ if (descriptor.getId().equals(id)) {
+ return descriptor;
+ }
+ }
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/deployment/DeploymentTargetWizardPage.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,248 @@
+/**
+ * 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.internal.deployment;
+
+import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.util.Policy;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.part.PageBook;
+import org.symbian.tools.tmw.core.TMWCore;
+import org.symbian.tools.tmw.core.runtimes.IPackager;
+import org.symbian.tools.tmw.ui.TMWCoreUI;
+import org.symbian.tools.tmw.ui.ProjectMemo;
+import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
+import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType;
+import org.symbian.tools.tmw.ui.deployment.ITargetDetailsPane;
+
+public class DeploymentTargetWizardPage extends WizardPage implements ITargetDetailsPane.Context {
+ private final DeployWizardContext context;
+ private PageBook descriptions;
+ private Control emptyness;
+ private final Set<IDeploymentTarget> inited = new HashSet<IDeploymentTarget>();
+ private TableViewer list;
+ private final Map<IDeploymentTargetType, ITargetDetailsPane> panes = new HashMap<IDeploymentTargetType, ITargetDetailsPane>();
+ private final IDeploymentTarget prev;
+
+ public DeploymentTargetWizardPage(DeployWizardContext context, ProjectMemo memo) {
+ super("TargetPage", "Select Deployment Target", null);
+ this.context = context;
+ prev = memo.getPreviousDeploymentTarget();
+ setDescription(MessageFormat.format("Select emulator or device to deploy the application ''{0}''", context
+ .getProject().getProject().getName()));
+ }
+
+ public void createControl(Composite parent) {
+ Composite root = new Composite(parent, SWT.NONE);
+
+ root.setLayout(new FormLayout());
+
+ list = new TableViewer(root, SWT.BORDER);
+ list.setContentProvider(new ArrayContentProvider());
+ list.setLabelProvider(new WorkbenchLabelProvider());
+ list.setSorter(new ViewerSorter() {
+ @Override
+ public int category(Object element) {
+ return ((DeploymentTargetWrapper) element).getCategory();
+ }
+ });
+ list.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = ((IStructuredSelection) event.getSelection());
+ DeploymentTargetWrapper target = (DeploymentTargetWrapper) selection.getFirstElement();
+ selectDeploymentTarget(target);
+ }
+ });
+ list.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ if (getWizard().performFinish()) {
+ IWizardContainer container = getWizard().getContainer();
+ if (container instanceof WizardDialog) {
+ ((WizardDialog) container).close();
+ }
+ }
+ }
+ });
+ final Button search = new Button(root, SWT.NONE);
+ search.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ doBluetoothSearch(search);
+ }
+ });
+ search.setText("Discover");
+ search.setImage(TMWCoreUI.getImages().getDiscoverButtonIcon());
+
+ descriptions = new PageBook(root, SWT.BORDER);
+ emptyness = new Composite(descriptions, SWT.NONE);
+
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 5);
+ data.right = new FormAttachment(100, -5);
+ data.bottom = new FormAttachment(100, -5);
+ data.height = 80;
+ descriptions.setLayoutData(data);
+
+ data = new FormData();
+ data.top = new FormAttachment(0, 5);
+ data.right = new FormAttachment(100, -5);
+ search.setLayoutData(data);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, 5);
+ data.top = new FormAttachment(0, 5);
+ data.bottom = new FormAttachment(descriptions, -10);
+ data.right = new FormAttachment(search, -10);
+
+ list.getControl().setLayoutData(data);
+ list.setInput(context.getDeploymentTargets());
+ setPageComplete(false);
+
+ if (prev != null) {
+ list.setSelection(new StructuredSelection(prev));
+ }
+ setControl(root);
+ }
+
+ protected void doBluetoothSearch(final Button search) {
+ try {
+ final ISelection sel = list.getSelection();
+ getContainer().run(true, true, new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ monitor.beginTask("Searching for Bluetooth devices", IProgressMonitor.UNKNOWN);
+ try {
+ context.doSearch(new SubProgressMonitor(monitor, 100));
+ } catch (CoreException e) {
+ Policy.getStatusHandler().show(e.getStatus(), "Application Deployment");
+ }
+ monitor.done();
+ search.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ list.setInput(context.getDeploymentTargets());
+ if (!sel.isEmpty()) {
+ list.setSelection(sel);
+ selectDeploymentTarget((DeploymentTargetWrapper) ((IStructuredSelection) sel)
+ .getFirstElement());
+ } else {
+ DeploymentTargetWrapper[] deploymentTargets = context.getDeploymentTargets();
+ if (deploymentTargets.length == 0) {
+ selectDeploymentTarget(null);
+ } else {
+ list.setSelection(new StructuredSelection(deploymentTargets[0]));
+ selectDeploymentTarget(deploymentTargets[0]);
+ }
+ }
+ }
+ });
+ }
+ });
+ } catch (InvocationTargetException e) {
+ TMWCoreUI.log(e);
+ } catch (InterruptedException e) {
+ TMWCoreUI.log(e);
+ }
+ }
+
+ private IPackager getPackager() {
+ return TMWCore.getDefault().getRuntimesManager().getPackager(context.getProject());
+ }
+
+ protected void selectDeploymentTarget(DeploymentTargetWrapper target) {
+ if (target != null) {
+ if (!inited.contains(target)) {
+ target.init(context.getProject(), getPackager(),
+ TMWCoreUI.getMemo(context.getProject()).getMemo(target.getType().getId(), target));
+ inited.add(target);
+ }
+ context.setTarget(target);
+
+ IDeploymentTargetType type = target.getType();
+ ITargetDetailsPane pane = panes.get(type);
+ if (pane == null) {
+ pane = TMWCoreUI.getDefault().getPresentations().createDetailsPane(type);
+ pane.createControl(descriptions);
+ pane.init(this);
+ panes.put(type, pane);
+ }
+ pane.setTarget(target.getActualTarget());
+ descriptions.showPage(pane.getControl());
+ } else {
+ descriptions.showPage(emptyness);
+ context.setTarget(null);
+ setPageComplete(false);
+ setMessage(null);
+ }
+ revalidate();
+ }
+
+ protected void toggleLogging(boolean logging) {
+ context.setLogging(logging);
+ }
+
+ public void revalidate() {
+ String error = null;
+ String warning = !context.areTargetsReady() ? "Press \"Discover\" to find more deployment targets" : null;
+ if (context.getTarget() == null) {
+ error = "Select device or emulator to deploy the application";
+ } else {
+ final IStatus validate = panes.get(context.getTarget().getType()).validate();
+ if (validate.getSeverity() == IStatus.ERROR) {
+ error = validate.getMessage();
+ } else if (validate.getSeverity() == IStatus.WARNING) {
+ warning = validate.getMessage();
+ }
+ }
+ setErrorMessage(error);
+ setMessage(warning, IStatus.WARNING);
+ setPageComplete(error == null);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/deployment/DeploymentTargetWrapper.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,168 @@
+/**
+ * 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.internal.deployment;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.RGB;
+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.runtimes.IPackager;
+import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
+
+public class DeploymentTargetWrapper implements IDeploymentTarget {
+ public class WorkbenchAdapter2Wrapper implements IWorkbenchAdapter2 {
+ private final IWorkbenchAdapter2 adapter;
+
+ public WorkbenchAdapter2Wrapper(IWorkbenchAdapter2 adapter) {
+ this.adapter = adapter;
+ }
+
+ public RGB getForeground(Object element) {
+ return adapter.getForeground(((DeploymentTargetWrapper) element).getActualTarget());
+ }
+
+ public RGB getBackground(Object element) {
+ return adapter.getBackground(((DeploymentTargetWrapper) element).getActualTarget());
+ }
+
+ public FontData getFont(Object element) {
+ return adapter.getFont(((DeploymentTargetWrapper) element).getActualTarget());
+ }
+ }
+
+ public class WorkbenchAdapterWrapper implements IWorkbenchAdapter {
+ private final IWorkbenchAdapter adapter;
+
+ public WorkbenchAdapterWrapper(IWorkbenchAdapter adapter) {
+ this.adapter = adapter;
+ }
+
+ public Object[] getChildren(Object o) {
+ return adapter.getChildren(((DeploymentTargetWrapper) o).getActualTarget());
+ }
+
+ public ImageDescriptor getImageDescriptor(Object object) {
+ return adapter.getImageDescriptor(((DeploymentTargetWrapper) object).getActualTarget());
+ }
+
+ public String getLabel(Object o) {
+ return adapter.getLabel(((DeploymentTargetWrapper) o).getActualTarget());
+ }
+
+ public Object getParent(Object o) {
+ return adapter.getParent(((DeploymentTargetWrapper) o).getActualTarget());
+ }
+ }
+
+ private final DeploymentTargetTypeDescriptor type;
+ private final IDeploymentTarget target;
+
+ public void save(IMemento memento) {
+ target.save(memento);
+ }
+
+ public void init(IMTWProject project, IPackager packager, IMemento memento) {
+ target.init(project, packager, memento);
+ }
+
+ public DeploymentTargetWrapper(IDeploymentTarget target, DeploymentTargetTypeDescriptor type) {
+ this.target = target;
+ this.type = type;
+ }
+
+ public IStatus deploy(IMTWProject project, IPackager packager, IProgressMonitor monitor)
+ throws CoreException {
+ return target.deploy(project, packager, monitor);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ DeploymentTargetWrapper other = (DeploymentTargetWrapper) obj;
+ if (target == null) {
+ if (other.target != null) {
+ return false;
+ }
+ } else if (!target.equals(other.target)) {
+ return false;
+ }
+ return true;
+ }
+
+ public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
+ Object a = target.getAdapter(adapter);
+ if (IWorkbenchAdapter.class.isAssignableFrom(adapter)) {
+ return a == null ? new TargetWorkbenchAdapter(this) : new WorkbenchAdapterWrapper((IWorkbenchAdapter) a);
+ } else if (IWorkbenchAdapter2.class.isAssignableFrom(adapter)) {
+ return a == null ? new TargetWorkbenchAdapter(this) : new WorkbenchAdapter2Wrapper((IWorkbenchAdapter2) a);
+ } else {
+ return a;
+ }
+ }
+
+ public int getCategory() {
+ return type.getPriority() * 0xFFFF + (type.getId().hashCode() & 0xFFFF);
+ }
+
+ public String getId() {
+ return target.getId();
+ }
+
+ public String getName() {
+ return target.getName();
+ }
+
+ public String getProviderId() {
+ return type.getId();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((target == null) ? 0 : target.hashCode());
+ return result;
+ }
+
+ public DeploymentTargetTypeDescriptor getType() {
+ return type;
+ }
+
+ public IDeploymentTarget getActualTarget() {
+ return target;
+ }
+
+ public String getDescription() {
+ return target.getDescription();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/deployment/TargetWorkbenchAdapter.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,72 @@
+/**
+ * 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.internal.deployment;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+import org.eclipse.ui.model.IWorkbenchAdapter2;
+
+public class TargetWorkbenchAdapter implements IWorkbenchAdapter, IWorkbenchAdapter2 {
+ /**
+ *
+ */
+ private final DeploymentTargetWrapper deploymentTargetWrapper;
+
+ /**
+ * @param deploymentTargetWrapper
+ */
+ TargetWorkbenchAdapter(DeploymentTargetWrapper deploymentTargetWrapper) {
+ this.deploymentTargetWrapper = deploymentTargetWrapper;
+ }
+
+ public String getLabel(Object object) {
+ return this.deploymentTargetWrapper.getName();
+ }
+
+ public ImageDescriptor getImageDescriptor(Object object) {
+ return this.deploymentTargetWrapper.getType().getImageDescriptor();
+ }
+
+ public RGB getForeground(Object element) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public RGB getBackground(Object element) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public FontData getFont(Object element) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Object[] getChildren(Object o) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Object getParent(Object o) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/deployment/externalapp/FilesystemDeploymentTarget.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.internal.deployment.externalapp;
+
+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.ui.deployment.IDeploymentTarget;
+import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType;
+
+public class FilesystemDeploymentTarget implements IDeploymentTargetType {
+
+ public FilesystemDeploymentTarget() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public IDeploymentTarget[] getTargets(IMTWProject project) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void discoverTargets(IProgressMonitor monitor) throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public IDeploymentTarget findTarget(IMTWProject project, String id) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean targetsDiscovered() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public ISchedulingRule getSchedulingRule(IDeploymentTarget target) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/deployment/targets/AdapterFactory.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,58 @@
+/**
+ * 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.internal.deployment.targets;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+import org.eclipse.ui.model.WorkbenchAdapter;
+
+@SuppressWarnings("rawtypes")
+public class AdapterFactory implements IAdapterFactory {
+ private final IWorkbenchAdapter adapter = new WorkbenchAdapter() {
+ @Override
+ public ImageDescriptor getImageDescriptor(Object object) {
+ if (object instanceof ExternalApplicationDeploymentType) {
+ return ImageDescriptor.createFromImageData(((ExternalApplicationDeploymentType) object).getProgram()
+ .getImageData());
+ }
+ return super.getImageDescriptor(object);
+ }
+
+ public String getLabel(Object object) {
+ if (object instanceof ExternalApplicationDeploymentType) {
+ return ((ExternalApplicationDeploymentType) object).getName();
+ }
+ return super.getLabel(object);
+ };
+ };
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof ExternalApplicationDeploymentType
+ && IWorkbenchAdapter.class.isAssignableFrom(adapterType)) {
+ return adapter;
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return new Class[] { IWorkbenchAdapter.class };
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/deployment/targets/ExternalApplicationDeploymentType.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,118 @@
+/**
+ * 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.internal.deployment.targets;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+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.runtimes.IPackager;
+import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
+import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType;
+
+public class ExternalApplicationDeploymentType extends PlatformObject implements IDeploymentTargetType,
+ IDeploymentTarget {
+
+ private IMTWProject project;
+
+ public IStatus deploy(IMTWProject project, IPackager packager, IProgressMonitor monitor)
+ throws CoreException {
+ Program app = getExternalApp(project);
+ File file = packager.packageApplication(project, monitor);
+ if (file != null) {
+ app.execute(file.toString());
+ return new Status(
+ IStatus.OK,
+ TMWCore.PLUGIN_ID,
+ "Mobile web application was passed as an argument to external application. Please follow its prompts to complete deployment.");
+ } else {
+ return new Status(IStatus.ERROR, TMWCore.PLUGIN_ID, "Application packaging failed");
+ }
+ }
+
+ public void discoverTargets(IProgressMonitor monitor) throws CoreException {
+ // Do nothing
+ }
+
+ public IDeploymentTarget findTarget(IMTWProject project, String id) {
+ if (getExternalApp(project) != null) {
+ return this;
+ } else {
+ return null;
+ }
+ }
+
+ public String getDescription() {
+ return getExternalApp(project).getName();
+ }
+
+ private Program getExternalApp(IMTWProject project) {
+ this.project = project;
+ IPackager packager = TMWCore.getDefault().getRuntimesManager().getPackager(project);
+ if (packager != null) {
+ return Program.findProgram(packager.getFileType(project));
+ } else {
+ return null;
+ }
+ }
+
+ public String getId() {
+ return "mtw.externalapp";
+ }
+
+ public String getName() {
+ return "Use external application";
+ }
+
+ public Program getProgram() {
+ return getExternalApp(project);
+ }
+
+ public ISchedulingRule getSchedulingRule(IDeploymentTarget target) {
+ return null;
+ }
+
+ public IDeploymentTarget[] getTargets(IMTWProject project) {
+ if (getExternalApp(project) != null) {
+ return new IDeploymentTarget[] { this };
+ } else {
+ return null;
+ }
+ }
+
+ public void init(IMTWProject project, IPackager packager, IMemento memento) {
+ // Do nothing
+ }
+
+ public void save(IMemento memento) {
+ // Do nothing
+ }
+
+ public boolean targetsDiscovered() {
+ return true;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/deployment/targets/FilesystemDeploymentTarget.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,142 @@
+/**
+ * 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.internal.deployment.targets;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.PlatformObject;
+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.runtimes.IPackager;
+import org.symbian.tools.tmw.ui.TMWCoreUI;
+import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
+import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType;
+
+public class FilesystemDeploymentTarget extends PlatformObject implements IDeploymentTargetType, IDeploymentTarget {
+ private String defaultName;
+ private IPath path;
+
+ public IStatus deploy(IMTWProject project, IPackager packager, IProgressMonitor monitor) throws CoreException {
+ final File file = packager.packageApplication(project, monitor);
+ try {
+ final InputStream inputStream = new BufferedInputStream(new FileInputStream(file));
+ final OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(path.toFile()));
+ try {
+ final byte[] buffer = new byte[16384];
+ int read = -1;
+ while ((read = inputStream.read(buffer)) > 0) {
+ outputStream.write(buffer, 0, read);
+ }
+ } finally {
+ inputStream.close();
+ outputStream.close();
+ }
+ } catch (IOException e) {
+ throw new CoreException(
+ new Status(IStatus.ERROR, TMWCoreUI.PLUGIN_ID, "Failed to copy application file", e));
+ } finally {
+ file.delete();
+ }
+ return Status.OK_STATUS;
+ }
+
+ public void discoverTargets(IProgressMonitor monitor) throws CoreException {
+ // Do nothing
+ }
+
+ public IDeploymentTarget findTarget(IMTWProject project, String id) {
+ return getId().equals(id) ? this : null;
+ }
+
+ public String getDefaultName() {
+ return defaultName;
+ }
+
+ public String getDescription() {
+ return "Copies application package to a location in the local filesystem";
+ }
+
+ public String getId() {
+ return "mtw.filesystem";
+ }
+
+ public String getName() {
+ return "Local filesystem";
+ }
+
+ public IPath getPath() {
+ return path;
+ }
+
+ public ISchedulingRule getSchedulingRule(IDeploymentTarget target) {
+ return null;
+ }
+
+ public IDeploymentTarget[] getTargets(IMTWProject project) {
+ return new IDeploymentTarget[] { this };
+ }
+
+ public void init(IMTWProject 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;
+ if (string == null) {
+ string = TMWCoreUI.getDefault().getPreferenceStore().getString("path");
+ if (string != null) {
+ final IPath p = Path.fromPortableString(string);
+ if (p.toFile().isDirectory()) {
+ this.path = p.append(defaultName);
+ }
+ }
+ } else {
+ path = Path.fromPortableString(string);
+ if (!path.removeLastSegments(1).toFile().isDirectory()) {
+ path = null;
+ }
+ }
+ }
+
+ public void save(IMemento memento) {
+ memento.putString("path", path.toPortableString());
+ TMWCoreUI.getDefault().getPreferenceStore().setValue("path", path.removeLastSegments(1).toPortableString());
+ }
+
+ public void setPath(IPath path) {
+ this.path = path;
+ }
+
+ public boolean targetsDiscovered() {
+ return true;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/deployment/targets/LocalFileSystemPane.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,140 @@
+/**
+ * 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.internal.deployment.targets;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+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.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.symbian.tools.tmw.ui.TMWCoreUI;
+import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
+import org.symbian.tools.tmw.ui.deployment.ITargetDetailsPane;
+
+public class LocalFileSystemPane implements ITargetDetailsPane {
+ private Composite root;
+ private Text location;
+ private FilesystemDeploymentTarget target;
+ private Context page;
+
+ public void init(Context page) {
+ this.page = page;
+ }
+
+ public void setTarget(IDeploymentTarget target) {
+ this.target = (FilesystemDeploymentTarget) target;
+ IPath path = this.target.getPath();
+ String string;
+ if (path == null) {
+ string = "";
+ } else {
+ string = path.toOSString();
+ }
+ location.setText(string);
+ page.revalidate();
+ }
+
+ public void createControl(Composite parent) {
+ root = new Composite(parent, SWT.NONE);
+ root.setLayout(new GridLayout(2, false));
+ Label label = new Label(root, SWT.NONE);
+ label.setText("File name:");
+ GridDataFactory.generate(label, 2, 1);
+ location = new Text(root, SWT.BORDER);
+ location.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ location.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ page.revalidate();
+ }
+ });
+ final Button button = new Button(root, SWT.NONE);
+ button.setText("Browse...");
+ button.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ browse();
+ }
+ });
+ }
+
+ protected void browse() {
+ final FileDialog dialog = new FileDialog(location.getShell(), SWT.SAVE);
+ dialog.setText("Select Application Package Location");
+ dialog.setFileName(target.getDefaultName());
+ final IPath path = target.getPath();
+ if (path != null) {
+ dialog.setFilterPath(path.removeLastSegments(1).toOSString());
+ }
+ String newPath = dialog.open();
+ if (newPath != null) {
+ location.setText(newPath);
+ page.revalidate();
+ }
+ }
+
+ public IStatus validate() {
+ target.setPath(null);
+ String path = location.getText();
+ if (path.trim().length() == 0) {
+ return new Status(IStatus.ERROR, TMWCoreUI.PLUGIN_ID, "File name must be specified");
+ } else {
+ final File file = new File(path);
+ if (!file.getParentFile().isDirectory()) {
+ return new Status(IStatus.ERROR, TMWCoreUI.PLUGIN_ID, String.format("%s is not a valid folder",
+ file.getParent()));
+ } else {
+ IStatus status = ResourcesPlugin.getWorkspace().validateName(file.getName(), IResource.FILE);
+ if (status.getSeverity() == IStatus.ERROR) {
+ return status;
+ } else {
+ Path p = new Path(path.trim());
+ target.setPath(p);
+ if (p.toFile().exists()) {
+ return new Status(IStatus.WARNING, TMWCoreUI.PLUGIN_ID,
+ "Target file already exists. It will be overwritten.");
+ } else {
+ return status;
+ }
+ }
+ }
+ }
+ }
+
+ public Control getControl() {
+ return root;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/libraries/MTWGlobalScopeContainerUI.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,34 @@
+/**
+ * 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.internal.libraries;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.wst.jsdt.core.IJavaScriptProject;
+import org.eclipse.wst.jsdt.internal.ui.IJsGlobalScopeContainerInitializerExtension;
+
+@SuppressWarnings("restriction")
+public class MTWGlobalScopeContainerUI implements IJsGlobalScopeContainerInitializerExtension {
+
+ public ImageDescriptor getImage(IPath containerPath, String element, IJavaScriptProject project) {
+ System.out.println(project);
+ return null;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/libraries/TMWContainerPage.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,73 @@
+/**
+ * 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.internal.libraries;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.jsdt.core.IIncludePathEntry;
+import org.eclipse.wst.jsdt.core.IJavaScriptProject;
+import org.eclipse.wst.jsdt.core.JavaScriptCore;
+import org.eclipse.wst.jsdt.internal.ui.wizards.dialogfields.DialogField;
+import org.eclipse.wst.jsdt.internal.ui.wizards.dialogfields.LayoutUtil;
+import org.eclipse.wst.jsdt.ui.wizards.IJsGlobalScopeContainerPage;
+
+@SuppressWarnings("restriction")
+public class TMWContainerPage extends WizardPage implements IJsGlobalScopeContainerPage {
+ private static final String CONTAINER_ID = "org.symbian.tools.mtw.core.mobileWebLibrary"; //$NON-NLS-1$
+
+ public TMWContainerPage() {
+ super("TMWLibraryWizzardPage"); //$NON-NLS-1$
+ setTitle("Mobile Web Runtime Library");
+ }
+
+ public boolean finish() {
+ return true;
+ }
+
+ public IIncludePathEntry getSelection() {
+ return null;
+ }
+
+ public void setSelection(IIncludePathEntry containerEntry) {
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setFont(parent.getFont());
+ DialogField field = new DialogField();
+
+ field.setLabelText("Library added to a project");
+ LayoutUtil.doDefaultLayout(composite, new DialogField[] { field }, false, SWT.DEFAULT, SWT.DEFAULT);
+ Dialog.applyDialogFont(composite);
+ setControl(composite);
+ setDescription("Mobile application support");
+ }
+
+ public void initialize(IJavaScriptProject project, IIncludePathEntry[] currentEntries) {
+ // nothing to initialize
+ }
+
+ public IIncludePathEntry[] getNewContainers() {
+ IIncludePathEntry library = JavaScriptCore.newContainerEntry(new Path(CONTAINER_ID));
+ return new IIncludePathEntry[] { library };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/ConsoleFactory.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2009 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.ui;
+
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IConsoleFactory;
+import org.eclipse.ui.console.IConsoleManager;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.MessageConsoleStream;
+
+public class ConsoleFactory implements IConsoleFactory {
+
+ private static MessageConsole console;
+
+ public void openConsole() {
+ getConsole();
+ console.activate();
+ }
+
+ public static MessageConsoleStream createStream() {
+ getConsole();
+ return console.newMessageStream();
+ }
+
+ public static void activateConsole() {
+ getConsole();
+ console.activate();
+ }
+
+ private synchronized static MessageConsole getConsole() {
+ if (console == null) {
+ console = new MessageConsole("Mobile Web Console", null, true);
+ IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
+ consoleManager.addConsoles(new IConsole[]{console});
+ }
+ return console;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/Images.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,55 @@
+/**
+ * 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.ui;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+
+public final class Images {
+ private final String DISCOVER_ICON = "icons/full/obj16/discover.gif";
+ private final String EXCLUDED_ICON = "icons/full/obj16/excluded.gif";
+ private final String BLUETOOTH_ICON = "icons/full/obj16/bluetooth.gif";
+
+ private final ImageRegistry registry;
+
+ Images(final ImageRegistry registry) {
+ this.registry = registry;
+ add(registry, DISCOVER_ICON);
+ add(registry, EXCLUDED_ICON);
+ add(registry, BLUETOOTH_ICON);
+ }
+
+ private void add(final ImageRegistry registry, String icon) {
+ ImageDescriptor descriptor = TMWCoreUI.imageDescriptorFromPlugin(TMWCoreUI.PLUGIN_ID, icon);
+ registry.put(icon, descriptor);
+ }
+
+ public Image getDiscoverButtonIcon() {
+ return registry.get(DISCOVER_ICON);
+ }
+
+ public ImageDescriptor getExcludedIconDescriptor() {
+ return registry.getDescriptor(EXCLUDED_ICON);
+ }
+
+ public ImageDescriptor getBluetoothImageDescriptor() {
+ return registry.getDescriptor(BLUETOOTH_ICON);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/ProjectMemo.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,140 @@
+/**
+ * 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.ui;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+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.ui.deployment.IDeploymentTarget;
+import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType;
+
+public class ProjectMemo {
+ private static final String TARGET_TYPE = "typeId";
+ private static final String TARGET = "targetId";
+ private static final String TARGET_CONFIGURATION = "target";
+ private static final String MEMO_TYPE = "deployment";
+
+ private final IMTWProject project;
+ private XMLMemento memento;
+
+ public ProjectMemo(IMTWProject project) {
+ this.project = project;
+ }
+
+ public synchronized void setDeploymentTarget(String providerId, IDeploymentTarget target) {
+ try {
+ checkMemento();
+ memento.putString(TARGET_TYPE, providerId);
+ memento.putString(TARGET, target.getId());
+ IMemento child = null;
+ IMemento[] children = memento.getChildren(TARGET_CONFIGURATION);
+ for (IMemento memento : children) {
+ if (providerId.equals(memento.getString(TARGET_TYPE))
+ && target.getId().equals(memento.getString(TARGET))) {
+ child = memento;
+ }
+ }
+ if (child == null) {
+ child = memento.createChild(TARGET_CONFIGURATION);
+ child.putString(TARGET_TYPE, providerId);
+ child.putString(TARGET, target.getId());
+ }
+ target.save(child);
+ saveMemento();
+ } catch (CoreException e) {
+ TMWCoreUI.log(e);
+ } catch (IOException e) {
+ TMWCoreUI.log(e);
+ }
+ }
+
+ private void saveMemento() throws IOException, CoreException {
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ final Writer writer = new OutputStreamWriter(os);
+ memento.save(writer);
+ writer.close();
+ final InputStream stream = new ByteArrayInputStream(os.toByteArray());
+ IFile file = getMemoFile();
+ if (file.exists()) {
+ file.setContents(stream, IFile.KEEP_HISTORY, null);
+ } else {
+ file.create(stream, false, null);
+ }
+ }
+
+ private IFile getMemoFile() {
+ return project.getProject().getFile(new Path(".settings").append(TMWCoreUI.PLUGIN_ID).addFileExtension("xml"));
+ }
+
+ private void checkMemento() throws CoreException, IOException {
+ IFile memoFile = getMemoFile();
+ if (memoFile.exists()) {
+ memento = XMLMemento.createReadRoot(new InputStreamReader(memoFile.getContents(), memoFile.getCharset()));
+ } else {
+ memento = XMLMemento.createWriteRoot(MEMO_TYPE);
+ }
+ }
+
+ public IDeploymentTarget getPreviousDeploymentTarget() {
+ try {
+ checkMemento();
+ String type = memento.getString(TARGET_TYPE);
+ if (type != null) {
+ final IDeploymentTargetType provider = TMWCoreUI.getDefault().getDeploymentTypesRegistry()
+ .getType(type);
+ if (provider != null) {
+ IDeploymentTarget target = provider.findTarget(project, memento.getString(TARGET));
+ if (target != null) {
+ return target;
+ }
+ }
+ }
+ } catch (CoreException e) {
+ TMWCoreUI.log(e);
+ } catch (IOException e) {
+ TMWCoreUI.log(e);
+ }
+ return null;
+ }
+
+ public IMemento getMemo(String targetType, IDeploymentTarget target) {
+ if (memento != null) {
+ IMemento[] children = memento.getChildren(TARGET_CONFIGURATION);
+ for (IMemento memento : children) {
+ if (targetType.equals(memento.getString(TARGET_TYPE))
+ && target.getId().equals(memento.getString(TARGET))) {
+ return memento;
+ }
+ }
+ }
+ return null;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/TMWCoreUI.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,108 @@
+package org.symbian.tools.tmw.ui;
+
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+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.internal.deployment.DeploymentTargetPresentationsManager;
+import org.symbian.tools.tmw.internal.deployment.DeploymentTargetTypesRegistry;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class TMWCoreUI extends AbstractUIPlugin {
+ private final Map<IProject, ProjectMemo> MEMOS = new WeakHashMap<IProject, ProjectMemo>();
+ private final DeploymentTargetTypesRegistry typesRegistry = new DeploymentTargetTypesRegistry();
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.symbian.tools.tmw.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static TMWCoreUI plugin;
+ private Images images;
+ private final DeploymentTargetPresentationsManager presentations = new DeploymentTargetPresentationsManager();
+
+ /**
+ * The constructor
+ */
+ public TMWCoreUI() {
+ }
+
+ @Override
+ protected void initializeImageRegistry(ImageRegistry reg) {
+ super.initializeImageRegistry(reg);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static TMWCoreUI getDefault() {
+ return plugin;
+ }
+
+ public static void log(String message, Exception e) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, e));
+ }
+
+ public static void log(String message, Object... args) {
+ log(String.format(message, args), (Exception) null);
+ }
+
+ public static void log(Exception e) {
+ log(null, e);
+ }
+
+ public static ProjectMemo getMemo(IMTWProject project) {
+ return getDefault().getMemoForProject(project);
+ }
+
+ private synchronized ProjectMemo getMemoForProject(IMTWProject project) {
+ ProjectMemo memo = MEMOS.get(project.getProject());
+ if (memo == null) {
+ memo = new ProjectMemo(project);
+ MEMOS.put(project.getProject(), memo);
+ }
+ return memo;
+ }
+
+ public DeploymentTargetTypesRegistry getDeploymentTypesRegistry() {
+ return typesRegistry;
+ }
+
+ public static Images getImages() {
+ if (getDefault().images == null) {
+ getDefault().images = new Images(getDefault().getImageRegistry());
+ }
+ return getDefault().images;
+ }
+
+ public DeploymentTargetPresentationsManager getPresentations() {
+ return presentations;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/UIUtils.java Mon Aug 09 15:18:34 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.ui;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorPart;
+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;
+
+public class UIUtils {
+ public static IMTWProject getProjectFromCommandContext(ExecutionEvent event) {
+ IResource resource = null;
+ IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
+ if (activePart instanceof IEditorPart) {
+ resource = (IResource) ((IEditorPart) activePart).getEditorInput().getAdapter(IResource.class);
+ } else {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
+ Object[] array = ((IStructuredSelection) selection).toArray();
+ if (array.length == 1 && array[0] instanceof IAdaptable) {
+ resource = (IResource) ((IAdaptable) array[0]).getAdapter(IResource.class);
+ }
+ }
+ }
+ if (resource != null) {
+ IProject project = resource.getProject();
+ return TMWCore.getDefault().create(project);
+ }
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/commands/DeployHandler.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,98 @@
+/**
+ * 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.ui.commands;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IWorkbenchWindow;
+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.ui.UIUtils;
+import org.symbian.tools.tmw.ui.deployment.DeployWizard;
+
+/**
+ * Our sample handler extends AbstractHandler, an IHandler base class.
+ * @see org.eclipse.core.commands.IHandler
+ * @see org.eclipse.core.commands.AbstractHandler
+ */
+public class DeployHandler extends AbstractHandler {
+ /**
+ * The constructor.
+ */
+ public DeployHandler() {
+ }
+
+ /**
+ * the command has been executed, so extract extract the needed information
+ * from the application context.
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+
+ final IMTWProject project = UIUtils.getProjectFromCommandContext(event);
+ if (project != null) {
+ window.getActivePage().saveAllEditors(true);
+ if (validate(project, window)) {
+ new WizardDialog(window.getShell(), new DeployWizard(project)).open();
+ }
+ }
+
+ return null;
+ }
+
+ private boolean validate(final IMTWProject project, final IWorkbenchWindow window) {
+ final boolean[] retvalue = { false };
+ final ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell());
+ try {
+ dialog.run(true, true, new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ retvalue[0] = project.validate(monitor);
+ }
+ });
+ } catch (InvocationTargetException e) {
+ TMWCore.log(null, e);
+ } catch (InterruptedException e) {
+ TMWCore.log(null, e);
+ }
+ if (!retvalue[0]) {
+ retvalue[0] = MessageDialog.openQuestion(window.getShell(), "Deploying Mobile Web Project",
+ String.format("Project %s has errors. Are you sure you want to deploy it?", project.getName()));
+ if (!retvalue[0]) {
+ try {
+ window.getActivePage().showView(IPageLayout.ID_PROBLEM_VIEW);
+ } catch (PartInitException e) {
+ TMWCore.log(null, e);
+ }
+ }
+ }
+ return retvalue[0];
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/DeployWizard.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,134 @@
+/**
+ * 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.ui.deployment;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.MultiRule;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+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.runtimes.IPackager;
+import org.symbian.tools.tmw.internal.deployment.DeployWizardContext;
+import org.symbian.tools.tmw.internal.deployment.DeploymentTargetWizardPage;
+import org.symbian.tools.tmw.internal.deployment.DeploymentTargetWrapper;
+import org.symbian.tools.tmw.ui.TMWCoreUI;
+import org.symbian.tools.tmw.ui.ProjectMemo;
+
+public final class DeployWizard extends Wizard {
+ private final DeployWizardContext context;
+ private final IMTWProject project;
+
+ public DeployWizard(IMTWProject project) {
+ this.project = project;
+ setNeedsProgressMonitor(true);
+ setWindowTitle("Deploy Mobile Application");
+ context = new DeployWizardContext(project);
+ }
+
+ @Override
+ public void addPages() {
+ addPage(new DeploymentTargetWizardPage(context, TMWCoreUI.getMemo(project)));
+ }
+
+ @Override
+ public boolean performFinish() {
+ final DeploymentTargetWrapper target = context.getTarget();
+ if (target.getType().isLongRunning()) {
+ DeployJob job = new DeployJob(context.getProject(), target);
+ job.schedule();
+ return true;
+ } else {
+ final IStatus[] retval = new IStatus[1];
+ try {
+ getContainer().run(false, true, new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ retval[0] = doDeploy(target, context.getProject(), monitor);
+ }
+ });
+ } catch (InvocationTargetException e) {
+ TMWCoreUI.log(e);
+ } catch (InterruptedException e) {
+ TMWCoreUI.log(e);
+ }
+ switch (retval[0].getSeverity()) {
+ case IStatus.ERROR:
+ StatusManager.getManager().handle(retval[0], StatusManager.SHOW | StatusManager.BLOCK);
+ return false;
+ case IStatus.WARNING:
+ StatusManager.getManager().handle(retval[0], StatusManager.SHOW | StatusManager.BLOCK);
+ default:
+ return true;
+ }
+ }
+ }
+
+ @Override
+ public boolean needsPreviousAndNextButtons() {
+ return false;
+ }
+
+ private IStatus doDeploy(DeploymentTargetWrapper target, IMTWProject project, IProgressMonitor monitor) {
+ IStatus status;
+ try {
+ IPackager packager = TMWCore.getDefault().getRuntimesManager().getPackager(project);
+ status = target.deploy(project, packager, monitor);
+ } catch (CoreException e) {
+ status = e.getStatus();
+ }
+ ProjectMemo memo = TMWCoreUI.getMemo(project);
+ memo.setDeploymentTarget(target.getProviderId(), target);
+ return status;
+ }
+
+ private final class DeployJob extends Job {
+ private final DeploymentTargetWrapper target;
+ private final IMTWProject project;
+
+ private DeployJob(IMTWProject project, DeploymentTargetWrapper deploymentTarget) {
+ super(String.format("Deploying %s to %s", project.getName(), deploymentTarget.getName()));
+ ISchedulingRule rule = deploymentTarget.getType().getSchedulingRule(deploymentTarget.getActualTarget());
+ if (rule != null) {
+ rule = MultiRule.combine(rule, project.getProject());
+ } else {
+ rule = project.getProject();
+ }
+ setRule(rule);
+ setUser(true);
+ this.project = project;
+ this.target = deploymentTarget;
+ }
+
+ public IStatus run(IProgressMonitor monitor) {
+ final IStatus status = doDeploy(target, project, monitor);
+ if (status.getSeverity() != IStatus.ERROR && status.getSeverity() != IStatus.WARNING) {
+ StatusManager.getManager().handle(status, StatusManager.SHOW);
+ }
+ return status;
+ }
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/IDeploymentTarget.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,87 @@
+/**
+ * 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.ui.deployment;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+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.runtimes.IPackager;
+
+/**
+ * <p>This is particular deployment target instance. It can be a Bluetooth phone
+ * connection, installed device emulator, FTP server, etc.</p>
+ *
+ * <p>This class methods can be called from non-SWT thread.</p>
+ *
+ * <p>Following adapters can be provided by either overriding getAdapter method
+ * or by contributing to org.eclipse.core.runtime.adapters extension point:</p>
+ * <ul><li>{@link org.eclipse.ui.IPersistable} - to persist advanced per-
+ * project target configuration</li><li>
+ * {@link org.eclipse.ui.model.IWorkbenchAdapter} or
+ * {@link org.eclipse.ui.model.IWorkbenchAdapter2} to customize target
+ * presentation in IDE user interface.</li></ul>
+ *
+ * <p>Overwriting <code>equals</code> and <code>hashCode</code> might be desirable
+ * if new objects are created each time user does discovery process.</p>
+ * @author Eugene Ostroukhov (eugeneo@symbian.org)
+ */
+public interface IDeploymentTarget extends IAdaptable {
+ /**
+ * Returns unique ID. There is no restriction on ID string format. Cannot
+ * be <code>null</code>
+ */
+ String getId();
+
+ /**
+ * <p>Returns user-readable name. Can be null if
+ * {@link org.eclipse.ui.model.IWorkbenchAdapter} is provided.<p>
+ * <p>Name is not used for purposes other then presentation and may change
+ * between invocations</p>
+ */
+ String getName();
+
+ /**
+ * Provides more details about target. This information is only displayed
+ * to the user and is not important for the application.
+ */
+ String getDescription();
+
+ /**
+ * Deploy application to this target.
+ *
+ * @param project project to deploy to the target
+ * @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;
+
+ /**
+ * Save project-specific settings to the memento. Workspace-wide settings
+ * should be managed separately.
+ */
+ void save(IMemento memento);
+
+ /**
+ * Initialize target for project deployment.
+ */
+ void init(IMTWProject project, IPackager packager, IMemento memento);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/IDeploymentTargetType.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,65 @@
+/**
+ * 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.ui.deployment;
+
+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;
+
+/**
+ * This interface is for deployment targets providers.
+ *
+ * @author Eugene
+ */
+public interface IDeploymentTargetType {
+ /**
+ * Returns list of the targets that accept provided project. Project
+ * cannot be <code>null</code>.
+ * @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);
+
+ /**
+ * Discovers targets. This can be a long-running task and in most cases
+ * will be triggered by the user.
+ */
+ void discoverTargets(IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Find target based on project and target ID. This method returns
+ * <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);
+
+ /**
+ * Return <code>false</code> if user needs to trigger long-running
+ * discovery to see all potential deployment targets.
+ */
+ boolean targetsDiscovered();
+
+ /**
+ * @param target that will be used by a {@link org.eclipse.core.runtime.jobs.Job}
+ * @return scheduling rule that will be used to properly schedule jobs to
+ * avoid resource access conflicts. Can be <code>null</code>
+ */
+ ISchedulingRule getSchedulingRule(IDeploymentTarget target);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/ITargetDetailsPane.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,43 @@
+/**
+ * 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.ui.deployment;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * Objects of this class provide UI for the users to visualize or configure
+ * their deployment targets. This object will not be reused between wizard
+ * deployment wizard restarts.
+ * There will be one instance for the target type. This object will not be
+ * instantiated for each target.
+ *
+ * @author Eugene Ostroukhov (eugeneo@symbian.org)
+ */
+public interface ITargetDetailsPane {
+ interface Context {
+ void revalidate();
+ }
+ void init(Context page);
+ void setTarget(IDeploymentTarget target);
+ void createControl(Composite parent);
+ Control getControl();
+ IStatus validate();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/bluetooth/BluetoothRule.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,20 @@
+package org.symbian.tools.tmw.ui.deployment.bluetooth;
+
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+
+public class BluetoothRule implements ISchedulingRule {
+ public static final ISchedulingRule INSTANCE = new BluetoothRule();
+
+ private BluetoothRule() {
+ // No instantiation
+ }
+
+ public boolean contains(ISchedulingRule rule) {
+ return isConflicting(rule);
+ }
+
+ public boolean isConflicting(ISchedulingRule rule) {
+ return rule instanceof BluetoothRule;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/bluetooth/BluetoothTarget.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,321 @@
+/**
+ * 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.ui.deployment.bluetooth;
+
+import java.io.EOFException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.text.MessageFormat;
+import java.util.Collection;
+import java.util.LinkedList;
+
+import javax.bluetooth.BluetoothConnectionException;
+import javax.bluetooth.BluetoothStateException;
+import javax.bluetooth.DeviceClass;
+import javax.bluetooth.DiscoveryListener;
+import javax.bluetooth.LocalDevice;
+import javax.bluetooth.RemoteDevice;
+import javax.bluetooth.ServiceRecord;
+import javax.bluetooth.UUID;
+import javax.microedition.io.Connector;
+import javax.obex.ClientSession;
+import javax.obex.HeaderSet;
+import javax.obex.Operation;
+import javax.obex.ResponseCodes;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.core.runtime.Status;
+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.runtimes.IPackager;
+import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
+
+public class BluetoothTarget extends PlatformObject implements IDeploymentTarget {
+ private static final UUID OBEX_OBJECT_PUSH = new UUID(0x1105);
+ private String serviceURL;
+ private RemoteDevice device;
+ protected String[] exceptionCodes = new String[] { "OBEX_HTTP_UNSUPPORTED_TYPE", "OBEX_HTTP_FORBIDDEN" };
+ private String message = "Deployment was successful. Please follow on-screen instructions to complete application deployment on your device.";
+ private final String name;
+ private final BluetoothTargetType provider;
+ private final Collection<IStatus> statuses = new LinkedList<IStatus>();
+
+ public BluetoothTarget(String name, RemoteDevice device, BluetoothTargetType provider) {
+ this.name = name;
+ this.device = device;
+ this.provider = provider;
+ }
+
+ public IStatus deploy(IMTWProject 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),
+ IProgressMonitor.UNKNOWN);
+ final File application = packager.packageApplication(project, new SubProgressMonitor(monitor, 100));
+ try {
+ deployWidget(application, packager.getFileType(project), new SubProgressMonitor(monitor, 10));
+ } finally {
+ application.delete();
+ }
+ monitor.done();
+ MultiStatus multiStatus = new MultiStatus(TMWCore.PLUGIN_ID, 0, message, null);
+ for (IStatus status : statuses) {
+ multiStatus.add(status);
+ }
+ return multiStatus;
+ }
+
+ private void deployWidget(File inputWidget, String fileType, IProgressMonitor progressMonitor) throws CoreException {
+ if (device == null) {
+ provider.discoverTargets(new SubProgressMonitor(progressMonitor, 10));
+ if (device == null) {
+ throw new CoreException(new Status(IStatus.ERROR, TMWCore.PLUGIN_ID, String.format(
+ "Device %s is not available", name)));
+ }
+ }
+ progressMonitor.beginTask("Deploying application", IProgressMonitor.UNKNOWN);
+ InputStream in = null;
+ OutputStream os = null;
+ Operation putOperation = null;
+ ClientSession clientSession = null;
+ try {
+ if (!provider.isBloothToothConnected()) {
+ String msg = "Bluetooth is either disabled or not present in the system.";
+ emitStatus(IStatus.ERROR, msg, progressMonitor);
+ return;
+ }
+
+ String message = MessageFormat.format("Searching for the service for the selected device \"{0}\"",
+ new Object[] { getName() });
+ emitStatus(IStatus.OK, message, progressMonitor);
+ String servicesFound = getServicesFound();
+ if (servicesFound == null || servicesFound.length() < 1) {
+ message = MessageFormat.format("Cannot find service to the device \"{0}\"", new Object[] { getName() });
+ emitStatus(IStatus.ERROR, message, progressMonitor);
+ return;
+ }
+
+ message = MessageFormat.format("Service for the device \"{0}\" found", new Object[] { getName() });
+ emitStatus(IStatus.OK, message, progressMonitor);
+
+ clientSession = (ClientSession) Connector.open(servicesFound);
+ HeaderSet hsConnectReply = clientSession.connect(null);
+ if (hsConnectReply.getResponseCode() != ResponseCodes.OBEX_HTTP_OK) {
+ emitStatus(IStatus.OK, "Failed to connect to the service", progressMonitor);
+ }
+
+ emitStatus(IStatus.OK, "Deployment Started", progressMonitor);
+
+ HeaderSet hsOperation = clientSession.createHeaderSet();
+
+ if (progressMonitor.isCanceled()) {
+ emitStatus(IStatus.CANCEL, "Deployment was canceled", progressMonitor);
+ return;
+ }
+
+ // Send widget to server
+ in = new FileInputStream(inputWidget);
+ message = MessageFormat.format("Deploying file from {0}", new Object[] { inputWidget.getAbsolutePath() });
+ emitStatus(IStatus.OK, message, progressMonitor);
+
+ hsOperation.setHeader(HeaderSet.NAME, inputWidget.getName());
+ hsOperation.setHeader(HeaderSet.TYPE, fileType);
+ int size = (int) inputWidget.length();
+ byte file[] = new byte[size];
+ hsOperation.setHeader(HeaderSet.LENGTH, new Long(file.length));
+
+ // Create PUT Operation
+ putOperation = clientSession.put(hsOperation);
+
+ os = putOperation.openOutputStream();
+
+ long start = System.currentTimeMillis();
+
+ byte[] buf = new byte[16 * 1024];
+ int len;
+ while ((len = in.read(buf)) > 0) {
+ os.write(buf, 0, len);
+ if (progressMonitor.isCanceled()) {
+ putOperation.abort();
+ emitStatus(IStatus.CANCEL, "Deployment was canceled", progressMonitor);
+ return;
+ }
+ }
+
+ os.flush();
+ os.close();
+
+ long elapsed = System.currentTimeMillis() - start;
+ emitStatus(IStatus.OK, "elapsed time: " + elapsed / 1000.0 + " seconds", progressMonitor);
+
+ int responseCode = putOperation.getResponseCode();
+ if (responseCode == ResponseCodes.OBEX_HTTP_OK) {
+ message = MessageFormat.format("File deployed to {0}", new Object[] { getName() });
+ emitStatus(IStatus.OK, message, progressMonitor);
+ } else {
+ message = "Error during deployment, OBEX error: " + responseCode;
+ emitStatus(IStatus.ERROR, message, progressMonitor);
+ }
+
+ } catch (BluetoothConnectionException x) {
+ String message = getExceptionMessage(x.getMessage());
+ emitStatus(IStatus.ERROR, message, progressMonitor);
+ } catch (IOException e) {
+ String message = getExceptionMessage(e.getMessage());
+ emitStatus(IStatus.ERROR, message, progressMonitor);
+ } finally {
+ try {
+ if (in != null) {
+ in.close();
+ }
+ if (putOperation != null) {
+ putOperation.close();
+ }
+ if (clientSession != null) {
+ clientSession.disconnect(null);
+ clientSession.close();
+ }
+ } catch (EOFException eof) {
+ // EOFException is now caught
+ // Ignore the error since deployment has already completed
+ //Activator.log(IStatus.ERROR, "EOF encountered while cleaning up Bluetooth deployment", eof);
+ } catch (IOException x) {
+ TMWCore.log("Error cleaning up BlueTooth deployment", x);
+ }
+ }
+ return;
+ }
+
+ protected void emitStatus(int severity, String statusDescription, IProgressMonitor monitor) {
+ statuses.add(new Status(severity, TMWCore.PLUGIN_ID, statusDescription));
+ monitor.setTaskName(statusDescription);
+ if (severity != IStatus.OK) {
+ message = statusDescription;
+ }
+ }
+
+ /**
+ * Returns the customized methods from the exception error code. If it
+ * matches it returns the customized message else returns the exception itself
+ * @param message exception message
+ * @return the customized message
+ */
+ protected String getExceptionMessage(String message) {
+
+ if (message.contains(exceptionCodes[0])) {
+ return "Device does not support the widget deployment";
+ } else if (message.contains(exceptionCodes[1])) {
+ return "Deployment rejected by the device";
+ }
+ return message;
+ }
+
+ public String getId() {
+ return getName();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ private String getServicesFound() {
+ try {
+ serviceURL = "";
+ UUID serviceUUID = OBEX_OBJECT_PUSH;
+
+ final Object serviceSearchCompletedEvent = new Object();
+
+ DiscoveryListener listener = new DiscoveryListener() {
+
+ public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) {
+ }
+
+ public void inquiryCompleted(int discType) {
+ }
+
+ public void servicesDiscovered(int transID, ServiceRecord[] servRecord) {
+ try {
+ for (int i = 0; i < servRecord.length; i++) {
+ if (servRecord[i].getHostDevice().getFriendlyName(false).equals(name)) {
+ serviceURL = servRecord[i].getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT,
+ false);
+ }
+ }
+ } catch (BluetoothStateException e) {
+ TMWCore.log(e.getMessage(), e);
+ } catch (IOException e) {
+ TMWCore.log(e.getMessage(), e);
+ }
+ }
+
+ public void serviceSearchCompleted(int transID, int respCode) {
+ synchronized (serviceSearchCompletedEvent) {
+ serviceSearchCompletedEvent.notifyAll();
+ }
+ }
+
+ };
+
+ UUID[] searchUuidSet = new UUID[] { serviceUUID };
+ int[] attrIDs = new int[] { 0x0100 }; // Service name
+
+ synchronized (serviceSearchCompletedEvent) {
+ LocalDevice.getLocalDevice().getDiscoveryAgent()
+ .searchServices(attrIDs, searchUuidSet, device, listener);
+ serviceSearchCompletedEvent.wait();
+ }
+
+ } catch (IOException e) {
+ TMWCore.log("Error in Bluetooth service discovery", e);
+ } catch (InterruptedException e) {
+ TMWCore.log("Error in Bluetooth service discovery", e);
+ }
+ return serviceURL;
+ }
+
+ public void init(IMTWProject project, IPackager packager, IMemento memento) {
+ // nothing
+ }
+
+ public void save(IMemento memento) {
+ // nothing
+ }
+
+ public void setAddress(RemoteDevice device) {
+ this.device = device;
+ }
+
+ public boolean isDiscovered() {
+ return device != null;
+ }
+
+ public String getDescription() {
+ return device == null ? "This device was remembered from past sessions and may not be available" : String
+ .format("Remote device with address %s", device.getBluetoothAddress());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/bluetooth/BluetoothTargetAdapterFactory.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,41 @@
+/**
+ * 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.ui.deployment.bluetooth;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+import org.eclipse.ui.model.IWorkbenchAdapter2;
+
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class BluetoothTargetAdapterFactory implements IAdapterFactory {
+ private final BluetoothTargetWorkbenchAdapter workbenchAdapter = new BluetoothTargetWorkbenchAdapter();
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if ((adapterType.isAssignableFrom(IWorkbenchAdapter.class) || adapterType
+ .isAssignableFrom(IWorkbenchAdapter2.class)) && adaptableObject instanceof BluetoothTarget) {
+ return workbenchAdapter;
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return new Class[] { IWorkbenchAdapter2.class, IWorkbenchAdapter.class };
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/bluetooth/BluetoothTargetType.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,207 @@
+/**
+ * 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.ui.deployment.bluetooth;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.Collection;
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.bluetooth.BluetoothStateException;
+import javax.bluetooth.DeviceClass;
+import javax.bluetooth.DiscoveryAgent;
+import javax.bluetooth.DiscoveryListener;
+import javax.bluetooth.LocalDevice;
+import javax.bluetooth.RemoteDevice;
+import javax.bluetooth.ServiceRecord;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+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.ui.ConsoleFactory;
+import org.symbian.tools.tmw.ui.TMWCoreUI;
+import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget;
+import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType;
+
+import com.intel.bluetooth.BlueCoveImpl;
+
+/**
+ * Discovers Bluetooth-enabled devices. This code is generic and will not
+ * perform any checks if the discovered device can run application being
+ * deployed.
+ *
+ * @author Eugene Ostroukhov (eugeneo@symbian.org)
+ */
+public class BluetoothTargetType implements IDeploymentTargetType {
+ private final class TargetDiscoveryListener implements DiscoveryListener {
+ final Object inquiryCompletedEvent;
+ boolean isCanceled;
+ final Map<String, BluetoothTarget> prevTargets;
+ final IProgressMonitor progressMonitor;
+
+ private TargetDiscoveryListener(Map<String, BluetoothTarget> previousTargets, Object inquiryCompletedEvent,
+ IProgressMonitor progressMonitor) {
+ this.prevTargets = previousTargets;
+ this.inquiryCompletedEvent = inquiryCompletedEvent;
+ this.progressMonitor = progressMonitor;
+ }
+
+ private void checkCanceled() {
+ if (!isCanceled && progressMonitor != null) {
+ if (progressMonitor.isCanceled()) {
+ try {
+ LocalDevice.getLocalDevice().getDiscoveryAgent().cancelInquiry(listener);
+ } catch (BluetoothStateException e) {
+ TMWCoreUI.log(e);
+ }
+ }
+ }
+ }
+
+ public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) {
+ try {
+ final String name = btDevice.getFriendlyName(false);
+ if (name != null && name.length() > 0) {
+ final BluetoothTarget target = prevTargets.get(name);
+ if (target != null) {
+ target.setAddress(btDevice);
+ targets.put(name, target);
+ } else {
+ targets.put(name, new BluetoothTarget(name, btDevice, BluetoothTargetType.this));
+ }
+ checkCanceled();
+ }
+ } catch (BluetoothStateException e) {
+ TMWCoreUI.log(e.getMessage(), e);
+ } catch (IOException e) {
+ TMWCoreUI.log(e.getMessage(), e);
+ }
+ }
+
+ public void inquiryCompleted(int discType) {
+ synchronized (inquiryCompletedEvent) {
+ inquiryCompletedEvent.notifyAll();
+ }
+ }
+
+ public void servicesDiscovered(int transID, ServiceRecord[] servRecord) {
+ }
+
+ public void serviceSearchCompleted(int transID, int respCode) {
+ }
+ }
+
+ private static PrintStream savedSysOut;
+ private boolean discovered = false;
+ private TargetDiscoveryListener listener;
+ private Map<String, BluetoothTarget> targets = new TreeMap<String, BluetoothTarget>();
+
+ public BluetoothTargetType() {
+ // set parameters for BlueCove
+ String param = Integer.toString(65 * 1024);
+ System.setProperty("bluecove.obex.mtu", param);
+ BlueCoveImpl.setConfigProperty("bluecove.obex.mtu", param);
+ }
+
+ public void discoverTargets(IProgressMonitor monitor) throws CoreException {
+ if (!isBloothToothConnected()) {
+ throw new CoreException(new Status(IStatus.ERROR, TMWCoreUI.PLUGIN_ID, "Bluetooth is not available"));
+ }
+ monitor.beginTask("Discovering Bluetooth devices", IProgressMonitor.UNKNOWN);
+ final Object inquiryCompletedEvent = new Object();
+ final Map<String, BluetoothTarget> previousTargets = targets;
+ targets = new TreeMap<String, BluetoothTarget>();
+
+ listener = new TargetDiscoveryListener(previousTargets, inquiryCompletedEvent, monitor);
+
+ synchronized (inquiryCompletedEvent) {
+ boolean started;
+ try {
+ started = LocalDevice.getLocalDevice().getDiscoveryAgent().startInquiry(DiscoveryAgent.GIAC, listener);
+ if (started) {
+ inquiryCompletedEvent.wait();
+ discovered = true;
+ }
+ } catch (BluetoothStateException e) {
+ TMWCoreUI.log(e.getMessage(), e);
+ } catch (InterruptedException e) {
+ TMWCoreUI.log(e.getMessage(), e);
+ }
+ }
+ monitor.done();
+ }
+
+ /** Toggle BlueCove logging
+ */
+ public void enableBlueCoveDiagnostics(boolean enable) {
+ System.setProperty("bluecove.debug", Boolean.valueOf(enable).toString());
+ BlueCoveImpl.instance().enableNativeDebug(enable);
+ if (enable) {
+ System.setOut(new PrintStream(ConsoleFactory.createStream()));
+ } else {
+ System.setOut(savedSysOut);
+ }
+ }
+
+ public IDeploymentTarget findTarget(IMTWProject project, String id) {
+ if (!isBloothToothConnected()) {
+ return null;
+ }
+ if (discovered) {
+ return targets.get(id);
+ } else {
+ BluetoothTarget target = targets.get(id);
+ if (target == null) {
+ target = new BluetoothTarget(id, null, this);
+ targets.put(id, target);
+ }
+ return target;
+ }
+ }
+
+ public IDeploymentTarget[] getTargets(IMTWProject project) {
+ if (targets != null) {
+ final Collection<BluetoothTarget> values = targets.values();
+ return values.toArray(new IDeploymentTarget[values.size()]);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Check whether the bluetooth is on or not.
+ *
+ * @return whether the device is on.
+ */
+ public boolean isBloothToothConnected() {
+ return LocalDevice.isPowerOn();
+ }
+
+ public boolean targetsDiscovered() {
+ return discovered;
+ }
+
+ public ISchedulingRule getSchedulingRule(IDeploymentTarget target) {
+ return BluetoothRule.INSTANCE;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/deployment/bluetooth/BluetoothTargetWorkbenchAdapter.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,65 @@
+/**
+ * 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.ui.deployment.bluetooth;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+import org.eclipse.ui.model.IWorkbenchAdapter2;
+import org.symbian.tools.tmw.ui.TMWCoreUI;
+
+public class BluetoothTargetWorkbenchAdapter implements IWorkbenchAdapter, IWorkbenchAdapter2 {
+ public RGB getForeground(Object element) {
+ final BluetoothTarget target = (BluetoothTarget) element;
+ if (!target.isDiscovered()) {
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getDisplay()
+ .getSystemColor(SWT.COLOR_DARK_GRAY).getRGB();
+ }
+ return null;
+ }
+
+ public RGB getBackground(Object element) {
+ return null;
+ }
+
+ public FontData getFont(Object element) {
+ return null;
+ }
+
+ public Object[] getChildren(Object o) {
+ return null;
+ }
+
+ public ImageDescriptor getImageDescriptor(Object object) {
+ return TMWCoreUI.getImages().getBluetoothImageDescriptor();
+ }
+
+ public String getLabel(Object o) {
+ final BluetoothTarget target = (BluetoothTarget) o;
+ return target.getName();
+ }
+
+ public Object getParent(Object o) {
+ return null;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/navigator/PackagingInformationDecorator.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,71 @@
+/**
+ * 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.ui.navigator;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.IDecoration;
+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.runtimes.IPackager;
+import org.symbian.tools.tmw.ui.TMWCoreUI;
+
+public class PackagingInformationDecorator implements ILightweightLabelDecorator {
+
+ public void decorate(Object element, IDecoration decoration) {
+ IResource resource = null;
+ if (element instanceof IResource) {
+ resource = (IResource) element;
+ } else if (element instanceof IAdaptable) {
+ resource = (IResource) ((IAdaptable) element).getAdapter(IResource.class);
+ }
+ if (resource != null && resource.isAccessible()) {
+ IMTWProject project = TMWCore.getDefault().create(resource.getProject());
+ if (project != null) {
+ IPackager packager = TMWCore.getDefault().getRuntimesManager().getPackager(project);
+ if (packager.getPathInPackage(resource) != null) {
+ decoration.addOverlay(TMWCoreUI.getImages().getExcludedIconDescriptor(), IDecoration.TOP_RIGHT);
+ }
+ }
+ }
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ // Do nothing
+
+ }
+
+ public void dispose() {
+ // Do nothing
+
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ // Do nothing
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ // Do nohing
+
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/navigator/RenameMoveActionProvider.java Mon Aug 09 15:18:34 2010 -0700
@@ -0,0 +1,101 @@
+/**
+ * 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.ui.navigator;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.actions.ActionContext;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
+import org.eclipse.wst.jsdt.ui.IContextMenuConstants;
+import org.eclipse.wst.jsdt.ui.actions.IJavaEditorActionDefinitionIds;
+import org.eclipse.wst.jsdt.ui.actions.JdtActionConstants;
+import org.eclipse.wst.jsdt.ui.actions.MoveAction;
+import org.eclipse.wst.jsdt.ui.actions.RenameAction;
+import org.eclipse.wst.jsdt.ui.actions.SelectionDispatchAction;
+
+public class RenameMoveActionProvider extends CommonActionProvider {
+ private SelectionDispatchAction fMoveAction;
+ private SelectionDispatchAction fRenameAction;
+
+ private final Collection<IAction> fActions = new HashSet<IAction>();
+
+ public void fillActionBars(IActionBars actionBars) {
+ if (fActions.size() > 0) {
+ actionBars.setGlobalActionHandler(JdtActionConstants.RENAME, fRenameAction);
+ actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), fRenameAction);
+
+ actionBars.setGlobalActionHandler(JdtActionConstants.MOVE, fMoveAction);
+ actionBars.setGlobalActionHandler(ActionFactory.MOVE.getId(), fMoveAction);
+ }
+ }
+
+ public void fillContextMenu(IMenuManager menu) {
+ menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, new Separator());
+ for (IAction action : fActions) {
+ menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, action);
+ }
+ }
+
+ public void init(ICommonActionExtensionSite site) {
+ ICommonViewerWorkbenchSite workbenchSite= null;
+ if (site.getViewSite() instanceof ICommonViewerWorkbenchSite) {
+ workbenchSite= (ICommonViewerWorkbenchSite) site.getViewSite();
+ }
+
+ // we only initialize the refactor group when in a view part
+ // (required for the constructor)
+ if (workbenchSite != null) {
+ if (workbenchSite.getPart() != null && workbenchSite.getPart() instanceof IViewPart) {
+ IViewPart viewPart= (IViewPart) workbenchSite.getPart();
+ IWorkbenchPartSite s = viewPart.getSite();
+
+ fRenameAction= new RenameAction(s);
+ initUpdatingAction(fRenameAction, workbenchSite.getSelectionProvider(), workbenchSite.getSelectionProvider().getSelection(), IJavaEditorActionDefinitionIds.RENAME_ELEMENT);
+ fMoveAction= new MoveAction(s);
+ initUpdatingAction(fMoveAction, workbenchSite.getSelectionProvider(), workbenchSite.getSelectionProvider().getSelection(), IJavaEditorActionDefinitionIds.RENAME_ELEMENT);
+ }
+ }
+ }
+
+ private void initUpdatingAction(SelectionDispatchAction action, ISelectionProvider provider, ISelection selection, String actionDefinitionId){
+ action.setActionDefinitionId(actionDefinitionId);
+ action.update(selection);
+ if (provider != null) {
+ provider.addSelectionChangedListener(action);
+ }
+ fActions.add(action);
+ }
+
+
+ public void setContext(ActionContext context) {
+ // Do nothing
+ }
+}
--- a/org.symbian.tools.wrttools.previewer/plugin.xml Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/plugin.xml Mon Aug 09 15:18:34 2010 -0700
@@ -6,7 +6,7 @@
point="org.eclipse.ui.views">
<view
allowMultiple="false"
- category="org.symbian.tools.mtw"
+ category="org.symbian.tools.tmw"
class="org.symbian.tools.wrttools.previewer.preview.PreviewView"
icon="icons/obj16/preview_view.gif"
id="org.symbian.tools.wrttools.editing.wrtpreview"
--- a/org.symbian.tools.wrttools.product/launch/WRT IDE Product (Windows).launch Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.wrttools.product/launch/WRT IDE Product (Windows).launch Mon Aug 09 15:18:34 2010 -0700
@@ -22,8 +22,8 @@
<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="javax.servlet@default:default,org.eclipse.osgi.util@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.ecf.provider.filetransfer@default:default,javax.servlet.jsp@default:default,org.eclipse.core.resources.win32.x86@default:false,org.apache.velocity@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.p2.jarprocessor@default:default,org.mortbay.jetty.server@default:default,org.apache.commons.httpclient*3.1.0.v20080605-1935@default:default,org.mortbay.jetty.util@default:default,org.eclipse.wst.sse.core@default:default,org.sat4j.pb@default:default,org.eclipse.wst.doc.user@default:default,org.eclipse.ui.ide@default:default,org.eclipse.jem.util@default:default,org.eclipse.gef@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.wst.jsdt.web.core@default:default,org.apache.commons.collections@default:default,org.eclipse.core.filebuffers@default:default,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,org.eclipse.ui.editors@default:default,org.eclipse.draw2d@default:default,org.eclipse.emf.ecore.edit@default:default,org.eclipse.swt@default:default,org.eclipse.team.cvs.ssh2@default:default,org.eclipse.equinox.p2.metadata.generator@default:default,org.eclipse.wst.common.infopop@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.debug.core@default:default,org.eclipse.debug.ui@default:default,org.eclipse.emf.ecore@default:default,org.mozilla.xpcom@default:default,org.eclipse.search@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.wst.common.environment@default:default,org.apache.xerces@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.wst.common.project.facet.core@default:default,org.eclipse.wst.dtd.core@default:default,org.eclipse.wst.xml.core@default:default,org.eclipse.wst.sse.ui@default:default,org.eclipse.emf.ecore.change@default:default,org.apache.log4j@default:default,org.eclipse.wst.validation.infopop@default:default,org.eclipse.wst.sse.ui.infopop@default:default,org.eclipse.wst.jsdt.core@default:default,org.eclipse.osgi.services@default:default,org.eclipse.team.cvs.ui@default:default,org.eclipse.wst.standard.schemas@default:default,org.eclipse.jsch.core@default:default,org.eclipse.wst.validation@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.team.ui@default:default,org.eclipse.ui.net@default:default,org.eclipse.help@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.compare.win32@default:default,org.eclipse.core.runtime@default:true,org.apache.commons.logging*1.0.4.v200904062259@default:default,org.eclipse.core.net@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.wst.internet.monitor.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.wst.internet.cache@default:default,org.eclipse.wst.validation.ui@default:default,org.eclipse.core.variables@default:default,org.eclipse.wst.internet.monitor.ui@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.help.ui@default:default,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.ui.forms@default:default,org.eclipse.update.configurator@3:true,org.apache.xml.serializer@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.wst.jsdt.web.ui@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.eclipse.jface@default:default,org.eclipse.ui.workbench.compatibility@default:false,org.eclipse.ui.workbench@default:default,org.eclipse.wst.css.core@default:default,com.ibm.icu@default:default,org.eclipse.wst.xml.xpath2.processor@default:default,org.eclipse.wst.common.snippets@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.update.scheduler@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.jsch.ui@default:default,org.eclipse.core.jobs@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.platform@default:default,org.eclipse.ui.views@default:default,java_cup.runtime@default:default,org.eclipse.core.resources@default:default,org.apache.commons.codec*1.3.0.v20100518-1140@default:default,org.eclipse.wst.common.ui@default:default,org.eclipse.wst.common.modulecore@default:default,org.eclipse.ui.win32@default:false,org.eclipse.ltk.core.refactoring@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,javax.xml@default:default,org.eclipse.platform.doc.user@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.wst.common.frameworks.ui@default:default,org.mozilla.xulrunner.win32.win32.x86@default:false,org.apache.xml.resolver@default:default,org.apache.jasper@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.wst.common.frameworks@default:default,org.eclipse.osgi@-1:true,org.eclipse.ui@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.emf.edit.ui@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.ecf.ssl@default:false,org.apache.bcel@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.core.expressions@default:default,org.eclipse.wst.xmleditor.doc.user@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.wst.html.ui@default:default,org.eclipse.text@default:default,org.eclipse.wst.html.ui.infopop@default:default,org.eclipse.wst.jsdt.doc@default:default,org.eclipse.update.ui@default:default,org.eclipse.wst.jsdt.support.firefox@default:default,org.eclipse.rcp@default:default,org.eclipse.compare@default:default,org.eclipse.emf.common@default:default,org.eclipse.wst.jsdt.support.ie@default:default,org.eclipse.cvs@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.wst.xml.ui@default:default,org.eclipse.wst.xml.xpath.ui@default:default,org.eclipse.ui.presentations.r21@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.wst.common.uriresolver@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.wst.jsdt.manipulation@default:default,org.eclipse.team.cvs.core@default:default,org.eclipse.jface.text@default:default,org.eclipse.equinox.security@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.equinox.app@default:default,org.apache.lucene@default:default,org.eclipse.help.appserver@default:default,org.eclipse.ecf@default:default,org.eclipse.ui.cheatsheets@default:default,org.jdom@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.update.core.win32@default:false,org.eclipse.help.base@default:default,org.eclipse.wst.css.ui@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.equinox.launcher.win32.win32.x86@default:false,org.eclipse.swt.win32.win32.x86@default:false,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.equinox.concurrent@default:default,org.apache.commons.lang@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.wst.xml.xpath.core@default:default,org.apache.commons.codec*1.3.0.v20100106-1700@default:default,org.eclipse.wst.common.emf@default:default,org.eclipse.wst.xml.ui.infopop@default:default,org.eclipse.wst.html.core@default:default,org.eclipse.core.net.win32.x86@default:false,org.eclipse.wst.jsdt.ui@default:default,org.apache.lucene.analysis@default:default,org.eclipse.compare.core@default:default,org.sat4j.core@default:default,org.apache.xalan@default:default,org.eclipse.emf.edit@default:default,org.eclipse.team.core@default:default,org.eclipse.ui.intro@default:default,org.mozilla.xulrunner@default:default,org.eclipse.update.core@default:default,org.apache.commons.el@default:default,org.eclipse.core.boot@default:default,com.jcraft.jsch@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.help.webapp@default:default,org.eclipse.ui.browser@default:default,org.eclipse.wst.sse.doc.user@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.emf.common.ui@default:default,org.eclipse.ui.console@default:default,org.eclipse.equinox.util@default:default,org.eclipse.wst.common.core@default:default"/>
-<stringAttribute key="selected_workspace_plugins" value="org.symbian.tools.wrttools.product@default:default,org.w3c.css@default:default,org.chromium.debug.ui@default:default,org.symbian.tools.wrttools.doc.WRTKit@default:default,org.symbian.tools.mtw.ui@default:default,org.symbian.tools.wrttools.doc.WebDeveloper@default:default,org.symbian.tools.wrttools.previewer@default:default,org.symbian.tools.wrttools@default:default,org.symbian.tools.mtw.core@default:default,org.symbian.tools.wrttools.debug.core@default:default,org.chromium.debug.core@default:default,org.chromium.sdk@default:default"/>
+<stringAttribute key="selected_target_plugins" value="org.eclipse.wst.internet.monitor.core@default:default,org.eclipse.osgi.util@default:default,org.eclipse.osgi.services@default:default,org.eclipse.draw2d@default:default,org.eclipse.ui.console@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.core.resources@default:default,org.eclipse.wst.jsdt.web.core@default:default,org.eclipse.debug.core@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.wst.xmleditor.doc.user@default:default,org.eclipse.platform@default:default,org.eclipse.wst.jsdt.web.ui@default:default,org.apache.commons.codec*1.3.0.v20100518-1140@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.jsch.ui@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.ui.workbench@default:default,com.ibm.icu@default:default,org.apache.commons.codec*1.3.0.v20100106-1700@default:default,org.apache.commons.httpclient*3.1.0.v20080605-1935@default:default,org.eclipse.ui.workbench.compatibility@default:false,org.eclipse.team.cvs.core@default:default,org.eclipse.equinox.app@default:default,org.eclipse.wst.common.project.facet.ui@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.wst.common.frameworks.ui@default:default,org.eclipse.emf.common.ui@default:default,org.eclipse.ui.ide@default:default,org.eclipse.wst.dtd.core@default:default,org.apache.xerces@default:default,org.eclipse.swt@default:default,org.eclipse.wst.jsdt.support.ie@default:default,org.eclipse.wst.xml.xpath2.processor@default:default,org.apache.log4j@default:default,org.eclipse.wst.common.ui@default:default,org.eclipse.ui.browser@default:default,org.eclipse.ui.forms@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.sat4j.pb@default:default,org.eclipse.core.jobs@default:default,org.apache.commons.collections@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.util@default:default,org.eclipse.wst.xml.xpath.ui@default:default,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.help.base@default:default,org.apache.xml.serializer@default:default,org.apache.xalan@default:default,org.eclipse.update.scheduler@default:default,org.eclipse.swt.win32.win32.x86@default:false,org.eclipse.help.ui@default:default,org.eclipse.wst.html.core@default:default,org.mozilla.xulrunner.win32.win32.x86@default:false,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.team.core@default:default,org.eclipse.wst.css.core@default:default,org.eclipse.wst.sse.core@default:default,org.eclipse.emf.common@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.wst.sse.ui@default:default,org.eclipse.core.net.win32.x86@default:false,org.eclipse.equinox.p2.repository@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.core.variables@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.wst.common.project.facet.core@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.gef@default:default,org.sat4j.core@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.ui.win32@default:false,org.eclipse.core.resources.win32.x86@default:false,org.eclipse.search@default:default,org.eclipse.wst.common.core@default:default,org.eclipse.help@default:default,org.eclipse.equinox.launcher.win32.win32.x86@default:false,javax.servlet@default:default,org.eclipse.jface@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.eclipse.core.runtime@default:true,org.eclipse.equinox.p2.metadata.generator@default:default,org.eclipse.ecf@default:default,org.eclipse.wst.sse.doc.user@default:default,org.eclipse.update.core@default:default,org.eclipse.wst.internet.cache@default:default,org.eclipse.ui.editors@default:default,org.eclipse.osgi@-1:true,org.eclipse.equinox.http.registry@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.debug.ui@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.ui@default:default,org.eclipse.help.appserver@default:default,org.eclipse.emf.ecore.edit@default:default,org.eclipse.wst.common.infopop@default:default,org.eclipse.wst.xml.core@default:default,org.eclipse.core.net@default:default,org.eclipse.cvs@default:default,com.jcraft.jsch@default:default,org.eclipse.wst.xml.xpath.core@default:default,org.eclipse.wst.common.environment@default:default,org.apache.xml.resolver@default:default,org.apache.commons.lang@default:default,org.eclipse.compare@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.apache.lucene.analysis@default:default,org.eclipse.ui.net@default:default,org.apache.commons.logging*1.0.4.v200904062259@default:default,org.eclipse.wst.common.frameworks@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.text@default:default,org.eclipse.compare.win32@default:default,org.eclipse.emf.edit@default:default,org.eclipse.wst.standard.schemas@default:default,org.eclipse.wst.common.snippets@default:default,java_cup.runtime@default:default,org.eclipse.ui.views@default:default,org.eclipse.wst.html.ui.infopop@default:default,org.eclipse.wst.validation.infopop@default:default,org.eclipse.wst.internet.monitor.ui@default:default,org.apache.commons.el@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.core.databinding@default:default,org.eclipse.wst.validation@default:default,org.apache.velocity@default:default,org.eclipse.team.ui@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.jem.util@default:default,org.eclipse.wst.jsdt.support.firefox@default:default,org.eclipse.wst.validation.ui@default:default,org.eclipse.team.cvs.ui@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.wst.html.ui@default:default,org.eclipse.wst.jsdt.manipulation@default:default,org.eclipse.ui.intro@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.ui.presentations.r21@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.mozilla.xulrunner@default:default,org.eclipse.update.core.win32@default:false,org.eclipse.wst.xml.ui.infopop@default:default,org.eclipse.team.cvs.ssh2@default:default,org.eclipse.jface.text@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.emf.edit.ui@default:default,javax.servlet.jsp@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.compare.core@default:default,org.eclipse.wst.jsdt.doc@default:default,org.eclipse.core.expressions@default:default,org.jdom@default:default,org.eclipse.platform.doc.user@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.wst.common.uriresolver@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.apache.bcel@default:default,org.mozilla.xpcom@default:default,org.eclipse.wst.jsdt.ui@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.ecf.identity@default:default,org.eclipse.jsch.core@default:default,org.eclipse.wst.common.modulecore@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.wst.doc.user@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.runtime.compatibility@default:default,org.apache.jasper@default:default,org.eclipse.wst.css.ui@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.update.ui@default:default,org.eclipse.wst.common.emf@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.wst.xml.ui@default:default,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.security@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.boot@default:default,org.mortbay.jetty.util@default:default,org.mortbay.jetty.server@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.rcp@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.wst.sse.ui.infopop@default:default,javax.xml@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.wst.jsdt.core@default:default,org.eclipse.update.configurator@3:true,org.eclipse.help.webapp@default:default,org.eclipse.core.filebuffers@default:default,org.apache.lucene@default:default,org.eclipse.ui.ide.application@default:default"/>
+<stringAttribute key="selected_workspace_plugins" value="org.symbian.tools.wrttools@default:default,org.chromium.debug.ui@default:default,org.symbian.tools.wrttools.doc.WebDeveloper@default:default,org.symbian.tools.wrttools.product@default:default,org.symbian.tools.wrttools.debug.core@default:default,org.symbian.tools.wrttools.doc.WRTKit@default:default,org.w3c.css@default:default,org.symbian.tools.wrttools.previewer@default:default,org.symbian.tools.tmw.core@default:default,org.chromium.debug.core@default:default,org.symbian.tools.tmw.ui@default:default,org.chromium.sdk@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="true"/>
<mapAttribute key="tracingOptions">
--- a/org.symbian.tools.wrttools.product/wrt-ide.product Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.wrttools.product/wrt-ide.product Mon Aug 09 15:18:34 2010 -0700
@@ -232,6 +232,7 @@
<plugin id="org.eclipse.wst.common.infopop"/>
<plugin id="org.eclipse.wst.common.modulecore"/>
<plugin id="org.eclipse.wst.common.project.facet.core"/>
+ <plugin id="org.eclipse.wst.common.project.facet.ui"/>
<plugin id="org.eclipse.wst.common.snippets"/>
<plugin id="org.eclipse.wst.common.ui"/>
<plugin id="org.eclipse.wst.common.uriresolver"/>
@@ -278,8 +279,8 @@
<plugin id="org.mozilla.xulrunner.win32.win32.x86" fragment="true"/>
<plugin id="org.sat4j.core"/>
<plugin id="org.sat4j.pb"/>
- <plugin id="org.symbian.tools.mtw.core"/>
- <plugin id="org.symbian.tools.mtw.ui"/>
+ <plugin id="org.symbian.tools.tmw.core"/>
+ <plugin id="org.symbian.tools.tmw.ui"/>
<plugin id="org.symbian.tools.wrttools"/>
<plugin id="org.symbian.tools.wrttools.debug.core"/>
<plugin id="org.symbian.tools.wrttools.doc.WRTKit"/>
--- a/org.symbian.tools.wrttools/META-INF/MANIFEST.MF Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.wrttools/META-INF/MANIFEST.MF Mon Aug 09 15:18:34 2010 -0700
@@ -27,8 +27,10 @@
org.eclipse.wst.common.snippets,
org.eclipse.jface.text;bundle-version="3.6.0",
org.eclipse.wst.jsdt.web.core;bundle-version="1.0.300",
- org.symbian.tools.mtw.core;bundle-version="1.0.0",
- org.symbian.tools.mtw.ui;bundle-version="1.0.0"
+ 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"
Bundle-RequiredExecutionEnvironment: J2SE-1.5,
JavaSE-1.6
Bundle-ActivationPolicy: lazy
--- a/org.symbian.tools.wrttools/plugin.xml Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.wrttools/plugin.xml Mon Aug 09 15:18:34 2010 -0700
@@ -28,7 +28,6 @@
<!-- Web Runtime Preferences -->
<extension
point="org.eclipse.core.runtime.preferences">
- <initializer class="org.symbian.tools.wrttools.core.deploy.PreferenceInitializer"/>
<initializer
class="org.symbian.tools.wrttools.core.WrtIdeCorePreferences">
</initializer>
@@ -420,45 +419,6 @@
</menuContribution>
</extension>
<extension
- point="org.eclipse.core.expressions.definitions">
- <definition
- id="org.symbian.tools.wrttools.symbianproject">
- <or>
- <with
- variable="selection">
- <and>
- <count
- value="1">
- </count>
- <iterate>
- <adapt
- type="org.eclipse.core.resources.IResource">
- <test
- property="org.eclipse.core.resources.projectNature"
- value="org.symbian.tools.wrttools.WidgetProjectNature">
- </test>
- </adapt>
- </iterate>
- </and>
- </with>
- <and>
- <with
- variable="activePart">
- <instanceof
- value="org.eclipse.ui.IEditorPart">
- </instanceof>
- </with>
- <with
- variable="activeEditorInput">
- <adapt
- type="org.eclipse.core.resources.IResource">
- </adapt>
- </with>
- </and>
- </or>
- </definition>
- </extension>
- <extension
point="org.eclipse.ui.decorators">
<decorator
adaptable="true"
@@ -798,7 +758,7 @@
</category>
</extension>
<extension
- point="org.symbian.tools.mtw.core.projectProvider">
+ point="org.symbian.tools.tmw.core.projectProvider">
<projectProvider
class="org.symbian.tools.wrttools.core.project.WRTIDEProjectProvider">
<enablement>
@@ -813,21 +773,27 @@
</projectProvider>
</extension>
<extension
- point="org.symbian.tools.mtw.core.runtimes">
+ point="org.symbian.tools.tmw.core.runtimes">
<runtime
- id="org.symbian.wrt11"
+ component-id="org.symbian.tools.wrttools.wrt"
+ component-version="1.1"
name="Symbian WRT 1.1">
+ <runtime-component
+ id="tmw.geolocation"
+ version="1.0">
+ </runtime-component>
</runtime>
</extension>
<extension
- point="org.symbian.tools.mtw.core.packagers">
+ point="org.symbian.tools.tmw.core.packagers">
<packager
delegate="org.symbian.tools.wrttools.core.packager.WrtPackager"
- targetRuntime="org.symbian.wrt11">
+ target-runtime="org.symbian.tools.wrttools.wrt"
+ target-runtime-version="1.1">
</packager>
</extension>
<extension
- point="org.symbian.tools.mtw.ui.deploymentTargetType">
+ point="org.symbian.tools.tmw.ui.deploymentTargetType">
<deployment-target-type
class="org.symbian.tools.wrttools.core.deploy.emulator.EmulatorTargetType"
icon="icons/deploy_settings.gif"
@@ -835,5 +801,42 @@
priority="50">
</deployment-target-type>
</extension>
+ <extension
+ point="org.eclipse.wst.common.project.facet.core.runtimes">
+ <runtime-component-type
+ id="org.symbian.tools.wrttools.wrt">
+ </runtime-component-type>
+ <runtime-component-version
+ type="org.symbian.tools.wrttools.wrt"
+ version="1.1">
+ </runtime-component-version>
+ </extension>
+ <extension
+ point="org.eclipse.wst.common.project.facet.ui.images">
+ <image
+ path="icons/main16_prev.gif"
+ runtime-component-type="org.symbian.tools.wrttools.wrt"
+ version="1.0">
+ </image>
+ </extension>
+ <extension
+ point="org.symbian.tools.tmw.core.runtimeIncludePath">
+ <runtime-include-path
+ id="org.symbian.tools.wrttools.wrt"
+ version="1.1">
+ <include-path-entry
+ file="libraries/core/widget.js"
+ name="WRT 1.1 Widget API">
+ </include-path-entry>
+ <include-path-entry
+ file="libraries/core/services.js"
+ name="WRT 1.1 Services API">
+ </include-path-entry>
+ <include-path-entry
+ file="libraries/core/menu.js"
+ name="WRT 1.1 Menu API">
+ </include-path-entry>
+ </runtime-include-path>
+ </extension>
</plugin>
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WRTProject.java Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WRTProject.java Mon Aug 09 15:18:34 2010 -0700
@@ -35,14 +35,15 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.symbian.tools.mtw.core.MTWCore;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.core.runtimes.IMobileWebRuntime;
+import org.symbian.tools.tmw.core.TMWCore;
+import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
public class WRTProject implements IMTWProject {
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.wrt11";
+ public static final String WRT11_RUNTIME = "org.symbian.tools.wrttools.wrt";
+ public static final String WRT11_VERSION = "1.1";
private final IProject project;
public WRTProject(IProject project) {
@@ -102,7 +103,7 @@
}
public IMobileWebRuntime getTargetRuntime() {
- return MTWCore.getDefault().getRuntimesManager().getRuntime(WRT11_RUNTIME);
+ return TMWCore.getDefault().getRuntimesManager().getRuntime(WRT11_RUNTIME, WRT11_VERSION);
}
private void saveProperties(Properties props) {
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/emulator/Emulator.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/**
- * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of the License "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Symbian Foundation - initial contribution.
- * Contributors:
- * Description:
- * Overview:
- * Details:
- * Platforms/Drives/Compatibility:
- * Assumptions/Requirement/Pre-requisites:
- * Failures and causes:
- */
-package org.symbian.tools.wrttools.core.deploy.emulator;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.ui.IMemento;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.core.runtimes.IPackager;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTarget;
-import org.symbian.tools.wrttools.Activator;
-
-public class Emulator extends PlatformObject implements IDeploymentTarget {
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result + ((path == null) ? 0 : path.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Emulator other = (Emulator) obj;
- if (id == null) {
- if (other.id != null) {
- return false;
- }
- } else if (!id.equals(other.id)) {
- return false;
- }
- if (path == null) {
- if (other.path != null) {
- return false;
- }
- } else if (!path.equals(other.path)) {
- return false;
- }
- return true;
- }
-
- private final String id;
- private final String path;
-
- public Emulator(String id, String path) {
- this.id = id;
- this.path = path;
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return id;
- }
-
- public String getDescription() {
- return path;
- }
-
- public IStatus deploy(IMTWProject project, IPackager packager, IProgressMonitor monitor)
- throws CoreException {
- final File application = packager.packageApplication(project, monitor);
- final File outputFile = new File(path);
- if (!outputFile.isDirectory()) {
- outputFile.mkdir();
- }
-
- final File out = new File(outputFile + "/" + application.getName()); //$NON-NLS-1$
- deployWidget(application, out);
- return new Status(
- IStatus.OK,
- Activator.PLUGIN_ID,
- "Application was successfully deployed to emulator. You will need to complete installation process using your emulator UI.");
- }
-
- public void save(IMemento memento) {
- // Do nothing
- }
-
- public void init(IMTWProject project, IPackager packager, IMemento memento) {
- // Do nothing
- }
-
- // helper methods
-
- /**
- * Deploys the widget from the source to the destination path of the emulator.
- * @param inputFile the actual widget path from where widget needs to be deployed.
- * @param outputFile the path of the emulator where the widget will be deoplyed.
- */
- private void deployWidget(File inputFile, File outputFile) throws CoreException {
- try {
- InputStream in = new FileInputStream(inputFile);
- OutputStream out = new FileOutputStream(outputFile);
- int c;
-
- while ((c = in.read()) != -1) {
- out.write(c);
- }
- in.close();
- out.close();
- } catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Application deployment failed", e));
- }
- }
-}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/emulator/EmulatorTargetType.java Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/**
- * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of the License "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Symbian Foundation - initial contribution.
- * Contributors:
- * Description:
- * Overview:
- * Details:
- * Platforms/Drives/Compatibility:
- * Assumptions/Requirement/Pre-requisites:
- * Failures and causes:
- */
-package org.symbian.tools.wrttools.core.deploy.emulator;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTarget;
-import org.symbian.tools.mtw.ui.deployment.IDeploymentTargetType;
-import org.symbian.tools.wrttools.core.IWRTConstants;
-import org.w3c.dom.Document;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-public final class EmulatorTargetType implements IDeploymentTargetType {
- /**
- * Map containing of the SDKS with the corresponding paths.
- */
- private Map<String, Emulator> listofEmulators;
-
- public EmulatorTargetType() {
- discoverTargets(new NullProgressMonitor());
- }
-
- public IDeploymentTarget[] getTargets(IMTWProject project) {
- Collection<Emulator> values = listofEmulators.values();
- return values.toArray(new Emulator[values.size()]);
- }
-
- public void discoverTargets(IProgressMonitor monitor) {
- if (listofEmulators == null) {
- listofEmulators = new HashMap<String, Emulator>();
- }
- listofEmulators.clear();
- initialize();
- }
-
- public IDeploymentTarget findTarget(IMTWProject project, String id) {
- return listofEmulators.get(id);
- }
-
- public boolean targetsDiscovered() {
- return true;
- }
-
- public ISchedulingRule getSchedulingRule(IDeploymentTarget target) {
- return null;
- }
-
- // helper methods
-
- /**
- * This will parse the xml and create the nodes to be displayed on the table
- * viewer. The information will be used by content & label provider to get
- * the contents and display accordingly in the list of the projects in the view.
- */
- public Map<String, Emulator> initialize() {
-
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- // Parse the devices.xml and retrieve the list of the emulators from it
- // and build the list to be displayed in the view.
-
- try {
- DocumentBuilder builder = factory.newDocumentBuilder();
- File file = new File(IWRTConstants.DEVICES_XML_PATH);
- if (!file.exists()) {
- IPath otherPath = new Path(System.getProperty("user.home"))
- .append(IWRTConstants.DEVICES_VISTA_XML_PATH);
- file = otherPath.toFile();
- }
- if (file.exists()) {
- FileInputStream fin = new FileInputStream(file);
- Document document = builder.parse(fin);
- NodeList childNodes = document.getChildNodes();
-
- for (int i = 0; i < childNodes.getLength(); i++) {
-
- Node node = childNodes.item(i);
- String nodeName = node.getNodeName();
- // If the node name is "devices" it is the root node of the xml.
- if (nodeName.equals(IWRTConstants.DEVICES_TAG)) {
- // once we have the root node get the child information to
- // build the devices list.
- createDevicesList(node);
-
- }
- }
- }
- } catch (ParserConfigurationException e) {
- // WidgetUtils.getView().getLogger().severe(e.getMessage());
- } catch (SAXException e) {
- // WidgetUtils.getView().getLogger().severe(e.getMessage());
- } catch (IOException e) {
- // WidgetUtils.getView().getLogger().severe(e.getMessage());
- }
- return listofEmulators;
- }
-
- /**
- * Creates the devices nodes in the table.
- * @param parentNode
- */
- private void createDevicesList(Node parentNode) {
- NodeList list = getChildNodes(parentNode);
- for (int i = 0; i < list.getLength(); i++) {
- Node node = list.item(i);
- String nodeName = node.getNodeName();
- if (nodeName.equals(IWRTConstants.DEVICE_TAG)) {
- createDeviceChildNode(node);
- }
- }
- }
-
- /**
- * Gets the EPOC ROOT node and than finally the list of devices.
- * @param parentNode
- */
- private void createDeviceChildNode(Node parentNode) {
- NodeList list = getChildNodes(parentNode);
- for (int i = 0; i < list.getLength(); i++) {
- Node node = list.item(i);
- String nodeName = node.getNodeName();
- if (nodeName.equals(IWRTConstants.EPOC_ROOT_TAG)) {
- addProject(node, parentNode);
- }
- }
- }
-
- /**
- * Adds the devices to the list to be displayed.
- * @param deviceNode the device node
- * @param epocNode the epoc root node.
- */
- private void addProject(Node epocNode, Node deviceNode) {
- NodeList list = getChildNodes(epocNode);
- NamedNodeMap attributes = deviceNode.getAttributes();
- String sdkId = "";
- String sdkName = "";
- for (int i = 0; i < attributes.getLength(); i++) {
- Node item = attributes.item(i);
- if (item.getNodeName().equals(IWRTConstants.NAME_ATTR)) {
- sdkName = item.getNodeValue();
- }
- if (item.getNodeName().equals(IWRTConstants.ID_ATTR)) {
- sdkId = item.getNodeValue();
- }
- }
- for (int i = 0; i < list.getLength(); i++) {
- Node node = list.item(i);
- if (sdkName.equals(IWRTConstants.EMULATOR_NAME)) {
- listofEmulators.put(sdkId, new Emulator(sdkId, node.getNodeValue()));
- }
- }
- }
-
- /**
- * Returns the child list of the particular Node.
- * @param parentNode
- */
- private static NodeList getChildNodes(Node parentNode) {
- return parentNode.getChildNodes();
- }
-
-}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/WrtPackager.java Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/WrtPackager.java Mon Aug 09 15:18:34 2010 -0700
@@ -29,9 +29,9 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.core.runtimes.IPackagerDelegate;
-import org.symbian.tools.mtw.core.utilities.ZipApplicationVisitor;
+import org.symbian.tools.tmw.core.projects.IMTWProject;
+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;
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/project/WRTIDEProjectProvider.java Thu Jul 29 15:59:01 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/project/WRTIDEProjectProvider.java Mon Aug 09 15:18:34 2010 -0700
@@ -22,8 +22,8 @@
import java.util.WeakHashMap;
import org.eclipse.core.resources.IProject;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.core.projects.IMTWProjectProvider;
+import org.symbian.tools.tmw.core.projects.IMTWProject;
+import org.symbian.tools.tmw.core.projects.IMTWProjectProvider;
import org.symbian.tools.wrttools.WRTProject;
import org.symbian.tools.wrttools.util.ProjectUtils;