本文整理汇总了Java中consulo.roots.ContentFolderScopes类的典型用法代码示例。如果您正苦于以下问题:Java ContentFolderScopes类的具体用法?Java ContentFolderScopes怎么用?Java ContentFolderScopes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContentFolderScopes类属于consulo.roots包,在下文中一共展示了ContentFolderScopes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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)));
}
}
}
}
}
示例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;
}
示例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()]);
}
示例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);
}
}
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}