本文整理汇总了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("/");
}