use of com.intellij.openapi.vcs.checkin.CheckinEnvironment in project intellij-community by JetBrains.
the class NewFilesProcessor method addToVcsIfNeeded.
/**
* @param localFileNames names of local files to add to VCS
*/
private static void addToVcsIfNeeded(@NotNull final Module module, @NotNull final String... localFileNames) {
final LocalFileSystem fs = LocalFileSystem.getInstance();
fs.refresh(false);
final Project project = module.getProject();
Arrays.stream(localFileNames).map(o -> fs.findFileByPath(o)).filter(o -> o != null).forEach(file -> {
final AbstractVcs<?> vcs = VcsUtil.getVcsFor(project, file);
if (vcs == null) {
return;
}
final CheckinEnvironment environment = vcs.getCheckinEnvironment();
if (environment != null) {
environment.scheduleUnversionedFilesForAddition(Collections.singletonList(file));
}
});
}
Aggregations