主控台頁面參與者

org.eclipse.ui.console.consolePageParticipants

3.1

此延伸點提供了提出主控台頁面參與者的機制。主控台頁面參與者會收到頁面生命週期事件通知,例如建立、啟動、取消啟動和除去。頁面參與者也可以提供頁面配接器。

<!ELEMENT extension (consolePageParticipant)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT consolePageParticipant (enablement)>

<!ATTLIST consolePageParticipant

id    CDATA #REQUIRED

class CDATA #REQUIRED>


<!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.ui.console.consolePageParticipants"

>

<consolePageParticipant class=

"com.example.ExamplePageParticipant"

id=

"com.example.ExamplePageParticipant"

>

<enablement>

<instanceof value=

"com.example.ExampleConsole"

/>

</enablement>

</consolePageParticipant>

</extension>

在以上的範例中,提供的主控台頁面參與者將會用於所有類型為 "com.example.ExampleConsole" 的主控台。

class 屬性的值必須是實作 org.eclipse.ui.console.IConsolePageParticipant 介面的 Java 類別的完整名稱。