KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2005, 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.viewers.provisional.AsynchronousContentAdapter;
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.jface.preference.IPreferenceStore;
18 import org.eclipse.jface.util.IPropertyChangeListener;
19 import org.eclipse.jface.util.PropertyChangeEvent;
20
21 public abstract class AsyncMonitorAdapter extends AsynchronousContentAdapter implements IPropertyChangeListener {
22
23     private boolean fDisplayMonitors;
24
25     public AsyncMonitorAdapter() {
26         IPreferenceStore preferenceStore = JDIDebugUIPlugin.getDefault().getPreferenceStore();
27         preferenceStore.addPropertyChangeListener(this);
28         fDisplayMonitors= preferenceStore.getBoolean(IJavaDebugUIConstants.PREF_SHOW_MONITOR_THREAD_INFO);
29     }
30
31     public void propertyChange(PropertyChangeEvent event) {
32         if (event.getProperty().equals(IJavaDebugUIConstants.PREF_SHOW_MONITOR_THREAD_INFO)) {
33             fDisplayMonitors= ((Boolean JavaDoc)event.getNewValue()).booleanValue();
34         }
35     }
36
37     protected boolean isDisplayMonitors() {
38         return fDisplayMonitors;
39     }
40     
41     /*
42      * (non-Javadoc)
43      * @see org.eclipse.debug.internal.ui.viewers.provisional.AsynchronousContentAdapter#supportsPartId(java.lang.String)
44      */

45     protected boolean supportsPartId(String JavaDoc id) {
46         return IDebugUIConstants.ID_DEBUG_VIEW.equals(id);
47     }
48 }
49
Popular Tags