Java Code Examples for com.intellij.util.containers.ContainerUtil#createLockFreeCopyOnWriteList()

The following examples show how to use com.intellij.util.containers.ContainerUtil#createLockFreeCopyOnWriteList() . 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: HighlightInfoComposite.java    From consulo with Apache License 2.0 6 votes vote down vote up
private HighlightInfoComposite(@Nonnull List<? extends HighlightInfo> infos, @Nonnull HighlightInfo anchorInfo) {
  super(null, null, anchorInfo.type, anchorInfo.startOffset, anchorInfo.endOffset, createCompositeDescription(infos), createCompositeTooltip(infos), anchorInfo.type.getSeverity(null), false, null,
        false, 0, anchorInfo.getProblemGroup(), null, anchorInfo.getGutterIconRenderer());
  highlighter = anchorInfo.getHighlighter();
  setGroup(anchorInfo.getGroup());
  List<Pair<IntentionActionDescriptor, RangeMarker>> markers = ContainerUtil.emptyList();
  List<Pair<IntentionActionDescriptor, TextRange>> ranges = ContainerUtil.emptyList();
  for (HighlightInfo info : infos) {
    if (info.quickFixActionMarkers != null) {
      if (markers == ContainerUtil.<Pair<IntentionActionDescriptor, RangeMarker>>emptyList()) markers = new ArrayList<>();
      markers.addAll(info.quickFixActionMarkers);
    }
    if (info.quickFixActionRanges != null) {
      if (ranges == ContainerUtil.<Pair<IntentionActionDescriptor, TextRange>>emptyList()) ranges = new ArrayList<>();
      ranges.addAll(info.quickFixActionRanges);
    }
  }
  quickFixActionMarkers = ContainerUtil.createLockFreeCopyOnWriteList(markers);
  quickFixActionRanges = ContainerUtil.createLockFreeCopyOnWriteList(ranges);
}
 
Example 2
Source File: HighlightInfo.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void registerFix(@Nullable IntentionAction action, @Nullable List<IntentionAction> options, @Nullable String displayName, @Nullable TextRange fixRange, @Nullable HighlightDisplayKey key) {
  if (action == null) return;
  if (fixRange == null) fixRange = new TextRange(startOffset, endOffset);
  if (quickFixActionRanges == null) {
    quickFixActionRanges = ContainerUtil.createLockFreeCopyOnWriteList();
  }
  IntentionActionDescriptor desc = new IntentionActionDescriptor(action, options, displayName, null, key, getProblemGroup(), getSeverity());
  quickFixActionRanges.add(Pair.create(desc, fixRange));
  fixStartOffset = Math.min(fixStartOffset, fixRange.getStartOffset());
  fixEndOffset = Math.max(fixEndOffset, fixRange.getEndOffset());
  if (action instanceof HintAction) {
    setHint(true);
  }
}
 
Example 3
Source File: MessageBusImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
void notifyOnSubscription(@Nonnull MessageBusConnectionImpl connection, @Nonnull Topic<?> topic) {
  checkNotDisposed();
  List<MessageBusConnectionImpl> topicSubscribers = mySubscribers.get(topic);
  if (topicSubscribers == null) {
    topicSubscribers = ContainerUtil.createLockFreeCopyOnWriteList();
    topicSubscribers = ConcurrencyUtil.cacheOrGet(mySubscribers, topic, topicSubscribers);
  }

  topicSubscribers.add(connection);

  myRootBus.clearSubscriberCache();
}
 
Example 4
Source File: TestFailedState.java    From consulo with Apache License 2.0 4 votes vote down vote up
public TestFailedState(@Nullable final String localizedMessage, @Nullable final String stackTrace) {
  myPresentationText = ContainerUtil.createLockFreeCopyOnWriteList(Collections.singleton(buildErrorPresentationText(localizedMessage, stackTrace)));
}
 
Example 5
Source File: ChangeSet.java    From consulo with Apache License 2.0 4 votes vote down vote up
public ChangeSet(long id, long timestamp) {
  myId = id;
  myTimestamp = timestamp;
  myChanges = ContainerUtil.createLockFreeCopyOnWriteList();
}