KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > monitors > JavaElementContentProvider


1 /*******************************************************************************
2  * Copyright (c) 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.internal.debug.ui.monitors;
12
13 import org.eclipse.debug.internal.ui.model.elements.ElementContentProvider;
14 import org.eclipse.debug.ui.IDebugUIConstants;
15 import org.eclipse.jdt.debug.ui.IJavaDebugUIConstants;
16 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
17 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPreferenceInitializer;
18 import org.eclipse.jface.preference.IPreferenceStore;
19 import org.eclipse.jface.util.IPropertyChangeListener;
20 import org.eclipse.jface.util.PropertyChangeEvent;
21
22 /**
23  * Common element presentation for the debug view.
24  *
25  * @since 3.3
26  */

27 public abstract class JavaElementContentProvider extends ElementContentProvider {
28     
29     protected Object JavaDoc[] EMPTY = new Object JavaDoc[0];
30     
31     private static boolean fgDisplayMonitors;
32     private static boolean fgDisplayThreadGroups;
33     
34     static {
35         IPreferenceStore preferenceStore = JDIDebugUIPlugin.getDefault().getPreferenceStore();
36         preferenceStore.addPropertyChangeListener(new IPropertyChangeListener() {
37             public void propertyChange(PropertyChangeEvent event) {
38                 if (event.getProperty().equals(IJavaDebugUIConstants.PREF_SHOW_MONITOR_THREAD_INFO)) {
39                     fgDisplayMonitors= JDIDebugUIPreferenceInitializer.getBoolean(event);
40                 } else if (event.getProperty().equals(IJavaDebugUIConstants.PREF_SHOW_THREAD_GROUPS)) {
41                     fgDisplayThreadGroups= JDIDebugUIPreferenceInitializer.getBoolean(event);
42                 }
43             }
44         
45         });
46         fgDisplayMonitors= preferenceStore.getBoolean(IJavaDebugUIConstants.PREF_SHOW_MONITOR_THREAD_INFO);
47         fgDisplayThreadGroups = preferenceStore.getBoolean(IJavaDebugUIConstants.PREF_SHOW_THREAD_GROUPS);
48     }
49     
50     public static boolean isDisplayThreadGroups() {
51         return fgDisplayThreadGroups;
52     }
53
54     public static boolean isDisplayMonitors() {
55         return fgDisplayMonitors;
56     }
57     
58     /* (non-Javadoc)
59      * @see org.eclipse.debug.internal.ui.viewers.model.provisional.elements.ElementContentProvider#supportsContextId(java.lang.String)
60      */

61     protected boolean supportsContextId(String JavaDoc id) {
62         return IDebugUIConstants.ID_DEBUG_VIEW.equals(id);
63     }
64
65 }
66
Popular Tags