KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > progress > PendingUpdateAdapter


1 /*******************************************************************************
2  * Copyright (c) 2003, 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.ui.progress;
12
13 import org.eclipse.core.runtime.IAdaptable;
14 import org.eclipse.jface.resource.ImageDescriptor;
15 import org.eclipse.ui.internal.progress.ProgressMessages;
16 import org.eclipse.ui.model.IWorkbenchAdapter;
17
18 /**
19  * The PendingUpdateAdapter is a convenience object that can be used
20  * by a BaseWorkbenchContentProvider that wants to show a pending update.
21  *
22  * @since 3.2
23  */

24 public class PendingUpdateAdapter implements IWorkbenchAdapter, IAdaptable {
25
26     private boolean removed = false;
27
28     /**
29      * Return whether or not this has been removed from the tree.
30      * @return boolean
31      */

32     protected boolean isRemoved() {
33         return removed;
34     }
35
36     /**
37      * Set whether or not this has been removed from the tree.
38      * @param removedValue boolean
39      */

40     protected void setRemoved(boolean removedValue) {
41         this.removed = removedValue;
42     }
43
44     /**
45      * Create a new instance of the receiver.
46      */

47     public PendingUpdateAdapter() {
48         //No initial behavior
49
}
50
51     /* (non-Javadoc)
52      * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
53      */

54     public Object JavaDoc getAdapter(Class JavaDoc adapter) {
55         if (adapter == IWorkbenchAdapter.class) {
56             return this;
57         }
58         return null;
59     }
60
61     /* (non-Javadoc)
62      * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
63      */

64     public Object JavaDoc[] getChildren(Object JavaDoc o) {
65         return new Object JavaDoc[0];
66     }
67
68     /* (non-Javadoc)
69      * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
70      */

71     public ImageDescriptor getImageDescriptor(Object JavaDoc object) {
72         return null;
73     }
74
75     /* (non-Javadoc)
76      * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
77      */

78     public String JavaDoc getLabel(Object JavaDoc o) {
79         return ProgressMessages.PendingUpdateAdapter_PendingLabel;
80     }
81
82     /* (non-Javadoc)
83      * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
84      */

85     public Object JavaDoc getParent(Object JavaDoc o) {
86         return null;
87     }
88 }
89
Popular Tags