InspectionGadgetsFix (Object... infos) { return new InspectionGadgetsFix() { @NotNull @Override public String getFamilyName() { return InspectionGadgetsBundle.message("create.package.info.java.family.name"); } @Override public boolean startInWriteAction() { return false; } @Override protected void doFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { DataManager.getInstance() .getDataContextFromFocusAsync() .onSuccess(context -> { final AnActionEvent event = new AnActionEvent(null, context, "", new Presentation(), ActionManager.getInstance(), 0); new CreatePackageInfoAction().actionPerformed(event); }); } @Override public @NotNull IntentionPreviewInfo generatePreview(@NotNull Project project, @NotNull ProblemDescriptor previewDescriptor) { Icon icon = FileTypeRegistry.getInstance().getFileTypeByFileName("package-info.java").getIcon(); HtmlChunk fragment = HtmlChunk.fragment(HtmlChunk.text(getFamilyName()), HtmlChunk.icon("file", icon)); return new IntentionPreviewInfo.Html(fragment); } }; }