本文整理汇总了Java中com.intellij.openapi.roots.ContentEntry.getFile方法的典型用法代码示例。如果您正苦于以下问题:Java ContentEntry.getFile方法的具体用法?Java ContentEntry.getFile怎么用?Java ContentEntry.getFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.roots.ContentEntry
的用法示例。
在下文中一共展示了ContentEntry.getFile方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupRootModel
import com.intellij.openapi.roots.ContentEntry; //导入方法依赖的package包/类
@Override
public void setupRootModel(@NotNull final ModifiableRootModel rootModel) throws ConfigurationException {
if (mySdk == null) {
rootModel.inheritSdk();
} else {
rootModel.setSdk(mySdk);
}
// Make the entire module directory a source root.
ContentEntry contentEntry = doAddContentEntry(rootModel);
if (contentEntry != null) {
final VirtualFile file = contentEntry.getFile();
if (file != null && file.isDirectory())
contentEntry.addSourceFolder(file, false);
}
}
示例2: isInContent
import com.intellij.openapi.roots.ContentEntry; //导入方法依赖的package包/类
private static boolean isInContent(@NotNull ContentEntry[] contentEntries, @NotNull PhpNamespaceRootInfo info) {
for (ContentEntry entry : contentEntries) {
VirtualFile file = entry.getFile();
if (file != null &&
FileUtil.isAncestor(file.getPath(), info.getSourcePath(), false) &&
!existsSource(entry.getSourceFolders(), info)
) {
return true;
}
}
return false;
}
开发者ID:aurimasniekis,项目名称:idea-php-psr4-namespace-detector,代码行数:15,代码来源:PhpPsr4NamespaceRootDetector.java
示例3: getDirSetRoot
import com.intellij.openapi.roots.ContentEntry; //导入方法依赖的package包/类
private VirtualFile getDirSetRoot(final ContentEntry contentEntry) {
final VirtualFile contentRoot = contentEntry.getFile();
final VirtualFile[] sourceFolderFiles = contentEntry.getSourceFolderFiles();
for (VirtualFile sourceFolderFile : sourceFolderFiles) {
if (contentRoot.equals(sourceFolderFile)) {
return contentRoot.getParent();
}
}
return contentRoot;
}
示例4: findOrCreateContentRoot
import com.intellij.openapi.roots.ContentEntry; //导入方法依赖的package包/类
@NotNull
private static ContentEntry findOrCreateContentRoot(@NotNull ModifiableRootModel model, @NotNull String path) {
ContentEntry[] entries = model.getContentEntries();
for (ContentEntry entry : entries) {
VirtualFile file = entry.getFile();
if (file == null) {
continue;
}
if (ExternalSystemApiUtil.getLocalFileSystemPath(file).equals(path)) {
return entry;
}
}
return model.addContentEntry(toVfsUrl(path));
}
示例5: isPathInContentEntry
import com.intellij.openapi.roots.ContentEntry; //导入方法依赖的package包/类
public static boolean isPathInContentEntry(@NotNull File path, @NotNull ContentEntry contentEntry) {
VirtualFile rootFile = contentEntry.getFile();
File rootFilePath;
if (rootFile == null) {
String s = urlToPath(contentEntry.getUrl());
rootFilePath = new File(s);
}
else {
rootFilePath = VfsUtilCore.virtualToIoFile(rootFile);
}
return isAncestor(rootFilePath, path, false);
}
示例6: validateContentEntriesCandidates
import com.intellij.openapi.roots.ContentEntry; //导入方法依赖的package包/类
private void validateContentEntriesCandidates(VirtualFile[] files) throws Exception {
for (final VirtualFile file : files) {
// check for collisions with already existing entries
for (final String contentEntryUrl : myEntryToEditorMap.keySet()) {
final ContentEntry contentEntry = getContentEntry(contentEntryUrl);
if (contentEntry == null) continue;
final VirtualFile contentEntryFile = contentEntry.getFile();
if (contentEntryFile == null) {
continue; // skip invalid entry
}
if (contentEntryFile.equals(file)) {
throw new Exception(ProjectBundle.message("module.paths.add.content.already.exists.error", file.getPresentableUrl()));
}
if (VfsUtilCore.isAncestor(contentEntryFile, file, true)) {
// intersection not allowed
throw new Exception(
ProjectBundle.message("module.paths.add.content.intersect.error", file.getPresentableUrl(),
contentEntryFile.getPresentableUrl()));
}
if (VfsUtilCore.isAncestor(file, contentEntryFile, true)) {
// intersection not allowed
throw new Exception(
ProjectBundle.message("module.paths.add.content.dominate.error", file.getPresentableUrl(),
contentEntryFile.getPresentableUrl()));
}
}
// check if the same root is configured for another module
final Module[] modules = myModulesProvider.getModules();
for (final Module module : modules) {
if (myModuleName.equals(module.getName())) {
continue;
}
ModuleRootModel rootModel = myModulesProvider.getRootModel(module);
LOG.assertTrue(rootModel != null);
final VirtualFile[] moduleContentRoots = rootModel.getContentRoots();
for (VirtualFile moduleContentRoot : moduleContentRoots) {
if (file.equals(moduleContentRoot)) {
throw new Exception(
ProjectBundle.message("module.paths.add.content.duplicate.error", file.getPresentableUrl(), module.getName()));
}
}
}
}
}