Bug 444188 - EclipsePreferences is not thread safe

Enable save actions so import warnings and etc. doesn't happen again.

Change-Id: Ib2bc0f90011d0a4614cc6f7fa4c723da0f9716a3
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/bundles/org.eclipse.equinox.preferences.tests/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.preferences.tests/.settings/org.eclipse.jdt.ui.prefs
index a970245..00f83ad 100644
--- a/bundles/org.eclipse.equinox.preferences.tests/.settings/org.eclipse.jdt.ui.prefs
+++ b/bundles/org.eclipse.equinox.preferences.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -1,3 +1,61 @@
-#Mon Dec 15 14:14:24 EET 2008
 eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
 org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=true
+sp_cleanup.convert_to_enhanced_for_loop=true
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_modifiers=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.preferences.tests/src/org/eclipse/equinox/preferences/tests/EclipsePreferencesTest.java b/bundles/org.eclipse.equinox.preferences.tests/src/org/eclipse/equinox/preferences/tests/EclipsePreferencesTest.java
index accbd2d..1089e97 100644
--- a/bundles/org.eclipse.equinox.preferences.tests/src/org/eclipse/equinox/preferences/tests/EclipsePreferencesTest.java
+++ b/bundles/org.eclipse.equinox.preferences.tests/src/org/eclipse/equinox/preferences/tests/EclipsePreferencesTest.java
@@ -30,23 +30,25 @@
 import org.junit.After;
 import org.junit.Test;
 import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
 
 /**
  * Test suite for class org.eclipse.core.internal.preferences.EclipsePreferences
- * WARNING: many tests are still located in org.eclipse.core.tests.internal.preferences.EclipsePreferencesTest from eclipse.platform.runtime
+ * WARNING: many tests are still located in
+ * org.eclipse.core.tests.internal.preferences.EclipsePreferencesTest from
+ * eclipse.platform.runtime
  */
 public class EclipsePreferencesTest {
 
-	/** 
+	/**
 	 * Concurrent access to listener collection should not lead to exceptions
+	 * 
 	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=444188
 	 */
 	@Test
 	public void testConcurrentPreferenceChangeListener() throws InterruptedException, CoreException {
 		final IEclipsePreferences node = createTestNode();
 		final int runSize = 100000;
-		
+
 		executeInTwoThreads(new ICoreRunnable() {
 			@Override
 			public void run(IProgressMonitor monitor) throws CoreException {
@@ -65,8 +67,9 @@
 		});
 	}
 
-	/** 
+	/**
 	 * Concurrent access to listener collection should not lead to exceptions
+	 * 
 	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=444188
 	 */
 	@Test
@@ -91,7 +94,8 @@
 					try {
 						node.node(Thread.currentThread().getName()).removeNode(); // Should not throw
 					} catch (BackingStoreException e) {
-						throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.core.tests.runtime", 0, "", null));
+						throw new CoreException(
+								new Status(IStatus.ERROR, "org.eclipse.core.tests.runtime", 0, "", null));
 					}
 					node.removeNodeChangeListener(listener); // Should not throw
 				}
@@ -111,7 +115,7 @@
 		job.schedule();
 		try {
 			latch.await();
-				runnable.run(new NullProgressMonitor());
+			runnable.run(new NullProgressMonitor());
 		} finally {
 			job.cancel();
 			job.join();
@@ -122,12 +126,12 @@
 			}
 		}
 	}
-	
+
 	@After
 	public void after() throws BackingStoreException {
 		getScopeRoot().removeNode();
 	}
-	
+
 	private static String getUniqueString() {
 		return System.currentTimeMillis() + "-" + Math.random();
 	}
@@ -135,7 +139,7 @@
 	private static IEclipsePreferences createTestNode() {
 		return (IEclipsePreferences) getScopeRoot().node(getUniqueString());
 	}
-	
+
 	private static IEclipsePreferences getScopeRoot() {
 		return (IEclipsePreferences) Platform.getPreferencesService().getRootNode().node("EclipsePreferencesTest");
 	}