diff options
author | Pierre-Charles David | 2018-01-26 09:57:24 +0000 |
---|---|---|
committer | Stéphane Bégaudeau | 2018-01-26 14:43:37 +0000 |
commit | 78d12316b8f118cd30e68973dc5ae641430dea79 (patch) | |
tree | a2003528149f4e10595d87b493a8ff6b13afcc18 | |
parent | 0404d254e5e6fda22b6909957a5d6706ee24c270 (diff) | |
download | org.eclipse.eef-78d12316b8f118cd30e68973dc5ae641430dea79.tar.gz org.eclipse.eef-78d12316b8f118cd30e68973dc5ae641430dea79.tar.xz org.eclipse.eef-78d12316b8f118cd30e68973dc5ae641430dea79.zip |
[530181] Add workarounds for combos under Windows 7
By default, under Windows 7 (and only there), if a combo is opened, it
will ignore concurrent requests to update its content. This means it
can display stale values, but trying to update the displayed values
once the combo is opened is broken under Windows 7.
This is configurable with system property
org.eclipse.eef.avoidUpdatingOpenedCombo if the situations appears in
other systmes we're not yet aware of.
If showing possibly stale values in the combo is an issue, a second
system property, org.eclipse.eef.forceCloseToUpdateCombo, can be set
to force the updating, at the cost of closing the combo. The user has
to re-open it, but at least in this case the content shown is up to
date.
Bug: 530181
Change-Id: Iba6ae5767e208206adbc4207c50894d52dedd0b1
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
-rw-r--r-- | plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFSelectLifecycleManager.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFSelectLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFSelectLifecycleManager.java index 0635a47bf..caa6aa514 100644 --- a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFSelectLifecycleManager.java +++ b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFSelectLifecycleManager.java @@ -221,6 +221,12 @@ public class EEFSelectLifecycleManager extends AbstractEEFWidgetLifecycleManager // Set combo items this.controller.onNewCandidates((value) -> { if (!this.combo.isDisposed()) { + if (this.combo.getListVisible() && this.avoidUpdatingOpenedCombo()) { + return; + } + if (this.forceCloseToUpdateCombo()) { + this.combo.setListVisible(false); + } if (value != null) { Object[] candidates = value.toArray(); for (int i = 0; i < candidates.length; i++) { @@ -240,6 +246,27 @@ public class EEFSelectLifecycleManager extends AbstractEEFWidgetLifecycleManager } /** + * Needed to workaround https://bugs.eclipse.org/530181, which happens at least under to Windows 7. + * + * @return true if we should avoid accepting new/updated input while the combo is opened/visible. + */ + private boolean avoidUpdatingOpenedCombo() { + // Default to true under Windows 7. + boolean win7 = "Windows7".equals(System.getProperty("org.osgi.framework.os.name")); //$NON-NLS-1$ //$NON-NLS-2$ + return Boolean.valueOf(System.getProperty("org.eclipse.eef.avoidUpdatingOpenedCombo", Boolean.toString(win7))).booleanValue(); //$NON-NLS-1$ + } + + /** + * Checks configuration flag to see if we must close of already opened combos to update their contents (instead of + * possibly displaying stale values on OSes that do not support updating opened combos). + * + * @return true if the combo must be force-closed for its content to be updated. + */ + private boolean forceCloseToUpdateCombo() { + return Boolean.valueOf(System.getProperty("org.eclipse.eef.forceCloseToUpdateCombo", Boolean.toString(false))).booleanValue(); //$NON-NLS-1$ + } + + /** * {@inheritDoc} * * @see org.eclipse.eef.ide.ui.api.widgets.IEEFLifecycleManager#aboutToBeHidden() |