* always display update notifications for outdated filebot installs

This commit is contained in:
Reinhard Pointner 2013-10-17 07:11:03 +00:00
parent 492c5b31b3
commit 02cd92d842
1 changed files with 71 additions and 83 deletions

View File

@ -1,7 +1,5 @@
package net.sourceforge.filebot;
import static java.awt.GraphicsEnvironment.*;
import static java.util.regex.Pattern.*;
import static javax.swing.JOptionPane.*;
@ -68,7 +66,6 @@ import net.sourceforge.tuned.TeePrintStream;
import org.w3c.dom.NodeList;
public class Main {
/**
@ -155,11 +152,12 @@ public class Main {
if (args.action.equalsIgnoreCase("test")) {
System.setProperty("useExtendedFileAttributes", "false");
System.setProperty("application.analytics", "false");
HistorySpooler.getInstance().setPersistentHistoryEnabled(false); // don't keep history of --action test rename operations
System.setProperty("application.rename.history", "false"); // don't keep history of --action test rename operations
}
// initialize analytics
Analytics.setEnabled(System.getProperty("application.analytics") == null ? true : Boolean.parseBoolean(System.getProperty("application.analytics")));
HistorySpooler.getInstance().setPersistentHistoryEnabled(System.getProperty("application.rename.history") == null ? true : Boolean.parseBoolean(System.getProperty("application.rename.history")));
// CLI mode => run command-line interface and then exit
if (args.runCLI()) {
@ -239,7 +237,6 @@ public class Main {
}
}
private static void startUserInterface(ArgumentBean args) {
JFrame frame = null;
@ -285,13 +282,11 @@ public class Main {
frame.setVisible(true);
}
/**
* Show update notifications if updates are available
*/
private static void checkUpdate() throws Exception {
final PreferencesEntry<String> updateIgnoreRevision = Settings.forPackage(Main.class).entry("update.revision.ignore");
final Properties updateProperties = new CachedResource<Properties>(getApplicationProperty("update.url"), Properties.class, 24 * 60 * 60 * 1000) {
final Properties updateProperties = new CachedResource<Properties>(getApplicationProperty("update.url"), Properties.class, 24 * 60 * 60 * 1000, 0, 0) {
@Override
public Properties process(ByteBuffer data) {
@ -310,9 +305,9 @@ public class Main {
// check if update is required
int latestRev = Integer.parseInt(updateProperties.getProperty("revision"));
int latestIgnoreRev = Math.max(getApplicationRevisionNumber(), updateIgnoreRevision.getValue() == null ? 0 : Integer.parseInt(updateIgnoreRevision.getValue()));
int currentRev = getApplicationRevisionNumber();
if (latestRev > latestIgnoreRev) {
if (latestRev > currentRev && currentRev > 0) {
SwingUtilities.invokeLater(new Runnable() {
@Override
@ -351,7 +346,6 @@ public class Main {
@Override
public void actionPerformed(ActionEvent evt) {
updateIgnoreRevision.setValue(updateProperties.getProperty("revision"));
dialog.setVisible(false);
}
}), "tag cancel");
@ -364,7 +358,6 @@ public class Main {
}
}
private static void showDonationReminder() {
int renameCount = HistorySpooler.getInstance().getPersistentHistoryTotalSize();
if (renameCount < 2000)
@ -396,7 +389,6 @@ public class Main {
Analytics.trackEvent("GUI", "Donate", "r" + currentRev, pane.getValue() == actions[0] ? 1 : 0);
}
private static void warmupCachedResources() {
Thread warmup = new Thread("warmupCachedResources") {
@ -428,7 +420,6 @@ public class Main {
warmup.start();
}
private static void restoreWindowBounds(final JFrame window, final Settings settings) {
// store bounds on close
window.addWindowListener(new WindowAdapter() {
@ -453,7 +444,6 @@ public class Main {
window.setBounds(x, y, width, height);
}
/**
* Shutdown ehcache properly, so that disk-persistent stores can actually be saved to disk
*/
@ -513,7 +503,6 @@ public class Main {
System.setProperty("ehcache.disk.store.dir", new File(cacheRoot, "default").getAbsolutePath());
}
/**
* Initialize default SecurityManager and grant all permissions via security policy. Initialization is required in order to run {@link ExpressionFormat} in a secure sandbox.
*/
@ -529,7 +518,6 @@ public class Main {
return true;
}
@Override
public PermissionCollection getPermissions(CodeSource codesource) {
// VisualVM can't connect if this method does return