/// <inheritdoc/> public void Process( IPsiSourceFile sourceFile, IRangeMarker rangeMarker, CodeCleanupProfile profile, IProgressIndicator progressIndicator) { IPsiServices psiServices = sourceFile.GetPsiServices(); IPsiFiles psiFiles = psiServices.Files; IContextBoundSettingsStore settings = sourceFile.GetSettingsStore(); var orderUsingSettings = settings.GetKey <OrderUsingsSettings>(SettingsOptimization.DoMeSlowly); OrderUsingsConfiguration config = null; if (!string.IsNullOrWhiteSpace(orderUsingSettings.OrderSpecificationXml)) { config = ConfigurationSerializer.FromXml(new StringReader(orderUsingSettings.OrderSpecificationXml)); } if (config == null) { return; } var file = psiFiles.GetDominantPsiFile <CSharpLanguage>(sourceFile) as ICSharpFile; if (file == null) { return; } if (!profile.GetSetting(DescriptorInstance)) { return; } file.GetPsiServices().Transactions.Execute( "Code cleanup", () => { using (_shellLocks.UsingWriteLock()) { CleanUsings(file, config); WalkNamespaceDeclarations(file.NamespaceDeclarations, config); } }); }