Skip to content

Instantly share code, notes, and snippets.

@eugene-kamenev
Created June 19, 2015 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eugene-kamenev/087dc4170a9ad74eec0a to your computer and use it in GitHub Desktop.
Save eugene-kamenev/087dc4170a9ad74eec0a to your computer and use it in GitHub Desktop.
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