<commit_before>package fr.inria.diverse.trace.commons.testutil

import org.eclipse.core.runtime.jobs.Job
import org.eclipse.swt.widgets.Display
import org.eclipse.ui.PlatformUI
import org.eclipse.ui.IWindowListener
import org.eclipse.ui.IWorkbenchWindow

class EclipseTestUtil {

	public static def void waitForJobsThenWindowClosed() {
		while (!Job.getJobManager().isIdle())
			delay(1000000);
	}

	static var closed = false;

	private static def void delay(long waitTimeMillis) {
		val Display display = Display.getCurrent();

		// We try to capture when the window is closed by the tester
		PlatformUI.getWorkbench.addWindowListener(
			new IWindowListener() {

				override windowActivated(IWorkbenchWindow window) {
				}

				override windowClosed(IWorkbenchWindow window) {
					closed = true
				}

				override windowDeactivated(IWorkbenchWindow window) {
				}

				override windowOpened(IWorkbenchWindow window) {<commit_msg>Adding a test operation to wait for eclipse to only finish its job.<commit_after>package fr.inria.diverse.trace.commons.testutil

import org.eclipse.core.runtime.jobs.Job
import org.eclipse.swt.widgets.Display
import org.eclipse.ui.PlatformUI
import org.eclipse.ui.IWindowListener
import org.eclipse.ui.IWorkbenchWindow

class EclipseTestUtil {

	public static def void waitForJobs() {
		while (!Job.getJobManager().isIdle())
			delay(100);
	}


	public static def void waitForJobsThenWindowClosed() {
		while (!Job.getJobManager().isIdle())
			delay(1000000);
	}

	static var closed = false;

	private static def void delay(long waitTimeMillis) {
		val Display display = Display.getCurrent();

		// We try to capture when the window is closed by the tester
		PlatformUI.getWorkbench.addWindowListener(
			new IWindowListener() {

				override windowActivated(IWorkbenchWindow window) {
				}

				override windowClosed(IWorkbenchWindow window) {
					closed = true
				}

				override windowDeactivated(IWorkbenchWindow window) {
				}

				override windowOpened(IWorkbenchWindow window) {
{'fraction_non_alphanumeric': 0.08440276406712735, 'fraction_numerical': 0.00839091806515301, 'mean_word_length': 4.376657824933687, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3756884', 'n_tokens_mistral': 693, 'n_tokens_neox': 581, 'n_words': 150}