我是Intellij IDEA插件和Java的新手。我写了我的第一个插件,用于检查carret pos并替换px-> rem。效果很好,但我想更进一步,并制作一个用于字符串操作的新插件,该插件显示一个小的弹出窗口,当按下快捷键并显示选项时,我可以在其中使用箭头键和Enter /空格键进行选择项目。
但是我似乎无法在Intellij插件文档中找到类似这样的信息。
请注意,我不想在右键单击上添加选项,而是想在插件使用actionPerformed
检测到操作时触发此小菜单。
答案 0 :(得分:0)
您可以使用查找来实现:
LookupImpl lookup = (LookupImpl) LookupManager.getInstance(project).createLookup(editor, LookupElement.EMPTY_ARRAY, "", new LookupArranger.DefaultArranger());
lookup.addItem(LookupElementBuilder.create("Opt 1"), myPrefixMatcher);
lookup.addItem(LookupElementBuilder.create("Opt 2"), myPrefixMatcher);
lookup.showLookup();