]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/events/TypedEvent.java
Remove invalid SHA-256-Digests
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / events / TypedEvent.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2017 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.swt.events;
15
16
17 import java.util.*;
18
19 import org.eclipse.swt.widgets.*;
20
21 /**
22  * This is the super class for all typed event classes provided
23  * by SWT. Typed events contain particular information which is
24  * applicable to the event occurrence.
25  *
26  * @see org.eclipse.swt.widgets.Event
27  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
28  */
29 public class TypedEvent extends EventObject {
30
31         /**
32          * the display where the event occurred
33          *
34          * @since 2.0
35          */
36         public Display display;
37
38         /**
39          * the widget that issued the event
40          */
41         public Widget widget;
42
43         /**
44          * the time that the event occurred.
45          *
46          * NOTE: This field is an unsigned integer and should
47          * be AND'ed with 0xFFFFFFFFL so that it can be treated
48          * as a signed long.
49          */
50         public int time;
51
52         /**
53          * a field for application use
54          */
55         public Object data;
56
57         static final long serialVersionUID = 3257285846578377524L;
58
59 /**
60  * Constructs a new instance of this class.
61  *
62  * @param object the object that fired the event
63  */
64 public TypedEvent(Object object) {
65         super(object);
66 }
67
68 /**
69  * Constructs a new instance of this class based on the
70  * information in the argument.
71  *
72  * @param e the low level event to initialize the receiver with
73  */
74 public TypedEvent(Event e) {
75         super(e.widget);
76         this.display = e.display;
77         this.widget = e.widget;
78         this.time = e.time;
79         this.data = e.data;
80 }
81
82 /**
83  * Returns the name of the event. This is the name of
84  * the class without the package name.
85  *
86  * @return the name of the event
87  */
88 String getName () {
89         String string = getClass ().getName ();
90         int index = string.lastIndexOf ('.');
91         if (index == -1) return string;
92         return string.substring (index + 1, string.length ());
93 }
94
95 /**
96  * Returns a string containing a concise, human-readable
97  * description of the receiver.
98  *
99  * @return a string representation of the event
100  */
101 @Override
102 public String toString() {
103         return getName ()
104                 + "{" + widget
105                 + " time=" + time
106                 + " data=" + data
107                 + "}";
108 }
109 }