framework detection excludes: method extracted to API

This commit is contained in:
nik
2013-10-23 17:27:29 +04:00
parent b48c2ea9dc
commit 52e9d7f98d
3 changed files with 12 additions and 7 deletions
@@ -33,4 +33,6 @@ public abstract class DetectionExcludesConfiguration {
public abstract void addExcludedFramework(@NotNull FrameworkType type);
public abstract void addExcludedFile(@NotNull VirtualFile file, @Nullable FrameworkType type);
public abstract void addExcludedUrl(@NotNull String url, @Nullable FrameworkType type);
public abstract boolean isExcludedFromDetection(@NotNull VirtualFile file, @NotNull FrameworkType frameworkType);
}
@@ -134,6 +134,15 @@ public class DetectionExcludesConfigurationImpl extends DetectionExcludesConfigu
}
}
@Override
public boolean isExcludedFromDetection(@NotNull VirtualFile file, @NotNull FrameworkType frameworkType) {
ensureOldSettingsLoaded();
if (myExcludedFrameworks.contains(frameworkType.getId())) {
return true;
}
return isFileExcluded(file, frameworkType.getId());
}
private boolean isFileExcluded(@NotNull VirtualFile file, @Nullable String typeId) {
if (myExcludedFiles.containsKey(typeId) && isUnder(file, myExcludedFiles.get(typeId))) return true;
return typeId != null && myExcludedFiles.containsKey(null) && isUnder(file, myExcludedFiles.get(null));
@@ -26,9 +26,6 @@ import com.intellij.testFramework.PlatformTestCase;
import com.intellij.testFramework.PsiTestUtil;
import com.intellij.testFramework.TempFiles;
import java.util.ArrayList;
import java.util.List;
/**
* @author nik
*/
@@ -91,10 +88,7 @@ public class ConvertingOldDetectionExcludesTest extends PlatformTestCase {
}
private boolean isFileExcluded(VirtualFile file) {
final List<VirtualFile> files = new ArrayList<VirtualFile>();
files.add(file);
getNewConfiguration().removeExcluded(files, new MockFrameworkType(FRAMEWORK_ID));
return files.isEmpty();
return getNewConfiguration().isExcludedFromDetection(file, new MockFrameworkType(FRAMEWORK_ID));
}
public void testConvert() {