mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 01:36:01 +02:00
Some clean up to make the core.tests plugin more 3.0 compliant.
Also added in a new ProjectCreator that creates projects from prebuilt zip files.
This commit is contained in:
parent
753aa6132f
commit
b34fcf2fc9
3 changed files with 8 additions and 12 deletions
|
@ -32,9 +32,9 @@ import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a utility class that properly creates a project for testing
|
* This is a utility class that properly creates a project for testing
|
||||||
* core features. Projects are created from a template stored in the
|
* core features. Projects are created from a template stored in a zip file
|
||||||
* resources/zips directory. These templates are created using the CDT
|
* These templates are created using the CDT and have the proper natures
|
||||||
* and have the proper natures and build settings set up.
|
* and build settings set up.
|
||||||
*
|
*
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,10 +14,10 @@ import junit.framework.Test;
|
||||||
import junit.framework.TestListener;
|
import junit.framework.TestListener;
|
||||||
import junit.framework.TestResult;
|
import junit.framework.TestResult;
|
||||||
|
|
||||||
import org.eclipse.core.boot.IPlatformRunnable;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.eclipse.core.runtime.IExtension;
|
import org.eclipse.core.runtime.IExtension;
|
||||||
|
import org.eclipse.core.runtime.IPlatformRunnable;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
import org.eclipse.ui.testing.ITestHarness;
|
import org.eclipse.ui.testing.ITestHarness;
|
||||||
|
@ -30,7 +30,7 @@ import org.w3c.dom.ProcessingInstruction;
|
||||||
/**
|
/**
|
||||||
* @see IPlatformRunnable
|
* @see IPlatformRunnable
|
||||||
*/
|
*/
|
||||||
public class RunTests implements IPlatformRunnable, ITestHarness, TestListener {
|
public class RunTests implements ITestHarness, TestListener {
|
||||||
|
|
||||||
private TestableObject testableObject;
|
private TestableObject testableObject;
|
||||||
private PrintStream stream;
|
private PrintStream stream;
|
||||||
|
|
|
@ -6,14 +6,12 @@ package org.eclipse.cdt.testplugin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.resources.IWorkspaceDescription;
|
import org.eclipse.core.resources.IWorkspaceDescription;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IPluginDescriptor;
|
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Plugin;
|
import org.eclipse.core.runtime.Plugin;
|
||||||
|
|
||||||
|
@ -23,8 +21,8 @@ public class CTestPlugin extends Plugin {
|
||||||
public static final String PLUGIN_ID = "org.eclipse.cdt.core.tests";
|
public static final String PLUGIN_ID = "org.eclipse.cdt.core.tests";
|
||||||
private static CTestPlugin fgDefault;
|
private static CTestPlugin fgDefault;
|
||||||
|
|
||||||
public CTestPlugin(IPluginDescriptor descriptor) {
|
public CTestPlugin() {
|
||||||
super(descriptor);
|
super();
|
||||||
fgDefault= this;
|
fgDefault= this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,9 +44,7 @@ public class CTestPlugin extends Plugin {
|
||||||
|
|
||||||
public File getFileInPlugin(IPath path) {
|
public File getFileInPlugin(IPath path) {
|
||||||
try {
|
try {
|
||||||
URL installURL= new URL(getDescriptor().getInstallURL(), path.toString());
|
return new File(Platform.asLocalURL(find(path)).getFile());
|
||||||
URL localURL= Platform.asLocalURL(installURL);
|
|
||||||
return new File(localURL.getFile());
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue