use of com.intellij.openapi.util.NullableComputable in project intellij-plugins by JetBrains.
the class FlexModuleBuilder method createSourceRoot.
@Nullable
private VirtualFile createSourceRoot(final ContentEntry contentEntry) {
final VirtualFile contentRoot = contentEntry.getFile();
if (contentRoot == null)
return null;
VirtualFile sourceRoot = VfsUtil.findRelativeFile(contentRoot, "src");
if (sourceRoot == null) {
sourceRoot = ApplicationManager.getApplication().runWriteAction(new NullableComputable<VirtualFile>() {
public VirtualFile compute() {
try {
return contentRoot.createChildDirectory(this, "src");
} catch (IOException e) {
return null;
}
}
});
}
if (sourceRoot != null) {
contentEntry.addSourceFolder(sourceRoot, false);
return sourceRoot;
}
return null;
}
Aggregations