本文整理汇总了Java中consulo.roots.ContentFolderScopes类的典型用法代码示例。如果您正苦于以下问题:Java ContentFolderScopes类的具体用法?Java ContentFolderScopes怎么用?Java ContentFolderScopes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContentFolderScopes类属于consulo.roots包,在下文中一共展示了ContentFolderScopes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: computeIncrementalCompilerInstructions
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
@Override
public void computeIncrementalCompilerInstructions(@NotNull IncrementalCompilerInstructionCreator creator,
@NotNull PackagingElementResolvingContext resolvingContext,
@NotNull ArtifactIncrementalCompilerContext compilerContext,
@NotNull ArtifactType artifactType)
{
Module module = findModule(resolvingContext);
if(module != null)
{
VirtualFile[] virtualFiles = ModuleRootManager.getInstance(module).getContentFolderFiles(ContentFolderScopes.of(myContentFolderType));
for(VirtualFile virtualFile : virtualFiles)
{
creator.addDirectoryCopyInstructions(virtualFile, null);
}
}
}
开发者ID:consulo,项目名称:consulo-javaee,代码行数:18,代码来源:WebResourceModuleOutputPackagingElement.java
示例2: getContentFolderIfIs
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
@Nullable
public static ContentFolder getContentFolderIfIs(@Nonnull VirtualFile virtualFile, final Project project) {
final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
final Module module = projectFileIndex.getModuleForFile(virtualFile);
if (module == null) {
return null;
}
final ContentEntry[] contentEntries = ModuleRootManager.getInstance(module).getContentEntries();
for (ContentEntry contentEntry : contentEntries) {
for (ContentFolder sourceFolder : contentEntry.getFolders(ContentFolderScopes.all())) {
if (Comparing.equal(virtualFile, sourceFolder.getFile())) {
return sourceFolder;
}
}
}
return null;
}
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:ProjectRootsUtil.java
示例3: getOutputPaths
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
public static String[] getOutputPaths(Module[] modules) {
if (modules.length == 0) {
return ArrayUtil.EMPTY_STRING_ARRAY;
}
final Set<String> outputPaths = new OrderedSet<String>();
for (Module module : modules) {
for (ContentFolderTypeProvider contentFolderType : ContentFolderTypeProvider.filter(ContentFolderScopes.productionAndTest())) {
String outputPathUrl = ModuleCompilerPathsManager.getInstance(module).getCompilerOutputUrl(contentFolderType);
if (outputPathUrl != null) {
outputPaths.add(VirtualFileManager.extractPath(outputPathUrl).replace('/', File.separatorChar));
}
}
}
return ArrayUtil.toStringArray(outputPaths);
}
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:CompilerPathsImpl.java
示例4: getOutputDirectories
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
public static VirtualFile[] getOutputDirectories(final Module[] modules) {
if (modules.length == 0) {
return VirtualFile.EMPTY_ARRAY;
}
final Set<VirtualFile> dirs = new OrderedSet<VirtualFile>();
for (Module module : modules) {
for (ContentFolderTypeProvider contentFolderType : ContentFolderTypeProvider.filter(ContentFolderScopes.productionAndTest())) {
VirtualFile virtualFile = ModuleCompilerPathsManager.getInstance(module).getCompilerOutput(contentFolderType);
if (virtualFile != null) {
dirs.add(virtualFile);
}
}
}
return VfsUtilCore.toVirtualFileArray(dirs);
}
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:CompilerPathsImpl.java
示例5: getSourceRoots
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
@Nonnull
@Override
public Collection<VirtualFile> getSourceRoots(PackagingElementResolvingContext context) {
Module module = NamedPointerUtil.get(myModulePointer);
if (module == null) {
return Collections.emptyList();
}
List<VirtualFile> roots = new SmartList<VirtualFile>();
ModuleRootModel rootModel = context.getModulesProvider().getRootModel(module);
for (ContentEntry entry : rootModel.getContentEntries()) {
for (ContentFolder folder : entry.getFolders(ContentFolderScopes.of(myContentFolderType))) {
ContainerUtil.addIfNotNull(folder.getFile(), roots);
}
}
return roots;
}
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:ModuleOutputPackagingElementImpl.java
示例6: getRootsForScan
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
private VirtualFile[] getRootsForScan(Project project) {
List<VirtualFile> list = new ArrayList<VirtualFile>();
Module[] modules = ModuleManager.getInstance(project).getModules();
TranslatingCompilerFilesMonitorHelper[] extensions = TranslatingCompilerFilesMonitorHelper.EP_NAME.getExtensions();
for (Module module : modules) {
for (TranslatingCompilerFilesMonitorHelper extension : extensions) {
VirtualFile[] rootsForModule = extension.getRootsForModule(module);
if (rootsForModule != null) {
Collections.addAll(list, rootsForModule);
}
}
VirtualFile[] contentFolderFiles = ModuleRootManager.getInstance(module).getContentFolderFiles(ContentFolderScopes.all(false));
Collections.addAll(list, contentFolderFiles);
}
return VfsUtil.toVirtualFileArray(list);
}
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:TranslatingCompilerFilesMonitorImpl.java
示例7: findResourceFile
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
@Nullable
public static VirtualFile findResourceFile(final String name, final Module inModule) {
final VirtualFile[] sourceRoots = ModuleRootManager.getInstance(inModule).getContentFolderFiles(ContentFolderScopes.productionAndTest());
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(inModule.getProject()).getFileIndex();
for (final VirtualFile sourceRoot : sourceRoots) {
final String packagePrefix = fileIndex.getPackageNameByDirectory(sourceRoot);
final String prefix = packagePrefix == null || packagePrefix.isEmpty() ? null : packagePrefix.replace('.', '/') + "/";
final String relPath = prefix != null && name.startsWith(prefix) && name.length() > prefix.length() ? name.substring(prefix.length()) : name;
final String fullPath = sourceRoot.getPath() + "/" + relPath;
final VirtualFile fileByPath = LocalFileSystem.getInstance().findFileByPath(fullPath);
if (fileByPath != null) {
return fileByPath;
}
}
return null;
}
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ResourceFileUtil.java
示例8: updateOutputPathPresentation
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
private void updateOutputPathPresentation() {
ModuleCompilerPathsManager moduleCompilerPathsManager = ModuleCompilerPathsManager.getInstance(getModule());
if (moduleCompilerPathsManager.isInheritedCompilerOutput()) {
final String baseUrl = ProjectStructureConfigurable.getInstance(myProject).getProjectConfigurable().getCompilerOutputUrl();
moduleCompileOutputChanged(baseUrl, getModule().getName());
}
else {
for (ContentFolderTypeProvider contentFolderTypeProvider : ContentFolderTypeProvider.filter(ContentFolderScopes.productionAndTest())) {
CommitableFieldPanel commitableFieldPanel = toField(contentFolderTypeProvider);
final VirtualFile compilerOutputPath = moduleCompilerPathsManager.getCompilerOutput(contentFolderTypeProvider);
if (compilerOutputPath != null) {
commitableFieldPanel.setText(FileUtil.toSystemDependentName(compilerOutputPath.getPath()));
}
else {
final String compilerOutputUrl = moduleCompilerPathsManager.getCompilerOutputUrl(contentFolderTypeProvider);
if (compilerOutputUrl != null) {
commitableFieldPanel.setText(FileUtil.toSystemDependentName(VfsUtilCore.urlToPath(compilerOutputUrl)));
}
}
}
}
}
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:BuildElementsEditor.java
示例9: isModified
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
@Override
public boolean isModified() {
ModuleCompilerPathsManager moduleCompilerPathsManager = ModuleCompilerPathsManager.getInstance(getModule());
if (myInheritCompilerOutput.isSelected() != moduleCompilerPathsManager.isInheritedCompilerOutput()) {
return true;
}
for (ContentFolderTypeProvider contentFolderTypeProvider : ContentFolderTypeProvider.filter(ContentFolderScopes.productionAndTest())) {
CommitableFieldPanel commitableFieldPanel = toField(contentFolderTypeProvider);
String compilerOutputUrl = moduleCompilerPathsManager.getCompilerOutputUrl(contentFolderTypeProvider);
String url = commitableFieldPanel.getUrl();
if (!Comparing.equal(compilerOutputUrl, url)) {
return true;
}
}
return false;
}
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:BuildElementsEditor.java
示例10: getExcludeRootsForModule
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
@Nonnull
@Override
public VirtualFilePointer[] getExcludeRootsForModule(@Nonnull final ModuleRootLayer moduleRootLayer) {
ModuleCompilerPathsManager manager = ModuleCompilerPathsManager.getInstance(moduleRootLayer.getModule());
List<VirtualFilePointer> result = new ArrayList<VirtualFilePointer>(3);
if (manager.isInheritedCompilerOutput()) {
final VirtualFilePointer compilerOutputPointer = CompilerConfiguration.getInstance(myProject).getCompilerOutputPointer();
for (ContentEntry contentEntry : moduleRootLayer.getContentEntries()) {
if (compilerOutputPointer.getUrl().contains(contentEntry.getUrl())) {
result.add(compilerOutputPointer);
}
}
}
else {
if (!manager.isExcludeOutput()) {
return VirtualFilePointer.EMPTY_ARRAY;
}
for (ContentFolderTypeProvider contentFolderType : ContentFolderTypeProvider.filter(ContentFolderScopes.productionAndTest())) {
result.add(manager.getCompilerOutputPointer(contentFolderType));
}
}
return result.isEmpty() ? VirtualFilePointer.EMPTY_ARRAY : result.toArray(new VirtualFilePointer[result.size()]);
}
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:ExcludeCompilerOutputPolicy.java
示例11: addRootsFromModules
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
private void addRootsFromModules(boolean includeSourceRoots, Set<String> recursive, Set<String> flat) {
final Module[] modules = ModuleManager.getInstance(myProject).getModules();
for (Module module : modules) {
final ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
addRootsToTrack(moduleRootManager.getContentRootUrls(), recursive, flat);
if (includeSourceRoots) {
addRootsToTrack(moduleRootManager.getContentFolderUrls(ContentFolderScopes.all(false)), recursive, flat);
}
final OrderEntry[] orderEntries = moduleRootManager.getOrderEntries();
for (OrderEntry entry : orderEntries) {
if (entry instanceof OrderEntryWithTracking) {
for (OrderRootType orderRootType : OrderRootType.getAllTypes()) {
addRootsToTrack(entry.getUrls(orderRootType), recursive, flat);
}
}
}
}
}
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:ProjectRootManagerComponent.java
示例12: canUnmark
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
public boolean canUnmark(AnActionEvent e) {
Module module = e.getData(LangDataKeys.MODULE);
VirtualFile[] vFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
if (module == null || vFiles == null) {
return false;
}
ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
final ContentEntry[] contentEntries = moduleRootManager.getContentEntries();
for (VirtualFile vFile : vFiles) {
if (!vFile.isDirectory()) {
continue;
}
for (ContentEntry contentEntry : contentEntries) {
for (ContentFolder contentFolder : contentEntry.getFolders(ContentFolderScopes.all())) {
if (Comparing.equal(contentFolder.getFile(), vFile)) {
return true;
}
}
}
}
return false;
}
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:UnmarkRootAction.java
示例13: canMark
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
public boolean canMark(AnActionEvent e) {
Module module = e.getData(LangDataKeys.MODULE);
VirtualFile[] vFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
if (module == null || vFiles == null) {
return false;
}
ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
final ContentEntry[] contentEntries = moduleRootManager.getContentEntries();
for (VirtualFile vFile : vFiles) {
if (!vFile.isDirectory()) {
return false;
}
for (ContentEntry contentEntry : contentEntries) {
for (ContentFolder contentFolder : contentEntry.getFolders(ContentFolderScopes.all())) {
if (Comparing.equal(contentFolder.getFile(), vFile)) {
if (contentFolder.getType() == myContentFolderType) {
return false;
}
}
}
}
}
return true;
}
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:MarkRootAction.java
示例14: checkForTestRoots
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
private static void checkForTestRoots(final Module srcModule, final Set<VirtualFile> testFolders, final Set<Module> processed) {
final boolean isFirst = processed.isEmpty();
if (!processed.add(srcModule)) return;
final ContentEntry[] entries = ModuleRootManager.getInstance(srcModule).getContentEntries();
for (ContentEntry entry : entries) {
for (ContentFolder sourceFolder : entry.getFolders(ContentFolderScopes.of(TestContentFolderTypeProvider.getInstance()))) {
final VirtualFile sourceFolderFile = sourceFolder.getFile();
if (sourceFolderFile != null) {
testFolders.add(sourceFolderFile);
}
}
}
if (isFirst && !testFolders.isEmpty()) return;
final HashSet<Module> modules = new HashSet<Module>();
ModuleUtilCore.collectModulesDependsOn(srcModule, modules);
for (Module module : modules) {
checkForTestRoots(module, testFolders, processed);
}
}
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:CreateTestAction.java
示例15: getTargetDirectory
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
@Nullable
@Override
protected PsiDirectory getTargetDirectory(DataContext ctx, IdeView view)
{
PsiDirectory[] directories = view.getDirectories();
if(directories.length == 1)
{
PsiDirectory psiDir = directories[0];
VirtualFile vDir = psiDir.getVirtualFile();
ProjectFileIndex index = ProjectRootManager.getInstance(psiDir.getProject()).getFileIndex();
if(vDir.equals(index.getSourceRootForFile(vDir)) && index.isUnderContentFolderType(vDir, ContentFolderScopes.onlyProduction()))
{
return psiDir;
}
}
return null;
}
开发者ID:consulo,项目名称:consulo-java,代码行数:19,代码来源:CreateModuleInfoAction.java
示例16: replaceSourceRoot
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
private void replaceSourceRoot(final VirtualFile newSourceRoot) {
ApplicationManager.getApplication().runWriteAction(
new Runnable() {
@Override
public void run() {
final ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
final ContentEntry[] content = rootModel.getContentEntries();
boolean contentToChangeFound = false;
for (ContentEntry contentEntry : content) {
final ContentFolder[] sourceFolders = contentEntry.getFolders(ContentFolderScopes.of(ProductionContentFolderTypeProvider.getInstance()));
for (ContentFolder sourceFolder : sourceFolders) {
contentEntry.removeFolder(sourceFolder);
}
final VirtualFile contentRoot = contentEntry.getFile();
if (contentRoot != null && VfsUtilCore.isAncestor(contentRoot, newSourceRoot, false)) {
contentEntry.addFolder(newSourceRoot, ProductionContentFolderTypeProvider.getInstance());
contentToChangeFound = true;
}
}
assertTrue(contentToChangeFound);
rootModel.commit();
}
}
);
}
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:SrcRepositoryUseTest.java
示例17: testBug1
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
public void testBug1() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
PsiTestUtil.addExcludedRoot(myModule, myPackDir);
PsiClass psiClass = myJavaFacade.findClass("p.A", GlobalSearchScope.allScope(myProject));
assertNull(psiClass);
ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
final ContentEntry content = rootModel.getContentEntries()[0];
content.removeFolder(content.getFolders(ContentFolderScopes.excluded())[0]);
rootModel.commit();
psiClass = myJavaFacade.findClass("p.A", GlobalSearchScope.allScope(myProject));
assertEquals("p.A", psiClass.getQualifiedName());
}
});
}
开发者ID:consulo,项目名称:consulo-java,代码行数:19,代码来源:SCR14423Test.java
示例18: testBug3
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
public void testBug3() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
PsiClass psiClass = myJavaFacade.findClass("p.A", GlobalSearchScope.allScope(myProject));
assertEquals("p.A", psiClass.getQualifiedName());
assertTrue(psiClass.isValid());
PsiTestUtil.addExcludedRoot(myModule, myPackDir);
assertFalse(psiClass.isValid());
ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
final ContentEntry content = rootModel.getContentEntries()[0];
content.removeFolder(content.getFolders(ContentFolderScopes.excluded())[0]);
rootModel.commit();
psiClass = myJavaFacade.findClass("p.A");
assertTrue(psiClass.isValid());
}
});
}
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:SCR14423Test.java
示例19: getExcludeRoots
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
@Nonnull
@Override
public VirtualFile[] getExcludeRoots() {
final List<VirtualFile> result = new SmartList<>();
for (ContentEntry contentEntry : getContent()) {
Collections.addAll(result, contentEntry.getFolderFiles(ContentFolderScopes.excluded()));
}
return VfsUtilCore.toVirtualFileArray(result);
}
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:ModuleRootLayerImpl.java
示例20: getExcludeRootUrls
import consulo.roots.ContentFolderScopes; //导入依赖的package包/类
@Nonnull
@Override
public String[] getExcludeRootUrls() {
final List<String> result = new SmartList<>();
for (ContentEntry contentEntry : getContent()) {
Collections.addAll(result, contentEntry.getFolderUrls(ContentFolderScopes.excluded()));
}
return ArrayUtil.toStringArray(result);
}
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:ModuleRootLayerImpl.java
注:本文中的consulo.roots.ContentFolderScopes类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论