01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdi;
11:
12: import org.eclipse.core.runtime.IExtensionRegistry;
13: import org.eclipse.core.runtime.Platform;
14: import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin;
15:
16: public class Bootstrap {
17: private static com.sun.jdi.VirtualMachineManager fVirtualMachineManager;
18:
19: public Bootstrap() {
20: }
21:
22: public static synchronized com.sun.jdi.VirtualMachineManager virtualMachineManager() {
23: if (fVirtualMachineManager != null)
24: return fVirtualMachineManager;
25:
26: try {
27: IExtensionRegistry extensionRegistry = Platform
28: .getExtensionRegistry();
29: String className = null;
30: if (extensionRegistry != null) { // is null if the platform was not started
31: className = extensionRegistry.getExtensionPoint(
32: JDIDebugPlugin.getUniqueIdentifier(),
33: "jdiclient").getLabel(); //$NON-NLS-1$
34: }
35: Class clazz = null;
36: if (className != null) {
37: clazz = Class.forName(className);
38: }
39: if (clazz != null) {
40: fVirtualMachineManager = (com.sun.jdi.VirtualMachineManager) clazz
41: .newInstance();
42: }
43: } catch (ClassNotFoundException e) {
44: } catch (NoClassDefFoundError e) {
45: } catch (InstantiationException e) {
46: } catch (IllegalAccessException e) {
47: }
48:
49: if (fVirtualMachineManager == null) {
50: // If any exceptions occurred, we'll end up here
51: fVirtualMachineManager = new org.eclipse.jdi.internal.VirtualMachineManagerImpl();
52: }
53:
54: return fVirtualMachineManager;
55: }
56: }
|