private void makeClassImplementParcelable ( PsiElementFactory elementFactory , JavaCodeStyleManager styleManager ) { final PsiClassType [ ] implementsListTypes = psiClass . getImplementsListTypes ( ) ; final String implementsType = "android.os.Parcelable" ; for ( PsiClassType implementsListType : implementsListTypes ) { PsiClass resolved = implementsListType . resolve ( ) ; // Already implements Parcelable, no need to add it if ( resolved != null && implementsType . equals ( resolved . getQualifiedName ( ) ) ) { return ; } } PsiJavaCodeReferenceElement implementsReference = elementFactory . createReferenceFromText ( implementsType , psiClass ) ; PsiReferenceList implementsList = psiClass . getImplementsList ( ) ; if ( implementsList != null ) { styleManager . shortenClassReferences ( implementsList . add ( implementsReference ) ) ; } }
Make the class implementing Parcelable