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: import org.eclipse.core.runtime.Assert;
15:
16: /**
17: * Event object describing an open which may be generated from a
18: * selection or default selection event. The source of these
19: * events is a viewer.
20: *
21: * @see IOpenListener
22: */
23: public class OpenEvent extends EventObject {
24:
25: /**
26: * Generated serial version UID for this class.
27: * @since 3.1
28: */
29: private static final long serialVersionUID = 3761972652973176117L;
30:
31: /**
32: * The selection.
33: */
34: protected ISelection selection;
35:
36: /**
37: * Creates a new event for the given source and selection.
38: *
39: * @param source the viewer
40: * @param selection the selection
41: */
42: public OpenEvent(Viewer source, ISelection selection) {
43: super (source);
44: Assert.isNotNull(selection);
45: this .selection = selection;
46: }
47:
48: /**
49: * Returns the selection.
50: *
51: * @return the selection
52: */
53: public ISelection getSelection() {
54: return selection;
55: }
56:
57: /**
58: * Returns the viewer that is the source of this event.
59: *
60: * @return the originating viewer
61: */
62: public Viewer getViewer() {
63: return (Viewer) getSource();
64: }
65: }
|