diff options
| author | Mickael Istria | 2017-11-29 15:02:49 +0000 |
|---|---|---|
| committer | Andrey Loskutov | 2017-12-03 14:44:39 +0000 |
| commit | 327db0d5beb6c00c8f39e4832207dddc1c9b7a06 (patch) | |
| tree | 5999b189c996ae8b56bb114a6124b6704006ef17 | |
| parent | 90d941cfe9cea77f25ed6d1cb688b6f032dfe508 (diff) | |
| download | eclipse.platform.ui-327db0d5beb6c00c8f39e4832207dddc1c9b7a06.tar.gz eclipse.platform.ui-327db0d5beb6c00c8f39e4832207dddc1c9b7a06.tar.xz eclipse.platform.ui-327db0d5beb6c00c8f39e4832207dddc1c9b7a06.zip | |
Bug 527848 - [Quick Access] IllegalStateException in Quick Access popupI20171203-2000
Change-Id: I9ff6b60115566b46b86c08e5183509e9f0d04ef6
Signed-off-by: Mickael Istria <mistria@redhat.com>
2 files changed, 20 insertions, 2 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessElement.java index d7f0506e1e3..be541809150 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessElement.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessElement.java @@ -203,8 +203,15 @@ public abstract class QuickAccessElement { Matcher m = p.matcher(sortLabel); // if matches, return an entry if (m.matches()) { - // and highlight match on the label - m = p.matcher(getLabel()); + // and highlight match on the label only + String label = getLabel(); + if (!sortLabel.equals(label)) { + m = p.matcher(getLabel()); + if (!m.matches()) { + return new QuickAccessEntry(this, providerForMatching, EMPTY_INDICES, EMPTY_INDICES, + QuickAccessEntry.MATCH_GOOD); + } + } int groupCount = m.groupCount(); int[][] indices = new int[groupCount][]; for (int i = 0; i < groupCount; i++) { diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/quickaccess/ContentMatchesTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/quickaccess/ContentMatchesTest.java index 278436b9536..5ea32aa40a6 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/quickaccess/ContentMatchesTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/quickaccess/ContentMatchesTest.java @@ -80,6 +80,17 @@ public class ContentMatchesTest extends UITestCase { assertTrue(Matchers.hasItems(Matchers.containsString("Text Editors")).matches(allEntries)); } + public void testRequestWithWhitespace() throws Exception { + Shell shell = searchField.getQuickAccessShell(); + assertFalse("Quick access dialog should not be visible yet", shell.isVisible()); + Text text = searchField.getQuickAccessSearchText(); + text.setText("text white"); + final Table table = searchField.getQuickAccessTable(); + processEventsUntil(() -> table.getItemCount() > 1, 200); + List<String> allEntries = getAllEntries(table); + assertTrue(Matchers.hasItems(Matchers.containsString("Text Editors")).matches(allEntries)); + } + private List<String> getAllEntries(Table table) { final int nbColumns = table.getColumnCount(); return Arrays.stream(table.getItems()).map(item -> { |
