use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.
the class FileAssociationsManagerImpl method removeAssociation.
public void removeAssociation(PsiFile file, PsiFile assoc) {
final VirtualFile virtualFile = file.getVirtualFile();
if (virtualFile == null)
return;
if (assoc.getVirtualFile() == null)
return;
for (VirtualFilePointer pointer : myAssociations.keySet()) {
if (pointer.getUrl().equals(virtualFile.getUrl())) {
VirtualFilePointerContainer container = myAssociations.get(pointer);
if (container != null) {
//noinspection ConstantConditions
final VirtualFilePointer p = container.findByUrl(assoc.getVirtualFile().getUrl());
if (p != null) {
container.remove(p);
if (container.size() == 0) {
myAssociations.remove(pointer);
}
touch();
}
}
return;
}
}
}
use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.
the class FileAssociationsManagerImpl method copy.
private static HashMap<VirtualFilePointer, VirtualFilePointerContainer> copy(FileAssociationsManagerImpl other) {
final HashMap<VirtualFilePointer, VirtualFilePointerContainer> hashMap = new LinkedHashMap<>();
final Set<VirtualFilePointer> virtualFilePointers = other.myAssociations.keySet();
for (VirtualFilePointer pointer : virtualFilePointers) {
final VirtualFilePointerContainer container = other.myFilePointerManager.createContainer(other.myProject);
container.addAll(other.myAssociations.get(pointer));
hashMap.put(other.myFilePointerManager.duplicate(pointer, other.myProject, null), container);
}
return hashMap;
}
use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.
the class FileAssociationsManagerImpl method writeExternal.
public void writeExternal(Element element) throws WriteExternalException {
for (VirtualFilePointer pointer : myAssociations.keySet()) {
final Element e = new Element("file");
e.setAttribute("url", pointer.getUrl());
final VirtualFilePointerContainer container = myAssociations.get(pointer);
container.writeExternal(e, "association");
element.addContent(e);
}
}
Aggregations