01: /*******************************************************************************
02: * Copyright (c) 2000, 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.jface.viewers;
11:
12: import java.util.EventObject;
13:
14: /**
15: * Event object describing a tree node being expanded
16: * or collapsed. The source of these events is the tree viewer.
17: *
18: * @see ITreeViewerListener
19: */
20: public class TreeExpansionEvent extends EventObject {
21:
22: /**
23: * Generated serial version UID for this class.
24: * @since 3.1
25: */
26: private static final long serialVersionUID = 3618414930227835185L;
27:
28: /**
29: * The element that was expanded or collapsed.
30: */
31: private Object element;
32:
33: /**
34: * Creates a new event for the given source and element.
35: *
36: * @param source the tree viewer
37: * @param element the element
38: */
39: public TreeExpansionEvent(AbstractTreeViewer source, Object element) {
40: super (source);
41: this .element = element;
42: }
43:
44: /**
45: * Returns the element that got expanded or collapsed.
46: *
47: * @return the element
48: */
49: public Object getElement() {
50: return element;
51: }
52:
53: /**
54: * Returns the originator of the event.
55: *
56: * @return the originating tree viewer
57: */
58: public AbstractTreeViewer getTreeViewer() {
59: return (AbstractTreeViewer) source;
60: }
61: }
|