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
This commit is contained in:
Wolf Posdorfer
2011-06-14 07:34:27 +00:00
committed by wolf.posdorfer
parent b931fedc4e
commit c2da66093d
3 changed files with 17 additions and 38 deletions

View File

@ -183,22 +183,18 @@ public class PluginManager implements MainWindowListener {
try { try {
File f = new File(installPath + jarFile.getName()); File f = new File(installPath + jarFile.getName());
if (installerFiles.contains(f)) { if (installerFiles.contains(f)) {
String oldfile = StringUtils String oldfile = StringUtils.getMD5Checksum(jarFile.getAbsolutePath());
.getMD5Checksum(jarFile String newfile = StringUtils.getMD5Checksum(f.getAbsolutePath());
.getAbsolutePath());
String newfile = StringUtils.getMD5Checksum(f Log.debug(f.getAbsolutePath() + " " + jarFile.getAbsolutePath());
.getAbsolutePath()); Log.debug(newfile + " " + oldfile + " equal:" + oldfile.equals(newfile));
Log.debug(f.getAbsolutePath() + " "
+ jarFile.getAbsolutePath());
Log.debug(newfile + " " + oldfile + " equal:"
+ oldfile.equals(newfile));
if (!oldfile.equals(newfile)) { if (!oldfile.equals(newfile)) {
Log.debug("deleting: " Log.debug("deleting: "+ file.getAbsolutePath() + "," + jarFile.getAbsolutePath());
+ file.getAbsolutePath() + ","
+ jarFile.getAbsolutePath());
uninstall(file); uninstall(file);
jarFile.delete(); jarFile.delete();
} }
} }
} catch (Exception e) { } catch (Exception e) {

View File

@ -399,6 +399,9 @@ public class PluginViewer extends JPanel implements Plugin {
if (sparkPlug.getPlugin().getDownloadURL().equals(plugin.getDownloadURL())) { if (sparkPlug.getPlugin().getDownloadURL().equals(plugin.getDownloadURL())) {
availablePanel.remove(sparkPlug); availablePanel.remove(sparkPlug);
_deactivatedPlugins.remove(sparkPlug.getPlugin().getName());
_prefs.setDeactivatedPlugins(_deactivatedPlugins);
PluginManager.getInstance().addPlugin(sparkPlug.getPlugin()); PluginManager.getInstance().addPlugin(sparkPlug.getPlugin());
sparkPlug.showOperationButton(); sparkPlug.showOperationButton();

View File

@ -24,7 +24,6 @@ import java.awt.FlowLayout;
import java.awt.Font; import java.awt.Font;
import java.awt.GridBagConstraints; import java.awt.GridBagConstraints;
import java.awt.GridBagLayout; import java.awt.GridBagLayout;
import java.awt.Image;
import java.awt.Insets; import java.awt.Insets;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -32,7 +31,6 @@ import java.io.File;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
@ -67,29 +65,8 @@ public class SparkPlugUI extends JPanel {
JLabel versionLabel = new JLabel(); JLabel versionLabel = new JLabel();
JLabel descriptionLabel = new JLabel(); JLabel descriptionLabel = new JLabel();
imageIcon.setIcon(SparkRes.getImageIcon(SparkRes.PLUGIN_IMAGE));
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));
}
add(imageIcon, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); 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)); 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()); 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()); descriptionLabel.setText(plugin.getDescription());