diff options
author | Darin Wright | 2005-01-10 22:49:49 +0000 |
---|---|---|
committer | Darin Wright | 2005-01-10 22:49:49 +0000 |
commit | 3b05431a9d5d756ccb9aeced0fe61ddb3d3070df (patch) | |
tree | 33bd0de4d811a4ac34f8d128d324db746e7c2f8c /org.eclipse.debug.ui | |
parent | 0dc301c378d2868eb139d0419b833923ae8ffaea (diff) | |
download | eclipse.platform.debug-3b05431a9d5d756ccb9aeced0fe61ddb3d3070df.tar.gz eclipse.platform.debug-3b05431a9d5d756ccb9aeced0fe61ddb3d3070df.tar.xz eclipse.platform.debug-3b05431a9d5d756ccb9aeced0fe61ddb3d3070df.zip |
memory view API - draft
Diffstat (limited to 'org.eclipse.debug.ui')
7 files changed, 697 insertions, 0 deletions
diff --git a/org.eclipse.debug.ui/schema/memoryRenderings.exsd b/org.eclipse.debug.ui/schema/memoryRenderings.exsd new file mode 100644 index 000000000..27fdce8de --- /dev/null +++ b/org.eclipse.debug.ui/schema/memoryRenderings.exsd @@ -0,0 +1,246 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Schema file written by PDE --> +<schema targetNamespace="org.eclipse.debug.ui"> +<annotation> + <appInfo> + <meta.schema plugin="org.eclipse.debug.ui" id="memoryRenderings" name="Memory Renderings"/> + </appInfo> + <documentation> + Allows plug-ins to contribute arbitrary renderings for memory blocks. For example, a rendering may translate raw bytes of a memory block into ASCII characters. + </documentation> + </annotation> + + <include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/> + + <element name="extension"> + <complexType> + <choice> + <element ref="renderingType" minOccurs="0" maxOccurs="unbounded"/> + <element ref="renderingBindings" minOccurs="0" maxOccurs="unbounded"/> + <element ref="defaultRenderings" minOccurs="0" maxOccurs="unbounded"/> + </choice> + <attribute name="point" type="string" use="required"> + <annotation> + <documentation> + a fully qualified identifier of the target extension point + </documentation> + </annotation> + </attribute> + <attribute name="id" type="string"> + <annotation> + <documentation> + an optional identifier of the extension instance + </documentation> + </annotation> + </attribute> + <attribute name="name" type="string"> + <annotation> + <documentation> + an optional name of the extension instance + </documentation> + </annotation> + </attribute> + </complexType> + </element> + + <element name="renderingType"> + <annotation> + <documentation> + This element defines a rendering. A rendering is comprised of an id, a name, an optional rendering factory, and an optional list of rendering properties. + </documentation> + </annotation> + <complexType> + <attribute name="name" type="string" use="required"> + <annotation> + <documentation> + human-readable name of this rendering type + </documentation> + <appInfo> + <meta.attribute translatable="true"/> + </appInfo> + </annotation> + </attribute> + <attribute name="id" type="string" use="required"> + <annotation> + <documentation> + unique identifier for this rendering + </documentation> + </annotation> + </attribute> + <attribute name="class" type="string" use="required"> + <annotation> + <documentation> + fully qualified name of the Java class that implements <code>org.eclipse.debug.ui.memory.IMemoryRenderingFactory</code> + </documentation> + <appInfo> + <meta.attribute kind="java"/> + </appInfo> + </annotation> + </attribute> + </complexType> + </element> + + <element name="renderingBindings"> + <annotation> + <documentation> + Binds memory blocks with available renderings. + </documentation> + </annotation> + <complexType> + <sequence> + <element ref="enablement" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + <attribute name="renderingIds" type="string"> + <annotation> + <documentation> + comma delimited list of memory renderings available for the associated type of memory block. When unspecified a <code>class</code> must be specified. Only one of <code>renderingIds</code> and <code>class</code> may be specified. + </documentation> + </annotation> + </attribute> + <attribute name="class" type="string"> + <annotation> + <documentation> + fully qualified name of the Java class that implements <code>org.eclipse.debug.ui.memory.IMemoryRenderingTypeProvider</code>, allowing for dynamic rendering bindings. When unspecified, <code>renderingIds</code> must be specified. Only one of <code>renderingIds</code> and <code>class</code> may be specified. + </documentation> + <appInfo> + <meta.attribute kind="java"/> + </appInfo> + </annotation> + </attribute> + </complexType> + </element> + + <element name="defaultRenderings"> + <annotation> + <documentation> + Specifies the default renderings to create for memory blocks. + </documentation> + </annotation> + <complexType> + <sequence> + <element ref="enablement" minOccurs="1" maxOccurs="unbounded"/> + </sequence> + <attribute name="renderingIds" type="string"> + <annotation> + <documentation> + comma delimited list of of memory renderings to be created by default for memory blocks of the associated type. Memory renderings are specified via their <code>renderingId</code>. An equivalent rendering binding must exist for a default rendering to be considered. When unspecified, <code>primaryId</code> must be specified. + </documentation> + </annotation> + </attribute> + <attribute name="primaryId" type="string"> + <annotation> + <documentation> + specifies the id of the rendering to be considered primary. When there is more than one default rendering bound to a memory block, the UI may use the information to determine which rendering should be made visible (i.e the primrary one). + </documentation> + </annotation> + </attribute> + </complexType> + </element> + + <annotation> + <appInfo> + <meta.section type="since"/> + </appInfo> + <documentation> + 3.1 - replacement for memoryRenderingTypes extension point which was considered experimental in 3.0 + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="examples"/> + </appInfo> + <documentation> + The following is an example for defining a new rendering type. + +<p> +<pre> +<extension + id="org.eclipse.debug.ui.renderings" + name="Sample Rendering Type" + point="org.eclipse.debug.ui.memoryRenderingTypes"> + <rendering + name="Sample Rendering" + renderingId="com.example.sampleRendering" + renderingFactory="com.example.SampleRenderingsFactory"> + <renderingProperty + name="viewTabFactory" + value="com.example.SampleViewTabFactory"> + </renderingProperty> + <viewBinding viewIds="org.eclipse.debug.ui.MemoryView.RenderingViewPane"/> + </rendering> +</extension> +</pre> +</p> + +In the above example, a new rendering type, Sample Rendering, is defined. This rendering type supports the rendering view pane from the Memory View. +<br><br> +The following is an example for allowing Sample Rendering to be displayed in the rendering view pane from the Memory View. +<p> +<pre> +<extension + id="com.example" + name="Sample Rendering Extension" + point="org.eclipse.debug.ui.memoryRenderingTypes"> + <renderingBinding + renderingIds="com.example.sampleRendering"> + <enablement> + <instanceof value="com.example.SampleMemoryBlock"/> + </enablement> + </renderingBinding> + <defaultRenderings + renderingIds="com.example.sampleRendering"> + <enablement> + <instanceof value="com.example.SampleMemoryBlock"/> + </enablement> + </defaultRenderings> +</extension> +</pre> +</p> + +In the above example, the Sample Rendering is defined as a valid rendering for SampleMemoryBlock. Whenever SampleMemoryBlock is created in the Memory View, a Sample Rendering will be created. + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="apiInfo"/> + </appInfo> + <documentation> + <p> +<li>Value of the attribute <b>renderingFactory </b> must be a fully qualifed name of a Java class that implements <b>IMemoryRenderingFactory</b>.</li> +<li>Value of the attribute <b> value </b> from the <b>viewTabFactory</b> rendering property must be a fully qualifed name of a Java class that implements <b>IMemoryViewTabFactory</b>.</li> +<li>Value of the attribute <b>instanceof</b> from the <b> enablement </b> element must be a fully qualified name of a Java class that implements the interface <b>IMemoryBlock</b>.</li> +</p> + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="implementation"/> + </appInfo> + <documentation> + The debug platform provides the following rendering types:<br> +<li>Hex Rendering (rendering id: org.eclipse.debug.ui.rendering.raw_memory)</li> +<li>ASCII Rendering (rendering id: org.eclipse.debug.ui.rendering.ascii)</li> +<li>Signed Integer Rendering (rendering id: org.eclipse.debug.ui.rendering.signedint)</li> +<li>Unsigned Integer Rendering (rendering id: org.eclipse.debug.ui.rendering.unsignedint) </li> +<br> +The debug platform provides a memory view to host renderings. + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="copyright"/> + </appInfo> + <documentation> + Copyright (c) 2004 IBM Corporation and others.<br> +All rights reserved. This program and the accompanying materials are made +available under the terms of the Common Public License v1.0 which +accompanies this distribution, and is available at +<a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a> + </documentation> + </annotation> + +</schema> diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryBlockTablePresentation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryBlockTablePresentation.java new file mode 100644 index 000000000..b801e5fbf --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryBlockTablePresentation.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + + +package org.eclipse.debug.ui.memory; + +import java.math.BigInteger; +import org.eclipse.debug.core.model.IMemoryBlock; +import org.eclipse.debug.ui.IDebugModelPresentation; + + +/** + * Allows debug models to customize the rendering of addresses for its memory blocks + * in text based renderings provided by the debug platform. + * + * TODO: extension point definition and example + * + * @since 3.1 + */ +public interface IMemoryBlockTablePresentation extends IDebugModelPresentation +{ + + /** + * Returns a collection of labels to head columns in a <code>TODO: add class name</code> + * rendering, or <code>null</code> if default labels should be used. + * + * @param blk memory block + * @param bytesPerLine the number if bytes to be displayed + * @param numColumns the number of columns the bytes are divided into + * @return a collection of labels to head columns in a <code>TODO: add class name</code> + * rendering, or <code>null</code> if default labels should be used + */ + public String[] getColumnLabels(IMemoryBlock blk, int bytesPerLine, int numColumns); + + + /** + * Renders and returns a label for a row starting at the given address within the given + * memory block, or <code>null</code> if default rendering should be used. + * + * @param blk memory block + * @param address an address in the memory block + * @return a label for a row starting at the given address within the given + * memory block, or <code>null</code> if default rendering should be used + */ + public String getRowLabel(IMemoryBlock blk, BigInteger address); + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRendering.java new file mode 100644 index 000000000..3c9c56635 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRendering.java @@ -0,0 +1,174 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.ui.memory; + +import org.eclipse.debug.core.model.IMemoryBlock; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** + * An arbitrary rendering of a memory block. A memory rendering is contributed + * via the <code>memoryRenderings</code> extension point. + * <p> + * Following is an example definition of a memory renderings extension. + * <pre> + * <extension point="org.eclipse.debug.ui.memoryRenderings"> + * <memoryRenderingType + * id="com.example.asciiRendering" + * name="ASCII" + * class="com.example.RenderingFactory"> + * </memoryRenderingType> + * </extension> + * </pre> + * The attributes are specified as follows: + * <ul> + * <li><code>id</code> specifies a unique identifier for a type of memory rendering</li> + * <li><code>name</code> specifies a human readable label for a rendering type</li> + * <li><code>class</code> specifies the fully qualified name of the Java class + * that implements <code>IMemoryRenderingFactory</code>. Renderings are created + * via this factory.</li> + * </ul> + * </p> + * <p> + * A rendering provides an image and label. To support dynamic labels and images, property + * change notification is used with the following property constants defined in + * <code>IBasicPropertyConstants</code>: + * <ul> + * <li><code>P_TEXT</code> - indicates a label change</li> + * <li><code>P_IMAGE</code> - indicates a image change</li> + * </ul> + * </p> + * <p> + * Renderings needing to synchronize with other renderings are intended to use + * property change notifications via its synchronization service. For example, when a + * rendering becomes visible, it can register for property change events with its rendering + * site's synchronization service, and when it becomes hidden it can deregister. When a + * rendering is activated, it should set itself as the synchrnoization provider in its + * rendering site and fire property change events to communicate information to + * interested listeners. + * </p> + * <p> + * Clients contributing a memory rendering type are intended to implement this interface + * and <code>IMemoryRenderingFactory</code>. The factory will be used to create instances + * of <code>IMemoryRendering</code>. + * </p> + * @since 3.1 + */ +public interface IMemoryRendering { + + /** + * Initializes this rendering to be hosted in the given view, displaying + * the given memory block. This method is called before this rendering's control + * has been created. + * + * @param site container hosting this rendering + * @param block the memory block to render + */ + public void init(IMemoryRenderingSite site, IMemoryBlock block); + + /** + * Creates the top level control for this rendering under the given parent composite. + * This method is called after this rendering's <code>init</code> method has been + * called. + * <p> + * Implementors are responsible for ensuring that + * the created control can be accessed via <code>getControl</code> + * </p> + * + * @param parent the parent composite + */ + public Control createControl(Composite parent); + + /** + * Returns the top level control for this rendering. + * <p> + * May return <code>null</code> if the control + * has not been created yet. + * </p> + * + * @return the top level control or <code>null</code> + */ + public Control getControl(); + + /** + * Disposes this rendering. + */ + public void dispose(); + + /** + * Notification this rendering has become the active rendering. + */ + public void activated(); + + /** + * Notification this rendering is no longer the active rendering. + */ + public void deactivated(); + + /** + * Notification this rendering has become visible in its container. + * Note that a rendering does not have to be active to be visible. + */ + public void becomesVisible(); + + /** + * Notification this rendering has become hidden in its container. + */ + public void becomesHidden(); + + /** + * @return if the rendering is enabled + */ + public boolean isEnabled(); + + /** + * @return the memory block displayed by this rendering. + */ + public IMemoryBlock getMemoryBlock(); + + /** + * @return the rendering id of this rendering. + */ + public String getRenderingId(); + + /** + * Adds a listener for property changes to this rendering. + * Has no effect if an identical listener is already registered. + * + * @param listener a property change listener + */ + public void addPropertyChangeListener(IPropertyChangeListener listener); + + /** + * Removes the given property change listener from this rendering. + * Has no effect if the identical listener is not registered. + * + * @param listener a property change listener + */ + public void removePropertyChangeListener(IPropertyChangeListener listener); + + /** + * Returns an image for this rendering. + * + * @return an image for this rendering + */ + public Image getImage(); + + /** + * Returns a label for this rendering. + * + * @return a label for this rendering + */ + public String getLabel(); + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingFactory.java new file mode 100644 index 000000000..c28b3e56a --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingFactory.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.ui.memory; + +/** + * A factory that creates memory renderings. + * <p> + * Clients contributing a memory rendering type are intended to implement this + * interface. The factory will be used to create renderings. + * </p> + * @since 3.1 + */ +public interface IMemoryRenderingFactory { + + /** + * Creates a rendering of the given type. + * Return null if the rendering is not to be created. Creation of a memory + * has been canceled. No error message will be displayed. + * Throws an exception if an error has occurred. + * @param id unique identifier of a memory rendering type + * @return a new rendering of the given type + */ + public IMemoryRendering createRendering(String id) throws Exception; + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingManager.java new file mode 100644 index 000000000..e1986d821 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingManager.java @@ -0,0 +1,87 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.ui.memory; + +import org.eclipse.debug.core.model.IMemoryBlock; + + +/** + * Manager for memory renderings. Provides facilities for creating + * renderings. + * <p> + * Clients are not intended to implement this interface. + * </p> + * @since 3.1 + */ +public interface IMemoryRenderingManager { + + /** + * Creates and returns a rendering specified by the given identifier, + * or <code>null</code> if none. + * + * @param id identifier of the rendering type to create + * @return specified rendering or <code>null</code> if none + */ + public IMemoryRendering createRendering(String id); + + /** + * Returns all contributed memory rendering types. + * + * @return all contributed memory rendering types + */ + public IMemoryRenderingType[] getRenderingTypes(); + + /** + * Returns the memory rendering type with the given identifier, or + * <code>null</code> if none. + * + * @param id memory rendering type identifier + * @return the memory rendering type with the given identifier, or + * <code>null</code> if none + */ + public IMemoryRenderingType getRenderingType(String id); + + /** + * Returns a collection of rendering types that are defined as the default + * rendering types for the given memory block, possibly empty. If a primary + * rendering was specified as part of a memory block's default bindings, + * it will appear first in the list. + * + * @param block memory block + * @return a collection of rendering types that are defined as the default + * rendering types for the given memory block, possibly empty + */ + public IMemoryRenderingType[] getDefaultRenderingTypes(IMemoryBlock block); + + /** + * Returns the default rendering type specified as the primary rendering + * type for a memory block, or <code>null</code> if none. + * + * @param block memory block + * @return the default rendering type specified as the primary rendering + * type for a memory block, or <code>null</code> if none + */ + public IMemoryRenderingType[] getPrimaryRenderingType(IMemoryBlock block); + + /** + * Returns a collection of all rendering types that are bound to + * the given memory block, possibly empty. This includes default + * and dynamic rendering types bound to the memory block. + * + * @param block memory block + * @return a collection of all rendering types that are bound to + * the given memory block, possibly empty + */ + public IMemoryRenderingType[] getRenderingTypes(IMemoryBlock block); + +} + + diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSite.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSite.java new file mode 100644 index 000000000..fb0e80701 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSite.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.ui.memory; + +import org.eclipse.ui.IViewSite; + +/** + * A workbench site that hosts memory renderings and provides synchronization services + * for memory renderings. + * <p> + * A rendering site has an optional synchronization provider at any one time. If a + * rendering provides synchronization information it should set itself as the synchronization + * prodiver for its memory rendering site when it is activated. + * </p> + * + * @since 3.1 + */ +public interface IMemoryRenderingSite { + + /** + * Returns the view site hosting memory renderings for this rendering site. + * + * @return the view site hosting memory renderings for this rendering site + */ + public IViewSite getViewSite(); + + /** + * Returns the syncrhonization serivce for this rendering site. + * + * @return the syncrhonization serivce for this rendering site + */ + public IMemoryRenderingSynchronizationService getSynchronizationService(); + + /** + * Sets the rendering currently providing sychronization information for + * this rendering site, or <code>null</code> if none. + * + * @param rendering active rendering providing synchronization information or + * <code>null</code> + */ + public void setSynchronizationProvider(IMemoryRendering rendering); +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSynchronizationService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSynchronizationService.java new file mode 100644 index 000000000..380b8b0c5 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSynchronizationService.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.ui.memory; + +import org.eclipse.debug.core.model.IMemoryBlock; +import org.eclipse.jface.util.IPropertyChangeListener; + + +/** + * Provides facilities related to the synchronization of memory renderings. + */ +public interface IMemoryRenderingSynchronizationService { + + /** + * Adds a listener for property changes notification for the specified properties. + * Specifying <code>null</code> indicates that the listener is interested in all + * properties. If an identical listener is already registered, the properties + * it is registered to listen for are updated. + * + * @param listener a property change listener + * @param properites properties the listener is interested in, or <code>null</code> + * to indicate all properties. + */ + public void addPropertyChangeListener(IPropertyChangeListener listener, String[] properties); + + /** + * Removes the given listener for property change notification. + * Has no effect if the identical listener is not registered. + * + * @param listener a property change listener + */ + public void removePropertyChangeListener(IPropertyChangeListener listener); + + /** + * Returns the current value of the specified property for the given memory block, or + * <code>null</code> if none. + * + * @param block memory block for which a property is requested + * @param property the name of the property + * @return the property value or <code>null</code> + */ + public Object getProperty(IMemoryBlock block, String property); + +} |