Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-04-19 20:07:04 -0400
committerspingel2010-04-19 20:07:04 -0400
commit56d6099b10df46a66e3ef8bd43da32a509eeeb2b (patch)
tree2a730ea7e99b29386fc9d11c39645f90de353f55
parentb9490511e7fa910eb108f31f5b492c9883753b16 (diff)
downloadrt.equinox.p2-56d6099b10df46a66e3ef8bd43da32a509eeeb2b.tar.gz
rt.equinox.p2-56d6099b10df46a66e3ef8bd43da32a509eeeb2b.tar.xz
rt.equinox.p2-56d6099b10df46a66e3ef8bd43da32a509eeeb2b.zip
bug 309612 - p2 discovery Catalog.performDiscovery(IProgressMonitor) should not return a multistatus unless necessaryv20100419
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/wizards/CatalogViewer.java25
1 files changed, 11 insertions, 14 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/wizards/CatalogViewer.java b/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/wizards/CatalogViewer.java
index 530198589..245f6e405 100644
--- a/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/wizards/CatalogViewer.java
+++ b/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/wizards/CatalogViewer.java
@@ -234,13 +234,13 @@ public class CatalogViewer extends FilteredViewer {
selectionProvider.addSelectionChangedListener(listener);
}
- protected void catalogUpdated(boolean wasCancelled) {
+ protected void catalogUpdated(boolean wasCancelled, boolean wasError) {
if (catalog != null && !wasCancelled) {
int categoryWithConnectorCount = 0;
for (CatalogCategory category : catalog.getCategories()) {
categoryWithConnectorCount += category.getItems().size();
}
- if (categoryWithConnectorCount == 0) {
+ if (categoryWithConnectorCount == 0 && !wasError) {
// nothing was discovered: notify the user
MessageDialog.openWarning(getShell(), Messages.ConnectorDiscoveryWizardMainPage_noConnectorsFound, Messages.ConnectorDiscoveryWizardMainPage_noConnectorsFound_description);
}
@@ -249,19 +249,12 @@ public class CatalogViewer extends FilteredViewer {
selectionProvider.setSelection(StructuredSelection.EMPTY);
}
- protected IStatus computeStatus(InvocationTargetException e, String message) {
+ private IStatus computeStatus(InvocationTargetException e, String message) {
Throwable cause = e.getCause();
- IStatus statusCause;
- if (cause instanceof CoreException) {
- statusCause = ((CoreException) cause).getStatus();
- } else {
- statusCause = new Status(IStatus.ERROR, DiscoveryUi.ID_PLUGIN, cause.getMessage(), cause);
- }
- if (statusCause.getMessage() != null) {
- message = NLS.bind(Messages.ConnectorDiscoveryWizardMainPage_message_with_cause, message, statusCause.getMessage());
+ if (cause.getMessage() != null) {
+ message = NLS.bind(Messages.ConnectorDiscoveryWizardMainPage_message_with_cause, message, cause.getMessage());
}
- IStatus status = new MultiStatus(DiscoveryUi.ID_PLUGIN, 0, new IStatus[] {statusCause}, message, cause);
- return status;
+ return new Status(IStatus.ERROR, DiscoveryUi.ID_PLUGIN, message, e);
}
protected Pattern createPattern(String filterText) {
@@ -557,6 +550,7 @@ public class CatalogViewer extends FilteredViewer {
public void updateCatalog() {
boolean wasCancelled = false;
+ boolean wasError = false;
try {
final IStatus[] result = new IStatus[1];
context.run(true, true, new IRunnableWithProgress() {
@@ -576,16 +570,18 @@ public class CatalogViewer extends FilteredViewer {
if (result[0] != null && !result[0].isOK()) {
StatusManager.getManager().handle(result[0], StatusManager.SHOW | StatusManager.BLOCK | StatusManager.LOG);
+ wasError = true;
}
} catch (InvocationTargetException e) {
IStatus status = computeStatus(e, Messages.ConnectorDiscoveryWizardMainPage_unexpectedException);
StatusManager.getManager().handle(status, StatusManager.SHOW | StatusManager.BLOCK | StatusManager.LOG);
+ wasError = true;
} catch (InterruptedException e) {
// cancelled by user so nothing to do here.
wasCancelled = true;
}
if (catalog != null) {
- catalogUpdated(wasCancelled);
+ catalogUpdated(wasCancelled, wasError);
if (configuration.isVerifyUpdateSiteAvailability() && !catalog.getItems().isEmpty()) {
try {
context.run(true, true, new IRunnableWithProgress() {
@@ -596,6 +592,7 @@ public class CatalogViewer extends FilteredViewer {
} catch (InvocationTargetException e) {
IStatus status = computeStatus(e, Messages.ConnectorDiscoveryWizardMainPage_unexpectedException);
StatusManager.getManager().handle(status, StatusManager.SHOW | StatusManager.BLOCK | StatusManager.LOG);
+ wasError = true;
} catch (InterruptedException e) {
// cancelled by user so nothing to do here.
wasCancelled = true;

Back to the top