KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > views > variables > VariablesViewer


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.debug.internal.ui.views.variables;
12
13 import org.eclipse.core.runtime.IProgressMonitor;
14 import org.eclipse.core.runtime.IStatus;
15 import org.eclipse.core.runtime.Status;
16 import org.eclipse.debug.internal.ui.viewers.AsynchronousTreeViewer;
17 import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
18 import org.eclipse.swt.widgets.Composite;
19 import org.eclipse.ui.progress.UIJob;
20
21 /**
22  * @since 3.2
23  *
24  */

25 public class VariablesViewer extends AsynchronousTreeViewer{
26
27     private VariablesView fView;
28
29     private UIJob fRestoreJob = new UIJob("restore viewer state") { //$NON-NLS-1$
30
public IStatus runInUIThread(IProgressMonitor monitor) {
31             fView.restoreState();
32             return Status.OK_STATUS;
33         }
34     };
35     
36     public VariablesViewer(Composite parent, int style, VariablesView view) {
37         super(parent, style);
38         fView = view;
39         fRestoreJob.setSystem(true);
40     }
41
42     protected void updateComplete(IAsynchronousRequestMonitor update) {
43         if (fView != null && !hasPendingUpdates()) {
44             fRestoreJob.schedule();
45             fView.populateDetailPane();
46         }
47     }
48
49     /* (non-Javadoc)
50      * @see org.eclipse.debug.internal.ui.treeviewer.AsynchronousTreeViewer#handlePresentationFailure(org.eclipse.debug.internal.ui.treeviewer.IPresentationRequestMonitor, org.eclipse.core.runtime.IStatus)
51      */

52     protected void handlePresentationFailure(IAsynchronousRequestMonitor update, IStatus status) {
53         fView.showMessage(status.getMessage());
54     }
55     
56 }
57
Popular Tags