void (final ActionEvent e) { final Object root = myRootsTree.getModel().getRoot(); if (root instanceof DefaultMutableTreeNode) { final Object userObject = ((DefaultMutableTreeNode)root).getUserObject(); if (userObject instanceof MigrationRootNode) { ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> { final Set<VirtualFile> files = new HashSet<>(); final TypeMigrationUsageInfo[] usages = ReadAction.compute(() -> { final Collection<? extends AbstractTreeNode<?>> children = ((MigrationRootNode)userObject).getChildren(); for (AbstractTreeNode<?> child : children) { expandTree((MigrationNode)child); } final TypeMigrationUsageInfo[] usages1 = myLabeler.getMigratedUsages(); for (TypeMigrationUsageInfo usage : usages1) { if (!usage.isExcluded()) { final PsiElement element = usage.getElement(); if (element != null) { files.add(element.getContainingFile().getVirtualFile()); } } } return usages1; }); ApplicationManager.getApplication().invokeLater(() -> { if (ReadonlyStatusHandler.getInstance(myProject). ensureFilesWritable(files).hasReadonlyFiles()) { return; } WriteCommandAction.writeCommandAction(myProject).run(() -> TypeMigrationProcessor.change(usages, myLabeler, myProject)); }, myProject.getDisposed()); }, JavaRefactoringBundle.message("type.migration.action.name"), false, myProject); } } UsageViewContentManager.getInstance(myProject).closeContent(myContent); }