KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > ui > contexts > DebugContextEvent


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 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.debug.ui.contexts;
12
13 import java.util.EventObject JavaDoc;
14
15 import org.eclipse.jface.viewers.ISelection;
16
17 /**
18  * A debug context event. Debug context events are generated by debug context
19  * providers. A debug context is represented by a selection and flags
20  * (bit mask) describing how the context has changed.
21  * <p>
22  * Clients may instantiate this class; not intended to be subclassed.
23  * </p>
24  * @see IDebugContextListener
25  * @see IDebugContextProvider
26  * @since 3.3
27  */

28 public class DebugContextEvent extends EventObject JavaDoc {
29
30     /**
31      * The context
32      */

33     private ISelection fContext;
34     
35     /**
36      * Change flags.
37      */

38     private int fFlags;
39     
40     /**
41      * Change constant (bit mask) indicating a context has been activated.
42      */

43     public static final int ACTIVATED = 0x01;
44     
45     /**
46      * Change constant (bit mask) indicating the state of a context has changed.
47      * State changes are only broadcast for previously activated contexts.
48      */

49     public static final int STATE = 0x10;
50
51     /**
52      * Generated serial version UID for this class.
53      */

54     private static final long serialVersionUID = 3395172504615255524L;
55
56     /**
57      * Constructs a new debug context event.
58      *
59      * @param source source of the event - a debug context provider
60      * @param context the relevant context
61      * @param flags bit mask indicating how the context has changed - see change constants
62      * defined in this class
63      */

64     public DebugContextEvent(IDebugContextProvider source, ISelection context, int flags) {
65         super(source);
66         fContext = context;
67         fFlags = flags;
68     }
69     
70     /**
71      * Returns the debug context associated with this event.
72      *
73      * @return debug context, possible an empty selection
74      */

75     public ISelection getContext() {
76         return fContext;
77     }
78     
79     /**
80      * Returns flags which describe in more detail how a context has changed.
81      * See change constants defined in this class.
82      *
83      * @return event flags
84      */

85     public int getFlags() {
86         return fFlags;
87     }
88     
89     /**
90      * Returns the context provider that initiated this event.
91      *
92      * @return context provider
93      */

94     public IDebugContextProvider getDebugContextProvider() {
95         return (IDebugContextProvider) getSource();
96     }
97 }
98
Popular Tags