我正在使用動態MenuContribution
,並得到警告說我的兩個引用標識符「無法找到」。即使貢獻有效。這些警告讓我煩惱。動態MenuContribution - 獲取警告
我在我的一個插件中定義了一個實現。基本上,它看起來是這樣的:
public class ViewerHistoryMenuItems extends CompoundContributionItem
implements IExecutableExtension {
private static final String PARAM_TYPE = "type";
private static final String PARAM_COMMAND = "command";
// some fields
public void setInitializationData(final IConfigurationElement config,
final String propertyName, final Object data) {
/* set fields */
}
protected final IContributionItem[] getContributionItems() {
/* create Items */
}
}
在其他插件我用這個ContributionItem
實現通過聲明如下:在問題 - 視圖
<menuContribution locationURI="menu:mylocationUri">
<dynamic id="myId">
<class class="ViewerHistoryMenuItems">
<parameter
name="type"
value="someValue">
</parameter>
<parameter
name="command"
value="someCommandId">
</parameter>
</class>
</dynamic>
<command
commandId="someCommandId"
icon="anIcon.png">
</command>
</menuContribution>
當尋找我得到兩個條目有(每個插件in,which use this contribution):
**Referenced identifier 'type' in attribute 'name' cannot be found**
**Referenced identifier 'command' in attribute 'name' cannot be found**
我在這裏錯過了什麼?任何想法,爲什麼我得到這個警告?
PS:這沒有幫助,使這兩個領域PARAM_TYPE
& PARAM_COMMAND
公衆
它說「名稱是參數的名稱......」所以我想我使用了它,並且調用了一個參數「type」和另一個「command」。但我想,我必須更多地考慮你的深刻答案,VonC。 – pimpf0r 2010-02-17 12:17:52
@ pimpf0r:就是這樣:我不確定「參數的名稱」可以引用任何* internal *字段類。在聲明模式下,比如'plugin.xml',我希望參數在所述'plugin.xml'的其他地方定義好。 – VonC 2010-02-17 12:50:53
好吧,我想我找到了「別處」。在這種情況下的其他地方意味着:定義/聲明參考命令的位置。我在我的動態聲明中提到同一個plugin.xml中的一個命令。但是添加的參數沒有在那裏聲明。 感謝您的幫助,VonC。 * high5 * – pimpf0r 2010-02-17 13:41:46