From c2da66093d84f5414e43b4cdd687b880990a3d0f Mon Sep 17 00:00:00 2001 From: Wolf Posdorfer Date: Tue, 14 Jun 2011 07:34:27 +0000 Subject: [PATCH] when downloading a plugin it should be removed from the "do-not-load-plugin"-list also removed the alternative plugin icon loading from website, as everything returns the same icon git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@12474 b35dd754-fafc-0310-a699-88a17e54d16e --- .../org/jivesoftware/spark/PluginManager.java | 20 +++++------- .../sparkimpl/plugin/viewer/PluginViewer.java | 3 ++ .../sparkimpl/plugin/viewer/SparkPlugUI.java | 32 ++++--------------- 3 files changed, 17 insertions(+), 38 deletions(-) diff --git a/src/java/org/jivesoftware/spark/PluginManager.java b/src/java/org/jivesoftware/spark/PluginManager.java index 95e9794d..fef58eaf 100644 --- a/src/java/org/jivesoftware/spark/PluginManager.java +++ b/src/java/org/jivesoftware/spark/PluginManager.java @@ -183,22 +183,18 @@ public class PluginManager implements MainWindowListener { try { File f = new File(installPath + jarFile.getName()); if (installerFiles.contains(f)) { - String oldfile = StringUtils - .getMD5Checksum(jarFile - .getAbsolutePath()); - String newfile = StringUtils.getMD5Checksum(f - .getAbsolutePath()); - Log.debug(f.getAbsolutePath() + " " - + jarFile.getAbsolutePath()); - Log.debug(newfile + " " + oldfile + " equal:" - + oldfile.equals(newfile)); + String oldfile = StringUtils.getMD5Checksum(jarFile.getAbsolutePath()); + String newfile = StringUtils.getMD5Checksum(f.getAbsolutePath()); + + Log.debug(f.getAbsolutePath() + " " + jarFile.getAbsolutePath()); + Log.debug(newfile + " " + oldfile + " equal:" + oldfile.equals(newfile)); + if (!oldfile.equals(newfile)) { - Log.debug("deleting: " - + file.getAbsolutePath() + "," - + jarFile.getAbsolutePath()); + Log.debug("deleting: "+ file.getAbsolutePath() + "," + jarFile.getAbsolutePath()); uninstall(file); jarFile.delete(); } + } } catch (Exception e) { diff --git a/src/java/org/jivesoftware/sparkimpl/plugin/viewer/PluginViewer.java b/src/java/org/jivesoftware/sparkimpl/plugin/viewer/PluginViewer.java index f838569a..bd07ddd0 100644 --- a/src/java/org/jivesoftware/sparkimpl/plugin/viewer/PluginViewer.java +++ b/src/java/org/jivesoftware/sparkimpl/plugin/viewer/PluginViewer.java @@ -399,6 +399,9 @@ public class PluginViewer extends JPanel implements Plugin { if (sparkPlug.getPlugin().getDownloadURL().equals(plugin.getDownloadURL())) { availablePanel.remove(sparkPlug); + _deactivatedPlugins.remove(sparkPlug.getPlugin().getName()); + _prefs.setDeactivatedPlugins(_deactivatedPlugins); + PluginManager.getInstance().addPlugin(sparkPlug.getPlugin()); sparkPlug.showOperationButton(); diff --git a/src/java/org/jivesoftware/sparkimpl/plugin/viewer/SparkPlugUI.java b/src/java/org/jivesoftware/sparkimpl/plugin/viewer/SparkPlugUI.java index 0a0e5cc6..6cb74a6c 100644 --- a/src/java/org/jivesoftware/sparkimpl/plugin/viewer/SparkPlugUI.java +++ b/src/java/org/jivesoftware/sparkimpl/plugin/viewer/SparkPlugUI.java @@ -24,7 +24,6 @@ import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; -import java.awt.Image; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -32,7 +31,6 @@ import java.io.File; import java.net.MalformedURLException; import java.net.URL; -import javax.imageio.ImageIO; import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.ImageIcon; @@ -67,29 +65,8 @@ public class SparkPlugUI extends JPanel { JLabel versionLabel = new JLabel(); JLabel descriptionLabel = new JLabel(); - - if (getFilename() != null) { - URL url = null; - try { - url = new URL("http://www.igniterealtime.org/updater/sparkplugs?filename=" + getFilename()); - final Image pluginImage = ImageIO.read(url); - - // In some cases, people are not supplying icons. This case needs to be handled. - if (pluginImage != null) { - ImageIcon pluginIcon = new ImageIcon(pluginImage); - imageIcon.setIcon(pluginIcon); - if (pluginIcon.getIconWidth() == -1) { - imageIcon.setIcon(SparkRes.getImageIcon(SparkRes.PLUGIN_IMAGE)); - } - } - } - catch (Exception e) { - Log.debug("Unable to find image for " + url); - } - } - else { - imageIcon.setIcon(SparkRes.getImageIcon(SparkRes.PLUGIN_IMAGE)); - } + imageIcon.setIcon(SparkRes.getImageIcon(SparkRes.PLUGIN_IMAGE)); + add(imageIcon, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); @@ -100,7 +77,10 @@ public class SparkPlugUI extends JPanel { add(versionLabel, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setText(plugin.getName()); - versionLabel.setText(plugin.getVersion() + " by " + plugin.getAuthor()); + if (plugin.getVersion() != null && plugin.getAuthor() != null) { + versionLabel.setText(plugin.getVersion() + " by " + + plugin.getAuthor()); + } descriptionLabel.setText(plugin.getDescription());