void (@NotNull VirtualFile directory) { SideEffectGuard.checkSideEffectAllowed(SideEffectGuard.EffectType.SETTINGS); if (!directory.isDirectory()) return; if (canBeMarked(directory)) { myNamespacePackageFolders.add(directory); PyNamespacePackagesStatisticsCollector.logToggleMarkingAsNamespacePackage(true); } else if (isMarked(directory)) { myNamespacePackageFolders.remove(directory); PyNamespacePackagesStatisticsCollector.logToggleMarkingAsNamespacePackage(false); } else { throw new IllegalStateException("Can't toggle namespace package state for: " + directory.getName()); } refreshView(); }