Revert "Bug 394739 - Remove org.eclipse.core.runtime.compatibility* bundles"

This reverts commit 6e7b01a93ef5f18648709aa2dafc4d47948fc7a9.

Change-Id: Ie7e6874adce2de879661128aa509bdb77c4d3c49
diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.resources.saveparticipant/META-INF/MANIFEST.MF
index 846195e..dfa7937 100644
--- a/tests/org.eclipse.core.tests.resources.saveparticipant/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.core.tests.resources.saveparticipant/META-INF/MANIFEST.MF
@@ -15,5 +15,5 @@
  org.eclipse.core.tests.resources.saveparticipant2,
  org.eclipse.core.tests.resources.saveparticipant3,
  org.eclipse.core.filesystem
+Eclipse-LazyStart: true
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager1Test.java b/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager1Test.java
index 98e8e55..e070a1f 100644
--- a/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager1Test.java
+++ b/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager1Test.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2006 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
@@ -12,7 +12,6 @@
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
-
 import org.eclipse.core.resources.*;
 import org.eclipse.core.runtime.*;
 import org.eclipse.core.tests.internal.builders.DeltaVerifierBuilder;
@@ -20,8 +19,6 @@
 import org.eclipse.core.tests.resources.saveparticipant1.SaveParticipant1Plugin;
 import org.eclipse.core.tests.resources.saveparticipant2.SaveParticipant2Plugin;
 import org.eclipse.core.tests.resources.saveparticipant3.SaveParticipant3Plugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
 
 /**
  * This class needs to be used with SaveManager2Test. Basically this
@@ -67,26 +64,26 @@
 	public static Test suite() {
 		// we do not add the whole class because the order is important
 		TestSuite suite = new TestSuite();
-		suite.addTest(new SaveManager1Test("saveWorkspace"));
+		suite.addTest(new SaveManager1Test("testSaveEmptyWorkspace"));
 		suite.addTest(new SaveManager1Test("testCreateMyProject"));
 		suite.addTest(new SaveManager1Test("testCreateProject2"));
 		suite.addTest(new SaveManager1Test("testAddSaveParticipant"));
 		suite.addTest(new SaveManager1Test("testBuilder"));
-		suite.addTest(new SaveManager1Test("saveWorkspace"));
+		suite.addTest(new SaveManager1Test("testSaveWorkspace"));
 		suite.addTest(new SaveManager1Test("testPostSave"));
 		return suite;
 	}
 
 	public void testAddSaveParticipant() {
 		// get plugin
-		Bundle bundle = Platform.getBundle(PI_SAVE_PARTICIPANT_1);
-		assertTrue("0.1", bundle != null);
+		IPluginDescriptor descriptor = Platform.getPluginRegistry().getPluginDescriptor(PI_SAVE_PARTICIPANT_1);
+		SaveParticipant1Plugin plugin1 = null;
 		try {
-			bundle.start();
-		} catch (BundleException e) {
+			plugin1 = (SaveParticipant1Plugin) descriptor.getPlugin();
+		} catch (CoreException e) {
 			fail("0.0", e);
 		}
-		SaveParticipant1Plugin plugin1 = SaveParticipant1Plugin.getInstance();
+		assertTrue("0.1", plugin1 != null);
 
 		//	prepare plugin to the save operation
 		plugin1.resetDeltaVerifier();
@@ -103,14 +100,14 @@
 		plugin1.setExpectedSaveKind(ISaveContext.FULL_SAVE);
 
 		// SaveParticipant2Plugin
-		bundle = Platform.getBundle(PI_SAVE_PARTICIPANT_2);
-		assertTrue("5.1", bundle != null);
+		descriptor = Platform.getPluginRegistry().getPluginDescriptor(PI_SAVE_PARTICIPANT_2);
+		SaveParticipant2Plugin plugin2 = null;
 		try {
-			bundle.start();
-		} catch (BundleException e) {
+			plugin2 = (SaveParticipant2Plugin) descriptor.getPlugin();
+		} catch (CoreException e) {
 			fail("5.0", e);
 		}
-		SaveParticipant2Plugin plugin2 = SaveParticipant2Plugin.getInstance();
+		assertTrue("5.1", plugin2 != null);
 
 		//	prepare plugin to the save operation
 		plugin2.getDeltaVerifier().reset();
@@ -126,15 +123,14 @@
 		plugin1.setExpectedSaveKind(ISaveContext.FULL_SAVE);
 
 		// SaveParticipant3Plugin
-		bundle = Platform.getBundle(PI_SAVE_PARTICIPANT_3);
-		assertTrue("7.1", bundle != null);
+		descriptor = Platform.getPluginRegistry().getPluginDescriptor(PI_SAVE_PARTICIPANT_3);
+		SaveParticipant3Plugin plugin3 = null;
 		try {
-			bundle.start();
-		} catch (BundleException e) {
+			plugin3 = (SaveParticipant3Plugin) descriptor.getPlugin();
+		} catch (CoreException e) {
 			fail("7.0", e);
 		}
-		SaveParticipant3Plugin plugin3 = SaveParticipant3Plugin.getInstance();
-
+		assertTrue("7.1", plugin3 != null);
 		try {
 			status = plugin3.registerAsSaveParticipant();
 			if (!status.isOK()) {
@@ -341,14 +337,14 @@
 
 	public void testPostSave() {
 		// get plugin
-		Bundle bundle = Platform.getBundle(PI_SAVE_PARTICIPANT_1);
-		assertTrue("0.1", bundle != null);
+		IPluginDescriptor descriptor = Platform.getPluginRegistry().getPluginDescriptor(PI_SAVE_PARTICIPANT_1);
+		SaveParticipant1Plugin plugin = null;
 		try {
-			bundle.start();
-		} catch (BundleException e) {
+			plugin = (SaveParticipant1Plugin) descriptor.getPlugin();
+		} catch (CoreException e) {
 			fail("0.0", e);
 		}
-		SaveParticipant1Plugin plugin = SaveParticipant1Plugin.getInstance();
+		assertTrue("0.1", plugin != null);
 
 		// look at the plugin save lifecycle
 		IStatus status = plugin.getSaveLifecycleLog();
diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager2Test.java b/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager2Test.java
index 49db181..57b636a 100644
--- a/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager2Test.java
+++ b/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager2Test.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2006 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
@@ -12,15 +12,12 @@
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
-
 import org.eclipse.core.resources.*;
 import org.eclipse.core.runtime.*;
 import org.eclipse.core.tests.internal.builders.DeltaVerifierBuilder;
 import org.eclipse.core.tests.resources.regression.SimpleBuilder;
 import org.eclipse.core.tests.resources.saveparticipant1.SaveParticipant1Plugin;
 import org.eclipse.core.tests.resources.saveparticipant3.SaveParticipant3Plugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
 
 /**
  * @see SaveManager1Test
@@ -77,14 +74,14 @@
 
 	public void testSaveParticipant() {
 		// get plugin
-		Bundle bundle = Platform.getBundle(PI_SAVE_PARTICIPANT_1);
-		assertTrue("0.1", bundle != null);
+		IPluginDescriptor descriptor = Platform.getPluginRegistry().getPluginDescriptor(PI_SAVE_PARTICIPANT_1);
+		SaveParticipant1Plugin plugin1 = null;
 		try {
-			bundle.start();
-		} catch (BundleException e) {
+			plugin1 = (SaveParticipant1Plugin) descriptor.getPlugin();
+		} catch (CoreException e) {
 			fail("0.0", e);
 		}
-		SaveParticipant1Plugin plugin1 = SaveParticipant1Plugin.getInstance();
+		assertTrue("0.1", plugin1 != null);
 
 		// prepare plugin to the save operation
 		plugin1.resetDeltaVerifier();
@@ -102,15 +99,14 @@
 		}
 
 		// SaveParticipant3Plugin
-		bundle = Platform.getBundle(PI_SAVE_PARTICIPANT_3);
-		assertTrue("7.1", bundle != null);
+		descriptor = Platform.getPluginRegistry().getPluginDescriptor(PI_SAVE_PARTICIPANT_3);
+		SaveParticipant3Plugin plugin3 = null;
 		try {
-			bundle.start();
-		} catch (BundleException e) {
+			plugin3 = (SaveParticipant3Plugin) descriptor.getPlugin();
+		} catch (CoreException e) {
 			fail("7.0", e);
 		}
-		SaveParticipant3Plugin plugin3 = SaveParticipant3Plugin.getInstance();
-
+		assertTrue("7.1", plugin3 != null);
 		try {
 			status = plugin3.registerAsSaveParticipant();
 			if (!status.isOK()) {
diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager3Test.java b/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager3Test.java
index 02bb421..601cbbd 100644
--- a/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager3Test.java
+++ b/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager3Test.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2006 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
@@ -12,15 +12,12 @@
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
-
 import org.eclipse.core.resources.*;
 import org.eclipse.core.runtime.*;
 import org.eclipse.core.tests.internal.builders.DeltaVerifierBuilder;
 import org.eclipse.core.tests.resources.saveparticipant1.SaveParticipant1Plugin;
 import org.eclipse.core.tests.resources.saveparticipant2.SaveParticipant2Plugin;
 import org.eclipse.core.tests.resources.saveparticipant3.SaveParticipant3Plugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
 
 /**
  * @see SaveManager1Test
@@ -84,14 +81,14 @@
 
 	public void testSaveParticipant() {
 		// SaveParticipant1Plugin
-		Bundle bundle = Platform.getBundle(PI_SAVE_PARTICIPANT_1);
-		assertTrue("0.1", bundle != null);
+		IPluginDescriptor descriptor = Platform.getPluginRegistry().getPluginDescriptor(PI_SAVE_PARTICIPANT_1);
+		SaveParticipant1Plugin plugin1 = null;
 		try {
-			bundle.start();
-		} catch (BundleException e) {
+			plugin1 = (SaveParticipant1Plugin) descriptor.getPlugin();
+		} catch (CoreException e) {
 			fail("0.0", e);
 		}
-		SaveParticipant1Plugin plugin1 = SaveParticipant1Plugin.getInstance();
+		assertTrue("0.1", plugin1 != null);
 
 		// check saved state and delta
 		plugin1.resetDeltaVerifier();
@@ -107,14 +104,14 @@
 		}
 
 		// SaveParticipant2Plugin
-		bundle = Platform.getBundle(PI_SAVE_PARTICIPANT_2);
-		assertTrue("5.1", bundle != null);
+		descriptor = Platform.getPluginRegistry().getPluginDescriptor(PI_SAVE_PARTICIPANT_2);
+		SaveParticipant2Plugin plugin2 = null;
 		try {
-			bundle.start();
-		} catch (BundleException e) {
+			plugin2 = (SaveParticipant2Plugin) descriptor.getPlugin();
+		} catch (CoreException e) {
 			fail("5.0", e);
 		}
-		SaveParticipant2Plugin plugin2 = SaveParticipant2Plugin.getInstance();
+		assertTrue("5.1", plugin2 != null);
 
 		// check saved state and delta
 		plugin2.resetDeltaVerifier();
@@ -144,15 +141,14 @@
 		}
 
 		// SaveParticipant3Plugin
-		bundle = Platform.getBundle(PI_SAVE_PARTICIPANT_3);
-		assertTrue("7.1", bundle != null);
+		descriptor = Platform.getPluginRegistry().getPluginDescriptor(PI_SAVE_PARTICIPANT_3);
+		SaveParticipant3Plugin plugin3 = null;
 		try {
-			bundle.start();
-		} catch (BundleException e) {
+			plugin3 = (SaveParticipant3Plugin) descriptor.getPlugin();
+		} catch (CoreException e) {
 			fail("7.0", e);
 		}
-		SaveParticipant3Plugin plugin3 = SaveParticipant3Plugin.getInstance();
-
+		assertTrue("7.1", plugin3 != null);
 		try {
 			status = plugin3.registerAsSaveParticipant();
 			if (!status.isOK()) {
diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant1/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.resources.saveparticipant1/META-INF/MANIFEST.MF
index 7482ca9..85c3c8e 100644
--- a/tests/org.eclipse.core.tests.resources.saveparticipant1/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.core.tests.resources.saveparticipant1/META-INF/MANIFEST.MF
@@ -11,5 +11,6 @@
  org.eclipse.core.tests.resources,
  org.junit,
  org.eclipse.core.runtime
+Eclipse-LazyStart: true
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
+
diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant1/src/org/eclipse/core/tests/resources/saveparticipant1/SaveParticipant1Plugin.java b/tests/org.eclipse.core.tests.resources.saveparticipant1/src/org/eclipse/core/tests/resources/saveparticipant1/SaveParticipant1Plugin.java
index 9ebf77a..41317b1 100644
--- a/tests/org.eclipse.core.tests.resources.saveparticipant1/src/org/eclipse/core/tests/resources/saveparticipant1/SaveParticipant1Plugin.java
+++ b/tests/org.eclipse.core.tests.resources.saveparticipant1/src/org/eclipse/core/tests/resources/saveparticipant1/SaveParticipant1Plugin.java
@@ -32,11 +32,7 @@
 	/** constants */
 	private static final String SAVE_NUMBER_LOCATION = "saveNumber";
 
