Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2015-12-04 16:35:52 -0500
committerPascal Rapicault2016-03-17 08:57:44 -0400
commitb11afb1607d18f4089b084654900985c0113c30d (patch)
treeeeaa7da84250ed00039423b6e07659a9480d9eb0
parentd41d8ba53a0e820a499f117df890ca2229749e75 (diff)
downloadrt.equinox.p2-I20160405-0800.tar.gz
rt.equinox.p2-I20160405-0800.tar.xz
rt.equinox.p2-I20160405-0800.zip
Gives hint and link to suggest edition of available sites to user. Change-Id: If02a8d7436dc3e9f7fdffab6b28eed988c4d44a2 Signed-off-by: Mickael Istria <mistria@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/messages.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/MessageDialogWithLink.java68
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java16
3 files changed, 84 insertions, 2 deletions
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/messages.properties b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/messages.properties
index 4148611df..adbaba443 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/messages.properties
@@ -28,7 +28,7 @@ PlanAnalyzer_IgnoringImpliedDowngrade="{0}" will be ignored because a newer vers
PlanAnalyzer_ImpliedUpdate="{0}" is already installed, so an update will be performed instead.
PlanAnalyzer_Items=Items
PlanAnalyzer_NothingToDo=Cannot complete the request. See the error log for details.
-PlanAnalyzer_NoUpdates=No updates were found.
+PlanAnalyzer_NoUpdates=No updates were found in <A>available software sites</A>.
PlanAnalyzer_AlreadyInstalled="{0}" will be ignored because it is already installed.
PlanAnalyzer_AnotherOperationInProgress=Cannot continue the operation. There is another install operation in progress.
PlanAnalyzer_RequestAltered=Your original request has been modified.
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/MessageDialogWithLink.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/MessageDialogWithLink.java
new file mode 100644
index 000000000..9a1240c8a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/MessageDialogWithLink.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Red Hat Inc.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mickael Istria (Red Hat Inc.) - 483644 Improve "No updates found" dialog
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.*;
+
+public class MessageDialogWithLink extends MessageDialog {
+
+ protected String linkMessage;
+ protected Link link;
+ protected List<SelectionListener> linkListeners = new ArrayList<SelectionListener>();
+
+ public MessageDialogWithLink(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
+ super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
+ this.message = null;
+ this.linkMessage = dialogMessage;
+ }
+
+ public MessageDialogWithLink(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, int defaultIndex, String... dialogButtonLabels) {
+ this(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
+ }
+
+ @Override
+ protected Control createMessageArea(Composite composite) {
+ super.createMessageArea(composite);
+ // create message
+ if (linkMessage != null) {
+ this.link = new Link(composite, getMessageLabelStyle());
+ this.link.setText(this.linkMessage);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT).applyTo(this.link);
+ for (SelectionListener linkListener : this.linkListeners) {
+ this.link.addSelectionListener(linkListener);
+ }
+ }
+ return composite;
+ }
+
+ public void addSelectionListener(SelectionListener listener) {
+ if (link != null && !link.isDisposed()) {
+ link.addSelectionListener(listener);
+ }
+ this.linkListeners.add(listener);
+ }
+
+ public void removeSelectionListener(SelectionListener listener) {
+ if (link != null && !link.isDisposed()) {
+ link.removeSelectionListener(listener);
+ }
+ this.linkListeners.add(listener);
+ }
+
+}
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 1d78b0c2f..8b0ad09f0 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
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
* Ericsson AB (Hamdan Msheik) - Bug 396420 - Control Install dialog through preference customization
* Red Hat Inc. - Bug 460967
+ * Mickael Istria (Red Hat Inc.) - 483644 Improve "No updates found" dialog
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui;
@@ -28,7 +29,11 @@ import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.ui.Policy;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
@@ -93,7 +98,16 @@ public class ProvUI {
// blocking right.
if ((style & StatusManager.BLOCK) == StatusManager.BLOCK || (style & StatusManager.SHOW) == StatusManager.SHOW) {
if (status.getSeverity() == IStatus.INFO) {
- MessageDialog.openInformation(ProvUI.getDefaultParentShell(), ProvUIMessages.ProvUI_InformationTitle, status.getMessage());
+ final MessageDialogWithLink dialog = new MessageDialogWithLink(ProvUI.getDefaultParentShell(), ProvUIMessages.ProvUI_InformationTitle, null, status.getMessage(), MessageDialog.INFORMATION, 0, IDialogConstants.OK_LABEL);
+ if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
+ dialog.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ ProvisioningUI.getDefaultUI().manipulateRepositories(dialog.getShell());
+ }
+ });
+ }
+ dialog.open();
// unset the dialog bits
style = style & ~StatusManager.BLOCK;
style = style & ~StatusManager.SHOW;

Back to the top