com.intellij.util.containers.WeakList Java Examples

The following examples show how to use com.intellij.util.containers.WeakList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LazyRangeMarkerFactoryImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void addToLazyMarkersList(@Nonnull LazyMarker marker, @Nonnull VirtualFile file) {
  WeakList<LazyMarker> markers = getMarkers(file);

  if (markers == null) {
    markers = file.putUserDataIfAbsent(LAZY_MARKERS_KEY, new WeakList<>());
  }
  markers.add(marker);
}
 
Example #2
Source File: LazyRangeMarkerFactoryImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void removeFromLazyMarkersList(@Nonnull LazyMarker marker, @Nonnull VirtualFile file) {
  WeakList<LazyMarker> markers = getMarkers(file);

  if (markers != null) {
    markers.remove(marker);
  }
}
 
Example #3
Source File: AbstractProgressIndicatorExBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void finish(@Nonnull final TaskInfo task) {
  WeakList<TaskInfo> finished = myFinished;
  if (finished == null) {
    synchronized (getLock()) {
      finished = myFinished;
      if (finished == null) {
        myFinished = finished = new WeakList<>();
      }
    }
  }
  if (!finished.addIfAbsent(task)) return;

  delegateRunningChange(each -> each.finish(task));
}
 
Example #4
Source File: LazyRangeMarkerFactoryImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
static WeakList<LazyMarker> getMarkers(@Nonnull VirtualFile file) {
  return file.getUserData(LazyRangeMarkerFactoryImpl.LAZY_MARKERS_KEY);
}