Emulator deployment was added
authorEugene Ostroukhov <eugeneo@symbian.org>
Thu, 29 Jul 2010 10:00:34 -0700
changeset 458 5ff93668b08c
parent 457 f1087591ff71
child 459 c278f0c8917f
Emulator deployment was added
org.symbian.tools.mtw.ui/plugin.xml
org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/DeploymentTargetTypeDescriptor.java
org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/DeploymentTargetWizardPage.java
org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/externalapp/AdapterFactory.java
org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/externalapp/ExternalApplicationDeploymentType.java
org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/ProjectMemo.java
org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/deployment/IDeploymentTarget.java
org.symbian.tools.wrttools/META-INF/MANIFEST.MF
org.symbian.tools.wrttools/plugin.xml
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WRTProject.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/DeployMessages.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/PreferenceConstants.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/PreferenceInitializer.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/ProgressMonitorAndLogger.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/deployMessages.properties
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/emulator/Emulator.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/emulator/EmulatorDeployer.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/emulator/EmulatorListProvider.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/emulator/EmulatorTargetType.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deployer/DeployException.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deployer/DeployStatus.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deployer/DeployerMessages.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deployer/IWidgetDeployer.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deployer/IWidgetDeployerConstants.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deployer/WidgetDeployer.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deployer/deployerMessages.properties
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/ProjectUtils.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/deploy/DeploymentTarget.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/deploy/EmulatorTarget.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/deploy/ProgramTarget.java
--- a/org.symbian.tools.mtw.ui/plugin.xml	Wed Jul 28 15:43:33 2010 -0700
+++ b/org.symbian.tools.mtw.ui/plugin.xml	Thu Jul 29 10:00:34 2010 -0700
@@ -142,6 +142,11 @@
            id="org.symbian.tools.mtw.bluetooth"
            priority="10">
      </deployment-target-type>
+     <deployment-target-type
+           class="org.symbian.tools.mtw.internal.deployment.externalapp.ExternalApplicationDeploymentType"
+           id="org.symbian.tools.mtw.ui.externalApp"
+           priority="1000">
+     </deployment-target-type>
   </extension>
   <extension
         point="org.eclipse.core.runtime.adapters">
@@ -155,6 +160,13 @@
               type="org.eclipse.ui.model.IWorkbenchAdapter2">
         </adapter>
      </factory>
+     <factory
+           adaptableType="org.symbian.tools.mtw.internal.deployment.externalapp.ExternalApplicationDeploymentType"
+           class="org.symbian.tools.mtw.internal.deployment.externalapp.AdapterFactory">
+        <adapter
+              type="org.eclipse.ui.model.IWorkbenchAdapter">
+        </adapter>
+     </factory>
   </extension>
 
 </plugin>
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/DeploymentTargetTypeDescriptor.java	Wed Jul 28 15:43:33 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/DeploymentTargetTypeDescriptor.java	Thu Jul 29 10:00:34 2010 -0700
@@ -75,17 +75,24 @@
     }
 
     private DeploymentTargetWrapper[] wrap(IDeploymentTarget[] targets) {
-        final DeploymentTargetWrapper[] w = new DeploymentTargetWrapper[targets.length];
-        for (int i = 0; i < targets.length; i++) {
-            final IDeploymentTarget target = targets[i];
-            DeploymentTargetWrapper wrapper = wrappers.get(target);
-            if (wrapper == null) {
-                wrapper = new DeploymentTargetWrapper(target, this);
-                wrappers.put(target, wrapper);
+        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]);
             }
-            w[i] = wrapper;
+            return w;
         }
-        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 {
@@ -93,7 +100,7 @@
     }
 
     public IDeploymentTarget findTarget(IMTWProject project, String id) {
-        return getProvider().findTarget(project, id);
+        return wrap(getProvider().findTarget(project, id));
     }
 
     private synchronized IDeploymentTargetType getProvider() {
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/DeploymentTargetWizardPage.java	Wed Jul 28 15:43:33 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/DeploymentTargetWizardPage.java	Thu Jul 29 10:00:34 2010 -0700
@@ -159,6 +159,7 @@
 
     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);
