void () { PsiFile originalPsi = myPreviewFile.resolveOriginalPsi(); if (originalPsi != null && !myEditor.isDisposed()) { CodeStyleSettings settings = CodeStyle.getSettings(originalPsi); final Language language = myPreviewFile.getLanguage(); myEditor.getSettings().setRightMargin(settings.getRightMargin(language)); myEditor.getSettings().setSoftMargins(settings.getSoftMargins(language)); myEditor.getSettings().setTabSize(settings.getTabSize(myPreviewFile.getFileType())); } }