Search in sources :

Example 1 with RemediationGroup

use of org.eclipse.equinox.internal.p2.ui.dialogs.RemediationGroup in project epp.mpc by eclipse.

the class FeatureSelectionWizardPage method updateMessage.

void updateMessage() {
    ProfileChangeOperation profileChangeOperation = getWizard().getProfileChangeOperation();
    if (profileChangeOperation != null) {
        if (profileChangeOperation instanceof RemediationOperation && ((RemediationOperation) profileChangeOperation).getResolutionResult() == Status.OK_STATUS) {
            if (remediationGroup == null) {
                remediationGroup = new RemediationGroup(this);
                remediationGroup.createRemediationControl(container);
            }
            setMessage(remediationGroup.getMessage(), IStatus.WARNING);
            remediationGroup.getDetailsGroup().setDetailText(getWizard().getErrorMessage());
            remediationGroup.update((RemediationOperation) profileChangeOperation);
            flipToRemediationComposite();
        } else {
            IStatus resolutionResult = profileChangeOperation.getResolutionResult();
            if (!resolutionResult.isOK()) {
                String message = resolutionResult.getMessage();
                if (resolutionResult.getSeverity() == IStatus.ERROR) {
                    message = Messages.FeatureSelectionWizardPage_provisioningErrorAdvisory;
                } else if (resolutionResult.getSeverity() == IStatus.WARNING) {
                    message = Messages.FeatureSelectionWizardPage_provisioningWarningAdvisory;
                }
                setMessage(message, Util.computeMessageType(resolutionResult));
                // avoid gratuitous scrolling
                String originalText = detailStatusText.getText();
                String newText;
                try {
                    newText = profileChangeOperation.getResolutionDetails();
                } catch (Exception e) {
                    // sometimes p2 might throw an exception
                    MarketplaceClientUi.error(e);
                    newText = Messages.FeatureSelectionWizardPage_detailsUnavailable;
                }
                if (newText != originalText || (newText != null && !newText.equals(originalText))) {
                    detailStatusText.setText(newText);
                }
                ((GridData) detailsControl.getLayoutData()).exclude = false;
            } else {
                setMessage(null, IMessageProvider.NONE);
                ((GridData) detailsControl.getLayoutData()).exclude = true;
            }
        }
    } else {
        setMessage(null, IMessageProvider.NONE);
        ((GridData) detailsControl.getLayoutData()).exclude = true;
    }
    ((Composite) getControl()).layout(true);
    defaultComposite.layout(true);
}
Also used : ProfileChangeOperation(org.eclipse.equinox.p2.operations.ProfileChangeOperation) IStatus(org.eclipse.core.runtime.IStatus) Composite(org.eclipse.swt.widgets.Composite) RemediationOperation(org.eclipse.equinox.p2.operations.RemediationOperation) StyledString(org.eclipse.jface.viewers.StyledString) RemediationGroup(org.eclipse.equinox.internal.p2.ui.dialogs.RemediationGroup) CoreException(org.eclipse.core.runtime.CoreException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ProvisionException(org.eclipse.equinox.p2.core.ProvisionException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 CoreException (org.eclipse.core.runtime.CoreException)1 IStatus (org.eclipse.core.runtime.IStatus)1 RemediationGroup (org.eclipse.equinox.internal.p2.ui.dialogs.RemediationGroup)1 ProvisionException (org.eclipse.equinox.p2.core.ProvisionException)1 ProfileChangeOperation (org.eclipse.equinox.p2.operations.ProfileChangeOperation)1 RemediationOperation (org.eclipse.equinox.p2.operations.RemediationOperation)1 StyledString (org.eclipse.jface.viewers.StyledString)1 Composite (org.eclipse.swt.widgets.Composite)1