public void settingsChanged() { DaemonCodeAnalyzerSettings settings = DaemonCodeAnalyzerSettings.getInstance(); if (settings.isCodeHighlightingChanged(myLastSettings)) { restart(); } myLastSettings = (DaemonCodeAnalyzerSettings) settings.clone(); }
public DaemonCodeAnalyzerImpl( Project project, DaemonCodeAnalyzerSettings daemonCodeAnalyzerSettings, EditorTracker editorTracker) { myProject = project; mySettings = daemonCodeAnalyzerSettings; myEditorTracker = editorTracker; myLastSettings = (DaemonCodeAnalyzerSettings) mySettings.clone(); myFileStatusMap = new FileStatusMap(myProject); myPassExecutorService = new PassExecutorService(myProject) { protected void afterApplyInformationToEditor( final TextEditorHighlightingPass pass, final FileEditor fileEditor, final ProgressIndicator updateProgress) { if (fileEditor instanceof TextEditor) { log(updateProgress, pass, "Apply "); Editor editor = ((TextEditor) fileEditor).getEditor(); repaintErrorStripeRenderer(editor); } } protected boolean isDisposed() { return myDisposed || super.isDisposed(); } }; Disposer.register(project, myPassExecutorService); Disposer.register(project, myFileStatusMap); }
void repaintErrorStripeRenderer(Editor editor) { if (!myProject.isInitialized()) return; final Document document = editor.getDocument(); final PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(document); final EditorMarkupModel markup = (EditorMarkupModel) editor.getMarkupModel(); markup.setErrorPanelPopupHandler(new DaemonEditorPopup(psiFile)); markup.setErrorStripTooltipRendererProvider(new DaemonTooltipRendererProvider(myProject)); markup.setMinMarkHeight(DaemonCodeAnalyzerSettings.getInstance().ERROR_STRIPE_MARK_MIN_HEIGHT); TrafficLightRenderer.setOrRefreshErrorStripeRenderer(markup, myProject, document, psiFile); }
private boolean showAddImportHint(HighlightInfo info) { if (!DaemonCodeAnalyzerSettings.getInstance().isImportHintEnabled()) return false; if (!DaemonCodeAnalyzer.getInstance(myProject).isImportHintsEnabled(myFile)) return false; PsiElement element = myFile.findElementAt(info.startOffset); if (element == null || !element.isValid()) return false; final List<Pair<HighlightInfo.IntentionActionDescriptor, TextRange>> list = info.quickFixActionRanges; for (Pair<HighlightInfo.IntentionActionDescriptor, TextRange> pair : list) { final IntentionAction action = pair.getFirst().getAction(); if (action instanceof HintAction && action.isAvailable(myProject, myEditor, myFile)) { return ((HintAction) action).showHint(myEditor); } } return false; }