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


Java FileUtil.startsWith方法代码示例

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


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

示例1: getDownloadFilesMessage

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private String getDownloadFilesMessage() {
  final LibraryDownloadSettings downloadSettings = mySettings.getDownloadSettings();
  if (downloadSettings == null) return "";

  final String downloadPath = downloadSettings.getDirectoryForDownloadedLibrariesPath();
  final String basePath = mySettings.getBaseDirectoryPath();
  String path;
  if (!StringUtil.isEmpty(basePath) && FileUtil.startsWith(downloadPath, basePath)) {
    path = FileUtil.getRelativePath(basePath, downloadPath, '/');
  }
  else {
    path = PathUtil.getFileName(downloadPath);
  }
  return MessageFormat.format("{0} {0, choice, 1#JAR|2#JARs} will be downloaded into <b>{1}</b> directory<br>" +
                                 "{2} library <b>{3}</b> will be created",
                                 downloadSettings.getSelectedDownloads().size(),
                                 path,
                                 downloadSettings.getLibraryLevel(),
                                 downloadSettings.getLibraryName());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LibraryOptionsPanel.java

示例2: belongs

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public boolean belongs(String url) {
  final VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
  if (file != null) {
    for (FileIndex index : getFileIndices()) {
      if (index.isInSourceContent(file)) {
        return true;
      }
    }
  }
  else {
    // the file might be deleted
    for (VirtualFile root : ProjectRootManager.getInstance(myProject).getContentSourceRoots()) {
      final String rootUrl = root.getUrl();
      if (FileUtil.startsWith(url, rootUrl.endsWith("/")? rootUrl : rootUrl + "/")) {
        return true;
      }
    }
  }
  return false;
  //return !FileUtil.startsWith(url, myTempDirUrl);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ProjectCompileScope.java

示例3: belongs

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public boolean belongs(String url) {
  //url = CompilerUtil.normalizePath(url, '/');
  if (getUrls().contains(url)) {
    return true;
  }
  for (String directoryUrl : myDirectoryUrls) {
    if (FileUtil.startsWith(url, directoryUrl)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:FileSetCompileScope.java

示例4: fileMatchesMapping

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private boolean fileMatchesMapping(final VirtualFile file,
                                   final Object matchContext,
                                   final String systemIndependentPath,
                                   final VcsDirectoryMapping mapping) {
  if (mapping.getDirectory().length() == 0) {
    return myDefaultVcsRootPolicy.matchesDefaultMapping(file, matchContext);
  }
  return FileUtil.startsWith(systemIndependentPath, mapping.systemIndependentPath());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:NewMappings.java

示例5: addCurrent

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public boolean addCurrent(final VirtualFile file) {
  for (String path : myPaths) {
    if (FileUtil.startsWith(file.getPath(), path)) {
      return false;
    }
  }

  myPaths.add(file.getPath());
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:FoldersCutDownWorker.java

示例6: hasUserPaths

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private static boolean hasUserPaths(OrderRootType rootType, Library library, String pathToJar) {
  String[] sources = library.getUrls(rootType);
  for (String each : sources) {
    if (!FileUtil.startsWith(each, pathToJar)) return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:MavenRootModelAdapter.java

示例7: loadForm

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public LwRootContainer loadForm(String formFileName) throws Exception {
  if (myCache.containsKey(formFileName)) {
    return myCache.get(formFileName);
  }

  final String relPath = FileUtil.toSystemIndependentName(formFileName);

  for (Map.Entry<File, String> entry : mySourceRoots.entrySet()) {
    final File sourceRoot = entry.getKey();
    final String prefix = entry.getValue();
    String path = relPath;
    if (prefix != null && FileUtil.startsWith(path, prefix)) {
      path = path.substring(prefix.length());
    }
    final File formFile = new File(sourceRoot, path);
    if (formFile.exists()) {
      final BufferedInputStream stream = new BufferedInputStream(new FileInputStream(formFile));
      try {
        return loadForm(formFileName, stream);
      }
      finally {
        stream.close();
      }
    }
  }

  throw new Exception("Cannot find nested form file " + formFileName);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:FormsInstrumenter.java

示例8: removeCommonParents

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
protected static void removeCommonParents(List<String> allPaths) {
  Collections.sort(allPaths);

  String prevPath = null;
  Iterator<String> it = allPaths.iterator();
  while (it.hasNext()) {
    String path = it.next();
    if (prevPath != null && FileUtil.startsWith(path, prevPath)) {      // the file is under previous file, so enough to check the parent
      it.remove();
    }
    else {
      prevPath = path;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:GitChangesCollector.java

示例9: isUrlUnderRoot

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private static boolean isUrlUnderRoot(final String url, final String root) {
  return (url.length() > root.length()) && url.charAt(root.length()) == '/' && FileUtil.startsWith(url, root);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:ModuleCompileScope.java

示例10: belongs

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public boolean belongs(String url) {
  if (myFile.isDirectory()){
    return FileUtil.startsWith(url, myUrl);
  }
  return FileUtil.pathsEqual(url, myUrl);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:OneProjectItemCompileScope.java

示例11: isUnderConfigOrSystem

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private boolean isUnderConfigOrSystem(@NotNull VirtualFile file) {
  final String filePath = file.getPath();
  return myConfigPath != null && FileUtil.startsWith(filePath, myConfigPath) ||
         myLogPath != null && FileUtil.startsWith(filePath, myLogPath);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:FileBasedIndexImpl.java

示例12: matchesPrefix

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private static boolean matchesPrefix(String path, String prefix) {
  if (prefix.length() == 0) {
    return !path.contains("/");
  }
  return FileUtil.startsWith(path, prefix) && !path.substring(prefix.length()).contains("/");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:FileTemplatesLoader.java


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