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 a selection change. The source of these
18: * events is a selection provider.
19: *
20: * @see ISelection
21: * @see ISelectionProvider
22: * @see ISelectionChangedListener
23: */
24: public class SelectionChangedEvent extends EventObject {
25:
26: /**
27: * Generated serial version UID for this class.
28: * @since 3.1
29: */
30: private static final long serialVersionUID = 3835149545519723574L;
31:
32: /**
33: * The selection.
34: */
35: protected ISelection selection;
36:
37: /**
38: * Creates a new event for the given source and selection.
39: *
40: * @param source the selection provider
41: * @param selection the selection
42: */
43: public SelectionChangedEvent(ISelectionProvider source,
44: ISelection selection) {
45: super (source);
46: Assert.isNotNull(selection);
47: this .selection = selection;
48: }
49:
50: /**
51: * Returns the selection.
52: *
53: * @return the selection
54: */
55: public ISelection getSelection() {
56: return selection;
57: }
58:
59: /**
60: * Returns the selection provider that is the source of this event.
61: *
62: * @return the originating selection provider
63: */
64: public ISelectionProvider getSelectionProvider() {
65: return (ISelectionProvider) getSource();
66: }
67: }
|