diff options
author | Andrey Loskutov | 2017-01-02 18:14:52 +0000 |
---|---|---|
committer | Andrey Loskutov | 2017-01-02 18:14:52 +0000 |
commit | e95d459b081037fc8f84088cfb7c3cb6eb54dea2 (patch) | |
tree | 746c5dc7e7b2efdd3023f7f05ea895b201f9df6c | |
parent | a5b2e9430aa6276fd39d33b3b337c0e2520859e3 (diff) | |
download | eclipse.platform.ua-e95d459b081037fc8f84088cfb7c3cb6eb54dea2.tar.gz eclipse.platform.ua-e95d459b081037fc8f84088cfb7c3cb6eb54dea2.tar.xz eclipse.platform.ua-e95d459b081037fc8f84088cfb7c3cb6eb54dea2.zip |
Bug 509829 - SWTException below EngineResultSection.lambda$0 (thrown in
Widget.getDisplay)
Change-Id: Ia8fc4a31737967ee930a03dd5244218dfb6acc0a
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r-- | org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineResultSection.java | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineResultSection.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineResultSection.java index d6e163120..8ef81fa4e 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineResultSection.java +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineResultSection.java @@ -59,9 +59,9 @@ import org.osgi.framework.Bundle; public class EngineResultSection { private static final String KEY_PREFIX_GRAYED = "grayed:"; //$NON-NLS-1$ - + private static final String CAT_HEADING_PREFIX = "catheading:"; //$NON-NLS-1$ - + private SearchResultsPart part; private EngineDescriptor desc; @@ -227,7 +227,7 @@ public class EngineResultSection { /* * (non-Javadoc) - * + * * @see org.eclipse.help.internal.search.federated.ISearchEngineResultCollector#add(org.eclipse.help.internal.search.federated.ISearchEngineResult[]) */ public synchronized void add(ISearchEngineResult[] matches) { @@ -259,7 +259,10 @@ public class EngineResultSection { } private void asyncUpdateResults(boolean now, final boolean scrollToBeginning) { - Runnable runnable = () -> BusyIndicator.showWhile(section.getDisplay(), () -> { + Runnable runnable = () -> BusyIndicator.showWhile(PlatformUI.getWorkbench().getDisplay(), () -> { + if (section.isDisposed()) { + return; + } updateResults(true); if (scrollToBeginning) { searchResults.setFocus(); @@ -267,12 +270,14 @@ public class EngineResultSection { part.updateSeparatorVisibility(); } }); - if (section.isDisposed()) + if (section.isDisposed()) { return; - if (now) - section.getDisplay().syncExec(runnable); - else - section.getDisplay().asyncExec(runnable); + } + if (now) { + PlatformUI.getWorkbench().getDisplay().syncExec(runnable); + } else { + PlatformUI.getWorkbench().getDisplay().asyncExec(runnable); + } } private ISearchEngineResult[] getResults() { @@ -292,11 +297,11 @@ public class EngineResultSection { sorter.sort(null, results); return results; } - + /** * Returns a copy of the given image but grayed and half transparent. * This gives the icon a grayed/disabled look. - * + * * @param image the image to gray * @return the grayed image */ @@ -380,11 +385,11 @@ public class EngineResultSection { imageId = id; } } - + if (isPotentialHit) { imageId = KEY_PREFIX_GRAYED + imageId; } - + buff.append(imageId); buff.append("\">"); //$NON-NLS-1$ buff.append("<a href=\""); //$NON-NLS-1$ @@ -416,7 +421,7 @@ public class EngineResultSection { else { elabel = hit.getLabel(); } - + elabel = EscapeUtils.escapeSpecialChars(elabel); buff.append(elabel); buff.append("</a>"); //$NON-NLS-1$ @@ -444,7 +449,7 @@ public class EngineResultSection { * Registers the given icon URL for use with this section. Icons * must be registered before use and referenced by the returned * ID. - * + * * @param iconURL the URL to the icon * @return the ID to use for referencing the icon */ @@ -461,7 +466,7 @@ public class EngineResultSection { * Same as registerHitIcon() but to register a grayed icon. You * can provide the same URL for both the regular and grayed icons, * but two different IDs will be returned. - * + * * @param iconURL the URL to the icon * @return the ID to use for referencing the icon */ |