mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-196053 Plugins: counter on Updates page appears only on opening the tab
This commit is contained in:
+1
-1
@@ -465,7 +465,7 @@ public class PluginManagerConfigurableNew
|
||||
myTabHeaderComponent.addTab(myUpdatesTabName = new CountTabName(myTabHeaderComponent, "Updates"));
|
||||
|
||||
myPluginUpdatesServiceCallback =
|
||||
PluginUpdatesService.connectConfigurableTab(countValue -> myUpdatesTabName.setCount(countValue == null ? 0 : countValue));
|
||||
PluginUpdatesService.connectConfigurable(countValue -> myUpdatesTabName.setCount(countValue == null ? 0 : countValue));
|
||||
|
||||
createSearchPanels();
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ public class PluginManagerConfigurableTreeRenderer implements ConfigurableTreeRe
|
||||
if (myTree == null) {
|
||||
PluginUpdatesService.connectTreeRenderer(tree, countValue -> {
|
||||
String oldCountValue = myCountValue;
|
||||
myCountValue = countValue == null || countValue == 0 ? null : countValue.toString();
|
||||
myCountValue = countValue == null || countValue <= 0 ? null : countValue.toString();
|
||||
if (myTree != null && !StringUtil.equals(oldCountValue, myCountValue)) {
|
||||
myTree.repaint();
|
||||
}
|
||||
|
||||
+3
-1
@@ -70,7 +70,9 @@ public class DetailsPagePluginComponent extends OpaquePanel {
|
||||
myCenterPanel = createCenterPanel(update);
|
||||
header.add(myCenterPanel);
|
||||
|
||||
createTagPanel();
|
||||
if (!update) {
|
||||
createTagPanel();
|
||||
}
|
||||
createMetricsPanel();
|
||||
createErrorPanel();
|
||||
createProgressPanel(!update);
|
||||
|
||||
+11
-11
@@ -47,7 +47,7 @@ public class PluginUpdatesService {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Runnable connectConfigurableTab(@NotNull Consumer<Integer> callback) {
|
||||
public static Runnable connectConfigurable(@NotNull Consumer<Integer> callback) {
|
||||
assert SwingUtilities.isEventDispatchThread();
|
||||
|
||||
Runnable disposer = myCreate ? () -> dispose() : null;
|
||||
@@ -82,7 +82,7 @@ public class PluginUpdatesService {
|
||||
PluginDownloader downloader = I.next();
|
||||
if (downloader.getDescriptor() == descriptor) {
|
||||
I.remove();
|
||||
doCountCallback();
|
||||
runCallbacks(getCount());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -90,8 +90,9 @@ public class PluginUpdatesService {
|
||||
|
||||
public static void recalculateUpdates() {
|
||||
assert SwingUtilities.isEventDispatchThread();
|
||||
|
||||
assert !myPreparing;
|
||||
|
||||
runCallbacks(-1);
|
||||
calculateUpdates();
|
||||
}
|
||||
|
||||
@@ -118,11 +119,6 @@ public class PluginUpdatesService {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Integer getCount() {
|
||||
return myCache == null ? null : new Integer(myCache.size());
|
||||
}
|
||||
|
||||
private static void calculateUpdates() {
|
||||
assert SwingUtilities.isEventDispatchThread();
|
||||
|
||||
@@ -142,7 +138,7 @@ public class PluginUpdatesService {
|
||||
myPrepared = true;
|
||||
myCache = updates;
|
||||
|
||||
doCountCallback();
|
||||
runCallbacks(getCount());
|
||||
|
||||
if (myPanelCallbacks != null) {
|
||||
for (Consumer<Collection<PluginDownloader>> callback : myPanelCallbacks) {
|
||||
@@ -154,8 +150,12 @@ public class PluginUpdatesService {
|
||||
});
|
||||
}
|
||||
|
||||
private static void doCountCallback() {
|
||||
Integer countValue = getCount();
|
||||
@Nullable
|
||||
private static Integer getCount() {
|
||||
return myCache == null ? null : new Integer(myCache.size());
|
||||
}
|
||||
|
||||
private static void runCallbacks(@Nullable Integer countValue) {
|
||||
if (myTreeCallback != null) {
|
||||
myTreeCallback.accept(countValue);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user