mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't generate invokeLater runnable on each document change event (IDEA-153495)
This commit is contained in:
+7
-2
@@ -288,11 +288,13 @@ class TextEditorComponent extends JBLoadingPanel implements DataProvider {
|
||||
* We can reuse this runnable to decrease number of allocated object.
|
||||
*/
|
||||
private final Runnable myUpdateRunnable;
|
||||
private boolean myUpdateScheduled;
|
||||
|
||||
public MyDocumentListener() {
|
||||
myUpdateRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myUpdateScheduled = false;
|
||||
updateModifiedProperty();
|
||||
}
|
||||
};
|
||||
@@ -300,8 +302,11 @@ class TextEditorComponent extends JBLoadingPanel implements DataProvider {
|
||||
|
||||
@Override
|
||||
public void documentChanged(DocumentEvent e) {
|
||||
// document's timestamp is changed later on undo or PSI changes
|
||||
ApplicationManager.getApplication().invokeLater(myUpdateRunnable);
|
||||
if (!myUpdateScheduled) {
|
||||
// document's timestamp is changed later on undo or PSI changes
|
||||
ApplicationManager.getApplication().invokeLater(myUpdateRunnable);
|
||||
myUpdateScheduled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user