本文整理汇总了Java中com.intellij.openapi.util.io.FileUtilRt类的典型用法代码示例。如果您正苦于以下问题:Java FileUtilRt类的具体用法?Java FileUtilRt怎么用?Java FileUtilRt使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileUtilRt类属于com.intellij.openapi.util.io包,在下文中一共展示了FileUtilRt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transformTestFile
import com.intellij.openapi.util.io.FileUtilRt; //导入依赖的package包/类
private static void transformTestFile(@NotNull Project project, int toSubtaskIndex, VirtualFile taskDir) {
String subtaskTestFileName = getTestFileName(project, toSubtaskIndex);
if (subtaskTestFileName == null) {
return;
}
String nameWithoutExtension = FileUtil.getNameWithoutExtension(subtaskTestFileName);
String extension = FileUtilRt.getExtension(subtaskTestFileName);
VirtualFile subtaskTestFile = taskDir.findChild(nameWithoutExtension + ".txt");
if (subtaskTestFile != null) {
ApplicationManager.getApplication().runWriteAction(() -> {
try {
subtaskTestFile.rename(project, nameWithoutExtension + "." + extension);
}
catch (IOException e) {
LOG.error(e);
}
});
}
}
示例2: transformFiles
import com.intellij.openapi.util.io.FileUtilRt; //导入依赖的package包/类
private static void transformFiles(Course course, Project project) {
List<VirtualFile> files = getAllAnswerTaskFiles(course, project);
for (VirtualFile answerFile : files) {
ApplicationManager.getApplication().runWriteAction(() -> {
String answerName = answerFile.getName();
String nameWithoutExtension = FileUtil.getNameWithoutExtension(answerName);
String name = FileUtil.getNameWithoutExtension(nameWithoutExtension) + "." + FileUtilRt.getExtension(answerName);
VirtualFile parent = answerFile.getParent();
VirtualFile file = parent.findChild(name);
try {
if (file != null) {
file.delete(CCProjectComponent.class);
}
VirtualFile windowsDescrFile = parent.findChild(FileUtil.getNameWithoutExtension(name) + EduNames.WINDOWS_POSTFIX);
if (windowsDescrFile != null) {
windowsDescrFile.delete(CCProjectComponent.class);
}
answerFile.rename(CCProjectComponent.class, name);
}
catch (IOException e) {
LOG.error(e);
}
});
}
}
示例3: getAllAnswerTaskFiles
import com.intellij.openapi.util.io.FileUtilRt; //导入依赖的package包/类
private static List<VirtualFile> getAllAnswerTaskFiles(@NotNull Course course, @NotNull Project project) {
List<VirtualFile> result = new ArrayList<>();
for (Lesson lesson : course.getLessons()) {
for (Task task : lesson.getTaskList()) {
for (Map.Entry<String, TaskFile> entry : task.getTaskFiles().entrySet()) {
String name = entry.getKey();
String answerName = FileUtil.getNameWithoutExtension(name) + CCUtils.ANSWER_EXTENSION_DOTTED + FileUtilRt.getExtension(name);
String taskPath = FileUtil.join(project.getBasePath(), EduNames.LESSON + lesson.getIndex(), EduNames.TASK + task.getIndex());
VirtualFile taskFile = LocalFileSystem.getInstance().findFileByPath(FileUtil.join(taskPath, answerName));
if (taskFile == null) {
taskFile = LocalFileSystem.getInstance().findFileByPath(FileUtil.join(taskPath, EduNames.SRC, answerName));
}
if (taskFile != null) {
result.add(taskFile);
}
}
}
}
return result;
}
示例4: modifyChildNode
import com.intellij.openapi.util.io.FileUtilRt; //导入依赖的package包/类
@Nullable
@Override
public AbstractTreeNode modifyChildNode(AbstractTreeNode childNode) {
AbstractTreeNode node = super.modifyChildNode(childNode);
if (node != null) {
return node;
}
if (childNode instanceof PsiFileNode) {
VirtualFile virtualFile = ((PsiFileNode)childNode).getVirtualFile();
if (virtualFile == null) {
return null;
}
if (FileUtilRt.getExtension(virtualFile.getName()).equals("iml")) {
return null;
}
return new CCStudentInvisibleFileNode(myProject, ((PsiFileNode)childNode).getValue(), myViewSettings);
}
return null;
}
示例5: getTestsFile
import com.intellij.openapi.util.io.FileUtilRt; //导入依赖的package包/类
@Nullable
@Override
protected VirtualFile getTestsFile() {
String testFileName = EduJavaPluginConfigurator.TEST_JAVA;
if (myTask instanceof TaskWithSubtasks) {
int activeSubtaskIndex = ((TaskWithSubtasks) myTask).getActiveSubtaskIndex();
testFileName = FileUtil.getNameWithoutExtension(testFileName) + EduNames.SUBTASK_MARKER + activeSubtaskIndex + "." + FileUtilRt.getExtension(EduJavaPluginConfigurator.TEST_JAVA);
}
VirtualFile taskDir = myTask.getTaskDir(myProject);
if (taskDir == null) {
return null;
}
VirtualFile srcDir = taskDir.findChild(EduNames.SRC);
if (srcDir != null) {
taskDir = srcDir;
}
VirtualFile virtualFile = taskDir.findChild(testFileName);
if (virtualFile != null) {
return virtualFile;
}
return null;
}
示例6: copyClass
import com.intellij.openapi.util.io.FileUtilRt; //导入依赖的package包/类
public static File copyClass(final String targetPath, @NonNls final String className, final boolean deleteOnExit) throws IOException{
final File targetDir = new File(targetPath).getAbsoluteFile();
final File file = new File(targetDir, className + ".class");
FileUtil.createParentDirs(file);
if (deleteOnExit) {
for (File f = file; f != null && !FileUtil.filesEqual(f, targetDir); f = FileUtilRt.getParentFile(f)) {
f.deleteOnExit();
}
}
@NonNls final String resourceName = "/" + className + ".class";
final InputStream stream = CopyResourcesUtil.class.getResourceAsStream(resourceName);
if (stream == null) {
throw new IOException("cannot load " + resourceName);
}
return copyStreamToFile(stream, file);
}
示例7: getTargetsByOutputFile
import com.intellij.openapi.util.io.FileUtilRt; //导入依赖的package包/类
@Override
public Collection<BuildTarget<?>> getTargetsByOutputFile(@NotNull File file) {
File current = file;
Collection<BuildTarget<?>> result = null;
while (current != null) {
List<BuildTarget<?>> targets = myOutputToTargets.get(current);
if (targets != null) {
if (result == null) {
result = targets;
}
else {
result = new ArrayList<BuildTarget<?>>(result);
result.addAll(targets);
}
}
current = FileUtilRt.getParentFile(current);
}
return result != null ? result : Collections.<BuildTarget<?>>emptyList();
}
示例8: deduplicate
import com.intellij.openapi.util.io.FileUtilRt; //导入依赖的package包/类
@Override
@Nullable
public String deduplicate(@NotNull Parameter parameter, @Nullable String value) {
if (StringUtil.isEmpty(value) || !parameter.constraints.contains(Parameter.Constraint.UNIQUE)) {
return value;
}
String suggested = value;
String extension = FileUtilRt.getExtension(value);
boolean hasExtension = !extension.isEmpty();
int extensionOffset = value.length() - extension.length();
//noinspection ForLoopThatDoesntUseLoopVariable
for (int i = 2; !parameter.uniquenessSatisfied(project, module, provider, packageName, suggested); i++) {
if (hasExtension) {
suggested = value.substring(0, extensionOffset) + i + value.substring(extensionOffset);
}
else {
suggested = value + i;
}
}
return suggested;
}
示例9: getClosureParameterType
import com.intellij.openapi.util.io.FileUtilRt; //导入依赖的package包/类
@Nullable
@Override
protected PsiType getClosureParameterType(GrClosableBlock closure, int index) {
PsiFile file = closure.getContainingFile();
if (file == null || !FileUtilRt.extensionEquals(file.getName(), GradleConstants.EXTENSION)) return null;
PsiType psiType = super.getClosureParameterType(closure, index);
if (psiType instanceof PsiWildcardType) {
PsiWildcardType wildcardType = (PsiWildcardType)psiType;
if (wildcardType.isSuper() && wildcardType.getBound() != null &&
wildcardType.getBound().equalsToText(GradleCommonClassNames.GRADLE_API_SOURCE_SET)) {
return wildcardType.getBound();
}
if (wildcardType.isSuper() && wildcardType.getBound() != null &&
wildcardType.getBound().equalsToText(GradleCommonClassNames.GRADLE_API_DISTRIBUTION)) {
return wildcardType.getBound();
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GradleClosureAsAnonymousParameterEnhancer.java
示例10: isExcluded
import com.intellij.openapi.util.io.FileUtilRt; //导入依赖的package包/类
@Override
public boolean isExcluded(File file) {
if (myFiles.contains(file)) {
return true;
}
if (!myDirectories.isEmpty() || !myRecursivelyExcludedDirectories.isEmpty()) { // optimization
File parent = FileUtilRt.getParentFile(file);
if (myDirectories.contains(parent)) {
return true;
}
while (parent != null) {
if (myRecursivelyExcludedDirectories.contains(parent)) {
return true;
}
parent = FileUtilRt.getParentFile(parent);
}
}
return false;
}
示例11: collectArchives
import com.intellij.openapi.util.io.FileUtilRt; //导入依赖的package包/类
private static void collectArchives(File file, boolean recursively, List<String> result) {
final File[] children = file.listFiles();
if (children != null) {
for (File child : children) {
final String extension = FileUtilRt.getExtension(child.getName());
if (child.isDirectory()) {
if (recursively) {
collectArchives(child, recursively, result);
}
}
// todo [nik] get list of extensions mapped to Archive file type from IDE settings
else if (AR_EXTENSIONS.contains(extension)) {
result.add(JpsPathUtil.getLibraryRootUrl(child));
}
}
}
}
示例12: getLanguageByExtension
import com.intellij.openapi.util.io.FileUtilRt; //导入依赖的package包/类
@Nullable
@Override
public OCLanguageKind getLanguageByExtension(Project project, String name) {
if (Blaze.isBlazeProject(project)) {
String extension = FileUtilRt.getExtension(name);
if (CFileExtensions.C_FILE_EXTENSIONS.contains(extension)) {
return OCLanguageKind.C;
}
if (CFileExtensions.CXX_FILE_EXTENSIONS.contains(extension)) {
return OCLanguageKind.CPP;
}
if (CFileExtensions.CXX_ONLY_HEADER_EXTENSIONS.contains(extension)) {
return OCLanguageKind.CPP;
}
}
return null;
}
示例13: addPathPatterns
import com.intellij.openapi.util.io.FileUtilRt; //导入依赖的package包/类
private void addPathPatterns(MyExecutor executor, JpsSdk<JpsSimpleElement<JpsAndroidSdkProperties>> androidSdk) {
final String tempDirectory = FileUtilRt.getTempDirectory();
executor.addPathPrefix("PROJECT_DIR", getOrCreateProjectDir().getPath());
executor.addPathPrefix("ANDROID_SDK_DIR", androidSdk.getHomePath());
executor.addPathPrefix("DATA_STORAGE_ROOT", myDataStorageRoot.getPath());
executor.addRegexPathPatternPrefix("AAPT_OUTPUT_TMP", FileUtil.toSystemIndependentName(tempDirectory) + "/android_apt_output\\d*tmp");
executor.addRegexPathPatternPrefix("COMBINED_ASSETS_TMP", FileUtil.toSystemIndependentName(tempDirectory) +
"/android_combined_assets\\d*tmp");
executor.addRegexPathPatternPrefix("COMBINED_RESOURCES_TMP", FileUtil.toSystemIndependentName(tempDirectory) +
"/android_combined_resources\\d*tmp");
executor.addRegexPathPatternPrefix("CLASSPATH_TMP", FileUtil.toSystemIndependentName(tempDirectory) + "/classpath\\d*\\.jar");
executor.addRegexPathPattern("JAVA_PATH", ".*/java");
executor.addRegexPathPattern("IDEA_RT_PATH", ".*/idea_rt.jar");
executor.addRegexPathPattern("PROGUARD_INPUT_JAR", ".*/proguard_input\\S*\\.jar");
// for running on buildserver
executor.addRegexPathPattern("IDEA_RT_PATH", ".*/production/java-runtime");
AndroidBuildTestingManager.startBuildTesting(executor);
}
示例14: walk
import com.intellij.openapi.util.io.FileUtilRt; //导入依赖的package包/类
private static void walk(File root, MultiMap<Couple<Integer>, String> dimToPath, File file) throws IOException {
if (file.isDirectory()) {
for (File child : file.listFiles()) {
walk(root, dimToPath, child);
}
}
else {
if (IMAGE_EXTENSIONS.contains(FileUtilRt.getExtension(file.getName()))) {
String relativePath = file.getAbsolutePath().substring(root.getAbsolutePath().length() + 1);
Image image = loadImage(file);
File target;
int width = image.getWidth(null);
int height = image.getHeight(null);
if (height != width && (height > 100 || width > 100)) {
target = new File("/Users/max/images/other", relativePath);
}
else {
target = new File("/Users/max/images/icons", relativePath);
dimToPath.putValue(new Couple<Integer>(width, height), relativePath);
}
FileUtil.copy(file, target);
}
}
}
示例15: containsDependencyOnApklibFile
import com.intellij.openapi.util.io.FileUtilRt; //导入依赖的package包/类
private static boolean containsDependencyOnApklibFile(@NotNull LibraryOrderEntry libraryOrderEntry,
@NotNull IdeModifiableModelsProvider modelsProvider) {
final Library library = libraryOrderEntry.getLibrary();
if (library == null) {
return false;
}
final Library.ModifiableModel libraryModel = modelsProvider.getModifiableLibraryModel(library);
final String[] urls = libraryModel.getUrls(OrderRootType.CLASSES);
for (String url : urls) {
final String fileName = PathUtil.getFileName(PathUtil.toPresentableUrl(url));
if (FileUtilRt.extensionEquals(fileName, "apklib")) {
return true;
}
}
return false;
}