| /******************************************************************************* |
| * Copyright (c) 2021 Red Hat Inc. and others. |
| * |
| * This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Red Hat Inc. - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.pde.unittest.junit.internal.launcher; |
| |
| import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab; |
| import org.eclipse.pde.ui.launcher.AbstractPDELaunchConfigurationTabGroup; |
| import org.eclipse.pde.ui.launcher.ConfigurationTab; |
| import org.eclipse.pde.ui.launcher.PluginJUnitMainTab; |
| import org.eclipse.pde.ui.launcher.PluginsTab; |
| import org.eclipse.pde.ui.launcher.TracingTab; |
| import org.eclipse.pde.unittest.junit.launcher.JUnitPluginTestTab; |
| |
| import org.eclipse.core.runtime.CoreException; |
| |
| import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; |
| |
| import org.eclipse.debug.ui.CommonTab; |
| import org.eclipse.debug.ui.EnvironmentTab; |
| import org.eclipse.debug.ui.ILaunchConfigurationDialog; |
| import org.eclipse.debug.ui.ILaunchConfigurationTab; |
| |
| import org.eclipse.jdt.internal.junit.launcher.AssertionVMArg; |
| |
| import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; |
| |
| public class JUnitPluginTabGroup extends AbstractPDELaunchConfigurationTabGroup { |
| |
| @Override |
| public void createTabs(ILaunchConfigurationDialog dialog, String mode) { |
| ILaunchConfigurationTab[] tabs = null; |
| tabs = new ILaunchConfigurationTab[] { new JUnitPluginTestTab(), new PluginJUnitMainTab(), |
| new JavaArgumentsTab(), new PluginsTab(), new ConfigurationTab(true), new TracingTab(), |
| new EnvironmentTab(), new CommonTab() }; |
| setTabs(tabs); |
| } |
| |
| @Override |
| public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { |
| super.setDefaults(configuration); |
| |
| String vmArgs; |
| try { |
| vmArgs = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, ""); //$NON-NLS-1$ |
| } catch (CoreException e) { |
| vmArgs = ""; //$NON-NLS-1$ |
| } |
| vmArgs = AssertionVMArg.enableAssertInArgString(vmArgs); |
| if (vmArgs.length() > 0) |
| configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs); |
| } |
| } |