blob: 2da58826630134e8e28a61f373533dc5e3f51dcf [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2004, 2007 Mylyn project committers 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
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.eclipse.mylyn.internal.java.ui.junit;
import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ui.PlatformUI;
/**
* @author Mik Kersten
*/
public class TaskContextJUnitLaunchConfiguration extends JUnitLaunchConfigurationDelegate {
@Override
protected IMember[] evaluateTests(ILaunchConfiguration configuration, IProgressMonitor monitor)
throws CoreException {
Set<IType> contextTestCases = InteractionContextTestUtil.getTestCasesInContext();
InteractionContextTestUtil.setupTestConfiguration(contextTestCases, configuration, monitor);
if (contextTestCases.isEmpty()) {
MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
"Context Test Suite", "No test types found in the active task context.");
}
return contextTestCases.toArray(new IMember[contextTestCases.size()]);
}
}