1 /*******************************************************************************
2  * Copyright (c) 2005, 2010 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  *     Pawel Piech (Wind River) - added a breadcrumb mode to Debug view (Bug 252677)
14  *******************************************************************************/
15 package org.eclipse.debug.internal.ui.viewers.model.provisional;
16 
17 import org.eclipse.jface.util.IPropertyChangeListener;
18 import org.eclipse.ui.IWorkbenchPart;
19 import org.eclipse.ui.IWorkbenchWindow;
20 
21 /**
22  * Context in which an asynchronous request has been made.
23  * <p>
24  * Clients may implement and extend this interface to provide
25  * special contexts. Implementations must subclass {@link PresentationContext}.
26  * </p>
27  * @since 3.2
28  */
29 public interface IPresentationContext {
30 
31 	/**
32 	 * Property name used for property change notification when the columns
33 	 * in a presentation context change.
34 	 */
35 	String PROPERTY_COLUMNS = "PROPERTY_COLUMNS"; //$NON-NLS-1$
36 
37 	/**
38 	 * Property indicating whether the presentation context is disposed.
39 	 * It is set to <code>Boolean.TRUE</code> after the presentation context
40 	 * is disposed. This property may be <code>null</code>, which indicates
41 	 * that context is not yet disposed.
42 	 *
43 	 * @since 3.6
44 	 */
45 	String PROPERTY_DISPOSED = "PROPERTY_DISPOSED"; //$NON-NLS-1$
46 
47 	/**
48 	 * Returns identifiers of the visible columns in the order
49 	 * labels should be provided, or <code>null</code> if columns
50 	 * are not being displayed. Label providers use this
51 	 * information.
52 	 *
53 	 * @return visible column identifiers or <code>null</code>
54 	 * @see IColumnPresentation
55 	 */
getColumns()56 	String[] getColumns();
57 
58 	/**
59 	 * Registers the given listener for property change notification.
60 	 *
61 	 * @param listener property listener
62 	 */
addPropertyChangeListener(IPropertyChangeListener listener)63 	void addPropertyChangeListener(IPropertyChangeListener listener);
64 
65 	/**
66 	 * Unregisters the given listener from property change notification.
67 	 *
68 	 * @param listener property listener.
69 	 */
removePropertyChangeListener(IPropertyChangeListener listener)70 	void removePropertyChangeListener(IPropertyChangeListener listener);
71 
72 	/**
73 	 * Returns the id of this presentation context. Usually this is the id of
74 	 * the associated part. However, when no part is associated with this context,
75 	 * the id may exist on its own. Allows for a context that is not tied to a part.
76 	 *
77 	 * @return id
78 	 * @since 3.3
79 	 */
getId()80 	String getId();
81 
82 	/**
83 	 * Sets the specified property and notifies listeners of changes.
84 	 *
85 	 * @param property property name
86 	 * @param value property value
87 	 */
setProperty(String property, Object value)88 	void setProperty(String property, Object value);
89 
90 	/**
91 	 * Returns the property with the specified name or <code>null</code>
92 	 * if none.
93 	 *
94 	 * @param property property name
95 	 * @return property value or <code>null</code>
96 	 */
getProperty(String property)97 	Object getProperty(String property);
98 
99 	/**
100 	 * Disposes this presentation context. Called by the framework
101 	 * when the associated viewer is disposed.
102 	 */
dispose()103 	void dispose();
104 
105 	/**
106 	 * Returns all keys of properties currently set in this context,
107 	 * possibly an empty collection
108 	 *
109 	 * @return keys of all current properties
110 	 * @since 3.4
111 	 */
getProperties()112 	String[] getProperties();
113 
114 	/**
115 	 * Returns the part that this presentation context is associated with.
116 	 * May return <code>null</code> if the presentation is not associated
117 	 * with a part.
118 	 *
119 	 * @return IWorkbenchPart or <code>null</code>
120 	 * @since 3.6
121 	 */
getPart()122 	IWorkbenchPart getPart();
123 
124 	/**
125 	 * Returns the window that this presentation context is associated with.
126 	 * May return <code>null</code> if the presentation is not associated
127 	 * with a window.
128 	 *
129 	 * @return IWorkbenchWindow or <code>null</code>
130 	 * @since 3.6
131 	 */
getWindow()132 	IWorkbenchWindow getWindow();
133 
134 }
135