34 import org.eclipse.core.runtime.Path; |
34 import org.eclipse.core.runtime.Path; |
35 import org.eclipse.core.runtime.PlatformObject; |
35 import org.eclipse.core.runtime.PlatformObject; |
36 import org.eclipse.core.runtime.Status; |
36 import org.eclipse.core.runtime.Status; |
37 import org.eclipse.core.runtime.jobs.ISchedulingRule; |
37 import org.eclipse.core.runtime.jobs.ISchedulingRule; |
38 import org.eclipse.ui.IMemento; |
38 import org.eclipse.ui.IMemento; |
39 import org.symbian.tools.tmw.core.projects.IMTWProject; |
39 import org.symbian.tools.tmw.core.projects.ITMWProject; |
40 import org.symbian.tools.tmw.core.runtimes.IPackager; |
40 import org.symbian.tools.tmw.core.runtimes.IPackager; |
41 import org.symbian.tools.tmw.ui.TMWCoreUI; |
41 import org.symbian.tools.tmw.ui.TMWCoreUI; |
42 import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget; |
42 import org.symbian.tools.tmw.ui.deployment.IDeploymentTarget; |
43 import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType; |
43 import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType; |
44 |
44 |
45 public class FilesystemDeploymentTarget extends PlatformObject implements IDeploymentTargetType, IDeploymentTarget { |
45 public class FilesystemDeploymentTarget extends PlatformObject implements IDeploymentTargetType, IDeploymentTarget { |
46 private String defaultName; |
46 private String defaultName; |
47 private IPath path; |
47 private IPath path; |
48 |
48 |
49 public IStatus deploy(IMTWProject project, IPackager packager, IProgressMonitor monitor) throws CoreException { |
49 public IStatus deploy(ITMWProject project, IPackager packager, IProgressMonitor monitor) throws CoreException { |
50 final File file = packager.packageApplication(project, monitor); |
50 final File file = packager.packageApplication(project, monitor); |
51 try { |
51 try { |
52 final InputStream inputStream = new BufferedInputStream(new FileInputStream(file)); |
52 final InputStream inputStream = new BufferedInputStream(new FileInputStream(file)); |
53 final OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(path.toFile())); |
53 final OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(path.toFile())); |
54 try { |
54 try { |
72 |
72 |
73 public void discoverTargets(IProgressMonitor monitor) throws CoreException { |
73 public void discoverTargets(IProgressMonitor monitor) throws CoreException { |
74 // Do nothing |
74 // Do nothing |
75 } |
75 } |
76 |
76 |
77 public IDeploymentTarget findTarget(IMTWProject project, String id) { |
77 public IDeploymentTarget findTarget(ITMWProject project, String id) { |
78 return getId().equals(id) ? this : null; |
78 return getId().equals(id) ? this : null; |
79 } |
79 } |
80 |
80 |
81 public String getDefaultName() { |
81 public String getDefaultName() { |
82 return defaultName; |
82 return defaultName; |
100 |
100 |
101 public ISchedulingRule getSchedulingRule(IDeploymentTarget target) { |
101 public ISchedulingRule getSchedulingRule(IDeploymentTarget target) { |
102 return null; |
102 return null; |
103 } |
103 } |
104 |
104 |
105 public IDeploymentTarget[] getTargets(IMTWProject project) { |
105 public IDeploymentTarget[] getTargets(ITMWProject project) { |
106 return new IDeploymentTarget[] { this }; |
106 return new IDeploymentTarget[] { this }; |
107 } |
107 } |
108 |
108 |
109 public void init(IMTWProject project, IPackager packager, IMemento memento) { |
109 public void init(ITMWProject project, IPackager packager, IMemento memento) { |
110 defaultName = new Path(project.getName()).addFileExtension(packager.getFileType(project)).toOSString(); |
110 defaultName = new Path(project.getName()).addFileExtension(packager.getFileType(project)).toOSString(); |
111 path = null; |
111 path = null; |
112 String string = memento != null ? memento.getString("path") : null; |
112 String string = memento != null ? memento.getString("path") : null; |
113 if (string == null) { |
113 if (string == null) { |
114 string = TMWCoreUI.getDefault().getPreferenceStore().getString("path"); |
114 string = TMWCoreUI.getDefault().getPreferenceStore().getString("path"); |