KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > viewers > ContainerRequestMonitor


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.viewers;
12
13 import org.eclipse.debug.internal.ui.viewers.provisional.IContainerRequestMonitor;
14
15 /**
16  * Implementation of an <code>IContainerRequestMonitor</code>. Collects whether
17  * an element contains children.
18  * <p>
19  * Not intended to be subclassed or instantiated by clients. For use
20  * speficially with <code>AsynchronousTreeViewer</code>.
21  * </p>
22  * @since 3.2
23  */

24 class ContainerRequestMonitor extends AsynchronousRequestMonitor implements IContainerRequestMonitor {
25     
26     /**
27      * Whether the item has children
28      */

29     private boolean fIsChildren = false;
30
31     /**
32      * Constructs an update request for the given node in the given model.
33      *
34      * @param node node to update
35      * @param mode model the update was issued for
36      */

37     ContainerRequestMonitor(ModelNode node, AsynchronousModel model) {
38         super(node, model);
39     }
40
41     /* (non-Javadoc)
42      * @see org.eclipse.debug.ui.viewers.AsynchronousRequestMonitor#performUpdate()
43      */

44     protected void performUpdate() {
45         ((AsynchronousTreeModel)getModel()).setIsContainer(getNode(), fIsChildren);
46     }
47
48     /* (non-Javadoc)
49      * @see org.eclipse.debug.ui.viewers.AsynchronousRequestMonitor#contains(org.eclipse.debug.ui.viewers.AsynchronousRequestMonitor)
50      */

51     protected boolean contains(AsynchronousRequestMonitor update) {
52         return (update instanceof ChildrenRequestMonitor || update instanceof ContainerRequestMonitor) && contains(update.getNode());
53     }
54
55     /* (non-Javadoc)
56      * @see org.eclipse.debug.ui.viewers.IContainerRequestMonitor#setIsContainer(boolean)
57      */

58     public void setIsContainer(boolean container) {
59         fIsChildren = container;
60     }
61
62 }
63
Popular Tags