mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Apply settings to model without preview too
(cherry picked from commit 397e9d9)
This commit is contained in:
+15
-8
@@ -210,14 +210,7 @@ public abstract class CodeStyleAbstractPanel implements Disposable {
|
||||
PsiFile psiFile = createFileFromText(project, myTextToReformat);
|
||||
prepareForReformat(psiFile);
|
||||
|
||||
try {
|
||||
apply(mySettings);
|
||||
if (myModel != null) {
|
||||
myModel.fireAfterCurrentSettingsChanged();
|
||||
}
|
||||
}
|
||||
catch (ConfigurationException ignore) {
|
||||
}
|
||||
applySettingsToModel();
|
||||
CodeStyleSettings clone = mySettings.clone();
|
||||
clone.setRightMargin(getDefaultLanguage(), getAdjustedRightMargin());
|
||||
CodeStyleSettingsManager.getInstance(project).setTemporarySettings(clone);
|
||||
@@ -242,6 +235,17 @@ public abstract class CodeStyleAbstractPanel implements Disposable {
|
||||
});
|
||||
}
|
||||
|
||||
private void applySettingsToModel() {
|
||||
try {
|
||||
apply(mySettings);
|
||||
if (myModel != null) {
|
||||
myModel.fireAfterCurrentSettingsChanged();
|
||||
}
|
||||
}
|
||||
catch (ConfigurationException ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reformats {@link #myTextToReformat target text} with the {@link #mySettings current code style settings} and returns
|
||||
* list of changes applied to the target text during that.
|
||||
@@ -444,6 +448,9 @@ public abstract class CodeStyleAbstractPanel implements Disposable {
|
||||
UiNotifyConnector.doWhenFirstShown(myEditor.getComponent(), () -> addUpdatePreviewRequest());
|
||||
}
|
||||
}
|
||||
else {
|
||||
applySettingsToModel();
|
||||
}
|
||||
}
|
||||
|
||||
private void addUpdatePreviewRequest() {
|
||||
|
||||
@@ -223,7 +223,6 @@ public class GeneralCodeStylePanel extends CodeStyleAbstractPanel {
|
||||
private static String getTagText(JTextField field, String defaultValue) {
|
||||
String fieldText = field.getText();
|
||||
if (StringUtil.isEmpty(field.getText())) {
|
||||
field.setText(defaultValue);
|
||||
return defaultValue;
|
||||
}
|
||||
return fieldText;
|
||||
|
||||
Reference in New Issue
Block a user