建立參與者

org.eclipse.ltk.core.refactoring.createParticipants

3.0

這個延伸點用來定義重構建立參與者。表示式的讀者提供下列預先定義的變數,您可透過 <with variable="..."> 表示式元素來參照它們: 在表示式評估期間使用的預設變數會連結到 element 變數。

<!ELEMENT extension (createParticipant*)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT createParticipant (enablement)>

<!ATTLIST createParticipant

id    CDATA #REQUIRED

name  CDATA #REQUIRED

class CDATA #REQUIRED>


下列範例定義建立參與者。如果受重構影響的其中一個專案具有 Java 性質,而且要建立的元素是 folder 時, 則啟用這個參與者。

<createParticipant id=

"org.myCompany.createParticipant"

name=

"%CreateParticipant.name"

class=

"org.myCompany.CreateParticipant"

>

<enablement>

<with variable=

"affectedNatures"

>

<iterate operator=

"or"

>

<equals value=

"org.eclipse.jdt.core.javanature"

/>

</iterate>

</with>

<with variable=

"element"

>

<instanceof value=

"org.eclipse.core.resources.IFolder"

/>

</with>

</enablement>

</createParticipant>

構成的類別必須延伸 org.eclipse.ltk.core.refactoring.participants.CreateParticipant