@@ -171,12 +172,17 @@
                     search.getDisplay().asyncExec(new Runnable() {
                         public void run() {
                             list.setInput(context.getDeploymentTargets());
-                            ISelection selection = list.getSelection();
-                            if (selection.isEmpty()) {
-                                selectDeploymentTarget(null);
+                            if (!sel.isEmpty()) {
+                                list.setSelection(sel);
+                                selectDeploymentTarget((DeploymentTargetWrapper) ((IStructuredSelection)sel).getFirstElement());
                             } else {
-                                selectDeploymentTarget((DeploymentTargetWrapper) ((IStructuredSelection) selection)
-                                        .getFirstElement());
+                                DeploymentTargetWrapper[] deploymentTargets = context.getDeploymentTargets();
+                                if (deploymentTargets.length == 0) {
+                                    selectDeploymentTarget(null);
+                                } else {
+                                    list.setSelection(new StructuredSelection(deploymentTargets[0]));
+                                    selectDeploymentTarget(deploymentTargets[0]);
+                                }
                             }
                         }
                     });
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/internal/deployment/externalapp/AdapterFactory.java	Thu Jul 29 10:00: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.mtw.internal.deployment.externalapp;
+
+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/mtw/internal/deployment/externalapp/ExternalApplicationDeploymentType.java	Thu Jul 29 10:00:34 2010 -0700
@@ -0,0 +1,120 @@
+/**
+ * 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 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.IMobileWebRuntime;
+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, IMobileWebRuntime runtime, IProgressMonitor monitor)
+            throws CoreException {
+        Program app = getExternalApp(project);
+        IPackager packager = MTWCore.getDefault().getRuntimesManager().getPackager(project, runtime);
+        File file = packager.packageApplication(project, runtime, 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 load(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/ui/ProjectMemo.java	Wed Jul 28 15:43:33 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/ProjectMemo.java	Thu Jul 29 10:00:34 2010 -0700
@@ -104,6 +104,7 @@
                         if (child != null) {
                             target.load(child);
                         }
+                        return target;
                     }
                 }
             }
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/deployment/IDeploymentTarget.java	Wed Jul 28 15:43:33 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/deployment/IDeploymentTarget.java	Thu Jul 29 10:00:34 2010 -0700
@@ -42,6 +42,8 @@
  * {@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 {
--- a/org.symbian.tools.wrttools/META-INF/MANIFEST.MF	Wed Jul 28 15:43:33 2010 -0700
+++ b/org.symbian.tools.wrttools/META-INF/MANIFEST.MF	Thu Jul 29 10:00:34 2010 -0700
@@ -27,7 +27,8 @@
  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.core;bundle-version="1.0.0",
+ org.symbian.tools.mtw.ui;bundle-version="1.0.0"
 Bundle-RequiredExecutionEnvironment: J2SE-1.5,
  JavaSE-1.6
 Bundle-ActivationPolicy: lazy
--- a/org.symbian.tools.wrttools/plugin.xml	Wed Jul 28 15:43:33 2010 -0700
+++ b/org.symbian.tools.wrttools/plugin.xml	Thu Jul 29 10:00:34 2010 -0700
@@ -826,5 +826,14 @@
             targetRuntime="org.symbian.wrt11">
       </packager>
    </extension>
+   <extension
+         point="org.symbian.tools.mtw.ui.deploymentTargetType">
+      <deployment-target-type
+            class="org.symbian.tools.wrttools.core.deploy.emulator.EmulatorTargetType"
+            icon="icons/deploy_settings.gif"
+            id="org.symbian.tools.wrttools.symbianemulator"
+            priority="50">
+      </deployment-target-type>
+   </extension>
  
 </plugin>
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WRTProject.java	Wed Jul 28 15:43:33 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WRTProject.java	Thu Jul 29 10:00:34 2010 -0700
@@ -35,16 +35,11 @@
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.preference.IPreferenceStore;
 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.wrttools.wizards.deploy.DeploymentTarget;
 
 public class WRTProject implements IMTWProject {
-    private static final String PROP_DEPLOYMENT_TARGET_NAME = "deployment.target.name";
-
-    private static final String PROP_DEPLOYMENT_TARGET_TYPE = "deployment.target.type";
     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";
@@ -127,16 +122,6 @@
         }
     }
 
-    public void setDeploymentTarget(DeploymentTarget target) {
-        Properties props = getProps();
-        props.setProperty(PROP_DEPLOYMENT_TARGET_NAME, target.getName());
-        props.setProperty(PROP_DEPLOYMENT_TARGET_TYPE, target.getType());
-        IPreferenceStore store = Activator.getDefault().getPreferenceStore();
-        store.setValue(PROP_DEPLOYMENT_TARGET_NAME, target.getName());
-        store.setValue(PROP_DEPLOYMENT_TARGET_TYPE, target.getType());
-        saveProperties(props);
-    }
-
     public void setPreferredScreenSize(String screenSize) {
         Properties props = getProps();
         if (screenSize != null) {
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/DeployMessages.java	Wed Jul 28 15:43:33 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +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.wrttools.core.deploy;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class DeployMessages {
-	private static final String BUNDLE_NAME = "org.symbian.tools.wrttools.core.deploy.deployMessages"; //$NON-NLS-1$
-
-	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
-			.getBundle(BUNDLE_NAME);
-
-	private DeployMessages() {
-	}
-
-	public static String getString(String key) {
-		try {
-			return RESOURCE_BUNDLE.getString(key);
-		} catch (MissingResourceException e) {
-			return '!' + key + '!';
-		}
-	}
-}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/PreferenceConstants.java	Wed Jul 28 15:43:33 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +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.wrttools.core.deploy;
-
-/**
- * Constant definitions for plug-in preferences
- */
-public class PreferenceConstants {
-
-	///-----------------keys-----------------------//
-	
-	public static final String WRT_DEPLOY_CHOICE = "wrtDeploychoicePreference";	
-	
-	public static final String DEPLOYMENT_SETTINGE_PAGE = "org.symbian.tools.wrttools.core.deploy.DeployPreferencePage";
-	
-	//---------------------values----------------------------//
-	
-	public static final String WRT_DEPLOY_CHOICE_DEVICE = "DEVICE";
-	
-	public static final String WRT_DEPLOY_CHOICE_EMULATOR = "EMULATOR";	
-	
-	
-	
-	public static final String SELECTED_EMULATOR_PATH = "org.symbian.tools.wrttools.emulator";
-	
-	public static final String SELECTED_DEVICE_NAME = "selectedDeviceName";
-	public static final String SELECTED_EMULATOR_NAME = "selectedEmulatorDeviceName";
-	
-	public static final String DEBUG_ENABLED = "debugEnabled";
-
-    public static final String PACKAGE_WITH_ERRORS = "packageWithErrors";
-}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/PreferenceInitializer.java	Wed Jul 28 15:43:33 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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.wrttools.core.deploy;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.symbian.tools.wrttools.Activator;
-
-/**
- * Class used to initialize default preference values.
- */
-public class PreferenceInitializer extends AbstractPreferenceInitializer {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
-	 */
-	public void initializeDefaultPreferences() {
-		IPreferenceStore store = Activator.getDefault().getPreferenceStore();		
-
-        store.setDefault(PreferenceConstants.PACKAGE_WITH_ERRORS, MessageDialogWithToggle.PROMPT);
-	}
-
-}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/ProgressMonitorAndLogger.java	Wed Jul 28 15:43:33 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.symbian.tools.wrttools.Activator;
-import org.symbian.tools.wrttools.core.status.IWRTStatusListener;
-import org.symbian.tools.wrttools.core.status.WRTStatus;
-import org.symbian.tools.wrttools.util.ProjectUtils;
-
-public class ProgressMonitorAndLogger implements IWRTStatusListener {
-    private final IProgressMonitor monitor;
-    private final MultiStatus status;
-
-    public ProgressMonitorAndLogger(IProgressMonitor monitor, MultiStatus status) {
-        this.monitor = monitor;
-        this.status = status;
-    }
-
-    public void emitStatus(WRTStatus status) {
-        monitor.setTaskName(status.getStatusDescription().toString());
-        this.status.add(new Status(IStatus.INFO, Activator.PLUGIN_ID, status.getStatusDescription().toString()));
-    }
-
-    public boolean isStatusHandled(WRTStatus status) {
-        return true;
-    }
-
-    public void close() {
-        // Do nothing
-    }
-
-    public boolean canPackageWithErrors(IProject project) {
-        return ProjectUtils.canPackageWithErrors(project);
-    }
-}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/deployMessages.properties	Wed Jul 28 15:43:33 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-wrt.core.Deployer.searchdevice.dialog.title=Searching devices
-View.none.text=none
-wrt.core.Deploy.failed.as.package.failed=Deploy cannot be completed as Packing failed
-
-WRTDeployerConstants.success=Packaging Successful\n
-WRTDeployerConstants.failed=Packaging Failed\n 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/emulator/Emulator.java	Thu Jul 29 10:00:34 2010 -0700
@@ -0,0 +1,148 @@
+/**
+ * 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.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.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, IMobileWebRuntime runtime, IProgressMonitor monitor)
+            throws CoreException {
+        final IPackager packager = MTWCore.getDefault().getRuntimesManager().getPackager(project, runtime);
+        File application = packager.packageApplication(project, runtime, monitor);
+
+        File outputFile = new File(path);
+        if (!outputFile.isDirectory()) {
+            outputFile.mkdir();
+        }
+
+        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 load(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/EmulatorDeployer.java	Wed Jul 28 15:43:33 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +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.wrttools.core.deploy.emulator;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.text.MessageFormat;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.symbian.tools.wrttools.core.deployer.DeployException;
-import org.symbian.tools.wrttools.core.deployer.DeployerMessages;
-import org.symbian.tools.wrttools.core.deployer.WidgetDeployer;
-import org.symbian.tools.wrttools.core.status.IWRTConstants;
-
-/**
- * The class needed for the deployment of the widget to emulator.
- * @author avraina
- */
-public class EmulatorDeployer extends WidgetDeployer {
-	
-	private boolean isDeploySuccessful = false;
-
-	public IStatus deploy(String fileName, String des, IProgressMonitor monitor) throws DeployException{				
-		File inputFile = new File(fileName);
-		File outputFile = new File(des);
-		emitStatus(DeployerMessages.getString("Deployer.begin.msg")); //$NON-NLS-1$
-		try {
-			if(!outputFile.isDirectory()){
-				outputFile.mkdir();
-			}
-		} catch (Exception e) {
-			emitStatus(DeployerMessages.getString("Deployer.failed.err.msg")); //$NON-NLS-1$
-			throw new DeployException(e);
-		}
-		
-		// If the archive is directly deployed than directly deploy it
-		// else deploy from the folder path.
-		if(fileName.toLowerCase().endsWith(IWRTConstants.WIDGET_FILE_EXTENSION)){
-			File out = new File(outputFile + "/" + inputFile.getName()); //$NON-NLS-1$
-			deployWidget(inputFile, out);			
-		} 
-		if(isDeploySuccessful){				
-			emitStatus(DeployerMessages.getString("Deployer.ends.msg")); //$NON-NLS-1$
-		} else {
-			emitStatus(DeployerMessages.getString("Deployer.failed.err.msg")); //$NON-NLS-1$
-		}
-		return Status.OK_STATUS;
-	}
-	
-	// 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.
-	 * @throws DeployException throw a DeployException if anything goes wrong.
-	 */
-	private void deployWidget(File inputFile, File outputFile) throws DeployException{
-		try {
-			String message = MessageFormat.format(DeployerMessages.getString("Deployer.inputfile.msg"), new Object[]{inputFile});//$NON-NLS-1$
-			emitStatus(message);
-			
-			InputStream in = new FileInputStream(inputFile);
-			OutputStream out  = new FileOutputStream(outputFile);
-			int c;
-
-			while ((c = in.read()) != -1)
-				out.write(c);
-			in.close();
-			out.close();
-			
-			message = MessageFormat.format(DeployerMessages.getString("Deployer.outputfile.msg"), new Object[]{outputFile});//$NON-NLS-1$
-			emitStatus(message);
-			isDeploySuccessful= true;
-		} catch (Exception e) {
-			emitStatus(e.getMessage());
-			isDeploySuccessful=false;
-			emitStatus(DeployerMessages.getString("Deployer.failed.err.msg")); //$NON-NLS-1$
-			throw new DeployException(e);
-		}
-	}
-}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/emulator/EmulatorListProvider.java	Wed Jul 28 15:43:33 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +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.wrttools.core.deploy.emulator;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.HashMap;
-
-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.Path;
-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;
-
-
-
-
-/**
- * The Content provider for the Emulators List displayed.
- * @author avraina
- *
- */
-public class EmulatorListProvider{	
-
-	/**
-	 * Map containing of the SDKS with the corresponding paths.
-	 */	
-	private static HashMap<String, String> listofEmulators = new HashMap<String, String>();
-
-	public static HashMap<String, String> populateEmulators() {
-		if (listofEmulators == null) {
-			listofEmulators = new HashMap<String, String>();
-		}
-		listofEmulators.clear();
-		initialize();
-		return listofEmulators;
-	}
-	
-	// 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 static HashMap<String, String> 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);
-						
-					}
-				}
-				if(listofEmulators.size() == 0){
-					listofEmulators.put("None","");
-				}
-				
-				
-					
-			}
-			
-		} 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 static 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 static 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 static  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, node.getNodeValue());
-			}
-		}
-	}
-
-	/**
-	 * Returns the child list of the particular Node.
-	 * @param parentNode
-	 */
-	private static  NodeList getChildNodes(Node parentNode) {
-		return parentNode.getChildNodes();
-	}
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/emulator/EmulatorTargetType.java	Thu Jul 29 10:00:34 2010 -0700
@@ -0,0 +1,196 @@
+/**
+ * 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/deployer/DeployException.java	Wed Jul 28 15:43:33 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +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.wrttools.core.deployer;
-
-import org.symbian.tools.wrttools.core.exception.WRTException;
-
-public class DeployException extends WRTException {
-
-	private static final long serialVersionUID = -4322746430125745192L;
-
-	/**
-	 * @param cause
-	 */
-	public DeployException(Throwable cause) {
-		super(cause);
-	}
-
-	public DeployException(String message) {
-		super(message);
-	}
-}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deployer/DeployStatus.java	Wed Jul 28 15:43:33 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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.wrttools.core.deployer;
-
-import org.symbian.tools.wrttools.core.status.WRTStatus;
-
-/**
- * Raises the Deploy Status.
- * @author avraina
- *
- */
-public class DeployStatus extends WRTStatus{
-
-	/**
-	 * @param statusSource 
-	 * @param statusDescription
-	 */
-	public DeployStatus(String statusSource, String statusDescription) {
-		super(statusSource, statusDescription);
-	}
-}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deployer/DeployerMessages.java	Wed Jul 28 15:43:33 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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.wrttools.core.deployer;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class DeployerMessages {
-	private static final String BUNDLE_NAME = "org.symbian.tools.wrttools.core.deployer.deployerMessages"; //$NON-NLS-1$
-
-	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
-			.getBundle(BUNDLE_NAME);
-
-	private DeployerMessages() {
-	}
-
-	public static String getString(String key) {
-		try {
-			return RESOURCE_BUNDLE.getString(key);
-		} catch (MissingResourceException e) {
-			return '!' + key + '!';
-		}
-	}
-
-
-}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deployer/IWidgetDeployer.java	Wed Jul 28 15:43:33 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.wrttools.core.deployer;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.symbian.tools.wrttools.core.status.IWRTStatusListener;
-
-/**
- * The main interface for the Widget Project Deployment.The deployer will deploy the
- * widget to the different devices which can be an emulator, server etc. 
- * @author avraina
- *
- */
-public interface IWidgetDeployer {
-
-	/**
-	 * The method will deploy the widget to the target.
-	 * All the deployer tools must implement this method. Each deployer which 
-	 * @param inputPath the widget path from where the widget needs to be deployed.
-	 * @param destinationPath the destination path to which widget will be deployed. 
-	 * This can be an emulator , server or any other device
-	 * @return integer IStatus code. IStatus.OK for success, IStatus.CANCEL if the user canceled, IStatus.ERROR if an 
-	 * error was caught and reported to the status listener.
-	 * @throws DeployException throws a Deploy Exception if anything goes wrong while
-	 * deployment is going on.
-	 */
-	public IStatus deploy(String inputPath, String destinationPath, 
-						IProgressMonitor progressMonitor) throws DeployException;
-
-	/**
-	 * Sets the status listner associated with the widget deployer
-	 * @param statusListener the status listner to be associated.
-	 */
-	public void setStatusListener(IWRTStatusListener statusListener);
-
-    public boolean needsReport();
-
-}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deployer/IWidgetDeployerConstants.java	Wed Jul 28 15:43:33 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +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.wrttools.core.deployer;
-
-/**
- * Interface to hold the constants for the Deployer.
- * @author avraina
- *
- */
-public interface IWidgetDeployerConstants {
-	
-	/**
-	 * Refers to the deployer with can either be Emulator or Server or Device.
-	 * @author avraina
-	 *
-	 */
-	public enum DeployerType {
-		EMULATOR, SERVER, DEVICE
-	};
-	
-	/**
-	 * Widget file type.
-	 */
-	public static final String WIDGET_FILE_TYPE = "wgz";
-}
-
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deployer/WidgetDeployer.java	Wed Jul 28 15:43:33 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +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.wrttools.core.deployer;
-
-import org.symbian.tools.wrttools.core.status.IWRTConstants;
-import org.symbian.tools.wrttools.core.status.IWRTStatusListener;
-import org.symbian.tools.wrttools.core.status.WRTStatus;
-import org.symbian.tools.wrttools.core.status.WRTStatusHandler;
-
-/**
- * Main Class for the widget Deployer.This implements the IWidgetDeployer. 
- * Different Deployer need to extend this class.This also contains the default
- * implementation for the actual widget deployer such as making a sure the widget
- * is validated before deploying and also if the widget is packaged correctly before
- * deploying.
- * @author avraina
- *
- */
-public abstract class WidgetDeployer implements IWidgetDeployer{
-	
-	private WRTStatusHandler statusHandler;
-	
-	IWRTStatusListener statusListener;
-	
-	public WidgetDeployer() {
-		setStatus();
-	}
-
-	/**
-	 * The method is to check whether the widget project is validated.
-	 * This should be done before calling the deploy method.
-	 * @param fileName. The file name which needs to be validated.
-	 * @return true if the project is validated else false.
-	 */
-	public boolean callValidator(String fileName){
-		return false;
-	}
-	
-	/**
-	 * The method is to check whether the widget project is packaged.
-	 * This should be done before calling the deploy method.
-	 * @param fileName. The file name which need to be deployed.
-	 * @return true if the project is packaged else false.
-	 */
-	public boolean callPackager(String fileName){
-		return false;
-	}
-	
-	/**
-	 * The method returns the extension of the widget to be deployed.
-	 * @return the extension of the widget.
-	 */
-	public String checkPackagedInput(){		
-		return IWRTConstants.WIDGET_FILE_EXTENSION;	
-	}
-		
-	protected void setStatus() {
-		statusHandler = new WRTStatusHandler();
-		statusHandler.addListener(getStatusListener());
-	}
-
-	/**
-	 * Returns the associated status listner with the widget deployer
-	 * @return status listener
-	 */
-	public IWRTStatusListener getStatusListener() {
-		return statusListener;
-	}
-
-	/**
-	 * Sets the status listner associated with the widget deployer
-	 * @param statusListener the status listner to be associated.
-	 */
-	public void setStatusListener(IWRTStatusListener statusListener) {
-		this.statusListener = statusListener;
-	}
-	
-	/**
-	 * Creates the status specific to the widget deployer
-	 * @param statusDescription the description of the status
-	 * @return the WRTStatus created
-	 */
-	protected void emitStatus(String statusDescription) {
-		WRTStatus status = new WRTStatus();
-		status.setStatusSource(IWRTConstants.StatusSourceType.DEPLOYER.name());
-		status.setStatusDescription(statusDescription);		
-		getStatusListener().emitStatus(status);
-	}
-
-    public boolean needsReport() {
-        return true;
-    }
-}
\ No newline at end of file
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deployer/deployerMessages.properties	Wed Jul 28 15:43:33 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-Deployer.ends.msg=Deployment Successful.
-Deployer.completed.msg=Deployment Completed.
-Deployer.cancelled.msg=Deployment Cancelled.
-Deployer.cannotdeploy.err.msg=Cannot deploy to the device "{0}"
-Deployer.failed.err.msg=Deployment Failed.
-Deployer.preperation.msg=Preparing Widget Deployment. 
\ No newline at end of file
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/ProjectUtils.java	Wed Jul 28 15:43:33 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/ProjectUtils.java	Thu Jul 29 10:00:34 2010 -0700
@@ -56,11 +56,8 @@
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.SubProgressMonitor;
 import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IPageLayout;
 import org.eclipse.ui.IViewReference;
 import org.eclipse.ui.IWorkbenchPage;
