restart daemon on profile change; update status bar (IDEA-83489;IDEA-83496)

This commit is contained in:
anna
2012-03-26 17:25:57 +02:00
parent af0acb4af6
commit cc9306cd9c
5 changed files with 14 additions and 5 deletions
@@ -15,6 +15,7 @@
*/
package com.intellij.profile;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.components.StateSplitter;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
@@ -204,8 +205,14 @@ public abstract class DefaultProjectProfileManager extends ProjectProfileManager
return profile;
}
public void addProfilesListener(ProfileChangeAdapter profilesListener) {
public void addProfilesListener(final ProfileChangeAdapter profilesListener, Disposable parent) {
myProfilesListener.add(profilesListener);
Disposer.register(parent, new Disposable() {
@Override
public void dispose() {
myProfilesListener.remove(profilesListener);
}
});
}
public void removeProfilesListener(ProfileChangeAdapter profilesListener) {
@@ -63,6 +63,7 @@ import com.intellij.openapi.vfs.VirtualFilePropertyEvent;
import com.intellij.profile.Profile;
import com.intellij.profile.ProfileChangeAdapter;
import com.intellij.profile.codeInspection.InspectionProfileManager;
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
import com.intellij.psi.*;
import com.intellij.psi.impl.PsiDocumentManagerImpl;
import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
@@ -229,8 +230,9 @@ class DaemonListeners implements Disposable {
CommandProcessor.getInstance().addCommandListener(new MyCommandListener(), this);
ApplicationListener applicationListener = new MyApplicationListener();
ApplicationManager.getApplication().addApplicationListener(applicationListener, this);
EditorColorsManager.getInstance().addEditorColorsListener(new MyEditorColorsListener(),this);
EditorColorsManager.getInstance().addEditorColorsListener(new MyEditorColorsListener(), this);
InspectionProfileManager.getInstance().addProfileChangeListener(new MyProfileChangeListener(), this);
InspectionProjectProfileManager.getInstance(project).addProfilesListener(new MyProfileChangeListener(), this);
TodoConfiguration.getInstance().addPropertyChangeListener(new MyTodoListener(), this);
ActionManagerEx.getInstanceEx().addAnActionListener(new MyAnActionListener(), this);
VirtualFileManager.getInstance().addVirtualFileListener(new VirtualFileAdapter() {
@@ -80,11 +80,10 @@ public class WholeFileLocalInspectionsPassFactory extends AbstractProjectCompone
myFileTools.clear();
}
};
myProfileManager.addProfilesListener(myProfilesListener);
myProfileManager.addProfilesListener(myProfilesListener, myProject);
Disposer.register(myProject, new Disposable() {
@Override
public void dispose() {
myProfileManager.removeProfilesListener(myProfilesListener);
myFileTools.clear();
}
});
@@ -356,7 +356,7 @@ public class InspectionProfileManager extends ApplicationProfileManager implemen
return mySchemesManager;
}
public void onProfilesChanged() {
public static void onProfilesChanged() {
//cleanup caches blindly for all projects in case ide profile was modified
for (Project project : ProjectManager.getInstance().getOpenProjects()) {
HighlightingSettingsPerFile.getInstance(project).cleanProfileSettings();
@@ -53,6 +53,7 @@ public class ProjectInspectionToolsConfigurable extends InspectionToolsConfigura
myProfileManager.setRootProfile(profileName);
myProjectProfileManager.setProjectProfile(null);
}
InspectionProfileManager.onProfilesChanged();
}
@Override