void (final Module module, final String className) { final List<Path> files = new ArrayList<>(); final List<String> list = OrderEnumerator.orderEntries(module).recursively().runtimeOnly().getPathsList().getPathList(); for (String path : list) { files.add(Paths.get(path)); } final Project project = module.getProject(); PathClassLoader loader = new PathClassLoader(UrlClassLoader.build().files(files).parent(XmlSerializer.class.getClassLoader())); final Class<?> aClass; try { aClass = loader.loadClass(className); } catch (ClassNotFoundException e) { Messages.showErrorDialog(project, DevKitBundle.message("action.ShowSerializedXml.message.cannot.find.class", className), CommonBundle.getErrorTitle()); LOG.info(e); return; } final Object o; try { o = new SampleObjectGenerator().createValue(aClass, FList.emptyList()); } catch (Exception e) { Messages.showErrorDialog(project, DevKitBundle.message("action.ShowSerializedXml.message.cannot.generate.class", className, e.getMessage()), CommonBundle.getErrorTitle()); LOG.info(e); return; } final Element element; try { element = XmlSerializer.serialize(o); } catch (SerializationException e) { LOG.info(e); Throwable cause = e.getCause(); Messages.showErrorDialog(project, e.getMessage() + (cause != null ? ": " + cause.getMessage() : ""), CommonBundle.getErrorTitle()); return; } final @NlsSafe String text = JDOMUtil.writeElement(element); Messages.showIdeaMessageDialog(project, text, DevKitBundle.message("action.ShowSerializedXml.dialog.title", className), new String[]{CommonBundle.getOkButtonText()}, 0, Messages.getInformationIcon(), null); }