Search in sources :

Example 6 with DaemonCodeAnalyzerSettings

use of com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings in project intellij-community by JetBrains.

the class CodeInsightTestFixtureImpl method instantiateAndRun.

@NotNull
@TestOnly
public static List<HighlightInfo> instantiateAndRun(@NotNull PsiFile file, @NotNull Editor editor, @NotNull int[] toIgnore, boolean canChangeDocument) {
    ApplicationManager.getApplication().assertIsDispatchThread();
    Project project = file.getProject();
    ensureIndexesUpToDate(project);
    DaemonCodeAnalyzerImpl codeAnalyzer = (DaemonCodeAnalyzerImpl) DaemonCodeAnalyzer.getInstance(project);
    TextEditor textEditor = TextEditorProvider.getInstance().getTextEditor(editor);
    DaemonCodeAnalyzerSettings settings = DaemonCodeAnalyzerSettings.getInstance();
    ProcessCanceledException exception = null;
    for (int i = 0; i < 1000; i++) {
        int oldDelay = settings.AUTOREPARSE_DELAY;
        try {
            settings.AUTOREPARSE_DELAY = 0;
            List<HighlightInfo> infos = codeAnalyzer.runPasses(file, editor.getDocument(), textEditor, toIgnore, canChangeDocument, null);
            infos.addAll(DaemonCodeAnalyzerEx.getInstanceEx(project).getFileLevelHighlights(project, file));
            return infos;
        } catch (ProcessCanceledException e) {
            PsiDocumentManager.getInstance(project).commitAllDocuments();
            UIUtil.dispatchAllInvocationEvents();
            exception = e;
        } finally {
            settings.AUTOREPARSE_DELAY = oldDelay;
        }
    }
    // unable to highlight after 100 retries
    throw exception;
}
Also used : DaemonCodeAnalyzerSettings(com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings) Project(com.intellij.openapi.project.Project) ExtensionPoint(com.intellij.openapi.extensions.ExtensionPoint) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException) TestOnly(org.jetbrains.annotations.TestOnly) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with DaemonCodeAnalyzerSettings

use of com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings in project intellij-community by JetBrains.

the class ErrorHighlightingPanel method apply.

public void apply() throws ConfigurationException {
    DaemonCodeAnalyzerSettings settings = DaemonCodeAnalyzerSettings.getInstance();
    settings.AUTOREPARSE_DELAY = getAutoReparseDelay();
    settings.ERROR_STRIPE_MARK_MIN_HEIGHT = getErrorStripeMarkMinHeight();
    settings.NEXT_ERROR_ACTION_GOES_TO_ERRORS_FIRST = myNextErrorGoesToErrorsFirst.isSelected();
    for (ErrorOptionsProvider optionsProvider : myExtensions) {
        optionsProvider.apply();
    }
    UISettings.getInstance().fireUISettingsChanged();
}
Also used : DaemonCodeAnalyzerSettings(com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings) ErrorOptionsProvider(com.intellij.profile.codeInspection.ui.ErrorOptionsProvider)

Example 8 with DaemonCodeAnalyzerSettings

use of com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings in project intellij-community by JetBrains.

the class ErrorHighlightingPanel method isModified.

public boolean isModified() {
    DaemonCodeAnalyzerSettings settings = DaemonCodeAnalyzerSettings.getInstance();
    boolean isModified = settings.AUTOREPARSE_DELAY != getAutoReparseDelay();
    isModified |= getErrorStripeMarkMinHeight() != settings.ERROR_STRIPE_MARK_MIN_HEIGHT;
    isModified |= myNextErrorGoesToErrorsFirst.isSelected() != settings.NEXT_ERROR_ACTION_GOES_TO_ERRORS_FIRST;
    for (ErrorOptionsProvider optionsProvider : myExtensions) {
        isModified |= optionsProvider.isModified();
    }
    if (isModified)
        return true;
    return false;
}
Also used : DaemonCodeAnalyzerSettings(com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings) ErrorOptionsProvider(com.intellij.profile.codeInspection.ui.ErrorOptionsProvider)

Example 9 with DaemonCodeAnalyzerSettings

use of com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings in project intellij-community by JetBrains.

the class JavaAutoImportOptions method isModified.

public boolean isModified() {
    CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
    DaemonCodeAnalyzerSettings daemonSettings = DaemonCodeAnalyzerSettings.getInstance();
    boolean isModified = isModified(myCbShowImportPopup, daemonSettings.isImportHintEnabled());
    isModified |= isModified(myCbOptimizeImports, CodeInsightWorkspaceSettings.getInstance(myProject).optimizeImportsOnTheFly);
    isModified |= isModified(myCbAddUnambiguousImports, codeInsightSettings.ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY);
    isModified |= isModified(myCbAddMethodImports, codeInsightSettings.ADD_MEMBER_IMPORTS_ON_THE_FLY);
    isModified |= getSmartPasteValue() != codeInsightSettings.ADD_IMPORTS_ON_PASTE;
    isModified |= myExcludePackagesTable.isModified();
    return isModified;
}
Also used : DaemonCodeAnalyzerSettings(com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings) CodeInsightSettings(com.intellij.codeInsight.CodeInsightSettings)

Example 10 with DaemonCodeAnalyzerSettings

use of com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings in project intellij-community by JetBrains.

the class JavaAutoImportOptions method reset.

public void reset() {
    CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
    DaemonCodeAnalyzerSettings daemonSettings = DaemonCodeAnalyzerSettings.getInstance();
    switch(codeInsightSettings.ADD_IMPORTS_ON_PASTE) {
        case CodeInsightSettings.YES:
            mySmartPasteCombo.setSelectedItem(INSERT_IMPORTS_ALWAYS);
            break;
        case CodeInsightSettings.NO:
            mySmartPasteCombo.setSelectedItem(INSERT_IMPORTS_NONE);
            break;
        case CodeInsightSettings.ASK:
            mySmartPasteCombo.setSelectedItem(INSERT_IMPORTS_ASK);
            break;
    }
    myCbShowImportPopup.setSelected(daemonSettings.isImportHintEnabled());
    myCbOptimizeImports.setSelected(CodeInsightWorkspaceSettings.getInstance(myProject).optimizeImportsOnTheFly);
    myCbAddUnambiguousImports.setSelected(codeInsightSettings.ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY);
    myCbAddMethodImports.setSelected(codeInsightSettings.ADD_MEMBER_IMPORTS_ON_THE_FLY);
    myExcludePackagesTable.reset();
}
Also used : DaemonCodeAnalyzerSettings(com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings) CodeInsightSettings(com.intellij.codeInsight.CodeInsightSettings)

Aggregations

DaemonCodeAnalyzerSettings (com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings)10 CodeInsightSettings (com.intellij.codeInsight.CodeInsightSettings)3 Project (com.intellij.openapi.project.Project)3 ErrorOptionsProvider (com.intellij.profile.codeInspection.ui.ErrorOptionsProvider)3 UISettings (com.intellij.ide.ui.UISettings)1 PropertiesComponent (com.intellij.ide.util.PropertiesComponent)1 HighlightSeverity (com.intellij.lang.annotation.HighlightSeverity)1 EditorSettingsExternalizable (com.intellij.openapi.editor.ex.EditorSettingsExternalizable)1 ExtensionPoint (com.intellij.openapi.extensions.ExtensionPoint)1 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)1 NotNull (org.jetbrains.annotations.NotNull)1 TestOnly (org.jetbrains.annotations.TestOnly)1