]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.project/src/org/eclipse/equinox/internal/provisional/p2/installer/InstallAdvisor.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.project / src / org / eclipse / equinox / internal / provisional / p2 / installer / InstallAdvisor.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2008 IBM Corporation and others.\r
3  * All rights reserved. This program and the accompanying materials\r
4  * are made available under the terms of the Eclipse Public License v1.0\r
5  * which accompanies this distribution, and is available at\r
6  * http://www.eclipse.org/legal/epl-v10.html\r
7  *\r
8  * Contributors:\r
9  *     IBM Corporation - initial API and implementation\r
10  *******************************************************************************/\r
11 package org.eclipse.equinox.internal.provisional.p2.installer;\r
12 \r
13 import org.eclipse.core.runtime.IProgressMonitor;\r
14 import org.eclipse.core.runtime.IStatus;\r
15 import org.eclipse.core.runtime.OperationCanceledException;\r
16 \r
17 /**\r
18  * The install advisor helps to make decisions during install, and is the conduit\r
19  * for reporting progress and results back to an end user or log.\r
20  */\r
21 public abstract class InstallAdvisor {\r
22         /**\r
23          * Performs the actual install. The advisor is responsible for handling progress\r
24          * monitoring and cancelation. The advisor may perform the install in\r
25          * another thread, but must block the calling thread until the install\r
26          * completes.\r
27          * \r
28          * @param operation The install operation to run\r
29          * @return IStatus The result of the install operation. This is typically\r
30          * just the return value of {@link IInstallOperation#install(IProgressMonitor)},\r
31          * but the advisor may alter the result status if desired.\r
32          */\r
33         public abstract IStatus performInstall(IInstallOperation operation);\r
34 \r
35         /**\r
36          * Allows the advisor to modify or fill in missing values in the install description.  \r
37          * @param description The initial install description\r
38          * @return The install description to be used for the install.\r
39          * @exception OperationCanceledException if the install should be canceled.\r
40          */\r
41         public abstract InstallDescription prepareInstallDescription(InstallDescription description);\r
42 \r
43         /**\r
44          * Prompts for whether the installed application should be launched immediately.\r
45          * This method is only called after a successful install.\r
46          * \r
47          * @param description The initial install description\r
48          * @return <code>true</code> if the product should be launched, and \r
49          * <code>false</code> otherwise.\r
50          */\r
51         public abstract boolean promptForLaunch(InstallDescription description);\r
52 \r
53         /**\r
54          * Reports some result information to the context.  The status may be\r
55          * information, warning, or an error.\r
56          */\r
57         public abstract void setResult(IStatus status);\r
58 \r
59         /**\r
60          * Initializes the install advisor.  This method must be called before calling any \r
61          * other methods on the advisor are called.  Subsequent invocations of this\r
62          * method are ignored.\r
63          */\r
64         public abstract void start();\r
65 \r
66         /**\r
67          * Stops the install advisor. The advisor becomes invalid after it has been\r
68          * stopped; a stopped advisor cannot be restarted.\r
69          */\r
70         public abstract void stop();\r
71 }\r