啟動捷徑

org.eclipse.debug.ui.launchShortcuts

這個延伸點提供敏感性啟動選項的支援。延伸登錄的捷徑會出現在執行和/或除錯階式排列功能表中, 以啟動工作台選項或作用中的編輯器。

<!ELEMENT extension (shortcut*)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT shortcut (perspective* , contextualLaunch? , enablement?)>

<!ATTLIST shortcut

id            CDATA #REQUIRED

modes         CDATA #REQUIRED

class         CDATA #REQUIRED

label         CDATA #REQUIRED

icon          CDATA #IMPLIED

category      CDATA #IMPLIED

helpContextId CDATA #IMPLIED

path          CDATA #IMPLIED>


<!ELEMENT perspective EMPTY>

<!ATTLIST perspective

id CDATA #REQUIRED>

perspective 元素在 3.1 版中已經廢除。現在,最上層的「執行/除錯/設定檔」階層式功能表可支援環境定義(可區分選項)啟動, 而用戶端應該改為提供 contextualLaunch 元素。



<!ELEMENT contextualLaunch (contextLabel* , enablement?)>

保留所有新增捷徑至可區分選項「執行/除錯/設定檔」階層式功能表的說明。



<!ELEMENT contextLabel EMPTY>

<!ATTLIST contextLabel

mode  (run|debug|profile)

label 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.debug.ui.launchShortcuts"

>

<shortcut id=

"com.example.ExampleLaunchShortcutId"

modes=

"run,debug"

class=

"com.example.ExampleLaunchShortcutImpl"

label=

"Example Launch Shortcut"

icon=

"icons/examples.gif"

>

<perspective id=

"org.eclipse.jdt.ui.JavaPerspective"

/>

<perspective id=

"org.eclipse.debug.ui.DebugPerspective"

/>

</shortcut>

</extension>

上述範例中,啟動捷徑在執行和除錯階式排列功能表中將顯示為「範例啟動捷徑」標籤(在 JavaPerspective 和 DebugPerspective 之中)。

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

從 3.1 開始,除錯平台會針對每一個啟動捷徑及其適用模式來登錄一個指令處理常式,以允許用戶端為啟動捷徑定義按鍵連結。處理常式的指令 ID 會產生為啟動捷徑 ID 屬性,再加上一個句點和適用的啟動模式。例如,上述啟動捷徑範例的指令 ID 是 com.example.ExampleLaunchShortcutId.debug,代表在除錯模式中啟動。指令和按鍵連結可以依照下列方式來定義,以將 "ALT-SHIFT-D, E" 連結到啟動捷徑。

   

<extension point=

"org.eclipse.ui.commands"

>

<command name=

"Debug Example Launch"

description=

"除錯範例啟動"

categoryId=

"org.eclipse.debug.ui.category.run"

id=

"com.example.ExampleLaunchShortcutId.debug"

>

</command>

<keyBinding keySequence=

"M3+M2+D E"

contextId=

"org.eclipse.ui.globalScope"

commandId=

"com.example.ExampleLaunchShortcutId.debug"

keyConfigurationId=

"org.eclipse.ui.defaultAcceleratorConfiguration"

>

</keyBinding>

</extension>