| /******************************************************************************* |
| * Copyright (c) 2011 WindRiver Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * WindRiver Corporation - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.equinox.internal.p2.importexport.internal.wizard; |
| |
| import java.util.Collection; |
| import org.eclipse.core.runtime.Platform; |
| import org.eclipse.equinox.internal.p2.importexport.internal.*; |
| import org.eclipse.equinox.internal.p2.ui.dialogs.ISelectableIUsPage; |
| import org.eclipse.equinox.internal.p2.ui.dialogs.InstallWizard; |
| import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot; |
| import org.eclipse.equinox.p2.engine.ProvisioningContext; |
| import org.eclipse.equinox.p2.metadata.IInstallableUnit; |
| import org.eclipse.equinox.p2.operations.InstallOperation; |
| import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; |
| import org.eclipse.equinox.p2.ui.ProvisioningUI; |
| import org.eclipse.jface.dialogs.IDialogSettings; |
| import org.eclipse.jface.resource.ImageDescriptor; |
| import org.eclipse.jface.viewers.IStructuredSelection; |
| import org.eclipse.ui.IImportWizard; |
| import org.eclipse.ui.IWorkbench; |
| |
| public class ImportFromInstallationWizard extends InstallWizard implements IImportWizard { |
| |
| public ImportFromInstallationWizard() { |
| this(ProvisioningUI.getDefaultUI(), null, null, null); |
| } |
| |
| public ImportFromInstallationWizard(ProvisioningUI ui, InstallOperation operation, Collection<IInstallableUnit> initialSelections, LoadMetadataRepositoryJob preloadJob) { |
| super(ui, operation, initialSelections, preloadJob); |
| IDialogSettings workbenchSettings = ImportExportActivator.getDefault().getDialogSettings(); |
| String sectionName = "ImportFromInstallationWizard"; //$NON-NLS-1$ |
| IDialogSettings section = workbenchSettings.getSection(sectionName); |
| if (section == null) { |
| section = workbenchSettings.addNewSection(sectionName); |
| } |
| setDialogSettings(section); |
| } |
| |
| public void init(IWorkbench workbench, IStructuredSelection selection) { |
| setWindowTitle(Messages.ImportWizard_WINDOWTITLE); |
| setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(Platform.getBundle(Constants.Bundle_ID).getEntry("icons/wizban/install_wiz.png"))); //$NON-NLS-1$ |
| setNeedsProgressMonitor(true); |
| } |
| |
| @Override |
| protected ISelectableIUsPage createMainPage(IUElementListRoot input, Object[] selections) { |
| return new ImportFromInstallationPage(ui, this); |
| } |
| |
| @Override |
| protected ProvisioningContext getProvisioningContext() { |
| return ((ImportFromInstallationPage) mainPage).getProvisioningContext(); |
| } |
| } |