mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-232707 simplify racy myInstalledSearchSetState flag
this flag is set to false on EDT, then async task is launched that runs the query, then the flag is reset on EDT, so when the query actually runs, the state of the flag is likely to be reset already instead, we can setup the state of filter actions every time we handle the query GitOrigin-RevId: 5b24d000ce71ca239f4cc15baf876d14a55d4c28
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5499047fb1
commit
c4c29af142
@@ -83,7 +83,6 @@ class InstalledPluginsTab extends PluginsTab {
|
||||
private @Nullable PluginsGroupComponentWithProgress myInstalledPanel = null;
|
||||
private @Nullable SearchResultPanel myInstalledSearchPanel = null;
|
||||
private final DefaultActionGroup myInstalledSearchGroup;
|
||||
private boolean myInstalledSearchSetState = true;
|
||||
|
||||
private final PluginsGroup myBundledUpdateGroup =
|
||||
new PluginsGroup(IdeBundle.message("plugins.configurable.bundled.updates"), PluginsGroupType.BUNDLED_UPDATE);
|
||||
@@ -351,11 +350,6 @@ class InstalledPluginsTab extends PluginsTab {
|
||||
@Override
|
||||
public void hideSearchPanel() {
|
||||
super.hideSearchPanel();
|
||||
if (myInstalledSearchSetState) {
|
||||
for (AnAction action : myInstalledSearchGroup.getChildren(ActionManager.getInstance())) {
|
||||
((InstalledSearchOptionAction)action).setState(null);
|
||||
}
|
||||
}
|
||||
myPluginModelFacade.getModel().setInvalidFixCallback(null);
|
||||
}
|
||||
|
||||
@@ -381,32 +375,19 @@ class InstalledPluginsTab extends PluginsTab {
|
||||
};
|
||||
|
||||
if (updateAction.myIsSelected) {
|
||||
for (AnAction action : myInstalledSearchGroup.getChildren(ActionManager.getInstance())) {
|
||||
if (action != updateAction) {
|
||||
((InstalledSearchOptionAction)action).myIsSelected = false;
|
||||
}
|
||||
}
|
||||
|
||||
queries.add(updateAction.getQuery());
|
||||
}
|
||||
else {
|
||||
queries.remove(updateAction.getQuery());
|
||||
}
|
||||
|
||||
try {
|
||||
myInstalledSearchSetState = false;
|
||||
|
||||
String query = StringUtil.join(queries, " ");
|
||||
searchTextField.setTextIgnoreEvents(query);
|
||||
if (query.isEmpty()) {
|
||||
hideSearchPanel();
|
||||
}
|
||||
else {
|
||||
showSearchPanel(query);
|
||||
}
|
||||
String query = StringUtil.join(queries, " ");
|
||||
searchTextField.setTextIgnoreEvents(query);
|
||||
if (query.isEmpty()) {
|
||||
hideSearchPanel();
|
||||
}
|
||||
finally {
|
||||
myInstalledSearchSetState = true;
|
||||
else {
|
||||
showSearchPanel(query);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -651,19 +632,20 @@ class InstalledPluginsTab extends PluginsTab {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQuery(@NotNull String query) {
|
||||
super.setQuery(query);
|
||||
SearchQueryParser.Installed parser = new SearchQueryParser.Installed(query);
|
||||
for (AnAction action : myInstalledSearchGroup.getChildren(ActionManager.getInstance())) {
|
||||
((InstalledSearchOptionAction)action).setState(parser);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleQuery(@NotNull String query, @NotNull PluginsGroup result, AtomicBoolean runQuery) {
|
||||
int searchIndex = PluginManagerUsageCollector.updateAndGetSearchIndex();
|
||||
myPluginModelFacade.getModel().setInvalidFixCallback(null);
|
||||
|
||||
SearchQueryParser.Installed parser = new SearchQueryParser.Installed(query);
|
||||
|
||||
if (myInstalledSearchSetState) {
|
||||
for (AnAction action : myInstalledSearchGroup.getChildren(ActionManager.getInstance())) {
|
||||
((InstalledSearchOptionAction)action).setState(parser);
|
||||
}
|
||||
}
|
||||
|
||||
List<PluginUiModel> descriptors = myPluginModelFacade.getModel().getInstalledDescriptors();
|
||||
|
||||
if (!parser.vendors.isEmpty()) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.ui.components.JBScrollPane
|
||||
import com.intellij.util.Alarm
|
||||
import com.intellij.util.SingleAlarm
|
||||
import com.intellij.util.concurrency.annotations.RequiresEdt
|
||||
import com.intellij.util.ui.EDT
|
||||
import com.intellij.util.ui.JBUI
|
||||
import com.intellij.util.ui.accessibility.AccessibleAnnouncerUtil
|
||||
@@ -77,7 +78,8 @@ abstract class SearchResultPanel(
|
||||
query = ""
|
||||
}
|
||||
|
||||
fun setQuery(query: String) {
|
||||
@RequiresEdt
|
||||
open fun setQuery(query: String) {
|
||||
assert(EDT.isCurrentThreadEdt())
|
||||
if (query == this.query) {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user