Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Yves B.2020-02-22 16:16:23 +0000
committerEd Merks2020-03-16 10:07:04 +0000
commitae6be546d7e9f29e68bc0b0a635615544a216dd5 (patch)
tree36b621c38b69b2ab7475cef59d10b0af9fad523f
parentaf4a25f1c91c4927fd8fcbd10e081fe782c221a3 (diff)
downloadrt.equinox.p2-I20200316-1800.tar.gz
rt.equinox.p2-I20200316-1800.tar.xz
rt.equinox.p2-I20200316-1800.zip
Bug 281164 - [ui] Install new software dialog 'Work with' 'type orI20200318-1100I20200317-1800I20200316-1800
select a site' should not be a selection Change-Id: Ia39dab46133219e7060e15ab520b8dec07678c06 Signed-off-by: Pierre-Yves B. <PyvesDev@gmail.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java37
3 files changed, 28 insertions, 13 deletions
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 d272eb16b..f358cfa16 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.5.800.qualifier
+Bundle-Version: 2.5.900.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/pom.xml b/bundles/org.eclipse.equinox.p2.ui/pom.xml
index 41c992572..116bfab03 100644
--- a/bundles/org.eclipse.equinox.p2.ui/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.ui/pom.xml
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.ui</artifactId>
- <version>2.5.800-SNAPSHOT</version>
+ <version>2.5.900-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
index d07be5d43..bd9047a9a 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 IBM Corporation and others.
+ * Copyright (c) 2009, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -11,6 +11,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Yury Chernikov <Yury.Chernikov@borland.com> - Bug 271447 [ui] Bad layout in 'Install available software' dialog
+ * Pierre-Yves B. <pyvesdev@gmail.com> - Bug 281164 - [ui] Install new software dialog 'Work with' 'type or select a site' should not be a selection
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.dialogs;
@@ -157,22 +158,36 @@ public class RepositorySelectionGroup {
URI location = null;
IStatus status = null;
String text = repoCombo.getText().trim();
- int index = getComboIndex(text);
- // only validate text that doesn't match existing text in combo
- if (index < 0) {
- location = tracker.locationFromString(repoCombo.getText());
- if (location == null) {
- status = tracker.getInvalidLocationStatus(repoCombo.getText());
+ if (!text.isEmpty()) {
+ int index = getComboIndex(text);
+ // only validate text that doesn't match existing text in combo
+ if (index < 0) {
+ location = tracker.locationFromString(repoCombo.getText());
+ if (location == null) {
+ status = tracker.getInvalidLocationStatus(repoCombo.getText());
+ } else {
+ status = tracker.validateRepositoryLocation(ui.getSession(), location, false, new NullProgressMonitor());
+ }
} else {
- status = tracker.validateRepositoryLocation(ui.getSession(), location, false, new NullProgressMonitor());
+ // user typed or pasted an existing location. Select it.
+ repoComboSelectionChanged();
}
- } else {
- // user typed or pasted an existing location. Select it.
- repoComboSelectionChanged();
}
setRepoComboDecoration(status);
});
+ // Clear default text when user clicks in the combo box.
+ repoCombo.addMouseListener(MouseListener.mouseDownAdapter(e -> {
+ if (repoCombo.getText().equals(SITE_NONE))
+ repoCombo.setText(""); //$NON-NLS-1$
+ }));
+
+ // Restore default text when focus is lost from the combo box.
+ repoCombo.addFocusListener(FocusListener.focusLostAdapter(e -> {
+ if (repoCombo.getText().isEmpty())
+ fillRepoCombo(SITE_NONE);
+ }));
+
repoDec = new ControlDecoration(repoCombo, SWT.LEFT | SWT.TOP);
repoDec.setMarginWidth(DEC_MARGIN_WIDTH);

Back to the top