KickJava   Java API By Example, From Geeks To Geeks.

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


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.jdt.internal.debug.ui.monitors;
12
13 import org.eclipse.debug.ui.DeferredDebugElementWorkbenchAdapter;
14 import org.eclipse.jdt.internal.debug.ui.IJDIPreferencesConstants;
15 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
16 import org.eclipse.jface.preference.IPreferenceStore;
17 import org.eclipse.jface.util.IPropertyChangeListener;
18 import org.eclipse.jface.util.PropertyChangeEvent;
19 import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
20
21 /**
22  * A deferred workbench adapter for elements presenting monitor information in the debug veiw.
23  */

24 public abstract class DeferredMonitorElement extends DeferredDebugElementWorkbenchAdapter implements IDeferredWorkbenchAdapter, IPropertyChangeListener {
25
26     private boolean fDisplayMonitors= false;
27     public DeferredMonitorElement() {
28         IPreferenceStore preferenceStore = JDIDebugUIPlugin.getDefault().getPreferenceStore();
29         preferenceStore.addPropertyChangeListener(this);
30         fDisplayMonitors= preferenceStore.getBoolean(IJDIPreferencesConstants.PREF_SHOW_MONITOR_THREAD_INFO);
31     }
32     
33     /* (non-Javadoc)
34      * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
35      */

36     public void propertyChange(PropertyChangeEvent event) {
37         if (event.getProperty().equals(IJDIPreferencesConstants.PREF_SHOW_MONITOR_THREAD_INFO)) {
38             fDisplayMonitors= ((Boolean JavaDoc)event.getNewValue()).booleanValue();
39         }
40     }
41     
42     protected boolean isDisplayMonitors() {
43         return fDisplayMonitors;
44     }
45 }
46
Popular Tags