Bug 78318 - Backport performance tests
diff --git a/org.eclipse.jdt.debug.tests/plugin.xml b/org.eclipse.jdt.debug.tests/plugin.xml
index ffefc9a..baffc05 100644
--- a/org.eclipse.jdt.debug.tests/plugin.xml
+++ b/org.eclipse.jdt.debug.tests/plugin.xml
@@ -32,6 +32,7 @@
       <import plugin="org.eclipse.update.core"/>
       <import plugin="org.eclipse.core.runtime"/>
       <import plugin="org.eclipse.ui.console"/>
+      <import plugin="org.eclipse.test.performance"/>
    </requires>
 
 
@@ -151,5 +152,14 @@
             id="org.eclipse.jdt.debug.tests.testConfigType">
       </launchConfigurationType>
    </extension>
+   <extension
+         point="org.eclipse.debug.core.statusHandlers">
+      <statusHandler
+            code="1000"
+            plugin="org.eclipse.jdt.debug.tests"
+            class="org.eclipse.jdt.debug.tests.ui.performance.JavaApplicationStatusHandler"
+            id="org.eclipse.jdt.debug.tests.performance.statusHandler.JavaApplication">
+      </statusHandler>
+   </extension>
 
 </plugin>
diff --git a/org.eclipse.jdt.debug.tests/test.xml b/org.eclipse.jdt.debug.tests/test.xml
index 24ecf1b..a8eff76 100644
--- a/org.eclipse.jdt.debug.tests/test.xml
+++ b/org.eclipse.jdt.debug.tests/test.xml
@@ -20,7 +20,7 @@
     </delete>
   </target>
 
-  <!-- This target defines the tests that need to be run. -->
+  <!-- This target defines the regression tests that need to be run. -->
   <target name="suite">
     <property name="jdt-folder" 
               value="${eclipse-home}/jdt_folder"/>
@@ -32,6 +32,19 @@
                 value="org.eclipse.jdt.debug.tests.AutomatedSuite"/>
     </ant>
   </target>
+  
+  <!-- This target defines the performance tests that need to be run. -->
+  <target name="perfsuite">
+    <property name="jdt-folder" 
+              value="${eclipse-home}/jdt_folder"/>
+    <delete dir="${jdt-folder}" quiet="true"/>
+    <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
+      <property name="data-dir" value="${jdt-folder}"/>
+      <property name="plugin-name" value="${plugin-name}"/>
+      <property name="classname" 
+                value="org.eclipse.jdt.debug.tests.PerformanceSuite"/>
+    </ant>
+  </target>  
 
   <!-- This target holds code to cleanup the testing environment after -->
   <!-- after all of the tests have been run. You can use this target to -->
@@ -47,5 +60,12 @@
       <property name="output-file" value="${plugin-name}.xml"/>
     </ant>
   </target>
+  
+  <target name="performance" depends="init,perfsuite,cleanup">
+    <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
+      <property name="includes" value="org*.xml"/>
+      <property name="output-file" value="${plugin-name}.xml"/>
+    </ant>
+  </target>  
 
 </project>
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
index a1aed97..9a3544c 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
@@ -10,9 +10,7 @@
  *******************************************************************************/
 package org.eclipse.jdt.debug.tests;
 
-import java.util.Enumeration;
 import junit.framework.Test;
-import junit.framework.TestResult;
 import junit.framework.TestSuite;
 import org.eclipse.jdt.debug.tests.core.ArchiveSourceLookupTests;
 import org.eclipse.jdt.debug.tests.core.ArrayTests;
@@ -69,19 +67,13 @@
 import org.eclipse.jdt.debug.tests.core.WatchExpressionTests;
 import org.eclipse.jdt.debug.tests.core.WatchpointTests;
 import org.eclipse.jdt.debug.tests.core.WorkspaceSourceContainerTests;
-import org.eclipse.swt.widgets.Display;
 
 /**
  * Tests for integration and nightly builds.
  */
-public class AutomatedSuite extends TestSuite {
+public class AutomatedSuite extends DebugSuite {
 	
 	/**
-	 * Flag that indicates test are in progress
-	 */
-	protected boolean fTesting = true;
-
-	/**
 	 * Returns the suite.  This is required to
 	 * use the JUnit Launcher.
 	 */
@@ -159,43 +151,5 @@
 		
 		
 	}
-	
-	/**
-	 * Runs the tests and collects their result in a TestResult.
-	 * The debug tests cannot be run in the UI thread or the event
-	 * waiter blocks the UI when a resource changes.
-	 */
-	public void run(final TestResult result) {
-		final Display display = Display.getCurrent();
-		Thread thread = null;
-		try {
-			Runnable r = new Runnable() {
-				public void run() {
-					for (Enumeration e= tests(); e.hasMoreElements(); ) {
-				  		if (result.shouldStop() )
-				  			break;
-						Test test= (Test)e.nextElement();
-						runTest(test, result);
-					}					
-					fTesting = false;
-					display.wake();
-				}
-			};
-			thread = new Thread(r);
-			thread.start();
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-				
-		while (fTesting) {
-			try {
-				if (!display.readAndDispatch())
-					display.sleep();
-			} catch (Throwable e) {
-				e.printStackTrace();
-			}			
-		}		
-	}
-
 }
 
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ProjectCreationDecorator.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ProjectCreationDecorator.java
index bd5b902..8a37a07 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ProjectCreationDecorator.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ProjectCreationDecorator.java
@@ -121,6 +121,7 @@
 		createLaunchConfiguration("org.eclipse.debug.tests.targets.StepIntoSelectionClass");
 		createLaunchConfiguration("WatchItemTests");
 		createLaunchConfiguration("ArrayTests");
+		createLaunchConfiguration("PerfLoop");
 	}
 	
 	/**