KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdi > Bootstrap


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdi;
12
13 import org.eclipse.core.runtime.IExtensionRegistry;
14 import org.eclipse.core.runtime.Platform;
15 import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin;
16
17
18 public class Bootstrap
19 {
20     private static com.sun.jdi.VirtualMachineManager fVirtualMachineManager;
21
22     public Bootstrap() { }
23     
24     public static synchronized com.sun.jdi.VirtualMachineManager virtualMachineManager() {
25         if (fVirtualMachineManager != null)
26             return fVirtualMachineManager;
27         
28         try {
29             IExtensionRegistry extensionRegistry= Platform.getExtensionRegistry();
30             String JavaDoc className= null;
31             if (extensionRegistry != null) { // is null if the platform was not started
32
className= extensionRegistry.getExtensionPoint(JDIDebugPlugin.getUniqueIdentifier(), "jdiclient").getLabel(); //$NON-NLS-1$
33
}
34             Class JavaDoc clazz= null;
35             if (className != null) {
36                 clazz= Class.forName(className);
37             }
38             if (clazz != null) {
39                 fVirtualMachineManager = (com.sun.jdi.VirtualMachineManager)clazz.newInstance();
40             }
41         } catch (ClassNotFoundException JavaDoc e) {
42         } catch (NoClassDefFoundError JavaDoc e) {
43         } catch (InstantiationException JavaDoc e) {
44         } catch (IllegalAccessException JavaDoc e) {
45         }
46
47         if (fVirtualMachineManager == null) {
48             // If any exceptions occurred, we'll end up here
49
fVirtualMachineManager= new org.eclipse.jdi.internal.VirtualMachineManagerImpl();
50         }
51         
52         return fVirtualMachineManager;
53     }
54 }
55
Popular Tags