Fix for Bug 230218 [JFace] Test failures in PresentationsTestSuite and RCP Tests
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorRegistry.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorRegistry.java
index 11eca61..2638b32 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorRegistry.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorRegistry.java
@@ -84,6 +84,8 @@
         }
     };
 
+	private final boolean cleanOnDisplayDisposal;
+
     /**
      * Create a new instance of the receiver that is hooked to the current 
      * display.
@@ -113,8 +115,9 @@
      * @since 3.1
      */
     public ColorRegistry(Display display, boolean cleanOnDisplayDisposal) {
-        Assert.isNotNull(display);
+		Assert.isNotNull(display);
         this.display = display;
+        this.cleanOnDisplayDisposal = cleanOnDisplayDisposal;
         if (cleanOnDisplayDisposal) {
 			hookDisplayDispose();
 		}
@@ -129,6 +132,16 @@
      * @since 3.1
      */
     private Color createColor(RGB rgb) {
+    	if (this.display == null) {
+    		Display display = Display.getCurrent();
+    		if (display == null) {
+    			throw new IllegalStateException();
+    		}
+    		this.display = display;
+    		if (cleanOnDisplayDisposal) {
+    			hookDisplayDispose();
+    		}
+    	}
         return new Color(display, rgb);
     }
 
@@ -237,6 +250,7 @@
         disposeColors(staleColors.iterator());
         stringToColor.clear();
         staleColors.clear();
+        display = null;
     }
 
     /* (non-Javadoc)
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java
index 8f59568..a27e0ec 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java
@@ -203,6 +203,10 @@
         }
     };
 
+	private boolean displayDisposeHooked;
+
+	private final boolean cleanOnDisplayDisposal;
+
     /**
      * Creates an empty font registry.
      * <p>
@@ -278,6 +282,7 @@
         //readResourceBundle(location, loader);
         readResourceBundle(location);
 
+        cleanOnDisplayDisposal = true;
         hookDisplayDispose(display);
     }
 
@@ -353,6 +358,7 @@
 	 */
 	public FontRegistry(Display display, boolean cleanOnDisplayDisposal) {
 		Assert.isNotNull(display);
+		this.cleanOnDisplayDisposal = cleanOnDisplayDisposal;
 		if (cleanOnDisplayDisposal) {
 			hookDisplayDispose(display);
 		}
@@ -474,8 +480,11 @@
     private FontRecord createFont(String symbolicName, FontData[] fonts) {
         Display display = Display.getCurrent();
         if (display == null) {
-			return null;
-		}
+        	return null;
+        }
+        if (cleanOnDisplayDisposal && !displayDisposeHooked) {
+        	hookDisplayDispose(display);
+        }
 
         FontData[] validData = filterData(fonts, display);
         if (validData.length == 0) {
@@ -672,6 +681,8 @@
         disposeFonts(staleFonts.iterator());
         stringToFontRecord.clear();
         staleFonts.clear();
+        
+        displayDisposeHooked = false;
     }
 
     /**
@@ -689,7 +700,8 @@
      * Hook a dispose listener on the SWT display.
      */
     private void hookDisplayDispose(Display display) {
-        display.disposeExec(displayRunnable);
+    	displayDisposeHooked = true;
+    	display.disposeExec(displayRunnable);
     }
 
     /**
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferenceConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferenceConstants.java
index 665fa41..1039de1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferenceConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferenceConstants.java
@@ -534,7 +534,10 @@
 
 	/**
 	 * An named preference for whether or not tabs are on the top or bottom
-	 * for views. Values are either {@link SWT#TOP} or {@link SWT#BOTTOM}
+	 * for views. Values are either {@link SWT#TOP} or {@link SWT#BOTTOM}.
+	 * <p>
+	 * The default value for this preference is: <code>SWT.TOP</code>.
+	 * </p>
 	 * 
 	 * @since 3.4
 	 */
@@ -542,7 +545,10 @@
 
 	/**
 	 * An named preference for whether or not tabs are on the top or bottom
-	 * for editors. Values are either {@link SWT#TOP} or {@link SWT#BOTTOM}
+	 * for editors. Values are either {@link SWT#TOP} or {@link SWT#BOTTOM}.
+	 * <p>
+	 * The default value for this preference is: <code>SWT.TOP</code>.
+	 * </p>
 	 * 
 	 * @since 3.4
 	 */
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPreferenceInitializer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPreferenceInitializer.java
index 39f34fa..8510e9e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPreferenceInitializer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPreferenceInitializer.java
@@ -95,10 +95,6 @@
 		node.putBoolean(IHeapStatusConstants.PREF_SHOW_MAX, false);
 		node.putBoolean(IPreferenceConstants.OVERRIDE_PRESENTATION, false);
 		
-		//Backwards compatibility. This is now in the API preference store but a default
-		//check is required for migration purposed.
-		node.putBoolean(IWorkbenchPreferenceConstants.SHOW_MULTIPLE_EDITOR_TABS, true);
-		
 		IEclipsePreferences rootNode = (IEclipsePreferences) Platform
 				.getPreferencesService().getRootNode()
 				.node(InstanceScope.SCOPE);
diff --git a/bundles/org.eclipse.ui/src/org/eclipse/ui/internal/UIPreferenceInitializer.java b/bundles/org.eclipse.ui/src/org/eclipse/ui/internal/UIPreferenceInitializer.java
index b255f6e..76bea11 100644
--- a/bundles/org.eclipse.ui/src/org/eclipse/ui/internal/UIPreferenceInitializer.java
+++ b/bundles/org.eclipse.ui/src/org/eclipse/ui/internal/UIPreferenceInitializer.java
@@ -21,6 +21,7 @@
 import org.eclipse.core.runtime.preferences.IScopeContext;
 import org.eclipse.core.runtime.preferences.InstanceScope;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent;
+import org.eclipse.swt.SWT;
 import org.eclipse.ui.IWorkbenchPreferenceConstants;
 import org.eclipse.ui.keys.IBindingService;
 import org.osgi.service.prefs.BackingStoreException;
@@ -141,6 +142,10 @@
 		// Default the sticky view close behaviour to the new style
 		node.putBoolean(IWorkbenchPreferenceConstants.ENABLE_32_STICKY_CLOSE_BEHAVIOR, false);
 
+		node.putBoolean(IWorkbenchPreferenceConstants.SHOW_MULTIPLE_EDITOR_TABS, true);
+		node.putInt(IWorkbenchPreferenceConstants.VIEW_TAB_POSITION, SWT.TOP);
+		node.putInt(IWorkbenchPreferenceConstants.EDITOR_TAB_POSITION, SWT.TOP);
+		
 		IEclipsePreferences rootNode = (IEclipsePreferences) Platform
 				.getPreferencesService().getRootNode()
 				.node(InstanceScope.SCOPE);