void (@NotNull List<String> args) { try { DocumentBuilder builder = JavaXmlDocumentKt.createDocumentBuilder(); Document document = builder.newDocument(); Element intentions = document.createElement("Intentions"); document.appendChild(intentions); while (((IntentionManagerImpl)IntentionManager.getInstance()).hasActiveRequests()) { TimeoutUtil.sleep(100); } for (IntentionActionMetaData actionMetaData : IntentionManagerSettings.getInstance().getMetaData()) { Element intention = document.createElement("Intention"); intention.setAttribute("categories", StringUtil.join(actionMetaData.myCategory, ",")); intention.setAttribute("name", actionMetaData.getFamily()); Element description = document.createElement("description"); CDATASection descriptionSection = document.createCDATASection(escapeCDATA(actionMetaData.getDescription().getText())); description.appendChild(descriptionSection); intention.appendChild(description); TextDescriptor[] beforeDescriptors = actionMetaData.getExampleUsagesBefore(); if (beforeDescriptors.length > 0) { Element before = document.createElement("before"); CDATASection beforeSection = document.createCDATASection(escapeCDATA(beforeDescriptors[0].getText())); before.appendChild(beforeSection); intention.appendChild(before); } TextDescriptor[] afterDescriptors = actionMetaData.getExampleUsagesAfter(); if (afterDescriptors.length > 0) { Element after = document.createElement("after"); CDATASection afterSection = document.createCDATASection(escapeCDATA(afterDescriptors[0].getText())); after.appendChild(afterSection); intention.appendChild(after); } intentions.appendChild(intention); } Transformer transformer = TransformerFactory.newDefaultInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); DOMSource source = new DOMSource(document); final String path = args.size() == 2 ? args.get(1) : PathManager.getHomePath() + File.separator + "AllIntentions.xml"; StreamResult console = new StreamResult(new File(path)); transformer.transform(source, console); System.exit(0); } catch (IOException | TransformerException e) { // noinspection CallToPrintStackTrace e.printStackTrace(); System.exit(1); } }