Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSusan Franklin2010-05-12 17:47:54 +0000
committerSusan Franklin2010-05-12 17:47:54 +0000
commit4a7d8bed2169e28559b24010d1e38c523b299161 (patch)
tree1e423744fa0d8313c29b78e5826ad588de7b3250
parentd29725a15328688a3f47c0c1bf112bed0ef70e2b (diff)
downloadrt.equinox.p2-4a7d8bed2169e28559b24010d1e38c523b299161.tar.gz
rt.equinox.p2-4a7d8bed2169e28559b24010d1e38c523b299161.tar.xz
rt.equinox.p2-4a7d8bed2169e28559b24010d1e38c523b299161.zip
Bug 310667 - [ui] regression - features with UM install handlers not detected by install wizard
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UpdateManagerCompatibility.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java66
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionStatusPage.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties1
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java23
8 files changed, 96 insertions, 32 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java
index 1583bccf3..edbfb0b76 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java
@@ -169,6 +169,12 @@ public class ProvUI {
runCommand(INSTALLATION_DIALOG, ProvUIMessages.ProvUI_InstallDialogError, event);
}
+ public static boolean isUpdateManagerInstallerPresent() {
+ ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ Command command = commandService.getCommand(UPDATE_MANAGER_FIND_AND_INSTALL);
+ return command.isDefined();
+ }
+
public static QueryProvider getQueryProvider() {
if (queryProvider == null)
queryProvider = new QueryProvider(ProvUIActivator.getDefault().getProvisioningUI());
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java
index ad3b69a56..8a0fb51a2 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java
@@ -235,6 +235,7 @@ public class ProvUIMessages extends NLS {
public static String UpdateManagerCompatibility_ImportSitesTitle;
public static String UpdateManagerCompatibility_InvalidSiteFileMessage;
public static String UpdateManagerCompatibility_InvalidSitesTitle;
+ public static String UpdateManagerCompatibility_ItemRequiresUpdateManager;
public static String UpdateManagerCompatibility_UnableToOpenFindAndInstall;
public static String UpdateManagerCompatibility_UnableToOpenManageConfiguration;
public static String ServiceUI_LoginDetails;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UpdateManagerCompatibility.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UpdateManagerCompatibility.java
index 9dcef6708..1effbe36b 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UpdateManagerCompatibility.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UpdateManagerCompatibility.java
@@ -23,6 +23,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
@@ -166,15 +167,14 @@ public class UpdateManagerCompatibility {
}
}
- public static boolean requiresInstallHandlerSupport(IProvisioningPlan plan) {
+ public static IStatus getInstallHandlerStatus(IProvisioningPlan plan) {
IQueryResult<IInstallableUnit> result = plan.getAdditions().query(QueryUtil.createIUAnyQuery(), null);
for (Iterator<IInstallableUnit> iterator = result.iterator(); iterator.hasNext();) {
IInstallableUnit iu = iterator.next();
if (iu != null && iu.getProperty(ECLIPSE_INSTALL_HANDLER_PROP) != null)
- return true;
+ return new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, NLS.bind(ProvUIMessages.UpdateManagerCompatibility_ItemRequiresUpdateManager, iu.getId()));
}
- return false;
-
+ return Status.OK_STATUS;
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java
index 0886179d5..31cc1a65b 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java
@@ -13,8 +13,8 @@ package org.eclipse.equinox.internal.p2.ui.dialogs;
import java.util.ArrayList;
import java.util.Collection;
-import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.internal.p2.ui.model.*;
import org.eclipse.equinox.p2.engine.ProvisioningContext;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
@@ -22,8 +22,13 @@ import org.eclipse.equinox.p2.operations.InstallOperation;
import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
/**
* An install wizard that allows the users to browse all of the repositories
@@ -35,6 +40,7 @@ public class InstallWizard extends WizardWithLicenses {
SelectableIUsPage errorReportingPage;
boolean ignoreSelectionChanges = false;
+ IStatus installHandlerStatus;
public InstallWizard(ProvisioningUI ui, InstallOperation operation, Collection<IInstallableUnit> initialSelections, LoadMetadataRepositoryJob preloadJob) {
super(ui, operation, initialSelections == null ? null : initialSelections.toArray(), preloadJob);
@@ -164,4 +170,60 @@ public class InstallWizard extends WizardWithLicenses {
ignoreSelectionChanges = false;
}
}
+
+ /*
+ * Overridden to check whether there are UpdateManager install handlers in the item
+ * to be installed. Operations don't know about this compatibility issue.
+ * (non-Javadoc)
+ * @see org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard#getCurrentStatus()
+ */
+ public IStatus getCurrentStatus() {
+ IStatus originalStatus = super.getCurrentStatus();
+ int sev = originalStatus.getSeverity();
+ // Use the previously computed status if the user cancelled or if we were already in error.
+ // If we don't have an operation or a plan, we can't check this condition either, so just
+ // use the normal status.
+ if (sev == IStatus.CANCEL || sev == IStatus.ERROR || operation == null || operation.getProvisioningPlan() == null) {
+ return originalStatus;
+ }
+ // Does the plan require install handler support?
+ installHandlerStatus = UpdateManagerCompatibility.getInstallHandlerStatus(operation.getProvisioningPlan());
+ if (!installHandlerStatus.isOK()) {
+ // Set the status into the wizard. This ensures future calls to this method won't
+ // repeat the work (and prompting).
+ couldNotResolveStatus = installHandlerStatus;
+
+ // Is the update manager installer present? If so, offer to open it.
+ // In either case, the failure will be reported in this wizard.
+ if (ProvUI.isUpdateManagerInstallerPresent()) {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ Shell shell = ProvUI.getDefaultParentShell();
+ MessageDialog dialog = new MessageDialog(shell, ProvUIMessages.Policy_RequiresUpdateManagerTitle, null, ProvUIMessages.Policy_RequiresUpdateManagerMessage, MessageDialog.WARNING, new String[] {ProvUIMessages.LaunchUpdateManagerButton, IDialogConstants.CANCEL_LABEL}, 0);
+ if (dialog.open() == 0)
+ BusyIndicator.showWhile(shell.getDisplay(), new Runnable() {
+ public void run() {
+ UpdateManagerCompatibility.openInstaller();
+ }
+ });
+ }
+ });
+ }
+ return installHandlerStatus;
+ }
+ return originalStatus;
+ }
+
+ /*
+ * When we've found an install handler, that status trumps anything that the operation might have
+ * determined. We are relying here on the knowledge that the wizard's couldNotResolveStatus is
+ * reset on every new resolution, so that status only holds the installHandler status when it is
+ * the current status.
+ *
+ * (non-Javadoc)
+ * @see org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard#statusOverridesOperation()
+ */
+ public boolean statusOverridesOperation() {
+ return couldNotResolveStatus == installHandlerStatus;
+ }
}
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 1b2e9ac6b..3175aa5ac 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
@@ -237,6 +237,8 @@ public abstract class ProvisioningOperationWizard extends Wizard {
}
public IStatus getCurrentStatus() {
+ if (statusOverridesOperation())
+ return couldNotResolveStatus;
if (operation != null && operation.getResolutionResult() != null)
return operation.getResolutionResult();
return couldNotResolveStatus;
@@ -334,4 +336,12 @@ public abstract class ProvisioningOperationWizard extends Wizard {
});
}
}
+
+ /*
+ * Return a boolean indicating whether the wizard's current status should override any detail
+ * reported by the operation.
+ */
+ public boolean statusOverridesOperation() {
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionStatusPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionStatusPage.java
index 2bf4577e0..f1af3f817 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionStatusPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionStatusPage.java
@@ -124,11 +124,16 @@ public abstract class ResolutionStatusPage extends ProvisioningWizardPage {
String detail = null;
IInstallableUnit selectedIU = getSelectedIU();
IUDetailsGroup detailsGroup = getDetailsGroup();
+
// We either haven't resolved, or we failed to resolve and reported some error
- // while doing so. Since the specific error was already reported, the description
- // text can be used for the selected IU.
- if (resolvedOperation == null || !resolvedOperation.hasResolved()) {
- if (selectedIU != null) {
+ // while doing so.
+ if (resolvedOperation == null || !resolvedOperation.hasResolved() || getProvisioningWizard().statusOverridesOperation()) {
+ // See if the wizard status knows something more about it.
+ IStatus currentStatus = getProvisioningWizard().getCurrentStatus();
+ if (!currentStatus.isOK()) {
+ detail = currentStatus.getMessage();
+ detailsGroup.enablePropertyLink(false);
+ } else if (selectedIU != null) {
detail = getIUDescription(selectedIU);
detailsGroup.enablePropertyLink(true);
} else {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties
index 929652ea0..7a35c6f64 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties
@@ -130,6 +130,7 @@ UpdateManagerCompatibility_ExportSitesTitle=Export Sites
UpdateManagerCompatibility_ImportSitesTitle=Import Sites
UpdateManagerCompatibility_InvalidSiteFileMessage=The selected file does not contain any updates sites. Please select another file.
UpdateManagerCompatibility_InvalidSitesTitle=Invalid Sites File
+UpdateManagerCompatibility_ItemRequiresUpdateManager=The items selected for install include software ({0}) that requires install procedures from the older Eclipse Update Manager. The installation cannot continue.
UpdateManagerCompatibility_UnableToOpenFindAndInstall=Unable to open the Classic Update Manager 'Find and Install' wizard.
UpdateManagerCompatibility_UnableToOpenManageConfiguration=Unable to open the Classic Update Manager 'Manage Configuration' dialog.
Updates_Label=Updates Available
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java
index 4aab2bbc4..71e68ea44 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java
@@ -12,18 +12,14 @@ package org.eclipse.equinox.p2.ui;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
import org.eclipse.equinox.p2.engine.query.UserVisibleRootQuery;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
import org.eclipse.equinox.p2.operations.UpdateOperation;
import org.eclipse.equinox.p2.query.IQuery;
import org.eclipse.equinox.p2.query.QueryUtil;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.statushandlers.StatusManager;
/**
@@ -112,23 +108,6 @@ public class Policy {
return false;
}
- // If the plan requires install handler support, we want to open the old update UI and
- // cancel this operation
- if (UpdateManagerCompatibility.requiresInstallHandlerSupport(operation.getProvisioningPlan())) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- Shell shell = ProvUI.getDefaultParentShell();
- MessageDialog dialog = new MessageDialog(shell, ProvUIMessages.Policy_RequiresUpdateManagerTitle, null, ProvUIMessages.Policy_RequiresUpdateManagerMessage, MessageDialog.WARNING, new String[] {ProvUIMessages.LaunchUpdateManagerButton, IDialogConstants.CANCEL_LABEL}, 0);
- if (dialog.open() == 0)
- BusyIndicator.showWhile(shell.getDisplay(), new Runnable() {
- public void run() {
- UpdateManagerCompatibility.openInstaller();
- }
- });
- }
- });
- return false;
- }
// Allow the wizard to open otherwise.
return true;
}

Back to the top