Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,19 @@
import java.util.function.Supplier;

import org.eclipse.core.internal.jobs.JobManager;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager;
import org.eclipse.debug.tests.launching.LaunchConfigurationTests;
import org.eclipse.swt.widgets.Display;
import org.junit.Assert;
import org.osgi.framework.Bundle;
Expand Down Expand Up @@ -332,4 +341,42 @@ private static boolean belongsToFamilies(Job job, Object... excludedFamilies) {
return false;
}

/**
* Returns the launch manager.
*
* @return launch manager
*/
public static ILaunchManager getLaunchManager() {
return DebugPlugin.getDefault().getLaunchManager();
}

/**
* Returns the singleton instance of the <code>LaunchConfigurationManager</code>
*
* @return the singleton instance of the <code>LaunchConfigurationManager</code>
*/
public static LaunchConfigurationManager getLaunchConfigurationManager() {
return DebugUIPlugin.getDefault().getLaunchConfigurationManager();
}

/**
* Returns a launch configuration with the given name, creating one if required.
*
* @param configurationName configuration name
* @return launch configuration
*/
public static ILaunchConfiguration getLaunchConfiguration(String configurationName) throws CoreException {
ILaunchManager manager = getLaunchManager();
ILaunchConfiguration[] configurations = manager.getLaunchConfigurations();
for (ILaunchConfiguration config : configurations) {
if (config.getName().equals(configurationName)) {
return config;
}
}
ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(LaunchConfigurationTests.ID_TEST_LAUNCH_TYPE);
ILaunchConfigurationWorkingCopy wc = type.newInstance(null, configurationName);
ILaunchConfiguration saved = wc.doSave();
return saved;
}

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package org.eclipse.debug.tests.launching;

import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.debug.tests.TestUtil.getLaunchManager;
import static org.eclipse.debug.tests.TestUtil.waitWhile;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand Down Expand Up @@ -92,7 +93,7 @@
* Tests for launch configurations
*/
@SuppressWarnings("deprecation")
public class LaunchConfigurationTests extends AbstractLaunchTest implements ILaunchConfigurationListener {
public class LaunchConfigurationTests implements ILaunchConfigurationListener {

/**
* Identifier of test launch configuration type extension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package org.eclipse.debug.tests.launching;

import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.debug.tests.TestUtil.getLaunchConfigurationManager;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
Expand All @@ -25,6 +26,7 @@
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchHistory;
import org.eclipse.debug.tests.TestUtil;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
Expand All @@ -37,7 +39,7 @@
*
* @since 3.6
*/
public class LaunchFavoriteTests extends AbstractLaunchTest {
public class LaunchFavoriteTests {

/**
* Configuration to use for the test. One is created for each test during
Expand All @@ -64,7 +66,7 @@ public void setUp(TestInfo testInfo) throws Exception {
// clear the favorites
getRunLaunchHistory().setFavorites(new ILaunchConfiguration[0]);
getDebugLaunchHistory().setFavorites(new ILaunchConfiguration[0]);
fConfig = getLaunchConfiguration(testInfo.getDisplayName());
fConfig = TestUtil.getLaunchConfiguration(testInfo.getDisplayName());
}

@AfterEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
package org.eclipse.debug.tests.launching;

import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.debug.tests.TestUtil.getLaunchConfiguration;
import static org.eclipse.debug.tests.TestUtil.getLaunchConfigurationManager;
import static org.eclipse.debug.tests.TestUtil.getLaunchManager;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

Expand Down Expand Up @@ -57,7 +60,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;

public class LaunchGroupTests extends AbstractLaunchTest {
public class LaunchGroupTests {

private static final String GROUP_TYPE = "org.eclipse.debug.core.groups.GroupLaunchConfigurationType"; //$NON-NLS-1$
private static final String DEF_GRP_NAME = "Test Group"; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
package org.eclipse.debug.tests.launching;

import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.debug.tests.TestUtil.getLaunchConfiguration;
import static org.eclipse.debug.tests.TestUtil.getLaunchConfigurationManager;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
Expand All @@ -40,7 +42,7 @@
*
* @since 3.3
*/
public class LaunchHistoryTests extends AbstractLaunchTest {
public class LaunchHistoryTests {

private final PreferenceMemento prefMemento = new PreferenceMemento();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.tests.launching;

import static org.eclipse.debug.tests.TestUtil.getLaunchConfiguration;
import static org.eclipse.debug.tests.TestUtil.getLaunchManager;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
Expand Down Expand Up @@ -50,7 +52,7 @@
* @since 3.6
*/
@SuppressWarnings("deprecation")
public class LaunchManagerTests extends AbstractLaunchTest {
public class LaunchManagerTests {


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
*
* @since 3.10
*/
public class LaunchTests extends AbstractLaunchTest {
public class LaunchTests {

/**
* Windows MAX_PATH limit for file paths. See
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
/**
* Tests the refresh tab.
*/
public class RefreshTabTests extends AbstractLaunchTest {
public class RefreshTabTests {

/**
* Sets the selected resource in the navigator view.
Expand Down
Loading