mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-113638 ChooseByName restart on write action spawns a new thread
This commit is contained in:
@@ -898,15 +898,6 @@ public abstract class ChooseByNameBase {
|
||||
cancelCalcElementsThread();
|
||||
}
|
||||
});
|
||||
ApplicationManager.getApplication().addApplicationListener(new ApplicationAdapter() {
|
||||
@Override
|
||||
public void beforeWriteActionStart(Object action) {
|
||||
CalcElementsThread prevThread = cancelCalcElementsThread();
|
||||
if (prevThread != null) {
|
||||
prevThread.scheduleRestart();
|
||||
}
|
||||
}
|
||||
}, myTextPopup);
|
||||
myTextPopup.show(layeredPane);
|
||||
}
|
||||
|
||||
@@ -1503,7 +1494,7 @@ public abstract class ChooseByNameBase {
|
||||
|
||||
private final Alarm myShowCardAlarm = new Alarm();
|
||||
|
||||
void scheduleRestart() {
|
||||
private void scheduleRestart() {
|
||||
scheduleCalcElements(new CalcElementsThread(myPattern, myCheckboxState, myCallback, myModalityState, myCanCancel, myScopeExpanded));
|
||||
}
|
||||
|
||||
@@ -1520,6 +1511,15 @@ public abstract class ChooseByNameBase {
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ApplicationAdapter listener = new ApplicationAdapter() {
|
||||
@Override
|
||||
public void beforeWriteActionStart(Object action) {
|
||||
cancel();
|
||||
scheduleRestart();
|
||||
ApplicationManager.getApplication().removeApplicationListener(this);
|
||||
}
|
||||
};
|
||||
ApplicationManager.getApplication().addApplicationListener(listener);
|
||||
try {
|
||||
boolean everywhere = myCheckboxState;
|
||||
if (!ourLoadNamesEachTime) ensureNamesLoaded(everywhere);
|
||||
@@ -1528,6 +1528,9 @@ public abstract class ChooseByNameBase {
|
||||
catch (ProcessCanceledException e) {
|
||||
//OK
|
||||
}
|
||||
finally {
|
||||
ApplicationManager.getApplication().removeApplicationListener(listener);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user