-	private static SaveParticipant1Plugin instance;
-
 	public SaveParticipant1Plugin() {
-		super();
-		instance = this;
 		deltaVerifier = new ResourceDeltaVerifier();
 	}
 
@@ -71,7 +67,7 @@
 	}
 
 	public String getPluginId() {
-		return getBundle().getSymbolicName();
+		return getDescriptor().getUniqueIdentifier();
 	}
 
 	/**
@@ -197,8 +193,4 @@
 			output.close();
 		}
 	}
-
-	public static SaveParticipant1Plugin getInstance() {
-		return instance;
-	}
 }
diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant2/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.resources.saveparticipant2/META-INF/MANIFEST.MF
index 3b352b6..91bacf7 100644
--- a/tests/org.eclipse.core.tests.resources.saveparticipant2/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.core.tests.resources.saveparticipant2/META-INF/MANIFEST.MF
@@ -10,6 +10,6 @@
  org.eclipse.core.tests.resources,
  org.junit,
  org.eclipse.core.runtime
+Eclipse-LazyStart: true
 Bundle-Activator: org.eclipse.core.tests.resources.saveparticipant2.SaveParticipant2Plugin
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant2/src/org/eclipse/core/tests/resources/saveparticipant2/SaveParticipant2Plugin.java b/tests/org.eclipse.core.tests.resources.saveparticipant2/src/org/eclipse/core/tests/resources/saveparticipant2/SaveParticipant2Plugin.java
index 978a493..7560a83 100644
--- a/tests/org.eclipse.core.tests.resources.saveparticipant2/src/org/eclipse/core/tests/resources/saveparticipant2/SaveParticipant2Plugin.java
+++ b/tests/org.eclipse.core.tests.resources.saveparticipant2/src/org/eclipse/core/tests/resources/saveparticipant2/SaveParticipant2Plugin.java
@@ -32,11 +32,7 @@
 	/** constants */
 	private static final String SAVE_NUMBER_LOCATION = "saveNumber";
 
