mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 13:11:39 +07:00
IDEA-113331
This commit is contained in:
+31
-38
@@ -20,6 +20,7 @@ import com.intellij.application.options.OptionsContainingConfigurable;
|
||||
import com.intellij.application.options.editor.EditorOptionsProvider;
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
|
||||
import com.intellij.execution.impl.ConsoleViewUtil;
|
||||
import com.intellij.ide.todo.TodoConfiguration;
|
||||
import com.intellij.ide.ui.LafManager;
|
||||
import com.intellij.ide.ui.laf.darcula.DarculaInstaller;
|
||||
import com.intellij.ide.ui.laf.darcula.DarculaLaf;
|
||||
@@ -231,53 +232,45 @@ public class ColorAndFontOptions extends SearchableConfigurable.Parent.Abstract
|
||||
|
||||
@Override
|
||||
public void apply() throws ConfigurationException {
|
||||
if (!myApplyCompleted) {
|
||||
try {
|
||||
EditorColorsManager myColorsManager = EditorColorsManager.getInstance();
|
||||
|
||||
myColorsManager.removeAllSchemes();
|
||||
for (MyColorScheme scheme : mySchemes.values()) {
|
||||
if (!scheme.isDefault()) {
|
||||
scheme.apply();
|
||||
myColorsManager.addColorsScheme(scheme.getOriginalScheme());
|
||||
}
|
||||
}
|
||||
|
||||
EditorColorsScheme originalScheme = mySelectedScheme.getOriginalScheme();
|
||||
myColorsManager.setGlobalScheme(originalScheme);
|
||||
if (originalScheme != null && DarculaLaf.NAME.equals(originalScheme.getName()) && !UIUtil.isUnderDarcula()) {
|
||||
int ok = Messages.showYesNoDialog(
|
||||
"Darcula color scheme has been set for editors. Would you like to set Darcula as default Look and Feel?",
|
||||
"Darcula Look and Feel",
|
||||
Messages.getQuestionIcon());
|
||||
if (ok == Messages.OK) {
|
||||
LafManager.getInstance().setCurrentLookAndFeel(new DarculaLookAndFeelInfo());
|
||||
DarculaInstaller.install();
|
||||
}
|
||||
}
|
||||
applyChangesToEditors();
|
||||
|
||||
reset();
|
||||
}
|
||||
finally {
|
||||
myApplyCompleted = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (myApplyCompleted) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
EditorColorsManager myColorsManager = EditorColorsManager.getInstance();
|
||||
|
||||
myColorsManager.removeAllSchemes();
|
||||
for (MyColorScheme scheme : mySchemes.values()) {
|
||||
if (!scheme.isDefault()) {
|
||||
scheme.apply();
|
||||
myColorsManager.addColorsScheme(scheme.getOriginalScheme());
|
||||
}
|
||||
}
|
||||
|
||||
// initAll();
|
||||
// resetSchemesCombo();
|
||||
|
||||
EditorColorsScheme originalScheme = mySelectedScheme.getOriginalScheme();
|
||||
myColorsManager.setGlobalScheme(originalScheme);
|
||||
if (originalScheme != null && DarculaLaf.NAME.equals(originalScheme.getName()) && !UIUtil.isUnderDarcula()) {
|
||||
int ok = Messages.showYesNoDialog(
|
||||
"Darcula color scheme has been set for editors. Would you like to set Darcula as default Look and Feel?",
|
||||
"Darcula Look and Feel",
|
||||
Messages.getQuestionIcon());
|
||||
if (ok == Messages.OK) {
|
||||
LafManager.getInstance().setCurrentLookAndFeel(new DarculaLookAndFeelInfo());
|
||||
DarculaInstaller.install();
|
||||
}
|
||||
}
|
||||
applyChangesToEditors();
|
||||
|
||||
reset();
|
||||
}
|
||||
finally {
|
||||
myApplyCompleted = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyChangesToEditors() {
|
||||
EditorFactory.getInstance().refreshAllEditors();
|
||||
|
||||
TodoConfiguration.getInstance().colorSettingsChanged();
|
||||
Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
|
||||
for (Project openProject : openProjects) {
|
||||
FileStatusManager.getInstance(openProject).fileStatusesChanged();
|
||||
|
||||
@@ -22,10 +22,7 @@ import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.JDOMExternalizable;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.psi.search.IndexPattern;
|
||||
import com.intellij.psi.search.IndexPatternProvider;
|
||||
import com.intellij.psi.search.TodoAttributesUtil;
|
||||
import com.intellij.psi.search.TodoPattern;
|
||||
import com.intellij.psi.search.*;
|
||||
import com.intellij.util.EventDispatcher;
|
||||
import com.intellij.util.messages.MessageBus;
|
||||
import org.jdom.Element;
|
||||
@@ -36,6 +33,7 @@ import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Vladimir Kondratyev
|
||||
@@ -161,8 +159,8 @@ public class TodoConfiguration implements NamedComponent, JDOMExternalizable {
|
||||
|
||||
@Override
|
||||
public void readExternal(Element element) throws InvalidDataException {
|
||||
ArrayList<TodoPattern> patternsList = new ArrayList<TodoPattern>();
|
||||
ArrayList<TodoFilter> filtersList = new ArrayList<TodoFilter>();
|
||||
List<TodoPattern> patternsList = new ArrayList<TodoPattern>();
|
||||
List<TodoFilter> filtersList = new ArrayList<TodoFilter>();
|
||||
for (Object o : element.getChildren()) {
|
||||
Element child = (Element)o;
|
||||
if (ELEMENT_PATTERN.equals(child.getName())) {
|
||||
@@ -195,4 +193,13 @@ public class TodoConfiguration implements NamedComponent, JDOMExternalizable {
|
||||
element.addContent(child);
|
||||
}
|
||||
}
|
||||
|
||||
public void colorSettingsChanged() {
|
||||
for (TodoPattern pattern : myTodoPatterns) {
|
||||
TodoAttributes attributes = pattern.getAttributes();
|
||||
if (!attributes.shouldUseCustomTodoColor()) {
|
||||
attributes.setUseCustomTodoColor(false, TodoAttributesUtil.getDefaultColorSchemeTextAttributes());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user