KickJava   Java API By Example, From Geeks To Geeks.

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


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 an open which may be generated from a
19  * selection or default selection event. The source of these
20  * events is a viewer.
21  *
22  * @see IOpenListener
23  */

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

30     private static final long serialVersionUID = 3761972652973176117L;
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 viewer
41      * @param selection the selection
42      */

43     public OpenEvent(Viewer source, ISelection selection) {
44         super(source);
45         Assert.isNotNull(selection);
46         this.selection = selection;
47     }
48
49     /**
50      * Returns the selection.
51      *
52      * @return the selection
53      */

54     public ISelection getSelection() {
55         return selection;
56     }
57
58     /**
59      * Returns the viewer that is the source of this event.
60      *
61      * @return the originating viewer
62      */

63     public Viewer getViewer() {
64         return (Viewer) getSource();
65     }
66 }
67
Popular Tags