Java Code Examples for com.intellij.util.containers.MultiMap#putAllValues()

The following examples show how to use com.intellij.util.containers.MultiMap#putAllValues() . 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: VcsDirtyScopeManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
private VcsInvalidated calculateInvalidated(@Nonnull DirtBuilder dirt) {
  MultiMap<AbstractVcs, FilePath> files = dirt.getFilesForVcs();
  MultiMap<AbstractVcs, FilePath> dirs = dirt.getDirsForVcs();
  if (dirt.isEverythingDirty()) {
    dirs.putAllValues(getEverythingDirtyRoots());
  }
  Set<AbstractVcs> keys = ContainerUtil.union(files.keySet(), dirs.keySet());

  Map<AbstractVcs, VcsDirtyScopeImpl> scopes = ContainerUtil.newHashMap();
  for (AbstractVcs key : keys) {
    VcsDirtyScopeImpl scope = new VcsDirtyScopeImpl(key, myProject);
    scopes.put(key, scope);
    scope.addDirtyData(dirs.get(key), files.get(key));
  }

  return new VcsInvalidated(new ArrayList<>(scopes.values()), dirt.isEverythingDirty());
}
 
Example 2
Source File: VcsDirtyScopeManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
private MultiMap<AbstractVcs, FilePath> getEverythingDirtyRoots() {
  MultiMap<AbstractVcs, FilePath> dirtyRoots = MultiMap.createSet();
  dirtyRoots.putAllValues(groupByVcs(toFilePaths(DefaultVcsRootPolicy.getInstance(myProject).getDirtyRoots())));

  List<VcsDirectoryMapping> mappings = myVcsManager.getDirectoryMappings();
  for (VcsDirectoryMapping mapping : mappings) {
    if (!mapping.isDefaultMapping() && mapping.getVcs() != null) {
      AbstractVcs vcs = myVcsManager.findVcsByName(mapping.getVcs());
      if (vcs != null) {
        dirtyRoots.putValue(vcs, VcsUtil.getFilePath(mapping.getDirectory(), true));
      }
    }
  }
  return dirtyRoots;
}
 
Example 3
Source File: ProjectLoadingErrorsNotifierImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void fireNotifications() {
  final MultiMap<ConfigurationErrorType, ConfigurationErrorDescription> descriptionsMap = new MultiMap<ConfigurationErrorType, ConfigurationErrorDescription>();
  synchronized (myLock) {
    if (myErrors.isEmpty()) return;
    descriptionsMap.putAllValues(myErrors);
    myErrors.clear();
  }

  for (final ConfigurationErrorType type : descriptionsMap.keySet()) {
    final Collection<ConfigurationErrorDescription> descriptions = descriptionsMap.get(type);
    if (descriptions.isEmpty()) continue;

    final String invalidElements = getInvalidElementsString(type, descriptions);
    final String errorText = ProjectBundle.message("error.message.configuration.cannot.load") + " " + invalidElements + " <a href=\"\">Details...</a>";

    Notifications.Bus.notify(new Notification("Project Loading Error", "Error Loading Project", errorText, NotificationType.ERROR, new NotificationListener() {
      @Override
      public void hyperlinkUpdate(@Nonnull Notification notification, @Nonnull HyperlinkEvent event) {
        final List<ConfigurationErrorDescription> validDescriptions = ContainerUtil.findAll(descriptions, new Condition<ConfigurationErrorDescription>() {
          @Override
          public boolean value(ConfigurationErrorDescription errorDescription) {
            return errorDescription.isValid();
          }
        });
        RemoveInvalidElementsDialog.showDialog(myProject, CommonBundle.getErrorTitle(), type, invalidElements, validDescriptions);

        notification.expire();
      }
    }), myProject);
  }

}