我正在開發NetBeans模塊,並且已經聲明瞭一個與我的自定義項目類型(EsperProject類)一起工作的操作(使用註釋,它們被轉換爲layer.xml記錄):NetBeans模塊中的操作 - 上下文菜單,主菜單
@ActionID(category = "Run", id = "my.package.RunEsperAction")
@ActionRegistration(displayName = "My Action", asynchronous=true)
@ActionReferences({
@ActionReference(path = "Menu/BuildProject", position = 0)
})
public final class RunEsperAction implements ActionListener {
private final EsperProject project;
public RunEsperAction(EsperProject project) {
this.project = project;
}
@Override
public void actionPerformed(ActionEvent ev) {
// do sth with project
}
}
我可以運行從BuildProject菜單中選擇操作(這是actualy運行菜單),但我不能讓它在兩種情況下工作,我需要(這兩個異步調用作爲註解來聲明):
- 我想從項目上下文菜單中運行該操作。
- 我需要從主菜單項「運行主項目」中運行我的EsperProject時觸發的操作 。
感謝您的任何建議。