Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2011-05-11 14:05:13 +0000
committerPascal Rapicault2011-05-11 14:05:13 +0000
commit0959e86192bb449ddfc09bea117dc40e316da8a4 (patch)
tree55c0f8322afe7ed2c1f8680488a707b614885766 /bundles/org.eclipse.equinox.p2.ui
parent6ca7a78c5e5448614d50ec9902518144112d583c (diff)
downloadrt.equinox.p2-0959e86192bb449ddfc09bea117dc40e316da8a4.tar.gz
rt.equinox.p2-0959e86192bb449ddfc09bea117dc40e316da8a4.tar.xz
rt.equinox.p2-0959e86192bb449ddfc09bea117dc40e316da8a4.zip
Bug 341121 - [ui] ResolutionResultsWizardPage resolves on UI threadv20110511
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ui')
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java47
1 files changed, 31 insertions, 16 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java
index d29ee2ff1..556f2999f 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java
@@ -13,7 +13,8 @@
package org.eclipse.equinox.internal.p2.ui.dialogs;
import java.util.Collection;
-import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
import org.eclipse.equinox.internal.p2.ui.model.*;
import org.eclipse.equinox.internal.p2.ui.viewers.*;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
@@ -23,6 +24,7 @@ import org.eclipse.equinox.p2.operations.ProvisioningJob;
import org.eclipse.equinox.p2.query.IQueryable;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
@@ -52,16 +54,11 @@ public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
protected ResolutionResultsWizardPage(ProvisioningUI ui, ProvisioningOperationWizard wizard, IUElementListRoot input, ProfileChangeOperation operation) {
super("ResolutionPage", ui, wizard); //$NON-NLS-1$
- // We can exist as an empty page, but if there is an operation, we need to know that it's resolved.
- if (operation != null && !operation.hasResolved()) {
- operation.resolveModal(null);
- }
this.resolvedOperation = operation;
if (input == null)
this.input = new IUElementListRoot();
else
this.input = input;
- updateStatus(input, resolvedOperation);
}
/*
@@ -99,12 +96,6 @@ public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
tc.setWidth(columns[i].getWidthInPixels(tree));
}
- treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- setDetailText(resolvedOperation);
- }
- });
-
// Filters and sorters before establishing content, so we don't refresh unnecessarily.
IUComparator comparator = new IUComparator(IUComparator.IU_NAME);
comparator.useColumnConfig(getColumnConfig());
@@ -116,19 +107,43 @@ public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
labelProvider = new IUDetailsLabelProvider(null, getColumnConfig(), getShell());
treeViewer.setLabelProvider(labelProvider);
- setDrilldownElements(input, resolvedOperation);
- treeViewer.setInput(input);
-
// Optional area to show the size
createSizingInfo(composite);
// The text area shows a description of the selected IU, or error detail if applicable.
iuDetailsGroup = new IUDetailsGroup(sashForm, treeViewer, convertWidthInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_WIDTH), true);
- updateStatus(input, resolvedOperation);
setControl(sashForm);
sashForm.setWeights(getSashWeights());
Dialog.applyDialogFont(sashForm);
+
+ final Runnable runnable = new Runnable() {
+ public void run() {
+ treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ setDetailText(resolvedOperation);
+ }
+ });
+ updateStatus(input, resolvedOperation);
+ setDrilldownElements(input, resolvedOperation);
+ treeViewer.setInput(input);
+ }
+ };
+
+ if (resolvedOperation != null && !resolvedOperation.hasResolved()) {
+ try {
+ getContainer().run(true, false, new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ resolvedOperation.resolveModal(monitor);
+ display.asyncExec(runnable);
+ }
+ });
+ } catch (Exception e) {
+ StatusManager.getManager().handle(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e));
+ }
+ } else {
+ runnable.run();
+ }
}
protected void createSizingInfo(Composite parent) {

Back to the top