public PsiFile createFileFromText(@NotNull CharSequence text) {
   Project project = getProject();
   if (project == null) {
     project = DefaultProjectFactory.getInstance().getDefaultProject();
   }
   return createFileFromText(
       project, text, (LanguageFileType) getFileTypeWithoutSubstitution(), myFile, myFileName);
 }
Exemple #2
0
 @NotNull
 public static CharSequence decompile(@NotNull VirtualFile file) {
   PsiManager manager =
       PsiManager.getInstance(DefaultProjectFactory.getInstance().getDefaultProject());
   final ClsFileImpl clsFile = new ClsFileImpl(new ClassFileViewProvider(manager, file), true);
   final StringBuilder buffer = new StringBuilder();
   ApplicationManager.getApplication()
       .runReadAction(
           new Runnable() {
             @Override
             public void run() {
               clsFile.appendMirrorText(0, buffer);
             }
           });
   return buffer;
 }