mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 06:51:17 +07:00
cleanup
This commit is contained in:
@@ -19,7 +19,6 @@ import com.intellij.notification.Notification;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
@@ -39,26 +38,18 @@ import static junit.framework.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class VcsTestUtil {
|
||||
|
||||
public static VirtualFile createFile(@NotNull Project project, @NotNull final VirtualFile parent, @NotNull final String name,
|
||||
@Nullable final String content) {
|
||||
final Ref<VirtualFile> result = new Ref<VirtualFile>();
|
||||
new WriteCommandAction.Simple(project) {
|
||||
return new WriteCommandAction<VirtualFile>(project) {
|
||||
@Override
|
||||
protected void run() throws Throwable {
|
||||
try {
|
||||
VirtualFile file = parent.createChildData(this, name);
|
||||
if (content != null) {
|
||||
file.setBinaryContent(CharsetToolkit.getUtf8Bytes(content));
|
||||
}
|
||||
result.set(file);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
protected void run(@NotNull Result<VirtualFile> result) throws Throwable {
|
||||
VirtualFile file = parent.createChildData(this, name);
|
||||
if (content != null) {
|
||||
file.setBinaryContent(CharsetToolkit.getUtf8Bytes(content));
|
||||
}
|
||||
result.setResult(file);
|
||||
}
|
||||
}.execute();
|
||||
return result.get();
|
||||
}.execute().throwException().getResultObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user