mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
AppCode: more safe user-data handling when updating file encodings
(cherry-picked from d801698)
This commit is contained in:
@@ -486,6 +486,10 @@ public abstract class VirtualFile extends UserDataHolderBase implements Modifica
|
||||
}
|
||||
|
||||
public void setCharset(final Charset charset) {
|
||||
setCharset(charset, null);
|
||||
}
|
||||
|
||||
public void setCharset(final Charset charset, @Nullable Runnable whenChanged) {
|
||||
final Charset old = getUserData(CHARSET_KEY);
|
||||
putUserData(CHARSET_KEY, charset);
|
||||
if (Comparing.equal(charset, old)) return;
|
||||
@@ -497,6 +501,7 @@ public abstract class VirtualFile extends UserDataHolderBase implements Modifica
|
||||
setBOM(bom);
|
||||
|
||||
if (old != null) { //do not send on detect
|
||||
if (whenChanged != null) whenChanged.run();
|
||||
VirtualFileManager.getInstance().notifyPropertyChanged(this, PROP_ENCODING, old, charset);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user