void (@NotNull AnActionEvent e) { Module module = e.getData(PlatformCoreDataKeys.MODULE); if (module == null) { return; } VirtualFile[] contentRoots = ModuleRootManager.getInstance(module).getContentRoots(); if (contentRoots.length == 0) { return; } Sdk sdk = PythonSdkUtil.findPythonSdk(module); if (sdk == null) { return; } final PythonSpellcheckerDictionaryGenerator generator = new PythonSpellcheckerDictionaryGenerator(module.getProject(), contentRoots[0].getPath() + "/dicts"); VirtualFile[] roots = sdk.getRootProvider().getFiles(OrderRootType.CLASSES); for (VirtualFile root : roots) { if (root.getName().equals("Lib")) { generator.addFolder("python", root); generator.excludeFolder(root.findChild("test")); generator.excludeFolder(root.findChild("site-packages")); } else if (root.getName().equals("site-packages")) { VirtualFile djangoRoot = root.findChild("django"); if (djangoRoot != null) { generator.addFolder("django", djangoRoot); } } } generator.generate(); }