Bug 466233 - Toolbar items are wrongly rendered into a "drop-down"

Change-Id: I1688e0cbe9abb600079c40d0645e291438eb6f3f
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/TrimBarLayout.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/TrimBarLayout.java
index c610136..19cce1e 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/TrimBarLayout.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/TrimBarLayout.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2011, 2013 IBM Corporation and others.
+ * Copyright (c) 2011, 2015 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -9,6 +9,7 @@
  *     IBM Corporation - initial API and implementation
  *     Christian Walther (Indel AG) - Bug 399458: Fix layout overlap in line-wrapped trim bar
  *     Christian Walther (Indel AG) - Bug 389012: Fix division by zero in TrimBarLayout
+ *     Marc-Andre Laperle (Ericsson) - Bug 466233: Toolbar items are wrongly rendered into a "drop-down"
  *******************************************************************************/
 package org.eclipse.e4.ui.workbench.renderers.swt;
 
@@ -86,8 +87,10 @@
 	@Override
 	protected Point computeSize(Composite composite, int wHint, int hHint,
 			boolean flushCache) {
-		// Clear the current cache
-		lines.clear();
+		if (flushCache) {
+			// Clear the current cache
+			lines.clear();
+		}
 
 		// First, hide any empty toolbars
 		MTrimBar bar = (MTrimBar) composite
@@ -195,6 +198,10 @@
 
 	@Override
 	protected void layout(Composite composite, boolean flushCache) {
+		if (flushCache) {
+			// Clear the current cache
+			lines.clear();
+		}
 		Rectangle bounds = composite.getBounds();
 
 		// offset the rectangle to allow for the margins