KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > views > memory > AbstractMemoryRenderer


1 /*******************************************************************************
2  * Copyright (c) 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.views.memory;
12
13 import java.math.BigInteger JavaDoc;
14 import org.eclipse.debug.internal.core.memory.MemoryByte;
15
16
17 /**
18  * A rederer is a class that is responsible to convert data in byte
19  * into a string and vice versa.
20  *
21  * @since 3.0
22  */

23 abstract public class AbstractMemoryRenderer {
24     
25     protected IMemoryViewTab fViewTab;
26     protected String JavaDoc fRenderingId;
27     
28     /**
29      * Sets the view tab of which the renderer is rendering for.
30      * @param viewTab
31      */

32     public void setViewTab(IMemoryViewTab viewTab){
33         fViewTab = viewTab;
34     }
35     
36     /**
37      * Sets the rendering id of this renderer.
38      * @param rederingId
39      */

40     public void setRenderingId(String JavaDoc rederingId){
41         fRenderingId = rederingId;
42     }
43     
44     /**
45      * This is called by the label provider for IMemoryViewTab
46      * Implementor can reuse a memory view tab and presents data in a different format.
47      * @param dataType - type of data the bytes hold
48      * @param address - addres where the bytes belong to
49      * @param data - the bytes
50      * @param paddedStr - fill each byte that is invalid with this padded string.
51      * @return a string to represent the memory.
52      * Do not return null. Return a string to pad the cell if the memory cannot be converted successfully.
53      */

54     abstract public String JavaDoc getString(String JavaDoc dataType, BigInteger JavaDoc address, MemoryByte[] data, String JavaDoc paddedStr);
55     
56     /**
57      * This is called by the cell modifier from an IMemoryViewTab.
58      * Implementor will convert the string value to an array of bytes. The bytes will
59      * be passed to the debug adapter for memory block modification.
60      * Return null if the byte cannot be formatted properly.
61      * @param dataType - type of data the string represents
62      * @param address - address where the bytes belong to
63      * @param currentValues - current values of the data in bytes format
64      * @param data - the string to be converted to bytes
65      * @return the bytes to be passed to debug adapter for modification.
66      */

67     abstract public byte[] getBytes(String JavaDoc dataType, BigInteger JavaDoc address, MemoryByte[] currentValues, String JavaDoc data);
68
69 }
70
Popular Tags