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

The following examples show how to use com.intellij.util.containers.ContainerUtil#immutableList() . 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: ConfirmingTrustManager.java    From consulo with Apache License 2.0 6 votes vote down vote up
/**
 * Select all available certificates from underlying trust store. Returned list is not supposed to be modified.
 *
 * @return certificates
 */
public List<X509Certificate> getCertificates() {
  myReadLock.lock();
  try {
    List<X509Certificate> certificates = new ArrayList<X509Certificate>();
    for (String alias : Collections.list(myKeyStore.aliases())) {
      certificates.add(getCertificate(alias));
    }
    return ContainerUtil.immutableList(certificates);
  }
  catch (Exception e) {
    LOG.error(e);
    return ContainerUtil.emptyList();
  }
  finally {
    myReadLock.unlock();
  }
}
 
Example 2
Source File: PersistentFSImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void processEvents(@Nonnull List<? extends VFileEvent> events) {
  ApplicationManager.getApplication().assertWriteAccessAllowed();

  int startIndex = 0;
  int cappedInitialSize = Math.min(events.size(), INNER_ARRAYS_THRESHOLD);
  List<Runnable> applyEvents = new ArrayList<>(cappedInitialSize);
  MostlySingularMultiMap<String, VFileEvent> files = new MostlySingularMultiMap<String, VFileEvent>() {
    @Nonnull
    @Override
    protected Map<String, Object> createMap() {
      return new THashMap<>(cappedInitialSize, FileUtil.PATH_HASHING_STRATEGY);
    }
  };
  Set<String> middleDirs = new THashSet<>(cappedInitialSize, FileUtil.PATH_HASHING_STRATEGY);
  List<VFileEvent> validated = new ArrayList<>(cappedInitialSize);
  BulkFileListener publisher = getPublisher();
  while (startIndex != events.size()) {
    applyEvents.clear();
    files.clear();
    middleDirs.clear();
    validated.clear();
    startIndex = groupAndValidate(events, startIndex, applyEvents, validated, files, middleDirs);

    if (!validated.isEmpty()) {
      // do defensive copy to cope with ill-written listeners that save passed list for later processing
      List<VFileEvent> toSend = ContainerUtil.immutableList(validated.toArray(new VFileEvent[0]));
      publisher.before(toSend);

      applyEvents.forEach(Runnable::run);

      publisher.after(toSend);
    }
  }
}
 
Example 3
Source File: AbstractProjectViewPane.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
static List<TreeVisitor> createVisitors(@Nonnull Object... objects) {
  List<TreeVisitor> list = new ArrayList<>();
  for (Object object : objects) {
    TreeVisitor visitor = createVisitor(object);
    ContainerUtil.addIfNotNull(list, visitor);
  }
  return ContainerUtil.immutableList(list);
}
 
Example 4
Source File: IdeDocumentHistoryImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
@Nonnull
public List<PlaceInfo> getBackPlaces() {
  return ContainerUtil.immutableList(myBackPlaces);
}
 
Example 5
Source File: IdeDocumentHistoryImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public List<PlaceInfo> getChangePlaces() {
  return ContainerUtil.immutableList(myChangePlaces);
}
 
Example 6
Source File: Utils.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public static List<Shortcut> shortcutsOf(@Nonnull String actionId) {
  AnAction action = ActionManager.getInstance().getAction(actionId);
  return action == null ? ContainerUtil.<Shortcut>emptyList() : ContainerUtil.immutableList(action.getShortcutSet().getShortcuts());
}
 
Example 7
Source File: ProjectViewPaneSelectionHelper.java    From consulo with Apache License 2.0 4 votes vote down vote up
public SelectionDescriptor(@Nullable PsiElement targetPsiElement, @Nullable VirtualFile targetVirtualFile, @Nonnull List<TreePath> originalTreePaths) {
  this.targetPsiElement = targetPsiElement;
  this.targetVirtualFile = targetVirtualFile;
  this.originalTreePaths = ContainerUtil.immutableList(originalTreePaths);
}
 
Example 8
Source File: IgnoreEntryOccurrence.java    From idea-gitignore with MIT License 2 votes vote down vote up
/**
 * Constructor.
 *
 * @param url   entry URL
 * @param items parsed entry items
 */
public IgnoreEntryOccurrence(@NotNull String url, @NotNull ArrayList<Pair<String, Boolean>> items) {
    this.url = url;
    this.items = ContainerUtil.immutableList(items);
}