KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > viewers > SelectionChangedEvent


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.jface.viewers;
12
13 import java.util.EventObject JavaDoc;
14
15 import org.eclipse.core.runtime.Assert;
16
17 /**
18  * Event object describing a selection change. The source of these
19  * events is a selection provider.
20  *
21  * @see ISelection
22  * @see ISelectionProvider
23  * @see ISelectionChangedListener
24  */

25 public class SelectionChangedEvent extends EventObject JavaDoc {
26
27     /**
28      * Generated serial version UID for this class.
29      * @since 3.1
30      */

31     private static final long serialVersionUID = 3835149545519723574L;
32     
33     /**
34      * The selection.
35      */

36     protected ISelection selection;
37
38     /**
39      * Creates a new event for the given source and selection.
40      *
41      * @param source the selection provider
42      * @param selection the selection
43      */

44     public SelectionChangedEvent(ISelectionProvider source, 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 }
68
Popular Tags