49 import org.eclipse.core.runtime.Status; |
49 import org.eclipse.core.runtime.Status; |
50 import org.eclipse.core.runtime.SubProgressMonitor; |
50 import org.eclipse.core.runtime.SubProgressMonitor; |
51 import org.eclipse.ui.IMemento; |
51 import org.eclipse.ui.IMemento; |
52 import org.symbian.tools.mtw.core.MTWCore; |
52 import org.symbian.tools.mtw.core.MTWCore; |
53 import org.symbian.tools.mtw.core.projects.IMTWProject; |
53 import org.symbian.tools.mtw.core.projects.IMTWProject; |
54 import org.symbian.tools.mtw.core.runtimes.IMobileWebRuntime; |
|
55 import org.symbian.tools.mtw.core.runtimes.IPackager; |
54 import org.symbian.tools.mtw.core.runtimes.IPackager; |
56 import org.symbian.tools.mtw.ui.deployment.IDeploymentTarget; |
55 import org.symbian.tools.mtw.ui.deployment.IDeploymentTarget; |
57 |
56 |
58 public class BluetoothTarget extends PlatformObject implements IDeploymentTarget { |
57 public class BluetoothTarget extends PlatformObject implements IDeploymentTarget { |
59 private static final UUID OBEX_OBJECT_PUSH = new UUID(0x1105); |
58 private static final UUID OBEX_OBJECT_PUSH = new UUID(0x1105); |
69 this.name = name; |
68 this.name = name; |
70 this.device = device; |
69 this.device = device; |
71 this.provider = provider; |
70 this.provider = provider; |
72 } |
71 } |
73 |
72 |
74 public IStatus deploy(IMTWProject project, IMobileWebRuntime runtime, IProgressMonitor monitor) |
73 public IStatus deploy(IMTWProject project, IPackager packager, IProgressMonitor monitor) |
75 throws CoreException { |
74 throws CoreException { |
76 monitor.beginTask(String.format("Deploying application %s to %s", project.getName(), name), |
75 monitor.beginTask(String.format("Deploying application %s to %s", project.getName(), name), |
77 IProgressMonitor.UNKNOWN); |
76 IProgressMonitor.UNKNOWN); |
78 final IPackager packager = MTWCore.getDefault().getRuntimesManager().getPackager(project, runtime); |
77 final File application = packager.packageApplication(project, new SubProgressMonitor(monitor, 100)); |
79 if (packager == null) { |
|
80 return new Status(IStatus.ERROR, MTWCore.PLUGIN_ID, String.format("Project %s does not support runtime %s", |
|
81 project.getName(), runtime.getName())); |
|
82 } |
|
83 final File application = packager.packageApplication(project, runtime, new SubProgressMonitor(monitor, 100)); |
|
84 try { |
78 try { |
85 deployWidget(application, packager.getFileType(project), new SubProgressMonitor(monitor, 10)); |
79 deployWidget(application, packager.getFileType(project), new SubProgressMonitor(monitor, 10)); |
86 } finally { |
80 } finally { |
87 application.delete(); |
81 application.delete(); |
88 } |
82 } |