From e9d3421bc77d6c823db0a3f2ec023143ff9b20d4 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Wed, 5 Mar 2014 16:05:44 +0100 Subject: [PATCH] update button on installed plugins panel --- .../src/com/intellij/ide/plugins/PluginHeaderPanel.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginHeaderPanel.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginHeaderPanel.java index e6664c0845e6..285efb41f1a2 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginHeaderPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginHeaderPanel.java @@ -83,6 +83,7 @@ public class PluginHeaderPanel { //data myName.setText("" + plugin.getName() + ""); myCategory.setText(plugin.getCategory() == null ? "UNKNOWN" : plugin.getCategory().toUpperCase()); + final boolean hasNewerVersion = InstalledPluginsTableModel.hasNewerVersion(plugin.getPluginId()); if (plugin instanceof PluginNode) { final PluginNode node = (PluginNode)plugin; @@ -93,7 +94,7 @@ public class PluginHeaderPanel { myUpdated.setText("Updated " + DateFormatUtil.formatDate(node.getDate())); switch (node.getStatus()) { case PluginNode.STATUS_INSTALLED: - myActionId = InstalledPluginsTableModel.hasNewerVersion(plugin.getPluginId()) ? ACTION_ID.UPDATE : ACTION_ID.UNINSTALL; + myActionId = hasNewerVersion ? ACTION_ID.UPDATE : ACTION_ID.UNINSTALL; break; case PluginNode.STATUS_DOWNLOADED: myActionId = ACTION_ID.RESTART; @@ -114,10 +115,10 @@ public class PluginHeaderPanel { final String version = plugin.getVersion(); myVersion.setText("Version: " + (version == null ? "N/A" : version)); myUpdated.setVisible(false); - if (!plugin.isBundled()) { + if (!plugin.isBundled() || hasNewerVersion) { if (((IdeaPluginDescriptorImpl)plugin).isDeleted()) { myActionId = ACTION_ID.RESTART; - } else if (InstalledPluginsTableModel.hasNewerVersion(plugin.getPluginId())) { + } else if (hasNewerVersion) { myActionId = ACTION_ID.UPDATE; } else { myActionId = ACTION_ID.UNINSTALL;