mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs]: optimize, move rootModel modification in initProject to EDT
* edt execution was changed during db21e6456 while changing inheritance;
This commit is contained in:
@@ -30,6 +30,7 @@ import com.intellij.openapi.vcs.changes.committed.MockAbstractVcs;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.EdtTestUtil;
|
||||
import com.intellij.vcs.test.VcsPlatformTest;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -114,23 +115,25 @@ public abstract class VcsRootBaseTest extends VcsPlatformTest {
|
||||
Collection<String> contentRoots = vcsRootConfiguration.getContentRoots();
|
||||
createProjectStructure(myProject, contentRoots);
|
||||
if (!contentRoots.isEmpty()) {
|
||||
for (String root : contentRoots) {
|
||||
myProjectRoot.refresh(false, true);
|
||||
VirtualFile f = myProjectRoot.findFileByRelativePath(root);
|
||||
if (f != null) {
|
||||
myRootModel.addContentEntry(f);
|
||||
EdtTestUtil.runInEdtAndWait(() -> {
|
||||
for (String root : contentRoots) {
|
||||
VirtualFile f = myProjectRoot.findFileByRelativePath(root);
|
||||
if (f != null) {
|
||||
myRootModel.addContentEntry(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
static void createProjectStructure(@NotNull Project project, @NotNull Collection<String> paths) {
|
||||
void createProjectStructure(@NotNull Project project, @NotNull Collection<String> paths) {
|
||||
for (String path : paths) {
|
||||
cd(project.getBaseDir().getPath());
|
||||
File f = new File(project.getBaseDir().getPath(), path);
|
||||
f.mkdirs();
|
||||
LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f);
|
||||
}
|
||||
myProjectRoot.refresh(false, true);
|
||||
}
|
||||
|
||||
private void createDirs(@NotNull Collection<String> mockRoots) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user