1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-31 20:23:26 +02:00

Bug 334951: Convert the dsf-gdb test plug-in into a fragment

This commit is contained in:
John Cortell 2011-01-20 21:54:57 +00:00
parent c31bfa24ec
commit f7266e6cbb
6 changed files with 28 additions and 67 deletions

View file

@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: GDB/MI reference application tests Bundle-Name: GDB/MI reference application tests
Bundle-SymbolicName: org.eclipse.cdt.tests.dsf.gdb;singleton:=true Bundle-SymbolicName: org.eclipse.cdt.tests.dsf.gdb;singleton:=true
Bundle-Version: 2.1.0.qualifier Bundle-Version: 2.1.0.qualifier
Bundle-Activator: org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin
Bundle-Vendor: Ericsson Bundle-Vendor: Ericsson
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,
org.eclipse.cdt.dsf, org.eclipse.cdt.dsf,
@ -12,9 +11,10 @@ Require-Bundle: org.eclipse.core.runtime,
org.junit4, org.junit4,
org.eclipse.debug.core, org.eclipse.debug.core,
org.eclipse.swt, org.eclipse.swt,
org.eclipse.cdt.dsf.gdb,
org.eclipse.cdt.launch;bundle-version="6.1.0", org.eclipse.cdt.launch;bundle-version="6.1.0",
org.eclipse.cdt.gdb;bundle-version="7.0.0" org.eclipse.cdt.gdb;bundle-version="7.0.0"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: . Bundle-ClassPath: .
Fragment-Host: org.eclipse.cdt.dsf.gdb

View file

@ -10,7 +10,7 @@
# IBM Corporation # IBM Corporation
############################################################################### ###############################################################################
output.tests.jar = bin/ output.tests.jar = bin/
bin.includes = plugin.xml,\ bin.includes = fragment.xml,\
META-INF/,\ META-INF/,\
. .
source.. = src/ source.. = src/

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?> <?eclipse version="3.0"?>
<plugin> <fragment>
<extension point="org.eclipse.debug.core.launchConfigurationTypes"> <extension point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType <launchConfigurationType
sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator" sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
@ -13,4 +13,4 @@
</launchConfigurationType> </launchConfigurationType>
</extension> </extension>
</plugin> </fragment>

View file

