From 5eaa208019d3f5399d371f53e7662edc89e5b0e3 Mon Sep 17 00:00:00 2001 From: Pascal Rapicault Date: Tue, 4 Nov 2014 16:43:27 -0500 Subject: Add support to open information dialog --- .../org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF | 2 +- .../internal/p2/ui/ValidationDialogServiceUI.java | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'bundles/org.eclipse.equinox.p2.ui') diff --git a/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF index ea4b53a56..f678488fe 100644 --- a/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-SymbolicName: org.eclipse.equinox.p2.ui;singleton:=true -Bundle-Version: 2.3.0.qualifier +Bundle-Version: 2.4.0.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.ui.ProvUIActivator Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java index ff6209f26..2994b7f0e 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 IBM Corporation and others. + * Copyright (c) 2008, 2014 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Rapicorp, Inc. - add support for information dialog *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui; @@ -18,8 +19,7 @@ import org.eclipse.equinox.internal.p2.ui.dialogs.UserValidationDialog; import org.eclipse.equinox.internal.p2.ui.viewers.CertificateLabelProvider; import org.eclipse.equinox.p2.core.UIServices; import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.*; import org.eclipse.jface.viewers.*; import org.eclipse.jface.window.Window; import org.eclipse.osgi.util.NLS; @@ -160,7 +160,6 @@ public class ValidationDialogServiceUI extends UIServices { } public AuthenticationInfo getUsernamePassword(final String location, final AuthenticationInfo previousInfo) { - final AuthenticationInfo[] result = new AuthenticationInfo[1]; if (!suppressAuthentication() && !isHeadless()) { PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { @@ -186,6 +185,18 @@ public class ValidationDialogServiceUI extends UIServices { return result[0]; } + public void showInformationMessage(final String title, final String text) { + if (isHeadless()) { + super.showInformationMessage(title, text); + return; + } + PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(ProvUI.getDefaultParentShell(), title, text); + } + }); + } + private boolean isHeadless() { // If there is no UI available and we are still the IServiceUI, // assume that the operation should proceed. See -- cgit v1.2.3