主控台型樣相符接聽器

org.eclipse.ui.console.consolePatternMatchListeners

3.1

提供符合文字主控台的正規表示式。使用啟用表示式,可以提供型樣相符接聽器給特定的主控台。找到相符項時會通知接聽器。

<!ELEMENT extension (consolePatternMatchListener*)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT consolePatternMatchListener (enablement)>

<!ATTLIST consolePatternMatchListener

id        CDATA #REQUIRED

class     CDATA #REQUIRED

regex     CDATA #REQUIRED

flags     CDATA #IMPLIED

qualifier 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.ui.console.consolePatternMatchListener"

>

<consolePatternMatchListener class=

"com.example.ExampleConsolePatternMatcher"

id=

"com.example.ExampleConsolePatternMatcher"

regex=

".*foo.*"

>

<enablement>

<test property=

"org.eclipse.ui.console.consoleTypeTest"

value=

"exampleConsole"

/>

</enablement>

</consolePatternMatchListener>

</extension>

在以上的範例中,提供的主控台型樣媒合器將會用於類型為 "exampleConsole" 的主控台。

屬性 class 的值必須為一個 Java 類別的完整名稱,實作介面 org.eclipse.ui.console.IPatternMatchListenerDelegate

主控台外掛程式為測試 IConsole.getType() 值的啟用表示式提供了一個主控台類型內容測試程式。內容測試程式的 ID 為 org.eclipse.ui.console.consoleTypeTest