-	private static SaveParticipant2Plugin instance;
-
 	public SaveParticipant2Plugin() {
-		super();
-		instance = this;
 		deltaVerifier = new ResourceDeltaVerifier();
 	}
 
@@ -82,7 +78,7 @@
 	}
 
 	public String getPluginId() {
-		return getBundle().getSymbolicName();
+		return "org.eclipse.core.tests.resources.saveparticipant2"; //$NON-NLS-1$
 	}
 
 	/**
@@ -208,8 +204,4 @@
 			output.close();
 		}
 	}
-
-	public static SaveParticipant2Plugin getInstance() {
-		return instance;
-	}
 }
diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant3/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.resources.saveparticipant3/META-INF/MANIFEST.MF
index 5ec62ba..504f28b 100644
--- a/tests/org.eclipse.core.tests.resources.saveparticipant3/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.core.tests.resources.saveparticipant3/META-INF/MANIFEST.MF
@@ -10,6 +10,6 @@
  org.eclipse.core.tests.resources,
  org.junit,
  org.eclipse.core.runtime
+Eclipse-LazyStart: true
 Bundle-Activator: org.eclipse.core.tests.resources.saveparticipant3.SaveParticipant3Plugin
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant3/src/org/eclipse/core/tests/resources/saveparticipant3/SaveParticipant3Plugin.java b/tests/org.eclipse.core.tests.resources.saveparticipant3/src/org/eclipse/core/tests/resources/saveparticipant3/SaveParticipant3Plugin.java
index 6b443ba..a0bae24 100644
--- a/tests/org.eclipse.core.tests.resources.saveparticipant3/src/org/eclipse/core/tests/resources/saveparticipant3/SaveParticipant3Plugin.java
+++ b/tests/org.eclipse.core.tests.resources.saveparticipant3/src/org/eclipse/core/tests/resources/saveparticipant3/SaveParticipant3Plugin.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2006 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
@@ -20,11 +20,8 @@
 	protected boolean shouldFail = false;
 	protected static final String file1 = "file_1";
 
-	private static SaveParticipant3Plugin instance;
-
 	public SaveParticipant3Plugin() {
 		super();
-		instance = this;
 	}
 
 	protected IPath getFilePath(String name) {
@@ -53,7 +50,7 @@
 
 	public void saving(ISaveContext context) throws CoreException {
 		if (shouldFail)
-			throw new CoreException(new Status(0, getPluginId(), 0, "fake failure", null));
+			throw new CoreException(new Status(0, getDescriptor().getUniqueIdentifier(), 0, "fake failure", null));
 	}
 
 	protected void validate(ISaveContext context) {
@@ -63,10 +60,6 @@
 		if (value != null && value.equals(realPath))
 			return;
 		String message = "Name of configuration file is different than expected.";
-		saveLifecycleLog.add(new Status(IStatus.ERROR, getPluginId(), 111, message, null));
-	}
-
-	public static SaveParticipant3Plugin getInstance() {
-		return instance;
+		saveLifecycleLog.add(new Status(IStatus.ERROR, getDescriptor().getUniqueIdentifier(), 111, message, null));
 	}
 }
diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant3/src/org/eclipse/core/tests/resources/saveparticipant3/SaveParticipantPlugin.java b/tests/org.eclipse.core.tests.resources.saveparticipant3/src/org/eclipse/core/tests/resources/saveparticipant3/SaveParticipantPlugin.java
index 20b1a9e..09967ac 100644
--- a/tests/org.eclipse.core.tests.resources.saveparticipant3/src/org/eclipse/core/tests/resources/saveparticipant3/SaveParticipantPlugin.java
+++ b/tests/org.eclipse.core.tests.resources.saveparticipant3/src/org/eclipse/core/tests/resources/saveparticipant3/SaveParticipantPlugin.java
@@ -66,7 +66,7 @@
 	}
 
 	public String getPluginId() {
-		return getBundle().getSymbolicName();
+		return getDescriptor().getUniqueIdentifier();
 	}
 
 	/**