01: /*******************************************************************************
02: * Copyright (c) 2003, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.progress;
11:
12: import org.eclipse.core.runtime.IAdaptable;
13: import org.eclipse.jface.resource.ImageDescriptor;
14: import org.eclipse.ui.internal.progress.ProgressMessages;
15: import org.eclipse.ui.model.IWorkbenchAdapter;
16:
17: /**
18: * The PendingUpdateAdapter is a convenience object that can be used
19: * by a BaseWorkbenchContentProvider that wants to show a pending update.
20: *
21: * @since 3.2
22: */
23: public class PendingUpdateAdapter implements IWorkbenchAdapter,
24: 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 getAdapter(Class 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[] getChildren(Object o) {
65: return new Object[0];
66: }
67:
68: /* (non-Javadoc)
69: * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
70: */
71: public ImageDescriptor getImageDescriptor(Object object) {
72: return null;
73: }
74:
75: /* (non-Javadoc)
76: * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
77: */
78: public String getLabel(Object 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 getParent(Object o) {
86: return null;
87: }
88:
89: /* (non-Javadoc)
90: * @see java.lang.Object#toString()
91: */
92: public String toString() {
93: return getLabel(null);
94: }
95: }
|