@ -10,7 +10,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.framework; package org.eclipse.cdt.tests.dsf.gdb.framework;
import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.QualifiedName; import org.eclipse.core.runtime.QualifiedName;
@ -31,7 +31,7 @@ public class BackgroundRunner extends BlockJUnit4ClassRunner {
super(klass); super(klass);
} }
final static QualifiedName BACKGROUND_TEST_EXECUTION_FINISHED = new QualifiedName(TestsPlugin.getDefault().getBundle().getSymbolicName(), "background_test_execution_finished"); //$NON-NLS-1$ final static QualifiedName BACKGROUND_TEST_EXECUTION_FINISHED = new QualifiedName(GdbPlugin.getDefault().getBundle().getSymbolicName(), "background_test_execution_finished"); //$NON-NLS-1$
void invokeSuperRunImpl(RunNotifier notifier) { void invokeSuperRunImpl(RunNotifier notifier) {
super.run(notifier); super.run(notifier);

View file

@ -34,6 +34,7 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl.StepType; import org.eclipse.cdt.dsf.debug.service.IRunControl.StepType;
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext; import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.mi.service.IMICommandControl; import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext; import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.MIRunControl; import org.eclipse.cdt.dsf.mi.service.MIRunControl;
@ -504,12 +505,12 @@ public class SyncUtil {
try { try {
value = Integer.valueOf(value); value = Integer.valueOf(value);
if (value < 0) { if (value < 0) {
TestsPlugin.log(new Status(IStatus.ERROR, TestsPlugin.getUniqueIdentifier(), "\"" + propname + "\" property incorrectly specified. Should be an integer value or not specified at all.")); //$NON-NLS-1$ TestsPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "\"" + propname + "\" property incorrectly specified. Should be an integer value or not specified at all.")); //$NON-NLS-1$
value = -1; value = -1;
} }
} }
catch (NumberFormatException exc) { catch (NumberFormatException exc) {
TestsPlugin.log(new Status(IStatus.ERROR, TestsPlugin.getUniqueIdentifier(), "\"" + propname + "\" property incorrectly specified. Should be an integer value or not specified at all.")); //$NON-NLS-1$ TestsPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "\"" + propname + "\" property incorrectly specified. Should be an integer value or not specified at all.")); //$NON-NLS-1$
value = -1; value = -1;
} }
} }

View file

@ -13,23 +13,24 @@ package org.eclipse.cdt.tests.dsf.gdb.launching;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
/** /**
* The main plugin class to be used in the desktop. * This is no longer an activator class since this is no longer a plug-in. It's
* a fragment.
*/ */
public class TestsPlugin extends Plugin { public class TestsPlugin {
//The shared instance.
private static TestsPlugin plugin;
//Resource bundle.
private ResourceBundle resourceBundle; private ResourceBundle resourceBundle;
private static BundleContext bundleContext;
public static final String PLUGIN_ID = "org.eclipse.cdt.tests.dsf.gdb"; //$NON-NLS-1$ /**
* We're no longer a plug-in, but a fragment. Make this field an alias
* to our host plugin's ID.
*/
public static final String PLUGIN_ID = GdbPlugin.PLUGIN_ID;
/** Base tracing option for this plugin */ /** Base tracing option for this plugin */
public static final boolean DEBUG = "true".equals(Platform.getDebugOption("org.eclipse.cdt.tests.dsf.gdb/debug")); //$NON-NLS-1$//$NON-NLS-2$ public static final boolean DEBUG = "true".equals(Platform.getDebugOption("org.eclipse.cdt.tests.dsf.gdb/debug")); //$NON-NLS-1$//$NON-NLS-2$
@ -39,7 +40,6 @@ public class TestsPlugin extends Plugin {
*/ */
public TestsPlugin() { public TestsPlugin() {
super(); super();
plugin = this;
try { try {
resourceBundle = ResourceBundle.getBundle("org.eclipse.cdt.tests.dsf.gdb.TestsPluginResources"); //$NON-NLS-1$ resourceBundle = ResourceBundle.getBundle("org.eclipse.cdt.tests.dsf.gdb.TestsPluginResources"); //$NON-NLS-1$
} }
@ -47,68 +47,28 @@ public class TestsPlugin extends Plugin {
resourceBundle = null; resourceBundle = null;
} }
} }
/**
* This method is called upon plug-in activation
*/
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
bundleContext = context;
}
/**
* This method is called when the plug-in is stopped
*/
@Override
public void stop(BundleContext context) throws Exception {
super.stop(context);
}
/**
* Returns the shared instance.
*/
public static TestsPlugin getDefault() {
return plugin;
}
/** /**
* Returns the string from the plugin's resource bundle, * Returns this fragment's resource bundle,
* or 'key' if not found.
*/
public static String getResourceString(String key) {
ResourceBundle bundle = TestsPlugin.getDefault().getResourceBundle();
try {
return (bundle != null) ? bundle.getString(key) : key;
}
catch (MissingResourceException e) {
return key;
}
}
/**
* Returns the plugin's resource bundle,
*/ */
public ResourceBundle getResourceBundle() { public ResourceBundle getResourceBundle() {
return resourceBundle; return resourceBundle;
} }
/** /**
* Returns the plugin's bundle context, * Returns the host plug-in's bundle context,
*/ */
public static BundleContext getBundleContext() { public static BundleContext getBundleContext() {
return bundleContext; return GdbPlugin.getBundleContext();
}
/**
* Convenience method which returns the unique identifier of this plugin.
*/
public static String getUniqueIdentifier() {
return getDefault().getBundle().getSymbolicName();
} }
/** /**
* Logs the specified status with this plug-in's log. * Logs the specified status with this host plug-in's log.
* *
* @param status * @param status
* status to log * status to log
*/ */
public static void log(IStatus status) { public static void log(IStatus status) {
getDefault().getLog().log(status); GdbPlugin.getDefault().getLog().log(status);
} }
/** /**
@ -118,7 +78,7 @@ public class TestsPlugin extends Plugin {
* the exception to be logged * the exception to be logged
*/ */
public static void log( Throwable e ) { public static void log( Throwable e ) {
log(new Status(IStatus.ERROR, getUniqueIdentifier(), "Internal Error", e)); //$NON-NLS-1$ log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Internal Error", e)); //$NON-NLS-1$
} }
/** /**
@ -145,7 +105,7 @@ public class TestsPlugin extends Plugin {
return (int)(timeoutMs * multiplier); return (int)(timeoutMs * multiplier);
} }
catch (NumberFormatException exc) { catch (NumberFormatException exc) {
log(new Status(IStatus.ERROR, getUniqueIdentifier(), "\"dsf.gdb.tests.timeout.multiplier\" property incorrectly specified. Should be a float value (e.g., \"1.5\") or not specified at all.")); //$NON-NLS-1$ log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "\"dsf.gdb.tests.timeout.multiplier\" property incorrectly specified. Should be a float value (e.g., \"1.5\") or not specified at all.")); //$NON-NLS-1$
return timeoutMs; return timeoutMs;
} }
} }