daemon settings moved to analysis

This commit is contained in:
Alexey Kudravtsev
2013-05-07 12:30:13 +04:00
parent 5398682ca0
commit ba24c4b4ee
4 changed files with 66 additions and 35 deletions
@@ -0,0 +1,55 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.codeInsight.daemon;
import com.intellij.openapi.components.ServiceManager;
import org.jetbrains.annotations.NonNls;
public class DaemonCodeAnalyzerSettings {
public static DaemonCodeAnalyzerSettings getInstance() {
return ServiceManager.getService(DaemonCodeAnalyzerSettings.class);
}
public boolean NEXT_ERROR_ACTION_GOES_TO_ERRORS_FIRST = false;
public int AUTOREPARSE_DELAY = 300;
public boolean SHOW_ADD_IMPORT_HINTS = true;
@NonNls public String NO_AUTO_IMPORT_PATTERN = "[a-z].?";
public boolean SUPPRESS_WARNINGS = true;
public boolean SHOW_METHOD_SEPARATORS = false;
public int ERROR_STRIPE_MARK_MIN_HEIGHT = 3;
public boolean SHOW_SMALL_ICONS_IN_GUTTER = true;
public boolean isCodeHighlightingChanged(DaemonCodeAnalyzerSettings oldSettings) {
return false;
}
public boolean isImportHintEnabled() {
return SHOW_ADD_IMPORT_HINTS;
}
public void setImportHintEnabled(boolean isImportHintEnabled) {
SHOW_ADD_IMPORT_HINTS = isImportHintEnabled;
}
public boolean isSuppressWarnings() {
return SUPPRESS_WARNINGS;
}
public void setSuppressWarnings(boolean suppressWarnings) {
SUPPRESS_WARNINGS = suppressWarnings;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ import java.io.File;
file = StoragePathMacros.APP_CONFIG + "/editor.codeinsight.xml"
)}
)
public class DaemonCodeAnalyzerSettings implements PersistentStateComponent<Element>, Cloneable, ExportableComponent {
public class DaemonCodeAnalyzerSettingsImpl extends DaemonCodeAnalyzerSettings implements PersistentStateComponent<Element>, Cloneable, ExportableComponent {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings");
@NonNls private static final String ROOT_TAG = "root";
@NonNls private static final String PROFILE_ATT = "profile";
@@ -45,15 +45,10 @@ public class DaemonCodeAnalyzerSettings implements PersistentStateComponent<Elem
@NonNls public static final String PROFILE_COPY_NAME = "copy";
private final InspectionProfileManager myManager;
public DaemonCodeAnalyzerSettings(InspectionProfileManager manager) {
public DaemonCodeAnalyzerSettingsImpl(InspectionProfileManager manager) {
myManager = manager;
}
public static DaemonCodeAnalyzerSettings getInstance() {
return ServiceManager.getService(DaemonCodeAnalyzerSettings.class);
}
@Override
@NotNull
public File[] getExportFiles() {
@@ -66,21 +61,13 @@ public class DaemonCodeAnalyzerSettings implements PersistentStateComponent<Elem
return DaemonBundle.message("error.highlighting.settings");
}
public boolean NEXT_ERROR_ACTION_GOES_TO_ERRORS_FIRST = false;
public int AUTOREPARSE_DELAY = 300;
public boolean SHOW_ADD_IMPORT_HINTS = true;
@NonNls public String NO_AUTO_IMPORT_PATTERN = "[a-z].?";
public boolean SUPPRESS_WARNINGS = true;
public boolean SHOW_METHOD_SEPARATORS = false;
public int ERROR_STRIPE_MARK_MIN_HEIGHT = 3;
public boolean SHOW_SMALL_ICONS_IN_GUTTER = true;
@Override
public boolean isCodeHighlightingChanged(DaemonCodeAnalyzerSettings oldSettings) {
try {
Element rootNew = new Element(ROOT_TAG);
writeExternal(rootNew);
Element rootOld = new Element(ROOT_TAG);
oldSettings.writeExternal(rootOld);
((DaemonCodeAnalyzerSettingsImpl)oldSettings).writeExternal(rootOld);
return !JDOMUtil.areElementsEqual(rootOld, rootNew);
}
@@ -92,8 +79,8 @@ public class DaemonCodeAnalyzerSettings implements PersistentStateComponent<Elem
}
@Override
public Object clone() {
DaemonCodeAnalyzerSettings settings = new DaemonCodeAnalyzerSettings(myManager);
public DaemonCodeAnalyzerSettingsImpl clone() {
DaemonCodeAnalyzerSettingsImpl settings = new DaemonCodeAnalyzerSettingsImpl(myManager);
settings.AUTOREPARSE_DELAY = AUTOREPARSE_DELAY;
settings.SHOW_ADD_IMPORT_HINTS = SHOW_ADD_IMPORT_HINTS;
settings.SHOW_METHOD_SEPARATORS = SHOW_METHOD_SEPARATORS;
@@ -134,12 +121,4 @@ public class DaemonCodeAnalyzerSettings implements PersistentStateComponent<Elem
DefaultJDOMExternalizer.writeExternal(this, element);
element.setAttribute(PROFILE_ATT, myManager.getRootProfile().getName());
}
public boolean isImportHintEnabled() {
return SHOW_ADD_IMPORT_HINTS;
}
public void setImportHintEnabled(boolean isImportHintEnabled) {
SHOW_ADD_IMPORT_HINTS = isImportHintEnabled;
}
}
@@ -20,10 +20,7 @@ import com.intellij.codeHighlighting.BackgroundEditorHighlighter;
import com.intellij.codeHighlighting.HighlightingPass;
import com.intellij.codeHighlighting.Pass;
import com.intellij.codeHighlighting.TextEditorHighlightingPass;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings;
import com.intellij.codeInsight.daemon.LineMarkerInfo;
import com.intellij.codeInsight.daemon.ReferenceImporter;
import com.intellij.codeInsight.daemon.*;
import com.intellij.codeInsight.hint.HintManager;
import com.intellij.codeInsight.intention.impl.IntentionHintComponent;
import com.intellij.concurrency.Job;
@@ -122,7 +119,7 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx
mySettings = daemonCodeAnalyzerSettings;
myEditorTracker = editorTracker;
myLastSettings = (DaemonCodeAnalyzerSettings)daemonCodeAnalyzerSettings.clone();
myLastSettings = ((DaemonCodeAnalyzerSettingsImpl)daemonCodeAnalyzerSettings).clone();
myFileStatusMap = new FileStatusMap(myProject);
myPassExecutorService = new PassExecutorService(myProject) {
@@ -368,7 +365,7 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx
if (settings.isCodeHighlightingChanged(myLastSettings)) {
restart();
}
myLastSettings = (DaemonCodeAnalyzerSettings)settings.clone();
myLastSettings = ((DaemonCodeAnalyzerSettingsImpl)settings).clone();
}
@Override
@@ -72,7 +72,7 @@
serviceImplementation="com.intellij.codeEditor.printing.PrintSettings"/>
<exportable serviceInterface="com.intellij.codeEditor.printing.PrintSettings"/>
<applicationService serviceInterface="com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings"
serviceImplementation="com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings"/>
serviceImplementation="com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettingsImpl"/>
<exportable serviceInterface="com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings"/>
<applicationService serviceInterface="com.intellij.facet.FacetTypeRegistry"