Java 类com.intellij.openapi.vfs.pointers.VirtualFilePointerListener 实例源码

项目:intellij-ce-playground    文件:VirtualFilePointerManagerImpl.java   
private synchronized void assertAllPointersDisposed() {
  for (Map.Entry<VirtualFilePointerListener, FilePointerPartNode> entry : myPointers.entrySet()) {
    FilePointerPartNode root = entry.getValue();
    ArrayList<FilePointerPartNode> left = new ArrayList<FilePointerPartNode>();
    root.getPointersUnder(null, false, "", left);
    if (!left.isEmpty()) {
      VirtualFilePointerImpl p = left.get(0).leaf;
      try {
        p.throwDisposalError("Not disposed pointer: "+p);
      }
      finally {
        for (FilePointerPartNode pair : left) {
          VirtualFilePointerImpl pointer = pair.leaf;
          pointer.dispose();
        }
      }
    }
  }

  synchronized (myContainers) {
    if (!myContainers.isEmpty()) {
      VirtualFilePointerContainerImpl container = myContainers.iterator().next();
      container.throwDisposalError("Not disposed container");
    }
  }
}
项目:tools-idea    文件:VirtualFilePointerManagerImpl.java   
private synchronized void assertAllPointersDisposed() {
  for (Map.Entry<VirtualFilePointerListener, FilePointerPartNode> entry : myPointers.entrySet()) {
    FilePointerPartNode root = entry.getValue();
    ArrayList<FilePointerPartNode> left = new ArrayList<FilePointerPartNode>();
    root.getPointersUnder("", 0, left);
    if (!left.isEmpty()) {
      VirtualFilePointerImpl p = left.get(0).leaf;
      try {
        p.throwDisposalError("Not disposed pointer: "+p);
      }
      finally {
        for (FilePointerPartNode pair : left) {
          VirtualFilePointerImpl pointer = pair.leaf;
          pointer.dispose();
        }
      }
    }
  }

  synchronized (myContainers) {
    if (!myContainers.isEmpty()) {
      VirtualFilePointerContainerImpl container = myContainers.iterator().next();
      container.throwDisposalError("Not disposed container");
    }
  }
}
项目:intellij-ce-playground    文件:VirtualFilePointerManagerImpl.java   
@NotNull
private VirtualFilePointerImpl getOrCreate(@NotNull Disposable parentDisposable,
                                           @Nullable VirtualFilePointerListener listener,
                                           @NotNull String path,
                                           @NotNull Pair<VirtualFile, String> fileAndUrl) {
  FilePointerPartNode root = myPointers.get(listener);
  FilePointerPartNode node;
  if (root == null) {
    root = new FilePointerPartNode(path, null, fileAndUrl);
    myPointers.put(listener, root);
    node = root;
  }
  else {
    node = root.findPointerOrCreate(path, 0, fileAndUrl);
  }

  VirtualFilePointerImpl pointer;
  if (node.leaf == null) {
    pointer = new VirtualFilePointerImpl(listener, parentDisposable, fileAndUrl);
    node.associate(pointer, fileAndUrl);
  }
  else {
    pointer = node.leaf;
  }
  pointer.myNode.incrementUsageCount(1);

  root.checkConsistency();
  return pointer;
}
项目:intellij-ce-playground    文件:VirtualFilePointerManagerImpl.java   
@Override
@NotNull
public synchronized VirtualFilePointer duplicate(@NotNull VirtualFilePointer pointer,
                                                 @NotNull Disposable parent,
                                                 @Nullable VirtualFilePointerListener listener) {
  VirtualFile file = pointer.getFile();
  return file == null ? create(pointer.getUrl(), parent, listener) : create(file, parent, listener);
}
项目:intellij-ce-playground    文件:VirtualFilePointerManagerImpl.java   
void removeNode(@NotNull FilePointerPartNode node, VirtualFilePointerListener listener) {
  boolean rootNodeEmpty = node.remove();
  if (rootNodeEmpty) {
    myPointers.remove(listener);
  }
  else {
    myPointers.get(listener).checkConsistency();
  }
}
项目:intellij-ce-playground    文件:VirtualFilePointerTest.java   
private VirtualFilePointer createPointerByFile(final File file, final VirtualFilePointerListener fileListener) throws IOException {
  final String url = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, file.getCanonicalPath().replace(File.separatorChar, '/'));
  final VirtualFile vFile = refreshAndFind(url);
  return vFile == null
         ? myVirtualFilePointerManager.create(url, disposable, fileListener)
         : myVirtualFilePointerManager.create(vFile, disposable, fileListener);
}
项目:intellij-ce-playground    文件:CoreVirtualFilePointerManager.java   
@NotNull
@Override
public VirtualFilePointer duplicate(@NotNull VirtualFilePointer pointer,
                                    @NotNull Disposable parent,
                                    @Nullable VirtualFilePointerListener listener) {
  return new IdentityVirtualFilePointer(pointer.getFile(), pointer.getUrl());
}
项目:intellij-ce-playground    文件:VirtualFilePointerContainerImpl.java   
public VirtualFilePointerContainerImpl(@NotNull VirtualFilePointerManager manager,
                                       @NotNull Disposable parentDisposable,
                                       @Nullable VirtualFilePointerListener listener) {
  //noinspection HardCodedStringLiteral
  super(TRACE_CREATION && !ApplicationInfoImpl.isInPerformanceTest()
        ? new Throwable("parent = '" + parentDisposable + "' (" + parentDisposable.getClass() + "); listener=" + listener)
        : null);
  myVirtualFilePointerManager = manager;
  myParent = parentDisposable;
  myListener = listener;
}
项目:intellij-ce-playground    文件:VirtualFilePointerContainerImpl.java   
@Override
@NotNull
public VirtualFilePointerContainer clone(@NotNull Disposable parent, @Nullable VirtualFilePointerListener listener) {
  assert !myDisposed;
  VirtualFilePointerContainer clone = myVirtualFilePointerManager.createContainer(parent, listener);
  for (VirtualFilePointer pointer : myList) {
    clone.add(pointer.getUrl());
  }
  return clone;
}
项目:tools-idea    文件:VirtualFilePointerManagerImpl.java   
@NotNull
private VirtualFilePointerImpl getOrCreate(@NotNull Disposable parentDisposable,
                                           @Nullable VirtualFilePointerListener listener,
                                           @NotNull String path,
                                           @NotNull Pair<VirtualFile, String> fileAndUrl) {
  FilePointerPartNode root = myPointers.get(listener);
  FilePointerPartNode node;
  if (root == null) {
    root = new FilePointerPartNode(path, null, fileAndUrl);
    myPointers.put(listener, root);
    node = root;
  }
  else {
    node = root.findPointerOrCreate(path, 0, fileAndUrl);
  }

  VirtualFilePointerImpl pointer;
  if (node.leaf == null) {
    pointer = new VirtualFilePointerImpl(listener, parentDisposable, fileAndUrl);
    node.associate(pointer, fileAndUrl);
  }
  else {
    pointer = node.leaf;
  }
  pointer.myNode.incrementUsageCount(1);

  root.checkStructure();
  return pointer;
}
项目:tools-idea    文件:VirtualFilePointerManagerImpl.java   
@Override
@NotNull
public synchronized VirtualFilePointer duplicate(@NotNull VirtualFilePointer pointer,
                                                 @NotNull Disposable parent,
                                                 @Nullable VirtualFilePointerListener listener) {
  VirtualFile file = pointer.getFile();
  return file == null ? create(pointer.getUrl(), parent, listener) : create(file, parent, listener);
}
项目:tools-idea    文件:VirtualFilePointerManagerImpl.java   
void removeNode(@NotNull FilePointerPartNode node, VirtualFilePointerListener listener) {
  boolean rootNodeEmpty = node.remove();
  if (rootNodeEmpty) {
    myPointers.remove(listener);
  }
  else {
    myPointers.get(listener).checkStructure();
  }
}
项目:tools-idea    文件:VirtualFilePointerTest.java   
private VirtualFilePointer createPointerByFile(final File file, final VirtualFilePointerListener fileListener) throws IOException {
  final String url = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, file.getCanonicalPath().replace(File.separatorChar, '/'));
  final VirtualFile vFile = refreshAndFind(url);
  return vFile == null
         ? myVirtualFilePointerManager.create(url, disposable, fileListener)
         : myVirtualFilePointerManager.create(vFile, disposable, fileListener);
}
项目:tools-idea    文件:CoreVirtualFilePointerManager.java   
@NotNull
@Override
public VirtualFilePointer duplicate(@NotNull VirtualFilePointer pointer,
                                    @NotNull Disposable parent,
                                    @Nullable VirtualFilePointerListener listener) {
  return new IdentityVirtualFilePointer(pointer.getFile(), pointer.getUrl());
}
项目:tools-idea    文件:VirtualFilePointerContainerImpl.java   
public VirtualFilePointerContainerImpl(@NotNull VirtualFilePointerManager manager,
                                       @NotNull Disposable parentDisposable,
                                       @Nullable VirtualFilePointerListener listener) {
  //noinspection HardCodedStringLiteral
  super(TRACE_CREATION
        ? new Throwable("parent = '" + parentDisposable + "' (" + parentDisposable.getClass() + "); listener=" + listener)
        : null);
  myVirtualFilePointerManager = manager;
  myParent = parentDisposable;
  myListener = listener;
}
项目:tools-idea    文件:VirtualFilePointerContainerImpl.java   
@Override
@NotNull
public VirtualFilePointerContainer clone(@NotNull Disposable parent, @Nullable VirtualFilePointerListener listener) {
  assert !myDisposed;
  VirtualFilePointerContainer clone = myVirtualFilePointerManager.createContainer(parent, listener);
  for (VirtualFilePointer pointer : myList) {
    clone.add(pointer.getUrl());
  }
  return clone;
}
项目:consulo    文件:CompilerServerVirtualFilePointerManager.java   
@Nonnull
@Override
public VirtualFilePointer duplicate(@Nonnull VirtualFilePointer pointer,
                                    @Nonnull Disposable parent,
                                    @Nullable VirtualFilePointerListener listener) {
  return new CompilerServerVirtualFilePointer(pointer.getUrl());
}
项目:consulo    文件:VirtualFilePointerTest.java   
private VirtualFilePointer createPointerByFile(final File file, final VirtualFilePointerListener fileListener) throws IOException {
  final String url = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, file.getCanonicalPath().replace(File.separatorChar, '/'));
  final VirtualFile vFile = refreshAndFind(url);
  return vFile == null
         ? myVirtualFilePointerManager.create(url, disposable, fileListener)
         : myVirtualFilePointerManager.create(vFile, disposable, fileListener);
}
项目:consulo    文件:VirtualFilePointerManagerImpl.java   
@Nonnull
private VirtualFilePointerImpl getOrCreate(@Nonnull Disposable parentDisposable,
                                           @Nullable VirtualFilePointerListener listener,
                                           @Nonnull String path,
                                           @Nonnull Pair<VirtualFile, String> fileAndUrl) {
  FilePointerPartNode root = myPointers.get(listener);
  FilePointerPartNode node;
  if (root == null) {
    root = new FilePointerPartNode(path, null, fileAndUrl);
    root.pointersUnder++;
    myPointers.put(listener, root);
    node = root;
  }
  else {
    node = root.findPointerOrCreate(path, 0, fileAndUrl, 1);
  }

  VirtualFilePointerImpl pointer = node.getAnyPointer();
  if (pointer == null) {
    pointer = new VirtualFilePointerImpl(listener, parentDisposable, fileAndUrl);
    node.associate(pointer, fileAndUrl);
  }
  pointer.myNode.incrementUsageCount(1);

  root.checkConsistency();
  return pointer;
}
项目:consulo    文件:VirtualFilePointerManagerImpl.java   
@Override
@Nonnull
public synchronized VirtualFilePointer duplicate(@Nonnull VirtualFilePointer pointer,
                                                 @Nonnull Disposable parent,
                                                 @Nullable VirtualFilePointerListener listener) {
  VirtualFile file = pointer.getFile();
  return file == null ? create(pointer.getUrl(), parent, listener) : create(file, parent, listener);
}
项目:consulo    文件:VirtualFilePointerManagerImpl.java   
private synchronized void assertAllPointersDisposed() {
  for (Map.Entry<VirtualFilePointerListener, FilePointerPartNode> entry : myPointers.entrySet()) {
    FilePointerPartNode root = entry.getValue();
    List<FilePointerPartNode> left = new ArrayList<FilePointerPartNode>();
    List<VirtualFilePointerImpl> pointers = new ArrayList<VirtualFilePointerImpl>();
    root.addPointersUnder(null, false, "", left);
    for (FilePointerPartNode node : left) {
      node.addAllPointersTo(pointers);
    }
    if (!pointers.isEmpty()) {
      VirtualFilePointerImpl p = pointers.get(0);
      try {
        p.throwDisposalError("Not disposed pointer: "+p);
      }
      finally {
        for (VirtualFilePointerImpl pointer : pointers) {
          pointer.dispose();
        }
      }
    }
  }

  synchronized (myContainers) {
    if (!myContainers.isEmpty()) {
      VirtualFilePointerContainerImpl container = myContainers.iterator().next();
      container.throwDisposalError("Not disposed container");
    }
  }
}
项目:consulo    文件:VirtualFilePointerManagerImpl.java   
void removeNode(@Nonnull FilePointerPartNode node, VirtualFilePointerListener listener) {
  FilePointerPartNode root = node.remove();
  boolean rootNodeEmpty = root.children.length == 0 ;
  if (rootNodeEmpty) {
    myPointers.remove(listener);
  }
  else {
    myPointers.get(listener).checkConsistency();
  }
}
项目:consulo    文件:CoreVirtualFilePointerManager.java   
@Nonnull
@Override
public VirtualFilePointer duplicate(@Nonnull VirtualFilePointer pointer,
                                    @Nonnull Disposable parent,
                                    @Nullable VirtualFilePointerListener listener) {
  return new IdentityVirtualFilePointer(pointer.getFile(), pointer.getUrl());
}
项目:consulo    文件:VirtualFilePointerContainerImpl.java   
public VirtualFilePointerContainerImpl(@Nonnull VirtualFilePointerManager manager,
                                       @Nonnull Disposable parentDisposable,
                                       @Nullable VirtualFilePointerListener listener) {
  //noinspection HardCodedStringLiteral
  super(TRACE_CREATION && !ApplicationInfoImpl.isInPerformanceTest());
  myVirtualFilePointerManager = manager;
  myParent = parentDisposable;
  myListener = listener;
}
项目:consulo    文件:VirtualFilePointerContainerImpl.java   
@Override
@Nonnull
public VirtualFilePointerContainer clone(@Nonnull Disposable parent, @Nullable VirtualFilePointerListener listener) {
  assert !myDisposed;
  VirtualFilePointerContainer clone = myVirtualFilePointerManager.createContainer(parent, listener);
  for (VirtualFilePointer pointer : myList) {
    clone.add(pointer.getUrl());
  }
  return clone;
}
项目:intellij-ce-playground    文件:VirtualFilePointerImpl.java   
VirtualFilePointerImpl(VirtualFilePointerListener listener, @NotNull Disposable parentDisposable, Pair<VirtualFile, String> fileAndUrl) {
  super(TRACE_CREATION ? new Throwable("parent = '" + parentDisposable + "' (" + parentDisposable.getClass() + "); URL="+fileAndUrl) : null);
  myListener = listener;
}
项目:intellij-ce-playground    文件:VirtualFilePointerImpl.java   
VirtualFilePointerListener getListener() {
  return myListener;
}
项目:intellij-ce-playground    文件:VirtualFilePointerManagerImpl.java   
private EventDescriptor(@NotNull VirtualFilePointerListener listener, @NotNull VirtualFilePointer[] pointers) {
  myListener = listener;
  myPointers = pointers;
}
项目:intellij-ce-playground    文件:VirtualFilePointerManagerImpl.java   
@Override
@NotNull
public synchronized VirtualFilePointer create(@NotNull String url, @NotNull Disposable parent, @Nullable VirtualFilePointerListener listener) {
  return create(null, url, parent, listener);
}
项目:intellij-ce-playground    文件:VirtualFilePointerManagerImpl.java   
@Override
@NotNull
public synchronized VirtualFilePointer create(@NotNull VirtualFile file, @NotNull Disposable parent, @Nullable VirtualFilePointerListener listener) {
  return create(file, null, parent, listener);
}
项目:intellij-ce-playground    文件:VirtualFilePointerManagerImpl.java   
@Override
@NotNull
public synchronized VirtualFilePointerContainer createContainer(@NotNull Disposable parent, @Nullable VirtualFilePointerListener listener) {
  return registerContainer(parent, new VirtualFilePointerContainerImpl(this, parent, listener));
}
项目:intellij-ce-playground    文件:CoreVirtualFilePointerManager.java   
@NotNull
@Override
public VirtualFilePointer create(@NotNull String url, @NotNull Disposable parent, @Nullable VirtualFilePointerListener listener) {
  VirtualFile vFile = VirtualFileManager.getInstance().findFileByUrl(url);
  return new IdentityVirtualFilePointer(vFile, url);
}
项目:intellij-ce-playground    文件:CoreVirtualFilePointerManager.java   
@NotNull
@Override
public VirtualFilePointer create(@NotNull VirtualFile file, @NotNull Disposable parent, @Nullable VirtualFilePointerListener listener) {
  return new IdentityVirtualFilePointer(file, file.getUrl());
}
项目:intellij-ce-playground    文件:CoreVirtualFilePointerManager.java   
@NotNull
@Override
public VirtualFilePointerContainer createContainer(@NotNull Disposable parent, @Nullable VirtualFilePointerListener listener) {
  return new VirtualFilePointerContainerImpl(this, parent, listener);
}
项目:tools-idea    文件:VirtualFilePointerImpl.java   
VirtualFilePointerImpl(VirtualFilePointerListener listener, @NotNull Disposable parentDisposable, Pair<VirtualFile, String> fileAndUrl) {
  super(TRACE_CREATION ? new Throwable("parent = '" + parentDisposable + "' (" + parentDisposable.getClass() + "); URL="+fileAndUrl) : null);
  myListener = listener;
}
项目:tools-idea    文件:VirtualFilePointerImpl.java   
VirtualFilePointerListener getListener() {
  return myListener;
}
项目:tools-idea    文件:VirtualFilePointerManagerImpl.java   
private EventDescriptor(@NotNull VirtualFilePointerListener listener, @NotNull VirtualFilePointer[] pointers) {
  myListener = listener;
  myPointers = pointers;
}
项目:tools-idea    文件:VirtualFilePointerManagerImpl.java   
@Override
@NotNull
public synchronized VirtualFilePointer create(@NotNull String url, @NotNull Disposable parent, @Nullable VirtualFilePointerListener listener) {
  return create(null, url, parent, listener);
}
项目:tools-idea    文件:VirtualFilePointerManagerImpl.java   
@Override
@NotNull
public synchronized VirtualFilePointer create(@NotNull VirtualFile file, @NotNull Disposable parent, @Nullable VirtualFilePointerListener listener) {
  return create(file, file.getUrl(), parent, listener);
}
项目:tools-idea    文件:VirtualFilePointerManagerImpl.java   
@Override
@NotNull
public synchronized VirtualFilePointerContainer createContainer(@NotNull Disposable parent, @Nullable VirtualFilePointerListener listener) {
  return registerContainer(parent, new VirtualFilePointerContainerImpl(this, parent, listener));
}