Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSusan Franklin2009-05-27 17:47:09 -0400
committerSusan Franklin2009-05-27 17:47:09 -0400
commita53fb6e88ddbc37505e40fd1c265934f32682750 (patch)
tree4ee2d1cf2f5bb8ad60ccdc52597b53c0ebe1b937
parent5eb1e95a51d65b578423b8363ba55c47b9f7ba6c (diff)
downloadrt.equinox.p2-20090527-1812.tar.gz
rt.equinox.p2-20090527-1812.tar.xz
rt.equinox.p2-20090527-1812.zip
Bug 277544 - [ui] Empty wizard page on updatev20090527-1812
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UpdateWizardTest.java58
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/WizardWithLicenses.java11
4 files changed, 76 insertions, 10 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java
index f4e39fc06..8d9726815 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java
@@ -68,6 +68,9 @@ public class InstallWizardTest extends WizardTest {
// license needs approval
assertFalse("1.1", wizard.canFinish());
// finish button should be disabled
+ while (dialog.getShell().getDisplay().readAndDispatch()) {
+ // run event loop
+ }
Button finishButton = dialog.testGetButton(IDialogConstants.FINISH_ID);
assertFalse("1.2", finishButton.isEnabled());
} finally {
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UpdateWizardTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UpdateWizardTest.java
index a6c675586..abf4b84e7 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UpdateWizardTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UpdateWizardTest.java
@@ -29,7 +29,7 @@ import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.*;
import org.eclipse.ui.statushandlers.StatusManager;
/**
@@ -127,6 +127,9 @@ public class UpdateWizardTest extends WizardTest {
// license needs approval
assertFalse("1.1", wizard.canFinish());
// finish button should be disabled
+ while (dialog.getShell().getDisplay().readAndDispatch()) {
+ // run event loop
+ }
Button finishButton = dialog.testGetButton(IDialogConstants.FINISH_ID);
assertFalse("1.2", finishButton.isEnabled());
} finally {
@@ -220,4 +223,55 @@ public class UpdateWizardTest extends WizardTest {
dialog.getShell().close();
}
}
-}
+
+ /**
+ * Tests the wizard when multiple versions are available.
+ */
+ public void testBug277554MultipleVersions() throws ProvisionException {
+ IUElementListRoot root = new IUElementListRoot();
+ AvailableUpdateElement element = new AvailableUpdateElement(root, mainUpgrade1, main, TESTPROFILE, true);
+ AvailableUpdateElement element2 = new AvailableUpdateElement(root, mainUpgrade2, main, TESTPROFILE, true);
+ root.setChildren(new Object[] {element, element2});
+ ProfileChangeRequest request = new ProfileChangeRequest(profile);
+ request.removeInstallableUnits(new IInstallableUnit[] {main});
+ request.addInstallableUnits(new IInstallableUnit[] {mainUpgrade2});
+ PlannerResolutionOperation op = getResolvedOperation(request);
+ UpdateWizard wizard = new UpdateWizard(Policy.getDefault(), TESTPROFILE, root, new Object[] {element2}, op, null);
+ WizardDialog dialog = new ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard);
+ dialog.setBlockOnOpen(false);
+ dialog.open();
+
+ try {
+ SelectableIUsPage page1 = (SelectableIUsPage) wizard.getPage(SELECTION_PAGE);
+ // should already have a plan
+ assertTrue("1.0", page1.isPageComplete());
+ assertEquals("1.1", page1.getCheckedIUElements().length, 1);
+ ResolutionResultsWizardPage page2 = (ResolutionResultsWizardPage) wizard.getNextPage(page1);
+ dialog.showPage(page2);
+ // should only have one root item in the resolution page
+ assertEquals("1.2", 1, findTree(page2).getItemCount());
+ } finally {
+ dialog.getShell().close();
+ }
+ }
+
+ protected Tree findTree(ResolutionResultsWizardPage page) {
+ return findTree(page.getControl());
+ }
+
+ protected Tree findTree(Control control) {
+ if (control instanceof Tree)
+ return (Tree) control;
+ if (control instanceof Composite) {
+ Control[] children = ((Composite) control).getChildren();
+ for (int i = 0; i < children.length; i++) {
+ Tree tree = findTree(children[i]);
+ if (tree != null)
+ return tree;
+ }
+
+ }
+ return null;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java
index e47a0445e..cf39d0cd4 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2008, 2009 IBM 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:
+ * 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.dialogs;
@@ -74,8 +74,6 @@ public abstract class ProvisioningOperationWizard extends Wizard {
public void addPages() {
mainPage = createMainPage(root, planSelections);
addPage(mainPage);
- if (resolutionOperation != null)
- planChanged();
}
protected abstract IResolutionErrorReportingPage getErrorReportingPage();
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/WizardWithLicenses.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/WizardWithLicenses.java
index cf1c0a17f..221786295 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/WizardWithLicenses.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/WizardWithLicenses.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * David Dubrow <david.dubrow@nokia.com> - Bug 276356 [ui] check the wizard and page completion logic for AcceptLicensesWizardPage
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.dialogs;
@@ -17,7 +18,9 @@ import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.AcceptLicensesWiza
import org.eclipse.equinox.internal.provisional.p2.ui.model.IUElementListRoot;
import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
+import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.swt.widgets.Display;
/**
* Common superclass for wizards that need to show licenses.
@@ -44,6 +47,14 @@ public abstract class WizardWithLicenses extends ProvisioningOperationWizard {
if (licensePage == null) {
licensePage = createLicensesPage(ElementUtils.elementsToIUs(mainPage.getCheckedIUElements()), resolutionPage.getCurrentPlan());
addPage(licensePage);
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ IWizardContainer container = getContainer();
+ if (container != null)
+ container.updateButtons();
+ }
+ });
+
}
if (licensePage.hasLicensesToAccept()) {
return licensePage;

Back to the top