[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>
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 4eac0d0..33080f8 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 @@
 			@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 @@
 				@Override
 				public void keyReleased(KeyEvent e) {
 					if (e.character == '\r' || e.character == '\n') {
-						EEFTextLifecycleManager.this.updateValue();
+						EEFTextLifecycleManager.this.updateValue(false);
 					}
 				}
 
@@ -273,10 +273,13 @@
 
 	/**
 	 * 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 @@
 	@Override
 	public void aboutToBeHidden() {
 		if (this.isDirty) {
-			this.updateValue();
+			this.updateValue(true);
 		}
 
 		super.aboutToBeHidden();
@@ -380,4 +383,5 @@
 		}
 		return color;
 	}
+
 }