当前位置: 首页>>代码示例>>Java>>正文


Java FileUtilRt.extensionEquals方法代码示例

本文整理汇总了Java中com.intellij.openapi.util.io.FileUtilRt.extensionEquals方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtilRt.extensionEquals方法的具体用法?Java FileUtilRt.extensionEquals怎么用?Java FileUtilRt.extensionEquals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.util.io.FileUtilRt的用法示例。


在下文中一共展示了FileUtilRt.extensionEquals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: detectRoots

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@NotNull
@Override
public DirectoryProcessingResult detectRoots(@NotNull File dir,
                                             @NotNull File[] children,
                                             @NotNull File base,
                                             @NotNull List<DetectedProjectRoot> result) {
  LOG.info("Detecting roots under "  + dir);
  for (File child : children) {
    final String name = child.getName();
    if (FileUtilRt.extensionEquals(name, "py")) {
      LOG.info("Found Python file " + child.getPath());
      result.add(new DetectedContentRoot(dir, "Python", PythonModuleTypeBase.getInstance(), WebModuleType.getInstance()));
      return DirectoryProcessingResult.SKIP_CHILDREN;
    }
    if ("node_modules".equals(name)) {
      return DirectoryProcessingResult.SKIP_CHILDREN;
    }
  }
  return DirectoryProcessingResult.PROCESS_CHILDREN;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PyProjectStructureDetector.java

示例2: collectJarsInAarLibsFolder

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
private static void collectJarsInAarLibsFolder(@NotNull String aarDirPath, @NotNull Set<String> urlsToAdd) {
  final File libsFolder = new File(aarDirPath, SdkConstants.LIBS_FOLDER);

  if (!libsFolder.isDirectory()) {
    return;
  }
  final File[] children = libsFolder.listFiles();

  if (children != null) {
    for (File child : children) {
      if (FileUtilRt.extensionEquals(child.getName(), "jar")) {
        final String url = VirtualFileManager.constructUrl(JarFileSystem.PROTOCOL, FileUtil.
          toSystemIndependentName(child.getPath())) + JarFileSystem.JAR_SEPARATOR;
        urlsToAdd.add(url);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:AndroidFacetImporterBase.java

示例3: 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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AndroidFacetImporterBase.java

示例4: update

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@Override
public void update(@NotNull AnActionEvent e) {
  final Project project = getEventProject(e);
  boolean visible = false;
  if (project != null && ModuleManager.getInstance(project).getModules().length > 0) {
    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
    for (VirtualFile root : getRoots(e)) {
      if (!root.isInLocalFileSystem() && FileUtilRt.extensionEquals(root.getName(), "jar") && !fileIndex.isInLibraryClasses(root)) {
        visible = true;
        break;
      }
    }
  }

  Presentation presentation = e.getPresentation();
  presentation.setVisible(visible);
  presentation.setEnabled(visible);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:CreateLibraryFromFilesAction.java

示例5: 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

示例6: generateDoc

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@Nullable
@Override
public String generateDoc(PsiElement element, PsiElement originalElement) {
  PsiFile file = element.getContainingFile();
  if (file == null || !FileUtilRt.extensionEquals(file.getName(), GradleConstants.EXTENSION)) return null;
  return element instanceof GrLiteral ? findDoc(element, GrLiteral.class.cast(element).getValue()) : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:GradleDocumentationProvider.java

示例7: acceptLastCreatedPatchName

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
public void acceptLastCreatedPatchName(final String string) {
  if (StringUtil.isEmptyOrSpaces(string)) return;
  if (FileUtilRt.extensionEquals(string, DIFF)) {
    DEFAULT_PATCH_EXTENSION = DIFF;
  }
  else if (FileUtilRt.extensionEquals(string, PATCH)) {
    DEFAULT_PATCH_EXTENSION = PATCH;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:VcsConfiguration.java

示例8: attachToProject

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@Override
public boolean attachToProject(Project project, File projectDir, @Nullable ProjectOpenedCallback callback) {
  if (!projectDir.exists()) {
    Project newProject = ((ProjectManagerEx)ProjectManager.getInstance())
      .newProject(projectDir.getParentFile().getName(), projectDir.getParent(), true, false);
    if (newProject == null) {
      return false;
    }
    final VirtualFile baseDir = LocalFileSystem.getInstance().refreshAndFindFileByPath(projectDir.getParent());
    PlatformProjectOpenProcessor.runDirectoryProjectConfigurators(baseDir, newProject);
    newProject.save();
    AccessToken token = ApplicationManager.getApplication().acquireWriteActionLock(null);
    try {
      Disposer.dispose(newProject);
    }
    finally {
      token.finish();
    }
  }
  final String[] files = projectDir.list();
  if (files != null) {
    for (String file : files) {
      if (FileUtilRt.extensionEquals(file, "iml")) {
        VirtualFile imlFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(projectDir, file));
        if (imlFile != null) {
          attachModule(project, imlFile, callback);
          return true;
        }
      }
    }
  }
  int rc = Messages.showYesNoDialog(project, "The project at " +
                                             FileUtil.toSystemDependentName(projectDir.getPath()) +
                                             " uses a non-standard layout and cannot be attached to this project. Would you like to open it in a new window?",
                                    "Open Project", Messages.getQuestionIcon());

  return rc != Messages.YES;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:ModuleAttachProcessor.java

示例9: getDocumentationElementForLookupItem

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@Nullable
@Override
public PsiElement getDocumentationElementForLookupItem(PsiManager psiManager, Object object, PsiElement element) {
  final PsiFile file = element.getContainingFile();
  if (file == null || !FileUtilRt.extensionEquals(file.getName(), GradleConstants.EXTENSION)) return null;
  final String doc = findDoc(element, object);
  return !StringUtil.isEmpty(doc) ? new CustomMembersGenerator.GdslNamedParameter(String.valueOf(object), doc, element, null) : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:GradleDocumentationProvider.java

示例10: collectResources

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
private static void collectResources(@NotNull File resFile,
                                     @NotNull String resType,
                                     @NotNull Map<String, ResourceFileData> resDataMap,
                                     @NotNull TObjectLongHashMap<String> valueResFilesTimestamps,
                                     @Nullable AndroidAptValidityState oldState)
  throws IOException {
  final String resFilePath = FileUtil.toSystemIndependentName(resFile.getPath());
  final long resFileTimestamp = resFile.lastModified();

  if (ResourceFolderType.VALUES.getName().equals(resType) && FileUtilRt.extensionEquals(resFile.getName(), "xml")) {
    ResourceFileData dataToReuse = null;

    if (oldState != null) {
      final long oldTimestamp = oldState.getValueResourceFilesTimestamps().get(resFilePath);

      if (resFileTimestamp == oldTimestamp) {
        dataToReuse = oldState.getResources().get(resFilePath);
      }
    }

    if (dataToReuse != null) {
      resDataMap.put(resFilePath, dataToReuse);
    }
    else {
      final List<ResourceEntry> entries = AndroidBuildDataCache.getInstance().getParsedValueResourceFile(resFile);
      resDataMap.put(resFilePath, new ResourceFileData(entries, 0));
    }
    valueResFilesTimestamps.put(resFilePath, resFileTimestamp);
  }
  else {
    final ResourceType resTypeObj = ResourceType.getEnum(resType);
    final boolean idProvidingType =
      resTypeObj != null && ArrayUtil.find(AndroidCommonUtils.ID_PROVIDING_RESOURCE_TYPES, resTypeObj) >= 0;
    final ResourceFileData data =
      new ResourceFileData(Collections.<ResourceEntry>emptyList(), idProvidingType ? resFileTimestamp : 0);
    resDataMap.put(resFilePath, data);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:AndroidSourceGeneratingBuilder.java

示例11: visitClosure

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@Override
public void visitClosure(GrClosableBlock closure) {
  PsiFile file = closure.getContainingFile();
  if (file == null || !FileUtilRt.extensionEquals(file.getName(), GradleConstants.EXTENSION)) return;

  super.visitClosure(closure);
  GrMethodCall mavenMethodCall = PsiTreeUtil.getParentOfType(closure, GrMethodCall.class);
  if (mavenMethodCall == null) return;
  GrExpression mavenMethodExpression = mavenMethodCall.getInvokedExpression();
  if (mavenMethodExpression == null ||
      !ArrayUtil.contains(mavenMethodExpression.getText(), "maven", "ivy")) {
    return;
  }

  GrMethodCall repositoryMethodCall = PsiTreeUtil.getParentOfType(mavenMethodCall, GrMethodCall.class);
  if (repositoryMethodCall == null) return;
  GrExpression repositoryMethodExpression = repositoryMethodCall.getInvokedExpression();
  if (repositoryMethodExpression == null || !repositoryMethodExpression.getText().equals("repositories")) return;

  List<GrCallExpression> statements = findUrlCallExpressions(closure);
  if (statements.size() > 1) {
    registerError(closure);

    registerError(closure, GradleInspectionBundle.message("multiple.repository.urls"),
                  new LocalQuickFix[]{new MultipleRepositoryUrlsFix(closure, mavenMethodExpression.getText())},
                  ProblemHighlightType.GENERIC_ERROR);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:MultipleRepositoryUrlsInspection.java

示例12: extensionIsOneOf

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
private static boolean extensionIsOneOf(@NotNull String name, @NotNull String[] extensions) {
  for (String extension : extensions) {
    if (FileUtilRt.extensionEquals(name, extension)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:UnpackOperation.java

示例13: collectFiles

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
private static void collectFiles(File root, File file, Collection<String> result, Set<String> visited, Set<String> qNames)
  throws IOException {
  String path = file.getCanonicalPath();
  if (!visited.add(path)) {
    return;
  }
  
  if (file.isDirectory()) {
    final File[] children = file.listFiles();

    if (children != null) {
      for (File child : children) {
        collectFiles(root, child, result, visited, qNames);
      }
    }
  }
  else {
    if (FileUtilRt.extensionEquals(file.getName(), "class")) {
      final String qName = getQualifiedName(root, file);
      if (qName != null && !qNames.add(qName)) {
        reportWarning(FileUtilRt.toSystemDependentName(file.getPath()) + " won't be added. Class " +
                      qName + " already exists in classpath");
        return;
      }
    }
    result.add(path);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:AndroidDxRunner.java

示例14: packClassFilesIntoJar

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
private static void packClassFilesIntoJar(@NotNull File file,
                                          @NotNull File rootDirectory,
                                          boolean packRAndManifestClasses,
                                          @NotNull List<Pair<File, String>> files)
  throws IOException {

  if (file.isDirectory()) {
    final File[] children = file.listFiles();

    if (children != null) {
      for (File child : children) {
        packClassFilesIntoJar(child, rootDirectory, packRAndManifestClasses, files);
      }
    }
  }
  else if (file.isFile()) {
    if (!FileUtilRt.extensionEquals(file.getName(), "class")) {
      return;
    }

    if (!packRAndManifestClasses &&
        (R_PATTERN.matcher(file.getName()).matches() ||
         MANIFEST_PATTERN.matcher(file.getName()).matches() ||
         BUILD_CONFIG_CLASS_NAME.equals(file.getName()))) {
      return;
    }

    final String rootPath = rootDirectory.getAbsolutePath();

    String path = file.getAbsolutePath();
    path = FileUtil.toSystemIndependentName(path.substring(rootPath.length()));
    if (path.charAt(0) == '/') {
      path = path.substring(1);
    }

    files.add(Pair.create(file, path));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:AndroidCommonUtils.java

示例15: getResourceName

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@NotNull
public static String getResourceName(@NotNull String resourceType, @NotNull String fileName) {
  final String s = FileUtil.getNameWithoutExtension(fileName);

  return resourceType.equals("drawable") &&
         s.endsWith(".9") &&
         FileUtilRt.extensionEquals(fileName, PNG_EXTENSION)
         ? s.substring(0, s.length() - 2)
         : s;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:AndroidCommonUtils.java


注:本文中的com.intellij.openapi.util.io.FileUtilRt.extensionEquals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。