private NamedScope createScope(final Project project, final String firstGroupName, String secondGroupName) { final FilePatternPackageSet firstFilePatternPackageSet = new FilePatternPackageSet( SEARCH_SCOPE_GROUP_PREFIX + firstGroupName, "*//*" ); final FilePatternPackageSet secondFilePatternPackageSet = new FilePatternPackageSet( SEARCH_SCOPE_GROUP_PREFIX + secondGroupName, "*//*" ); final UnionPackageSet unionPackageSet = new UnionPackageSet( firstFilePatternPackageSet, secondFilePatternPackageSet ); return new NamedScope( SEARCH_SCOPE_Y_PREFIX + " " + firstGroupName + " " + secondGroupName, unionPackageSet ); }
@NotNull private NamedScope createScope(final Project project, final String groupName) { final FilePatternPackageSet filePatternPackageSet = new FilePatternPackageSet( SEARCH_SCOPE_GROUP_PREFIX + groupName, "*//*" ); return new NamedScope(SEARCH_SCOPE_Y_PREFIX + " " + groupName, filePatternPackageSet); }
public void testConvertToRegexp() throws Exception { assertEquals("a\\.[^\\.]*", FilePatternPackageSet.convertToRegexp("a.*", '.')); assertEquals("a\\.(.*\\.)?[^\\.]*", FilePatternPackageSet.convertToRegexp("a..*", '.')); assertEquals("a\\/[^\\/]*", FilePatternPackageSet.convertToRegexp("a/*", '/')); assertEquals("a\\/.*\\.css", FilePatternPackageSet.convertToRegexp("a/*.css", '/')); assertEquals("a\\/(.*\\/)?[^\\/]*", FilePatternPackageSet.convertToRegexp("a//*", '/')); assertEquals("[^\\.]*", FilePatternPackageSet.convertToRegexp("*", '.')); }
public void testConvertToRegexp() throws Exception { assertEquals("a\\.[^\\.]*", FilePatternPackageSet.convertToRegexp("a.*", '.')); assertEquals("a\\.(.*\\.)?[^\\.]*", FilePatternPackageSet.convertToRegexp("a..*", '.')); assertEquals("a\\/[^\\/]*", FilePatternPackageSet.convertToRegexp("a/*", '/')); assertEquals("a\\/(.*\\/)?[^\\/]*", FilePatternPackageSet.convertToRegexp("a//*", '/')); assertEquals("[^\\.]*", FilePatternPackageSet.convertToRegexp("*", '.')); }
public DirectoryNode(VirtualFile aDirectory, Project project, boolean compactPackages, boolean showFQName, VirtualFile baseDir, final VirtualFile[] contentRoots) { super(project); myVDirectory = aDirectory; final ProjectRootManager projectRootManager = ProjectRootManager.getInstance(project); final ProjectFileIndex index = projectRootManager.getFileIndex(); String dirName = aDirectory.getName(); if (showFQName) { final VirtualFile contentRoot = index.getContentRootForFile(myVDirectory); if (contentRoot != null) { if (Comparing.equal(myVDirectory, contentRoot)) { myFQName = dirName; } else { final VirtualFile sourceRoot = index.getSourceRootForFile(myVDirectory); if (Comparing.equal(myVDirectory, sourceRoot)) { myFQName = VfsUtilCore.getRelativePath(myVDirectory, contentRoot, '/'); } else if (sourceRoot != null) { myFQName = VfsUtilCore.getRelativePath(myVDirectory, sourceRoot, '/'); } else { myFQName = VfsUtilCore.getRelativePath(myVDirectory, contentRoot, '/'); } } if (contentRoots.length > 1 && ProjectRootsUtil.isModuleContentRoot(myVDirectory, project)) { myFQName = getContentRootName(baseDir, myFQName); } } else { myFQName = FilePatternPackageSet.getLibRelativePath(myVDirectory, index); } dirName = myFQName; } else { if (contentRoots.length > 1 && ProjectRootsUtil.isModuleContentRoot(myVDirectory, project)) { dirName = getContentRootName(baseDir, dirName); } } myDirName = dirName; myCompactPackages = compactPackages; }