| package org.eclipse.epp.installer.core.operations; |
| |
| import java.io.File; |
| |
| import org.eclipse.epp.installer.core.InstallOptions; |
| import org.eclipse.epp.installer.core.eclipse.EclipseInstallation; |
| import org.eclipse.epp.installer.core.model.InstallOperation; |
| import org.eclipse.epp.installer.internal.core.operations.CreateLinkOperation; |
| import org.eclipse.epp.installer.internal.core.operations.ModifyPlatformXMLOperation; |
| |
| |
| /** |
| * Create link files from each previously installed Eclipse based application selected by |
| * the user in {@link org.eclipse.epp.installer.core.steps.ChooseEclipseStep} to the |
| * newly installed extension/enhancement. |
| */ |
| public class LinkProductOperation extends InstallOperation { |
| |
| String[] eclipsePathList; |
| private String extensionFeature; |
| private File pathToExtension; |
| private InstallOptions options; |
| |
| /** |
| * Constructor for LinkProductOperation. |
| * @param options InstallOptions |
| * @param extensionFeature String name of installing extension feature |
| * @param pathToExtension String absolute path to extension |
| */ |
| public LinkProductOperation(InstallOptions options, String extensionFeature, File pathToExtension) { |
| this(options, InstallOptions.pathListToArray(options.getString(InstallOptions.OPTION_ECLIPSE_PATH_LIST)), extensionFeature, pathToExtension); |
| } |
| |
| /** |
| * Constructor for LinkProductOperation. |
| * @param eclipsePathList String[] list of paths to Eclipse based products |
| * @param extensionFeature String name of installing extension feature |
| * @param pathToExtension String absolute path to extension |
| */ |
| public LinkProductOperation(InstallOptions options, String[] eclipsePathList, String extensionFeature, File pathToExtension) { |
| if (options == null || eclipsePathList == null || extensionFeature == null || pathToExtension == null) { |
| throw new IllegalArgumentException(); |
| } |
| this.options = options; |
| this.eclipsePathList = eclipsePathList; |
| this.extensionFeature = extensionFeature; |
| this.pathToExtension = pathToExtension; |
| } |
| |
| protected void prepare() { |
| for (int i = 0; i < eclipsePathList.length; i++) { |
| File eclipseDir = new File(eclipsePathList[i]); |
| add(new CreateLinkOperation(options, eclipseDir, pathToExtension, extensionFeature)); |
| add(new ModifyPlatformXMLOperation(options, new EclipseInstallation(eclipseDir), pathToExtension, extensionFeature)); |
| } |
| } |
| |
| /** |
| * Method toString. |
| * @return String |
| */ |
| public String toString() { |
| return "Registering extension with Eclipse installations..."; |
| } |
| } |