|
Lines 10-27
Link Here
|
| 10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
| 11 |
package org.eclipse.equinox.p2.tests.ui.dialogs; |
11 |
package org.eclipse.equinox.p2.tests.ui.dialogs; |
| 12 |
|
12 |
|
| 13 |
import org.eclipse.equinox.p2.metadata.MetadataFactory; |
13 |
import java.lang.reflect.Field; |
| 14 |
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription; |
|
|
| 15 |
|
| 16 |
import java.util.ArrayList; |
14 |
import java.util.ArrayList; |
|
|
15 |
import java.util.Collection; |
| 17 |
import org.eclipse.equinox.internal.p2.metadata.License; |
16 |
import org.eclipse.equinox.internal.p2.metadata.License; |
| 18 |
import org.eclipse.equinox.internal.p2.ui.ProvUI; |
17 |
import org.eclipse.equinox.internal.p2.ui.ProvUI; |
| 19 |
import org.eclipse.equinox.internal.p2.ui.dialogs.*; |
18 |
import org.eclipse.equinox.internal.p2.ui.dialogs.*; |
| 20 |
import org.eclipse.equinox.internal.p2.ui.model.IIUElement; |
19 |
import org.eclipse.equinox.internal.p2.ui.model.IIUElement; |
| 21 |
import org.eclipse.equinox.internal.p2.ui.viewers.DeferredQueryContentProvider; |
20 |
import org.eclipse.equinox.internal.p2.ui.viewers.DeferredQueryContentProvider; |
| 22 |
import org.eclipse.equinox.p2.metadata.*; |
21 |
import org.eclipse.equinox.p2.metadata.*; |
| 23 |
import org.eclipse.equinox.p2.operations.InstallOperation; |
22 |
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription; |
| 24 |
import org.eclipse.equinox.p2.operations.ProfileModificationJob; |
23 |
import org.eclipse.equinox.p2.operations.*; |
| 25 |
import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; |
24 |
import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; |
| 26 |
import org.eclipse.jface.dialogs.IDialogConstants; |
25 |
import org.eclipse.jface.dialogs.IDialogConstants; |
| 27 |
import org.eclipse.jface.wizard.IWizardPage; |
26 |
import org.eclipse.jface.wizard.IWizardPage; |
|
Lines 99-104
Link Here
|
| 99 |
} |
98 |
} |
| 100 |
} |
99 |
} |
| 101 |
|
100 |
|
|
|
101 |
public void testInstallWizard() throws Exception { |
| 102 |
ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>(); |
| 103 |
iusInvolved.add(toInstall); |
| 104 |
InstallOperation op = new MyNewInstallOperation(getSession(), iusInvolved); |
| 105 |
op.setProfileId(TESTPROFILE); |
| 106 |
PreselectedIUInstallWizard wizard = new PreselectedIUInstallWizard(getProvisioningUI(), op, iusInvolved, null); |
| 107 |
ProvisioningWizardDialog dialog = new ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard); |
| 108 |
dialog.setBlockOnOpen(false); |
| 109 |
dialog.open(); |
| 110 |
ProfileModificationJob longOp = null; |
| 111 |
|
| 112 |
try { |
| 113 |
SelectableIUsPage page1 = (SelectableIUsPage) wizard.getPage(SELECTION_PAGE); |
| 114 |
// should already have a plan |
| 115 |
assertTrue("1.0", page1.isPageComplete()); |
| 116 |
// simulate the next button by getting next page and showing |
| 117 |
InstallWizardPage page = (InstallWizardPage) page1.getNextPage(); |
| 118 |
|
| 119 |
// get the operation |
| 120 |
Field opField = ResolutionResultsWizardPage.class.getDeclaredField("resolvedOperation"); |
| 121 |
opField.setAccessible(true); |
| 122 |
assertTrue("Expected instance of MyNewInstallOperation", opField.get(page) instanceof MyNewInstallOperation); |
| 123 |
} finally { |
| 124 |
dialog.getShell().close(); |
| 125 |
if (longOp != null) |
| 126 |
longOp.cancel(); |
| 127 |
} |
| 128 |
} |
| 129 |
|
| 130 |
private static class MyNewInstallOperation extends InstallOperation { |
| 131 |
public MyNewInstallOperation(ProvisioningSession session, Collection<IInstallableUnit> toInstall) { |
| 132 |
super(session, toInstall); |
| 133 |
} |
| 134 |
} |
| 135 |
|
| 102 |
/** |
136 |
/** |
| 103 |
* Tests the wizard |
137 |
* Tests the wizard |
| 104 |
*/ |
138 |
*/ |