ParcelablePlease-intellij-plugin/src/com/hannesdorfmann/parcelableplease/plugin/ParcelablePleaseAction.java
private PsiClass getPsiClassFromContext(AnActionEvent e) {
    PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);
    Editor editor = e.getData(PlatformDataKeys.EDITOR);
    

    if (psiFile == null || editor == null) {
      return null;
    }

    int offset = editor.getCaretModel().getOffset();
    PsiElement element = psiFile.findElementAt(offset);

    return PsiTreeUtil.getParentOfType(element, PsiClass.class);
  }
private PsiClass getPsiClassFromContext(AnActionEvent e) {
    PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);
    Editor editor = e.getData(PlatformDataKeys.EDITOR);
    

    if (psiFile == null || editor == null) {
      return null;
    }

    int offset = editor.getCaretModel().getOffset();
    PsiElement element = psiFile.findElementAt(offset);

    return PsiTreeUtil.getParentOfType(element, PsiClass.class);
  }
private PsiClass getPsiClassFromContext ( AnActionEvent e ) { PsiFile psiFile = e . getData ( LangDataKeys . PSI_FILE ) ; Editor editor = e . getData ( PlatformDataKeys . EDITOR ) ; if ( psiFile == null || editor == null ) { return null ; } int offset = editor . getCaretModel ( ) . getOffset ( ) ; PsiElement element = psiFile . findElementAt ( offset ) ; return PsiTreeUtil . getParentOfType ( element , PsiClass . class ) ; }
Get the class where currently the curser is
Get the class where currently the curser is