]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.project/src/org/simantics/project/management/install/DefaultInstallAdvisor.java
Merge commit '0b471805f017da83d715a0d8409f53bdd009d31e'
[simantics/platform.git] / bundles / org.simantics.project / src / org / simantics / project / management / install / DefaultInstallAdvisor.java
1 package org.simantics.project.management.install;\r
2 \r
3 import org.eclipse.core.runtime.IPath;\r
4 import org.eclipse.core.runtime.IProgressMonitor;\r
5 import org.eclipse.core.runtime.IStatus;\r
6 import org.eclipse.equinox.internal.provisional.p2.installer.IInstallOperation;\r
7 import org.eclipse.equinox.internal.provisional.p2.installer.InstallAdvisor;\r
8 import org.eclipse.equinox.internal.provisional.p2.installer.InstallDescription;\r
9 \r
10 /**\r
11  * \r
12  * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
13  *\r
14  */\r
15 public class DefaultInstallAdvisor extends InstallAdvisor{\r
16         \r
17         private IProgressMonitor monitor = null;\r
18         \r
19         public DefaultInstallAdvisor() {\r
20         }\r
21         \r
22         public IProgressMonitor getMonitor() {\r
23                 return monitor;\r
24         }\r
25         \r
26         public void setMonitor(IProgressMonitor monitor) {\r
27                 this.monitor = monitor;\r
28         }\r
29         \r
30         @Override\r
31         public IStatus performInstall(IInstallOperation operation) {\r
32                 return operation.install(getMonitor());\r
33         }\r
34         \r
35         @Override\r
36         public InstallDescription prepareInstallDescription(\r
37                         InstallDescription description) {\r
38                 if (description.getInstallLocation() == null)\r
39                         throw new IllegalArgumentException("Install location is missing!");\r
40                 IPath location = description.getInstallLocation();\r
41                 description.setAgentLocation(location.append("p2")); //$NON-NLS-1$\r
42                 \r
43                 return description;\r
44         }\r
45         \r
46         @Override\r
47         public boolean promptForLaunch(InstallDescription description) {\r
48                 return false;\r
49         }\r
50         \r
51         @Override\r
52         public void setResult(IStatus status) {\r
53                 if (monitor != null) {\r
54                         monitor.done();\r
55                 }\r
56         }\r
57         \r
58         @Override\r
59         public void start() {\r
60                 \r
61         }\r
62         \r
63         @Override\r
64         public void stop() {\r
65                 \r
66         }\r
67 \r
68                 \r
69 \r
70 }\r