fix applying of predefined style when code style configurable is wrapped in a tab

This commit is contained in:
Eugene Kudelevsky
2012-10-17 22:51:21 +04:00
parent 85459c84b5
commit a8c028a93b
2 changed files with 16 additions and 5 deletions
@@ -62,14 +62,16 @@ public abstract class CodeStyleAbstractConfigurable implements Configurable, Opt
@Override
public void reset() {
if (myPanel != null) {
myPanel.reset(mySettings);
}
reset(mySettings);
}
public void resetFromClone(){
reset(myCloneSettings);
}
public void reset(CodeStyleSettings settings) {
if (myPanel != null) {
myPanel.reset(myCloneSettings);
myPanel.reset(settings);
}
}
@@ -541,7 +541,16 @@ public abstract class TabbedLanguageCodeStylePanel extends CodeStyleAbstractPane
@Override
protected void resetImpl(CodeStyleSettings settings) {
myConfigurable.reset();
if (myConfigurable instanceof CodeStyleAbstractConfigurable) {
// when a predefined style is chosen and the configurable is wrapped in a tab,
// we apply it to CLONED code style settings and then pass them to this method to reset,
// usual reset() won't work in such case
((CodeStyleAbstractConfigurable)myConfigurable).reset(settings);
}
else {
// todo: support for other configurables
myConfigurable.reset();
}
}
}