KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > debug > ui > JavaDebugUtils


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.jdt.debug.ui;
12
13 import org.eclipse.debug.core.model.IDebugElement;
14 import org.eclipse.debug.core.model.IThread;
15 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
16 import org.eclipse.jdt.internal.debug.ui.monitors.ThreadMonitorManager;
17 import org.eclipse.jface.preference.IPreferenceStore;
18
19 /**
20  * Utilities for the Java debugger.
21  * <p>
22  * This class is not intended to be subclassed or instantiated.
23  * </p>
24  * @since 3.1
25  */

26 public class JavaDebugUtils {
27
28     /**
29      * Returns a collection of debug elements representing the monitors owned
30      * by the given thread's underlying <code>IJavaThread</code>, or an empty
31      * collection if none.
32      * <p>
33      * The result will be empty when the user has turned off the preference
34      * to show monitor information.
35      * </p>
36      *
37      * @param thread an <code>IJavaThread</code> or a thread with an <code>IJavaThread</code>
38      * adapter
39      * @return debug elements representing the monitors owned by the underlying
40      * <code>IJavaThread</code>, possibly empty
41      */

42     public static IDebugElement[] getOwnedMonitors(IThread thread) {
43         return ThreadMonitorManager.getDefault().getOwnedMonitors(thread);
44     }
45     
46     /**
47      * Returns a debug element representing a monitor in contention with
48      * the given thread's underlying <code>IJavaThread</code>, or <code>null</code>
49      * if none.
50      * <p>
51      * The result will be <code>null</code> when the user has turned off the preference
52      * to show monitor information.
53      * </p>
54      * @param thread an <code>IJavaThread</code> or a thread with an <code>IJavaThread</code>
55      * adapter
56      * @return debug element representing a monitor in contention with the underlying
57      * <code>IJavaThread</code>, or <code>null</code>
58      */

59     public static IDebugElement getContendedMonitor(IThread thread) {
60         return ThreadMonitorManager.getDefault().getContendedMonitor(thread);
61     }
62     
63     /**
64      * Returns the preference store for the Java Debug UI plug-in.
65      *
66      * @return preference store
67      * @since 3.2
68      */

69     public static IPreferenceStore getPreferenceStore()
70     {
71         return JDIDebugUIPlugin.getDefault().getPreferenceStore();
72     }
73 }
74
Popular Tags