記憶體呈現

org.eclipse.debug.ui.memoryRenderings

3.1 - 置換 memoryRenderingTypes 延伸點,在 3.0 中,這仍只是實驗性質

允許外掛程式為記憶體區塊提出任意呈現,並且將記憶體區塊連結到呈現。例如,呈現可以將記憶體區塊的原始位元組轉換成 ASCII 字元。

<!ELEMENT extension (renderingType* | renderingBindings*)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT renderingType EMPTY>

<!ATTLIST renderingType

name  CDATA #REQUIRED

id    CDATA #REQUIRED

class CDATA #REQUIRED>

這個元素可定義呈現類型。



<!ELEMENT renderingBindings (enablement*)>

<!ATTLIST renderingBindings

renderingIds CDATA #IMPLIED

primaryId    CDATA #IMPLIED

class        CDATA #IMPLIED

defaultIds   CDATA #IMPLIED>

連結具有可用呈現的記憶體區塊。



<!ELEMENT enablement (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate)*>

一般的根元素。這個元素可用於延伸點內定義其 enablement 表示式。enablement 表示式的子項是使用 and 運算子來組合。



<!ELEMENT not (not | and | or | instanceof | test | systemTest | equals | count | with | resolve | adapt | iterate)>

這個元素代表對其子元素表示式的求值結果執行的 NOT 運算。



<!ELEMENT and (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate)*>

這個元素代表對其所有子元素表示式的求值結果執行的 AND 運算。



<!ELEMENT or (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate)*>

這個元素代表對其所有子元素表示式的求值結果執行的 OR 運算。



<!ELEMENT instanceof EMPTY>

<!ATTLIST instanceof

value CDATA #REQUIRED>

這個元素是用來執行焦點物件的 instanceof 檢查。如果物件類型是屬性值指定的類型的子類型, 則這個表示式傳回 EvaluationResult.TRUE。否則傳回 EvaluationResult.FALSE。



<!ELEMENT test EMPTY>

<!ATTLIST test

property CDATA #REQUIRED

args     CDATA #IMPLIED

value    CDATA #IMPLIED>

這個元素是用來評估焦點物件的內容狀態。testable 內容集可使用內容測試程式延伸點加以延伸。如果尚未載入要執行實際測試的內容測試程式, 則 test 表示式傳回 EvaluationResult.NOT_LOADED。



<!ELEMENT systemTest EMPTY>

<!ATTLIST systemTest

property CDATA #REQUIRED

value    CDATA #REQUIRED>

呼叫 System.getProperty 方法來測試系統內容,並比較其結果與透過 value 屬性指定的值。



<!ELEMENT equals EMPTY>

<!ATTLIST equals

value CDATA #REQUIRED>

這個元素是用來執行焦點物件的相等檢查。如果物件等於屬性值提供的值, 則表示式傳回 EvaluationResult.TRUE。否則傳回 EvaluationResult.FALSE。



<!ELEMENT count EMPTY>

<!ATTLIST count

value CDATA #REQUIRED>

這個元素是用來測試集合中的元素數目。



<!ELEMENT with (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate)*>

<!ATTLIST with

variable CDATA #REQUIRED>

這個元素將要視察其所有子元素的物件變更為給定的變數所參照的物件。如果無法解析變數,則表示式在求值時會擲出 ExpressionException。with 表示式的子項是使用 and 運算子來組合。



<!ELEMENT resolve (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate)*>

<!ATTLIST resolve

variable CDATA #REQUIRED

args     CDATA #IMPLIED>

這個元素將要視察其所有子元素的物件變更為給定的變數所參照的物件。如果無法解析變數,則表示式在求值時會擲出 ExpressionException。with 表示式的子項是使用 and 運算子來組合。



<!ELEMENT adapt (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate)*>

<!ATTLIST adapt

type CDATA #REQUIRED>

這個元素是用來調整焦點物件,使它成為屬性類型指定的類型。如果配接器或參照的類型尚未載入,則表示式傳回未載入。如果類型名稱根本不存在,它會在評估期間擲出 ExpressionException。adapt 表示式的子項是使用 and 運算子來組合。



<!ELEMENT iterate (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate)*>

<!ATTLIST iterate

operator (or|and) >

這個元素是用於 java.util.Collection 類型變數的疊代。如果焦點物件不是 java.util.Collection 類型, 則在評估表示式時,將擲出 ExpressionException。



以下是定義新的呈現類型和連結的範例。

<extension point=

"org.eclipse.debug.ui.memoryRenderings"

>

<renderingType name=

"Sample Rendering"

id=

"com.example.sampleRendering"

class=

"com.example.SampleRenderingTypeDelegate"

>

</renderingType>

<renderingBindings renderingIds=

"com.example.sampleRendering"

>

<enablement>

<instanceof value=

"com.example.SampleMemoryBlock"

/>

</enablement>

</renderingBindings>

</extension>

在上面的範例中,會定義一個叫做「範例呈現」的新呈現類型。類別 com.example.SampleRenderingTypeDelegate 會實作 org.eclipse.debug.ui.memory.IMemoryRenderingTypeDelegate,並用於建立使用這個類型的新呈現。呈現會連結到 com.exmaple.SampleMemoryBlock 的實例。

  • renderingType 元素中的 class 屬性值必須是實作 org.eclipse.debug.ui.memory.IMemoryRenderingTypeDelegate 的 Java 類別完整名稱。
  • renderingBindings 元素中的 class 屬性值必須是實作 org.eclipse.debug.ui.memory.IMemoryRenderingBindingsProvider 的 Java 類別完整名稱。
  • 除錯平台會提供下列呈現類型:

  • 十六進位呈現(呈現 ID:org.eclipse.debug.ui.rendering.raw_memory)
  • ASCII 呈現(呈現 ID:org.eclipse.debug.ui.rendering.ascii)
  • 帶正負號整數呈現(呈現 ID:org.eclipse.debug.ui.rendering.signedint)
  • 不帶正負號的整數呈現(呈現 ID:org.eclipse.debug.ui.rendering.unsignedint)

  • 除錯平台提供了一個記憶體視圖來代管呈現。