diff options
author | Pierre-Charles David | 2016-11-02 08:39:21 +0000 |
---|---|---|
committer | Stéphane Bégaudeau | 2016-11-28 16:18:33 +0000 |
commit | 232b0d66f3a31db5b3ad428aab047accbfc5100c (patch) | |
tree | 55d15fb18ba754ddb65a07ef35c0dd72a95bba8b /plugins | |
parent | bee0d29a5feadb4ca33be17f07c8c212028ceb37 (diff) | |
download | org.eclipse.eef-232b0d66f3a31db5b3ad428aab047accbfc5100c.tar.gz org.eclipse.eef-232b0d66f3a31db5b3ad428aab047accbfc5100c.tar.xz org.eclipse.eef-232b0d66f3a31db5b3ad428aab047accbfc5100c.zip |
[498748] Make sure text field changes are applied when switching to
another tab
Bug: 498748
Change-Id: Ied241acb976f8af5461e4aee8ea3abb61ff761f1
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java index 4eac0d0c1..33080f814 100644 --- a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java +++ b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java @@ -226,7 +226,7 @@ public class EEFTextLifecycleManager extends AbstractEEFWidgetLifecycleManager { @Override public void focusLost(FocusEvent e) { if (!EEFTextLifecycleManager.this.container.isRenderingInProgress() && EEFTextLifecycleManager.this.isDirty) { - EEFTextLifecycleManager.this.updateValue(); + EEFTextLifecycleManager.this.updateValue(false); } } @@ -242,7 +242,7 @@ public class EEFTextLifecycleManager extends AbstractEEFWidgetLifecycleManager { @Override public void keyReleased(KeyEvent e) { if (e.character == '\r' || e.character == '\n') { - EEFTextLifecycleManager.this.updateValue(); + EEFTextLifecycleManager.this.updateValue(false); } } @@ -273,10 +273,13 @@ public class EEFTextLifecycleManager extends AbstractEEFWidgetLifecycleManager { /** * Updates the value. + * + * @param force + * if <code>true</code>, update even if we are in the render phase. */ - private void updateValue() { - if (!this.text.isDisposed() && this.isDirty && !EEFTextLifecycleManager.this.container.isRenderingInProgress() - && updateInProgress.compareAndSet(false, true)) { + private void updateValue(boolean force) { + boolean shouldUpdateWhileRendering = !EEFTextLifecycleManager.this.container.isRenderingInProgress() || force; + if (!this.text.isDisposed() && this.isDirty && shouldUpdateWhileRendering && updateInProgress.compareAndSet(false, true)) { try { IStatus result = controller.updateValue(text.getText()); if (result != null && result.getSeverity() == IStatus.ERROR) { @@ -327,7 +330,7 @@ public class EEFTextLifecycleManager extends AbstractEEFWidgetLifecycleManager { @Override public void aboutToBeHidden() { if (this.isDirty) { - this.updateValue(); + this.updateValue(true); } super.aboutToBeHidden(); @@ -380,4 +383,5 @@ public class EEFTextLifecycleManager extends AbstractEEFWidgetLifecycleManager { } return color; } + } |