diff options
author | Karsten Thoms | 2019-11-14 12:24:26 +0000 |
---|---|---|
committer | Karsten Thoms | 2019-11-15 19:53:26 +0000 |
commit | 2e6899ce766c03ac6e36f6579f75d0867abfc49b (patch) | |
tree | 2d58a903d853ef3b549b9330792e0cec33fc7ef8 /org.eclipse.debug.ui | |
parent | e969faf1708735d8309458eceec038ca10341c2b (diff) | |
download | eclipse.platform.debug-2e6899ce766c03ac6e36f6579f75d0867abfc49b.tar.gz eclipse.platform.debug-2e6899ce766c03ac6e36f6579f75d0867abfc49b.tar.xz eclipse.platform.debug-2e6899ce766c03ac6e36f6579f75d0867abfc49b.zip |
Bug 511338 - Perform tooltip update in background threadI20191117-1800I20191117-0600I20191116-1800I20191116-0600I20191115-1800
The UI thread does not have to be blocked for the retrieval of the
action's tooltip text. Using a CompletableFuture to retrieve the tooltip
text and setting it for the action when done on the UI thread.
Change-Id: I363c7ab642efd078de12cc08fe3cc3226793b4e9
Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
Diffstat (limited to 'org.eclipse.debug.ui')
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java index 99d14350a..fa9a4b984 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java @@ -17,6 +17,7 @@ package org.eclipse.debug.ui.actions; import java.util.ArrayList; import java.util.List; import java.util.Set; +import java.util.concurrent.CompletableFuture; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; @@ -51,6 +52,7 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.events.MenuAdapter; import org.eclipse.swt.events.MenuEvent; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; @@ -198,7 +200,10 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I * </p> */ protected void updateTooltip() { - getAction().setToolTipText(getToolTip()); + CompletableFuture.supplyAsync(this::getToolTip) + .thenAccept(tooltip -> + Display.getDefault().asyncExec(() -> getAction().setToolTipText(tooltip)) + ); } /** @@ -421,7 +426,7 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I /** * @since 3.12 */ - protected void runInternal(IAction action, boolean isShift) { + protected void runInternal(IAction action, @SuppressWarnings("unused") boolean isShift) { run(action); } |