private void forceDaemonRestart() { final FileViewProvider viewProvider = myFile.getViewProvider(); for (Language language : mySliders.keySet()) { JSlider slider = mySliders.get(language); PsiElement root = viewProvider.getPsi(language); assert root != null : "No root in " + viewProvider + " for " + language; int value = slider.getValue(); if (value == 1) { HighlightLevelUtil.forceRootHighlighting(root, FileHighlightingSetting.SKIP_HIGHLIGHTING); } else if (value == 2) { HighlightLevelUtil.forceRootHighlighting(root, FileHighlightingSetting.SKIP_INSPECTION); } else { HighlightLevelUtil.forceRootHighlighting(root, FileHighlightingSetting.FORCE_HIGHLIGHTING); } } final DaemonCodeAnalyzer analyzer = DaemonCodeAnalyzer.getInstance(myFile.getProject()); analyzer.restart(); }
@Override public void customize(@NotNull EditorEx editor) { boolean apply = isEnabled(); if (!READY) { return; } Project project = editor.getProject(); if (project == null) { return; } PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); if (file == null) { return; } Function<InspectionProfileImpl, InspectionProfileWrapper> strategy = file.getUserData(InspectionProfileWrapper.CUSTOMIZATION_KEY); if (strategy == null) { file.putUserData( InspectionProfileWrapper.CUSTOMIZATION_KEY, strategy = new MyInspectionProfileStrategy()); } if (!(strategy instanceof MyInspectionProfileStrategy)) { return; } ((MyInspectionProfileStrategy) strategy).setUseSpellCheck(apply); if (apply) { editor.putUserData(IntentionManager.SHOW_INTENTION_OPTIONS_KEY, false); } // Update representation. DaemonCodeAnalyzer analyzer = DaemonCodeAnalyzer.getInstance(project); if (analyzer != null) { analyzer.restart(file); } }