KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > ui > memory > IMemoryRendering


1 /*******************************************************************************
2  * Copyright (c) 2004, 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.debug.ui.memory;
12
13 import org.eclipse.core.runtime.IAdaptable;
14 import org.eclipse.debug.core.model.IMemoryBlock;
15 import org.eclipse.jface.util.IPropertyChangeListener;
16 import org.eclipse.swt.graphics.Image;
17 import org.eclipse.swt.widgets.Composite;
18 import org.eclipse.swt.widgets.Control;
19
20 /**
21  * An arbitrary rendering of a memory block. A memory rendering is contributed
22  * via the <code>memoryRenderings</code> extension point.
23  * <p>
24  * Following is an example definition of a memory renderings extension.
25  * <pre>
26  * &lt;extension point="org.eclipse.debug.ui.memoryRenderings"&gt;
27  * &lt;memoryRenderingType
28  * id="com.example.asciiRendering"
29  * name="ASCII"
30  * class="com.example.RenderingFactory"&gt;
31  * &lt;/memoryRenderingType&gt;
32  * &lt;/extension&gt;
33  * </pre>
34  * The attributes are specified as follows:
35  * <ul>
36  * <li><code>id</code> specifies a unique identifier for a type of memory rendering</li>
37  * <li><code>name</code> specifies a human readable label for a rendering type</li>
38  * <li><code>class</code> specifies the fully qualified name of the Java class
39  * that implements <code>IMemoryRenderingTypeDelegate</code>. Renderings are created
40  * via this factory.</li>
41  * </ul>
42  * </p>
43  * <p>
44  * A rendering provides an image and label. To support dynamic labels and images, property
45  * change notification is used with the following property constants defined in
46  * <code>IBasicPropertyConstants</code>:
47  * <ul>
48  * <li><code>P_TEXT</code> - indicates a label change</li>
49  * <li><code>P_IMAGE</code> - indicates a image change</li>
50  * </ul>
51  * </p>
52  * <p>
53  * Renderings needing to synchronize with other renderings are intended to use
54  * property change notifications via its synchronization service. For example, when a
55  * rendering becomes visible, it can register for property change events with its rendering
56  * site's synchronization service, and when it becomes hidden it can unregister. When a
57  * rendering is activated, it should set itself as the synchrnoization provider in its
58  * rendering site and fire property change events to communicate information to
59  * interested listeners.
60  * </p>
61  * <p>
62  * Clients contributing a memory rendering type are intended to implement this interface
63  * and <code>IMemoryRenderingTypeDelegate</code>. The factory will be used to create instances
64  * of <code>IMemoryRendering</code>.
65  * </p>
66  * @since 3.1
67  */

68 public interface IMemoryRendering extends IAdaptable{
69     
70     /**
71      * Initializes this rendering to be hosted in the given container, displaying
72      * the given memory block. This method is called before this rendering's control
73      * has been created.
74      *
75      * @param container container hosting this rendering
76      * @param block the memory block to render
77      */

78     public void init(IMemoryRenderingContainer container, IMemoryBlock block);
79     
80     /**
81      * Creates the top level control for this rendering under the given parent composite.
82      * This method is called after this rendering's <code>init</code> method has been
83      * called.
84      * <p>
85      * Implementors are responsible for ensuring that
86      * the created control can be accessed via <code>getControl</code>
87      * </p>
88      * @param parent the parent composite
89      */

90     public Control createControl(Composite parent);
91
92     /**
93      * Returns the top level control for this rendering.
94      * <p>
95      * May return <code>null</code> if the control
96      * has not been created yet.
97      * </p>
98      * @return the top level control or <code>null</code>
99      */

100     public Control getControl();
101     
102     /**
103      * Disposes this rendering.
104      */

105     public void dispose();
106     
107     /**
108      * Notification this rendering has become the active rendering. Only one
109      * rendering can be active at once. Generally, the active rendering is
110      * visible and has focus.
111      */

112     public void activated();
113     
114     /**
115      * Notification this rendering is no longer the active rendering.
116      */

117     public void deactivated();
118     
119     /**
120      * Notification this rendering has become visible in its container.
121      * Note that a rendering does not have to be active to be visible.
122      */

123     public void becomesVisible();
124     
125     /**
126      * Notification this rendering has become hidden in its container.
127      */

128     public void becomesHidden();
129     
130     /**
131      * Returns the memory block displayed by this rendering.
132      *
133      * @return the memory block displayed by this rendering
134      */

135     public IMemoryBlock getMemoryBlock();
136     
137     /**
138      * Returns the identifier associated with this rendering's type.
139      *
140      * @return the identifier associated with this rendering's type
141      * @see IMemoryRenderingType
142      */

143     public String JavaDoc getRenderingId();
144     
145     /**
146      * Adds a listener for property changes to this rendering.
147      * Has no effect if an identical listener is already registered.
148      *
149      * @param listener a property change listener
150      */

151     public void addPropertyChangeListener(IPropertyChangeListener listener);
152     
153     /**
154      * Removes the given property change listener from this rendering.
155      * Has no effect if the identical listener is not registered.
156      *
157      * @param listener a property change listener
158      */

159     public void removePropertyChangeListener(IPropertyChangeListener listener);
160     
161     /**
162      * Returns an image for this rendering. Clients should not dispose
163      * this image. This rendering will dispose the image if required when
164      * this rendering is disposed.
165      *
166      * @return an image for this rendering
167      */

168     public Image getImage();
169     
170     /**
171      * Returns a label for this rendering.
172      *
173      * @return a label for this rendering
174      */

175     public String JavaDoc getLabel();
176 }
177
Popular Tags