diff options
Diffstat (limited to 'testplugins/org.eclipse.objectteams.otdt.test.builder')
4 files changed, 56 insertions, 5 deletions
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/META-INF/MANIFEST.MF index 656a1fe31..5c4ae8a18 100644 --- a/testplugins/org.eclipse.objectteams.otdt.test.builder/META-INF/MANIFEST.MF +++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/META-INF/MANIFEST.MF @@ -17,6 +17,7 @@ Require-Bundle: org.junit, org.eclipse.jdt.core, org.eclipse.test.performance, org.eclipse.objectteams.otdt.tests, - org.eclipse.objectteams.otequinox + org.eclipse.objectteams.otequinox, + org.eclipse.pde.core Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/plugin.xml index 2e2fd3d57..35ef77456 100644 --- a/testplugins/org.eclipse.objectteams.otdt.test.builder/plugin.xml +++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/plugin.xml @@ -15,6 +15,18 @@ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif"> </team> </aspectBinding> + <aspectBinding + icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif"> + <basePlugin + icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif" + id="org.eclipse.pde.core"> + </basePlugin> + <team + activation="NONE" + class="org.eclipse.objectteams.otdt.test.builder.OTTestingEnvironment" + icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif"> + </team> + </aspectBinding> </extension> </plugin> diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTEquinoxBuilderTests.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTEquinoxBuilderTests.java index 9ea7ed7df..fdd653b52 100644 --- a/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTEquinoxBuilderTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTEquinoxBuilderTests.java @@ -319,8 +319,6 @@ public class OTEquinoxBuilderTests extends OTBuilderTests { expectingNoProblemsFor(project.getPath()); } - // NOTE: run this as the last test here, because I haven't figured out how to - // clean up after the simulated workbench restart. public void testBaseImportTrac132_2 () throws CoreException, IOException { IJavaProject trac132b= fileManager.setUpJavaProject("Trac132b"); env.addProject(trac132b.getProject()); @@ -348,6 +346,8 @@ public class OTEquinoxBuilderTests extends OTBuilderTests { env.getWorkspace().save(true, null); JavaModelManager.getJavaModelManager().shutdown(); JavaModelManager.doNotUse(); // reset the MANAGER singleton + // this one is extra: also restart PDE's PluginModelManager: + OTTestingEnvironment.restart(); JavaModelManager.getJavaModelManager().startup(); new JavaCorePreferenceInitializer().initializeDefaultPreferences(); diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTTestingEnvironment.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTTestingEnvironment.java index 297edfd2e..6f31dc338 100644 --- a/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTTestingEnvironment.java +++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTTestingEnvironment.java @@ -24,11 +24,39 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.runtime.CoreException; import org.eclipse.jdt.core.JavaCore; +import base org.eclipse.pde.internal.core.PluginModelManager; import base org.eclipse.jdt.core.tests.builder.TestingEnvironment; -/** Purpose: add OTJ_NATURE to test projects (method not normally overridable). */ +@SuppressWarnings("restriction") public team class OTTestingEnvironment { - + static OTTestingEnvironment instance; + public OTTestingEnvironment() { + instance = this; + } + + /** Better shutdown to allow reinitialization */ + protected class ModelManager playedBy PluginModelManager { + + ModelManager getInstance() -> PluginModelManager getInstance(); + + @SuppressWarnings("decapsulation") + void setFModelManager(ModelManager fModelManager) -> set PluginModelManager fModelManager; + + @SuppressWarnings("decapsulation") + void shutdown() -> void shutdown(); + + protected void internalRestart() { + shutdown(); + setFModelManager(null); + getInstance(); + } + + protected static void restart() { + getInstance().internalRestart(); + } + } + + /** Purpose: add OTJ_NATURE to test projects (method not normally overridable). */ protected class TestingEnvironment playedBy TestingEnvironment { @SuppressWarnings("decapsulation") @@ -52,4 +80,14 @@ public team class OTTestingEnvironment { addBuilderSpecs <- replace addBuilderSpecs; } + + /** Restart PDE's PluginModelManager. */ + public static void restart() { + instance.internalRestart(); + } + + // need a team instance to invoke a role method: + private void internalRestart() { + ModelManager.restart(); + } } |