@@ -78,7 +75,6 @@
 import org.eclipse.wst.validation.ValidationFramework;
 import org.symbian.tools.wrttools.Activator;
 import org.symbian.tools.wrttools.WidgetProjectNature;
-import org.symbian.tools.wrttools.core.deploy.PreferenceConstants;
 import org.symbian.tools.wrttools.core.packager.WRTPackagerConstants;
 import org.symbian.tools.wrttools.wizards.WrtLibraryWizardPage;
 
@@ -447,33 +443,4 @@
             Activator.log(e);
         }
     }
-
-    public static boolean canPackageWithErrors(final IProject project) {
-        final boolean[] flag = new boolean[1];
-        String value = Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.PACKAGE_WITH_ERRORS);
-        if (MessageDialogWithToggle.ALWAYS.equals(value)) {
-            flag[0] = true;
-        } else if (MessageDialogWithToggle.NEVER.equals(value)) {
-            flag[0] = false;
-        } else if (MessageDialogWithToggle.PROMPT.equals(value)) {
-            Display.getDefault().syncExec(new Runnable() {
-                public void run() {
-                    flag[0] = queryUser(project);
-                }
-            });
-        }
-        return flag[0];
-    }
-
-    protected static boolean queryUser(IProject project) {
-        Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
-        MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(shell, "WRT Application Packages",
-                String
-                        .format("Project %s has errors. Are you sure you want to package the project?", project
-                                .getName()), "Remember my selection", false, Activator.getDefault()
-                        .getPreferenceStore(),
-                PreferenceConstants.PACKAGE_WITH_ERRORS);
-        return dialog.getReturnCode() == IDialogConstants.YES_ID;
-    }
-
 }
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/deploy/DeploymentTarget.java	Wed Jul 28 15:43:33 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.wrttools.wizards.deploy;
-
-import org.eclipse.swt.graphics.Image;
-import org.symbian.tools.wrttools.core.deployer.IWidgetDeployer;
-import org.symbian.tools.wrttools.core.status.IWRTStatusListener;
-
-public abstract class DeploymentTarget {
-    private final String name;
-    protected String addr;
-
-    public DeploymentTarget(String name) {
-        this.name = name;
-    }
-
-    public String getAddr() {
-        return addr;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public abstract String getDescription();
-    public abstract IWidgetDeployer createDeployer(IWRTStatusListener statusListener);
-    public abstract String getType();
-    public abstract Image getIcon();
-    
-    public boolean isResolved() {
-        return true;
-    }
-
-    public abstract String getDeployMessage();
-}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/deploy/EmulatorTarget.java	Wed Jul 28 15:43:33 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +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.wizards.deploy;
-
-import java.text.MessageFormat;
-import java.util.Map.Entry;
-
-import org.eclipse.swt.graphics.Image;
-import org.symbian.tools.wrttools.core.WRTImages;
-import org.symbian.tools.wrttools.core.deploy.emulator.EmulatorDeployer;
-import org.symbian.tools.wrttools.core.deployer.IWidgetDeployer;
-import org.symbian.tools.wrttools.core.status.IWRTStatusListener;
-
-public class EmulatorTarget extends DeploymentTarget {
-    public EmulatorTarget(Entry<String, String> emulatorEntry) {
-        super(emulatorEntry.getKey());
-        addr = emulatorEntry.getValue();
-    }
-
-    @Override
-    public String getDescription() {
-        return MessageFormat.format("Emulator path: {0}", getAddr());
-    }
-
-    @Override
-    public IWidgetDeployer createDeployer(IWRTStatusListener statusListener) {
-        IWidgetDeployer widgetDeployer = new EmulatorDeployer();
-        widgetDeployer.setStatusListener(statusListener);
-        return widgetDeployer;
-    }
-
-    @Override
-    public String getType() {
-        return "emulator";
-    }
-
-    @Override
-    public Image getIcon() {
-        return WRTImages.getEmulatorImage();
-    }
-
-    public String getDeployMessage() {
-        return "Application was copied to emulator Phone Memory.\nYou should manually install it using the File Manager before running.";
-    }
-}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/deploy/ProgramTarget.java	Wed Jul 28 15:43:33 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +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.wizards.deploy;
-
-import java.text.MessageFormat;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.program.Program;
-import org.eclipse.swt.widgets.Display;
-import org.symbian.tools.wrttools.core.deployer.DeployException;
-import org.symbian.tools.wrttools.core.deployer.IWidgetDeployer;
-import org.symbian.tools.wrttools.core.deployer.WidgetDeployer;
-import org.symbian.tools.wrttools.core.status.IWRTStatusListener;
-
-public class ProgramTarget extends DeploymentTarget {
-    public class Deployer extends WidgetDeployer {
-        public IStatus deploy(String inputPath, String destinationPath, IProgressMonitor progressMonitor)
-                throws DeployException {
-            emitStatus(MessageFormat.format("Running {0}", program.getName()));
-            boolean b = program.execute(inputPath);
-            System.out.println(b);
-            return Status.OK_STATUS;
-        }
-    }
-
-    private static ProgramTarget instance;
-    
-    private final Program program;
-    private Image image;
-
-    private ProgramTarget(Program program) {
-        super(program.getName());
-        this.program = program;
-    }
-
-    public static ProgramTarget getInstance() {
-        if (instance == null) {
-            Program program = Program.findProgram("wgz");
-            if (program != null) {
-                instance = new ProgramTarget(program);
-            }
-        }
-        return instance;
-    }
-
-    @Override
-    public IWidgetDeployer createDeployer(IWRTStatusListener statusListener) {
-        Deployer deployer = new Deployer();
-        deployer.setStatusListener(statusListener);
-        return deployer;
-    }
-
-    @Override
-    public String getDescription() {
-        return "External application will be used to deploy the widget";
-    }
-
-    @Override
-    public String getType() {
-        return "program";
-    }
-
-    @Override
-    public Image getIcon() {
-        if (image == null || image.isDisposed()) {
-            Display current = Display.getCurrent();
-            image = new Image(current, program.getImageData());
-        }
-        return image;
-    }
-
-    public String getDeployMessage() {
-        return "Packaged WGZ archive was passed to external application. Follow application prompts to deploy WGZ file.";
-    }
-}