package org.mustbe.consulo.dotnet.module;

import org.jetbrains.annotations.NotNull;
import org.mustbe.consulo.dotnet.module.extension.DotNetModuleExtension;
import com.intellij.openapi.roots.ModuleRootModel;
import com.intellij.openapi.roots.impl.ModuleRootsProcessorFromModuleDir;

/**
 * @author VISTALL
 * @since 08.12.14
 */
public class DotNetModuleRootsProcessor extends ModuleRootsProcessorFromModuleDir
{
	@Override
	public boolean canHandle(@NotNull ModuleRootModel moduleRootModel)
	{
		DotNetModuleExtension extension = moduleRootModel.getExtension(DotNetModuleExtension.class);
		return extension != null && !extension.isAllowSourceRoots();
	}
}

@@ -36,16 +36,88 @@
 odule;%0A%0A
+import gnu.trove.TObjectIntHashMap;%0Aimport gnu.trove.TObjectProcedure;%0A%0A
 import o
@@ -234,256 +234,1500 @@
 ort 
-com.intellij.openapi.roots.ModuleRootModel;%0Aimport com.intellij.openapi.roots.impl.ModuleRootsProcessorFromModuleDir;%0A%0A/**%0A * @author VISTALL%0A * @since 08.12.14%0A */%0Apublic class DotNetModuleRootsProcessor extends ModuleRootsProcessorFromModuleDir%0A%7B
+org.mustbe.consulo.roots.ContentFolderTypeProvider;%0Aimport org.mustbe.consulo.roots.impl.ProductionContentFolderTypeProvider;%0Aimport com.google.common.base.Predicate;%0Aimport com.intellij.openapi.roots.ModuleRootModel;%0Aimport com.intellij.openapi.roots.impl.ModuleRootsProcessor;%0Aimport com.intellij.openapi.vfs.VfsUtil;%0Aimport com.intellij.openapi.vfs.VirtualFile;%0Aimport com.intellij.util.ArrayUtil;%0A%0A/**%0A * @author VISTALL%0A * @since 08.12.14%0A */%0Apublic class DotNetModuleRootsProcessor extends ModuleRootsProcessor%0A%7B%0A%09@Override%0A%09public boolean containsFile(@NotNull TObjectIntHashMap%3CVirtualFile%3E roots, @NotNull final VirtualFile virtualFile)%0A%09%7B%0A%09%09return !roots.forEachKey(new TObjectProcedure%3CVirtualFile%3E()%0A%09%09%7B%0A%09%09%09@Override%0A%09%09%09public boolean execute(VirtualFile object)%0A%09%09%09%7B%0A%09%09%09%09return !VfsUtil.isAncestor(object, virtualFile, false);%0A%09%09%09%7D%0A%09%09%7D);%0A%09%7D%0A%0A%09@NotNull%0A%09@Override%0A%09public VirtualFile%5B%5D getFiles(@NotNull ModuleRootModel moduleRootModel, @NotNull Predicate%3CContentFolderTypeProvider%3E predicate)%0A%09%7B%0A%09%09if(predicate.apply(ProductionContentFolderTypeProvider.getInstance()))%0A%09%09%7B%0A%09%09%09return moduleRootModel.getContentRoots();%0A%09%09%7D%0A%09%09return VirtualFile.EMPTY_ARRAY;%0A%09%7D%0A%0A%09@NotNull%0A%09@Override%0A%09public String%5B%5D getUrls(@NotNull ModuleRootModel moduleRootModel, @NotNull Predicate%3CContentFolderTypeProvider%3E predicate)%0A%09%7B%0A%09%09if(predicate.apply(ProductionContentFolderTypeProvider.getInstance()))%0A%09%09%7B%0A%09%09%09return moduleRootModel.getContentRootUrls();%0A%09%09%7D%0A%09%09return ArrayUtil.EMPTY_STRING_ARRAY;%0A%09%7D%0A
 %0A%09@O

handle from content roots not only module dir