Search in sources :

Example 16 with IWizardContainer

use of org.eclipse.jface.wizard.IWizardContainer 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 17 with IWizardContainer

use of org.eclipse.jface.wizard.IWizardContainer in project jbosstools-openshift by jbosstools.

the class AbstractOpenShiftWizardPage method initPageChangeListeners.

/**
 * Sets this page to get informed of page changes before they occur and
 * changes that occurred (if its running in WizardDialog).
 *
 * @see WizardDialog#addPageChangedListener(IPageChangedListener)
 * @see WizardDialog#addPageChangingListener(IPageChangingListener)
 */
protected void initPageChangeListeners() {
    IWizardContainer container = getContainer();
    if (container instanceof WizardDialog) {
        ((WizardDialog) container).addPageChangedListener(onPageChanged());
        ((WizardDialog) container).addPageChangingListener(onPageChanging());
    }
}
Also used : IWizardContainer(org.eclipse.jface.wizard.IWizardContainer) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 18 with IWizardContainer

use of org.eclipse.jface.wizard.IWizardContainer in project gemoc-studio by eclipse.

the class OptionTemplateSection method resetPageState.

/**
 * Resets the current page state by clearing the error message and making
 * the page complete, thereby allowing users to flip to the next page.
 */
protected void resetPageState() {
    if (pages.size() == 0)
        return;
    WizardPage firstPage = pages.get(0).page;
    IWizardContainer container = firstPage.getWizard().getContainer();
    WizardPage currentPage = (WizardPage) container.getCurrentPage();
    currentPage.setErrorMessage(null);
    currentPage.setPageComplete(true);
}
Also used : IWizardContainer(org.eclipse.jface.wizard.IWizardContainer) OptionTemplateWizardPage(org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.OptionTemplateWizardPage) WizardPage(org.eclipse.jface.wizard.WizardPage)

Example 19 with IWizardContainer

use of org.eclipse.jface.wizard.IWizardContainer in project gemoc-studio by eclipse.

the class TemplateListSelectionPage method setUseTemplate.

public void setUseTemplate(boolean useTemplate) {
    fUseTemplate.setSelection(useTemplate);
    wizardSelectionViewer.getControl().setEnabled(useTemplate);
    if (!useTemplate)
        // $NON-NLS-1$
        setDescription("");
    setDescriptionEnabled(useTemplate);
    IWizardContainer container = getContainer();
    if (container.getCurrentPage() != null) {
        container.updateButtons();
    }
}
Also used : IWizardContainer(org.eclipse.jface.wizard.IWizardContainer)

Aggregations

IWizardContainer (org.eclipse.jface.wizard.IWizardContainer)19 IPageChangeProvider (org.eclipse.jface.dialogs.IPageChangeProvider)5 IPageChangedListener (org.eclipse.jface.dialogs.IPageChangedListener)5 PageChangedEvent (org.eclipse.jface.dialogs.PageChangedEvent)5 WizardDialog (org.eclipse.jface.wizard.WizardDialog)5 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 Composite (org.eclipse.swt.widgets.Composite)4 URISyntaxException (java.net.URISyntaxException)3 IPageChangingListener (org.eclipse.jface.dialogs.IPageChangingListener)3 PageChangingEvent (org.eclipse.jface.dialogs.PageChangingEvent)3 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)3 Button (org.eclipse.swt.widgets.Button)3 Group (org.eclipse.swt.widgets.Group)3 Label (org.eclipse.swt.widgets.Label)3 Text (org.eclipse.swt.widgets.Text)3 Date (java.util.Date)2 TreeSet (java.util.TreeSet)2 Matcher (java.util.regex.Matcher)2 IWorkspaceRunnable (org.eclipse.core.resources.IWorkspaceRunnable)2