mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Don't detect indents and show notifications in read-only files
This commit is contained in:
+1
-2
@@ -32,7 +32,6 @@ import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiCompiledFile;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.testFramework.LightVirtualFile;
|
||||
@@ -114,7 +113,7 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider {
|
||||
}
|
||||
|
||||
private boolean isEnabled(@NotNull CodeStyleSettings settings, @NotNull PsiFile file) {
|
||||
if (file instanceof PsiCompiledFile || file.getFileType() == ScratchFileType.INSTANCE) return false;
|
||||
if (!(file.isWritable()) || file.getFileType() == ScratchFileType.INSTANCE) return false;
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
return myIsEnabledInTest;
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public class CodeStyleStatusBarWidget extends EditorBasedStatusBarPopup implemen
|
||||
protected WidgetState getWidgetState(@Nullable VirtualFile file) {
|
||||
if (file == null) return WidgetState.HIDDEN;
|
||||
PsiFile psiFile = getPsiFile();
|
||||
if (psiFile == null) return WidgetState.HIDDEN;
|
||||
if (psiFile == null || !psiFile.isWritable()) return WidgetState.HIDDEN;
|
||||
IndentOptions indentOptions = CodeStyle.getIndentOptions(psiFile);
|
||||
IndentOptions projectIndentOptions = CodeStyle.getSettings(myProject).getLanguageIndentOptions(psiFile.getLanguage());
|
||||
FileIndentOptionsProvider provider = findProvider(file, indentOptions);
|
||||
|
||||
Reference in New Issue
Block a user