private Object getApplication(String[] args) throws CoreException {
// Assume we are in 3.0 mode.
// Find the name of the application as specified by the PDE JUnit launcher.
// If no application is specified, the 3.0 default workbench application
// is returned.
IExtension extension =
Platform.getExtensionRegistry().getExtension(
Platform.PI_RUNTIME,
Platform.PT_APPLICATIONS,
getApplicationToRun(args));
// If no 3.0 extension can be found, search the registry
// for the pre-3.0 default workbench application, i.e. org.eclipse ui.workbench
// Set the deprecated flag to true
if (extension == null) {
extension = Platform.getExtensionRegistry().getExtension(
Platform.PI_RUNTIME,
Platform.PT_APPLICATIONS,
DEFAULT_APP_PRE_3_0);
fInDeprecatedMode = true;
}
Assert.assertNotNull(extension);
// If the extension does not have the correct grammar, return null.
// Otherwise, return the application object.
IConfigurationElement[] elements = extension.getConfigurationElements();
if (elements.length > 0) {
IConfigurationElement[] runs = elements[0].getChildren("run"); //$NON-NLS-1$
if (runs.length > 0) {
Object runnable = runs[0].createExecutableExtension("class"); //$NON-NLS-1$
if (runnable instanceof IPlatformRunnable)