boolean (@NotNull Project project, @NotNull AbstractInjectionPanel panel, @Nullable String dimensionServiceKey, @Nullable String helpId) { final DialogBuilder builder = new DialogBuilder(project); builder.setHelpId(helpId); builder.addOkAction(); builder.addCancelAction(); builder.setDimensionServiceKey(dimensionServiceKey); builder.setCenterPanel(panel.getComponent()); builder.setTitle(IntelliLangBundle.message("language.injection.settings.title")); builder.setOkOperation(() -> { try { panel.apply(); builder.getDialogWrapper().close(DialogWrapper.OK_EXIT_CODE); } catch (Exception e) { final Throwable cause = e.getCause(); final String message = e.getMessage() + (cause != null? "\n "+cause.getMessage():""); Messages.showErrorDialog(project, message, IntelliLangBundle.message("dialog.title.unable.to.save")); } }); return builder.show() == DialogWrapper.OK_EXIT_CODE; }