mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
allow removing implicitly ignored directories (CPP-8028 Exclude generated CMake files from VCS automatically)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -139,6 +139,7 @@ public abstract class ChangeListManager implements ChangeListModification {
|
||||
|
||||
public abstract void addFilesToIgnore(final IgnoredFileBean... ignoredFiles);
|
||||
public abstract void addDirectoryToIgnoreImplicitly(@NotNull String path);
|
||||
public abstract void removeImplicitlyIgnoredDirectory(@NotNull String path);
|
||||
public abstract void setFilesToIgnore(final IgnoredFileBean... ignoredFiles);
|
||||
public abstract IgnoredFileBean[] getFilesToIgnore();
|
||||
public abstract boolean isIgnoredFile(@NotNull VirtualFile file);
|
||||
|
||||
@@ -54,7 +54,6 @@ import com.intellij.util.messages.Topic;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.vcsUtil.VcsUtil;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.CalledInAwt;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -63,7 +62,7 @@ import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static com.intellij.openapi.vcs.ProjectLevelVcsManager.*;
|
||||
import static com.intellij.openapi.vcs.ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED;
|
||||
|
||||
@State(name = "ChangeListManager", storages = @Storage(StoragePathMacros.WORKSPACE_FILE))
|
||||
public class ChangeListManagerImpl extends ChangeListManagerEx implements ProjectComponent, ChangeListOwner, PersistentStateComponent<Element> {
|
||||
@@ -1431,6 +1430,11 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
|
||||
myIgnoredIdeaLevel.addIgnoredDirectoryImplicitly(path, myProject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeImplicitlyIgnoredDirectory(@NotNull String path) {
|
||||
myIgnoredIdeaLevel.removeImplicitlyIgnoredDirectory(path, myProject);
|
||||
}
|
||||
|
||||
public IgnoredFilesComponent getIgnoredFilesComponent() {
|
||||
return myIgnoredIdeaLevel;
|
||||
}
|
||||
|
||||
@@ -102,20 +102,34 @@ public class IgnoredFilesComponent {
|
||||
return;
|
||||
}
|
||||
}
|
||||
List<IgnoredFileBean> toRemove = new ArrayList<>();
|
||||
for (IgnoredFileBean bean : myFilesToIgnore) {
|
||||
if ((bean.getType() == IgnoreSettingsType.UNDER_DIR || bean.getType() == IgnoreSettingsType.FILE) &&
|
||||
FileUtil.isAncestor(path, bean.getPath(), false)) {
|
||||
toRemove.add(bean);
|
||||
}
|
||||
}
|
||||
myFilesToIgnore.removeAll(toRemove);
|
||||
doRemoveFilesToIgnore(path, true);
|
||||
myFilesToIgnore.add(IgnoredBeanFactory.ignoreUnderDirectory(path, project));
|
||||
}
|
||||
finally {
|
||||
myWriteLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeImplicitlyIgnoredDirectory(@NotNull String path, @NotNull Project project) {
|
||||
myWriteLock.lock();
|
||||
try {
|
||||
doRemoveFilesToIgnore(path, false);
|
||||
}
|
||||
finally {
|
||||
myWriteLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private void doRemoveFilesToIgnore(@NotNull String path, boolean includingSubpaths) {
|
||||
List<IgnoredFileBean> toRemove = new ArrayList<>();
|
||||
for (IgnoredFileBean bean : myFilesToIgnore) {
|
||||
if ((bean.getType() == IgnoreSettingsType.UNDER_DIR || bean.getType() == IgnoreSettingsType.FILE) &&
|
||||
includingSubpaths ? FileUtil.isAncestor(path, bean.getPath(), false) : FileUtil.pathsEqual(path, bean.getPath())) {
|
||||
toRemove.add(bean);
|
||||
}
|
||||
}
|
||||
myFilesToIgnore.removeAll(toRemove);
|
||||
}
|
||||
|
||||
private void addIgnoredFiles(@NotNull IgnoredFileBean[] filesToIgnore) {
|
||||
for (IgnoredFileBean bean : filesToIgnore) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -281,6 +281,11 @@ public class MockChangeListManager extends ChangeListManagerEx {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeImplicitlyIgnoredDirectory(@NotNull String path) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFilesToIgnore(IgnoredFileBean... ignoredFiles) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
Reference in New Issue
Block a user