Support Android flavors

This commit is contained in:
Yan Zhulanow
2015-04-14 20:11:27 +03:00
parent bf707ec3f7
commit 77be78b627
6 changed files with 24 additions and 20 deletions
@@ -19,6 +19,8 @@ package org.jetbrains.kotlin.plugin.android
import com.intellij.ide.highlighter.XmlFileType
import com.intellij.openapi.roots.ProjectRootManager
import com.intellij.openapi.util.SimpleModificationTracker
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.psi.PsiFile
import com.intellij.psi.impl.PsiTreeChangeEventImpl
import com.intellij.psi.impl.PsiTreeChangePreprocessor
@@ -58,6 +60,13 @@ public class AndroidPsiTreeChangePreprocessor : PsiTreeChangePreprocessor, Simpl
}
}
private fun AndroidResourceManager.getModuleResDirectories(): List<VirtualFile> {
val info = androidModuleInfo
if (info == null) return listOf()
val fileManager = VirtualFileManager.getInstance()
return info.resDirectories.map { fileManager.findFileByUrl("file://" + it) }
}
private fun PsiFile.isLayoutXmlFile(): Boolean {
if (getFileType() != XmlFileType.INSTANCE) return false
return getParent()?.getName()?.startsWith("layout") ?: false