From df57b8a2a5eb635cf3eddd4617dbeee19e213669 Mon Sep 17 00:00:00 2001 From: Pascal Rapicault (JBoss) Date: Mon, 29 Apr 2013 15:24:06 -0400 Subject: Add remediation support to Discovery UI --- .../p2/ui/dialogs/PreselectedIUInstallWizard.java | 13 +++++++++++-- .../src/org/eclipse/equinox/p2/ui/ProvisioningUI.java | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) (limited to 'bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox') diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/PreselectedIUInstallWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/PreselectedIUInstallWizard.java index 7d4518823..10a548c40 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/PreselectedIUInstallWizard.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/PreselectedIUInstallWizard.java @@ -21,6 +21,7 @@ import org.eclipse.equinox.p2.operations.InstallOperation; import org.eclipse.equinox.p2.operations.ProfileChangeOperation; import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; import org.eclipse.equinox.p2.ui.ProvisioningUI; +import org.eclipse.jface.wizard.IWizardPage; /** * An Install wizard that is invoked when the user has already selected which @@ -38,6 +39,14 @@ public class PreselectedIUInstallWizard extends WizardWithLicenses { setDefaultPageImageDescriptor(ProvUIImages.getImageDescriptor(ProvUIImages.WIZARD_BANNER_INSTALL)); } + @Override + public IWizardPage getStartingPage() { + if (remediationOperation != null && remediationOperation.hasRemedies()) { + return getNextPage(mainPage); + } + return super.getStartingPage(); + } + protected ISelectableIUsPage createMainPage(IUElementListRoot input, Object[] selections) { mainPage = new SelectableIUsPage(ui, this, input, selections); mainPage.setTitle(ProvUIMessages.PreselectedIUInstallWizard_Title); @@ -88,8 +97,8 @@ public class PreselectedIUInstallWizard extends WizardWithLicenses { @Override protected RemediationPage createRemediationPage() { - // TODO Auto-generated method stub - return null; + remediationPage = new RemediationPage(ui, this, root, operation); + return remediationPage; } } diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java index 670b753e7..38b45efa0 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java @@ -200,6 +200,23 @@ public class ProvisioningUI { * @return the wizard return code */ public int openInstallWizard(Collection initialSelections, InstallOperation operation, LoadMetadataRepositoryJob job) { + return openInstallWizard(initialSelections, operation, null, job); + } + + /** + * Open an install wizard for installing the specified IInstallableUnits and remediationOperation. + * + * @param initialSelections the IInstallableUnits that should be selected when the wizard opens. May be null. + * @param operation the operation describing the proposed install. If this operation is not null, then a wizard showing + * only the IInstallableUnits described in the operation will be shown. If the operation is null, then a + * wizard allowing the user to browse the repositories will be opened. + * @param remediationOperation the alternate operations if the proposed update failed. May be null. + * @param job a repository load job that is loading or has already loaded the repositories. Can be used to pass along + * an in-memory repository reference to the wizard. + * + * @return the wizard return code + */ + public int openInstallWizard(Collection initialSelections, InstallOperation operation, RemediationOperation remediationOperation, LoadMetadataRepositoryJob job) { if (operation == null) { InstallWizard wizard = new InstallWizard(this, operation, initialSelections, job); WizardDialog dialog = new ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard); @@ -208,6 +225,7 @@ public class ProvisioningUI { return dialog.open(); } PreselectedIUInstallWizard wizard = new PreselectedIUInstallWizard(this, operation, initialSelections, job); + wizard.setRemediationOperation(remediationOperation); WizardDialog dialog = new ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard); dialog.create(); PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IProvHelpContextIds.INSTALL_WIZARD); -- cgit v1.2.3