[英]Intellij idea plugin development : plugin not enabled on right click on project
我已經開發了一個intellij想法的插件,在項目上單擊鼠標右鍵,我會得到該插件的名稱,但是它始終處於禁用狀態。 如何啟用該插件。 這是我的plugin.xml代碼:
<actions>
<group id="GenerateCRUDAction.GenerateCRUD" text="_GenerateCRUD" description="GenerateCRUD" popup="true">
<action id="generateCrud" class="com.im.ui.crud.GenerateCrudAction" text="generateCrud"
description="generateCrud action">
</action>
<add-to-group group-id="ProjectViewPopupMenuRunGroup" anchor="last"/>
</group>
</actions>
您必須在操作的update()
方法中啟用演示,在哪里應檢查輸入是否對您的情況有效。
@Override
public void update(@NotNull AnActionEvent e) {
final Presentation presentation = e.getPresentation();
final Project project = e.getProject();
if (project == null) {
presentation.setEnabledAndVisible(false);
return;
}
presentation.setEnabledAndVisible(true);
}
您可以檢查Eclipser插件的源代碼,在這里您將找到實現的詳細示例。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.