當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。