Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 47668a56a453de75d54a5831baf81efd7ca766ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*******************************************************************************
 * Copyright (c) 2006, 2008 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.debug.ui.contexts;

import java.util.EventObject;

import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.ISelection;

/**
 * A debug context event. Debug context events are generated by debug context
 * providers. A debug context is represented by a selection and flags
 * (bit mask) describing how the context has changed.
 * <p>
 * Clients may instantiate this class.
 * </p>
 * @see IDebugContextListener
 * @see IDebugContextProvider
 * @since 3.3
 * @noextend This class is not intended to be subclassed by clients.
 */
public class DebugContextEvent extends EventObject {

	/**
	 * The context
	 */
	private ISelection fContext;

	/**
	 * Change flags.
	 */
	private int fFlags;

	/**
	 * Change constant (bit mask) indicating a context has been activated.
	 */
	public static final int ACTIVATED = 0x01;

	/**
	 * Change constant (bit mask) indicating the state of a context has changed.
	 * State changes are only broadcast for previously activated contexts.
	 */
	public static final int STATE = 0x10;

	/**
     * Generated serial version UID for this class.
     */
	private static final long serialVersionUID = 3395172504615255524L;

	/**
	 * Constructs a new debug context event.
	 *
	 * @param source source of the event - a debug context provider
	 * @param context the relevant context
	 * @param flags bit mask indicating how the context has changed - see change constants
	 * 	defined in this class
	 */
	public DebugContextEvent(IDebugContextProvider source, ISelection context, int flags) {
		super(source);
		Assert.isNotNull(context, "DebugContextEvent context must not be null"); //$NON-NLS-1$
		fContext = context;
		fFlags = flags;
	}

	/**
	 * Returns the debug context associated with this event.
	 *
	 * @return debug context, possible an empty selection
	 */
	public ISelection getContext() {
		return fContext;
	}

	/**
	 * Returns flags which describe in more detail how a context has changed.
	 * See change constants defined in this class.
	 *
	 * @return event flags
	 */
	public int getFlags() {
		return fFlags;
	}

	/**
	 * Returns the context provider that initiated this event.
	 *
	 * @return context provider
	 */
	public IDebugContextProvider getDebugContextProvider() {
		return (IDebugContextProvider) getSource();
	}
}

Back to the top