Created
June 19, 2015 09:57
-
-
Save eugene-kamenev/087dc4170a9ad74eec0a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.intellij.psi.*; | |
contributor(context()) { | |
if (classType?.hasAnnotation('com.arasthel.swissknife.annotations.Parcelable')) { | |
def psiFacade = com.intellij.psi.JavaPsiFacade.getInstance(project) | |
def scope = com.intellij.psi.search.GlobalSearchScope.allScope(project) | |
def parcelableClass = psiFacade.findClass('android.os.Parcelable', scope) | |
final PsiElementFactory elementFactory = psiFacade.getElementFactory() | |
PsiJavaCodeReferenceElement ref = elementFactory.createClassReferenceElement(parcelableClass) | |
classType.getImplementsList().add(ref) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment