Search in sources :

Example 1 with AcceptLicensesWizardPage

use of org.eclipse.equinox.p2.ui.AcceptLicensesWizardPage in project epp.mpc by eclipse.

the class MarketplaceWizard method getNextPage.

IWizardPage getNextPage(IWizardPage page, boolean nextpressed) {
    boolean skipFeatureSelection = false;
    MarketplacePage catalogPage = getCatalogPage();
    if (page == catalogPage && nextpressed) {
        profileChangeOperation = null;
        featureSelectionWizardPage.updateMessage();
        if (catalogPage.canSkipFeatureSelection()) {
            skipFeatureSelection = true;
        }
    }
    if (page == featureSelectionWizardPage || (page == catalogPage && skipFeatureSelection)) {
        IWizardContainer container = getContainer();
        if (nextpressed && profileChangeOperation != null && profileChangeOperation instanceof RemediationOperation) {
            try {
                container.run(true, false, new IRunnableWithProgress() {

                    public void run(IProgressMonitor monitor) {
                        ((RemediationOperation) profileChangeOperation).setCurrentRemedy(featureSelectionWizardPage.getRemediationGroup().getCurrentRemedy());
                        profileChangeOperation.resolveModal(monitor);
                    }
                });
            } catch (InterruptedException e) {
            // Nothing to report if thread was interrupted
            } catch (InvocationTargetException e) {
                ProvUI.handleException(e.getCause(), null, StatusManager.SHOW | StatusManager.LOG);
            }
        }
        IWizardPage nextPage = null;
        boolean operationUpdated = false;
        if (profileChangeOperation == null) {
            if (nextpressed) {
                updateProfileChangeOperation();
                operationUpdated = true;
            }
            if (profileChangeOperation == null || !profileChangeOperation.getResolutionResult().isOK()) {
                // can't compute a change operation, so there must be some kind of error
                // we show these on the the feature selection wizard page
                nextPage = featureSelectionWizardPage;
            } else if (profileChangeOperation instanceof UninstallOperation) {
                // next button was used to resolve errors on an uninstall.
                // by returning the same page the finish button will be enabled, allowing the user to finish.
                nextPage = featureSelectionWizardPage;
            } else if (profileChangeOperation instanceof RemediationOperation) {
                nextPage = featureSelectionWizardPage;
            }
        }
        if (nextPage == null && nextpressed && profileChangeOperation instanceof RemediationOperation && !featureSelectionWizardPage.isInRemediationMode()) {
            featureSelectionWizardPage.flipToRemediationComposite();
            nextPage = featureSelectionWizardPage;
        }
        if (nextPage == null && computeMustCheckLicenseAcceptance()) {
            if (acceptLicensesPage == null) {
                acceptLicensesPage = new AcceptLicensesWizardPage(ProvisioningUI.getDefaultUI().getLicenseManager(), operationIUs, profileChangeOperation);
                addPage(acceptLicensesPage);
            } else {
                acceptLicensesPage.update(operationIUs, profileChangeOperation);
            }
            if (nextpressed || acceptLicensesPage.hasLicensesToAccept() || profileChangeOperation instanceof RemediationOperation) {
                nextPage = acceptLicensesPage;
            }
        }
        if (nextPage == null && page == catalogPage) {
            nextPage = featureSelectionWizardPage;
        }
        if (operationUpdated && nextPage == container.getCurrentPage()) {
            container.updateButtons();
        }
        return nextPage;
    }
    if (page instanceof ImportFavoritesPage) {
        return catalogPage;
    }
    return getNextPageInList(page);
}
Also used : IWizardContainer(org.eclipse.jface.wizard.IWizardContainer) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) AcceptLicensesWizardPage(org.eclipse.equinox.p2.ui.AcceptLicensesWizardPage) RemediationOperation(org.eclipse.equinox.p2.operations.RemediationOperation) UninstallOperation(org.eclipse.equinox.p2.operations.UninstallOperation) IWizardPage(org.eclipse.jface.wizard.IWizardPage) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 2 with AcceptLicensesWizardPage

use of org.eclipse.equinox.p2.ui.AcceptLicensesWizardPage in project webtools.servertools by eclipse.

the class ExtensionWizard method addPages.

public void addPages() {
    super.addPages();
    ProvisioningUI ui = ProvisioningUI.getDefaultUI();
    licensePage = new AcceptLicensesWizardPage(ui.getLicenseManager(), new IInstallableUnit[0], null);
    licensePage.setWizard(this);
    errorPage = new ErrorWizardPage();
    errorPage.setWizard(this);
    extensionPage = new ExtensionWizardPage(licensePage, errorPage);
    extensionPage.setWizard(this);
}
Also used : ExtensionWizardPage(org.eclipse.wst.server.discovery.internal.wizard.ExtensionWizardPage) ErrorWizardPage(org.eclipse.wst.server.discovery.internal.wizard.ErrorWizardPage) AcceptLicensesWizardPage(org.eclipse.equinox.p2.ui.AcceptLicensesWizardPage) ProvisioningUI(org.eclipse.equinox.p2.ui.ProvisioningUI) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit)

Aggregations

AcceptLicensesWizardPage (org.eclipse.equinox.p2.ui.AcceptLicensesWizardPage)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)1 RemediationOperation (org.eclipse.equinox.p2.operations.RemediationOperation)1 UninstallOperation (org.eclipse.equinox.p2.operations.UninstallOperation)1 ProvisioningUI (org.eclipse.equinox.p2.ui.ProvisioningUI)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 IWizardContainer (org.eclipse.jface.wizard.IWizardContainer)1 IWizardPage (org.eclipse.jface.wizard.IWizardPage)1 ErrorWizardPage (org.eclipse.wst.server.discovery.internal.wizard.ErrorWizardPage)1 ExtensionWizardPage (org.eclipse.wst.server.discovery.internal.wizard.ExtensionWizardPage)1