本文整理匯總了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());
}
示例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);
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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("/");
}