use of com.intellij.openapi.vfs.LocalFileSystem in project intellij-community by JetBrains.
the class AntTasksProvider method getAntObjects.
private static Map<String, Class> getAntObjects(final GroovyFile groovyFile) {
final Project project = groovyFile.getProject();
final Module module = ModuleUtilCore.findModuleForPsiElement(groovyFile);
Set<VirtualFile> jars = new HashSet<>();
if (module != null) {
ContainerUtil.addAll(jars, OrderEnumerator.orderEntries(module).getAllLibrariesAndSdkClassesRoots());
}
if (groovyFile.isScript() && GroovyScriptUtil.getScriptType(groovyFile) instanceof GantScriptType) {
jars.addAll(GantScriptType.additionalScopeFiles(groovyFile));
}
final ArrayList<URL> urls = new ArrayList<>();
for (VirtualFile jar : jars) {
VirtualFile localFile = PathUtil.getLocalFile(jar);
if (localFile.getFileSystem() instanceof LocalFileSystem) {
urls.add(VfsUtilCore.convertToURL(localFile.getUrl()));
}
}
AntClassLoader loader;
synchronized (ourLock) {
final Map<List<URL>, AntClassLoader> map = CachedValuesManager.getManager(project).getParameterizedCachedValue(project, KEY, PROVIDER, false, project);
loader = map.get(urls);
if (loader == null) {
map.put(urls, loader = new AntClassLoader(urls));
}
}
return loader.getAntObjects();
}
use of com.intellij.openapi.vfs.LocalFileSystem in project intellij-community by JetBrains.
the class MavenProject method getExistingModuleFiles.
@NotNull
public List<VirtualFile> getExistingModuleFiles() {
LocalFileSystem fs = LocalFileSystem.getInstance();
List<VirtualFile> result = new ArrayList<>();
Set<String> pathsInStack = getModulePaths();
for (String each : pathsInStack) {
VirtualFile f = fs.findFileByPath(each);
if (f != null)
result.add(f);
}
return result;
}
use of com.intellij.openapi.vfs.LocalFileSystem in project intellij-community by JetBrains.
the class SvnExternalCommitNoticedTest method testExternalCommitInExternals.
@Test
public void testExternalCommitInExternals() throws Exception {
prepareExternal();
final File sourceDir = new File(myWorkingCopyDir.getPath(), "source");
final File externalDir = new File(myWorkingCopyDir.getPath(), "source/external");
final File file = new File(externalDir, "t11.txt");
final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
final File mainFile = new File(myWorkingCopyDir.getPath(), "source/s1.txt");
final VirtualFile vfMain = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(mainFile);
renameFileInCommand(vf, "tt11.txt");
renameFileInCommand(vfMain, "ss11.txt");
myVcsDirtyScopeManager.markEverythingDirty();
clManager.ensureUpToDate(false);
Assert.assertEquals(2, clManager.getChangesIn(myWorkingCopyDir).size());
TimeoutUtil.sleep(100);
runInAndVerifyIgnoreOutput("ci", "-m", "test", sourceDir.getPath());
runInAndVerifyIgnoreOutput("ci", "-m", "test", externalDir.getPath());
myWorkingCopyDir.refresh(false, true);
final LocalFileSystem lfs = LocalFileSystem.getInstance();
imitateEvent(lfs.refreshAndFindFileByIoFile(sourceDir));
imitateEvent(lfs.refreshAndFindFileByIoFile(externalDir));
// no dirty scope externally provided! just VFS refresh
clManager.ensureUpToDate(false);
Assert.assertEquals(0, clManager.getChangesIn(myWorkingCopyDir).size());
}
use of com.intellij.openapi.vfs.LocalFileSystem in project intellij-community by JetBrains.
the class SvnChangeProvider method putAdministrative17UnderVfsListener.
/**
* TODO: Currently could not find exact case when "file status is not correctly refreshed after external commit" that is covered by this
* TODO: code. So for now, checks for formats greater than 1.7 are not added here.
*/
private static void putAdministrative17UnderVfsListener(Set<NestedCopyInfo> pointInfos) {
if (!SvnVcs.ourListenToWcDb)
return;
final LocalFileSystem lfs = LocalFileSystem.getInstance();
for (NestedCopyInfo info : pointInfos) {
if (WorkingCopyFormat.ONE_DOT_SEVEN.equals(info.getFormat()) && !NestedCopyType.switched.equals(info.getType())) {
final VirtualFile root = info.getFile();
lfs.refreshIoFiles(Collections.singletonList(SvnUtil.getWcDb(virtualToIoFile(root))), true, false, null);
}
}
}
use of com.intellij.openapi.vfs.LocalFileSystem in project intellij-community by JetBrains.
the class SvnFileUrlMappingImpl method fillMapping.
private void fillMapping(final SvnMapping mapping, final List<SvnCopyRootSimple> list) {
final LocalFileSystem lfs = LocalFileSystem.getInstance();
for (SvnCopyRootSimple simple : list) {
final VirtualFile copyRoot = lfs.findFileByIoFile(new File(simple.myCopyRoot));
final VirtualFile vcsRoot = lfs.findFileByIoFile(new File(simple.myVcsRoot));
if (copyRoot == null || vcsRoot == null)
continue;
final SvnVcs vcs = SvnVcs.getInstance(myProject);
final Info svnInfo = vcs.getInfo(copyRoot);
if ((svnInfo == null) || (svnInfo.getRepositoryRootURL() == null))
continue;
Node node = new Node(copyRoot, svnInfo.getURL(), svnInfo.getRepositoryRootURL());
final RootUrlInfo info = new RootUrlInfo(node, SvnFormatSelector.findRootAndGetFormat(svnInfo.getFile()), vcsRoot);
mapping.add(info);
}
}
Aggregations