Update Manager now displays on startup of Processing

This commit is contained in:
Joel Moniz
2014-06-25 13:20:00 +05:30
parent 08fcd1923a
commit fa3df07439
2 changed files with 10 additions and 26 deletions

View File

@@ -50,7 +50,7 @@ public class UpdateCheck {
Base base;
String downloadURL = "http://processing.org/download/latest.txt";
static final long ONE_DAY = 0;//24 * 60 * 60 * 1000;
static final long ONE_DAY = 24 * 60 * 60 * 1000;
public UpdateCheck(Base base) {
@@ -58,7 +58,7 @@ public class UpdateCheck {
new Thread(new Runnable() {
public void run() {
try {
Thread.sleep(10 * 1000); // give the PDE time to get rolling
Thread.sleep(20 * 1000); // give the PDE time to get rolling
updateCheck();
} catch (Exception e) {
// this can safely be ignored, too many instances where no net
@@ -122,7 +122,6 @@ public class UpdateCheck {
if (offerToUpdateContributions) {
// Wait for xml file to be downloaded and updates to come in.
// (this should really be handled better).
base.rebuildContribModes();
Thread.sleep(5 * 1000);
if ((!base.libraryManagerFrame.hasAlreadyBeenOpened() &&
base.libraryManagerFrame.hasUpdates(base)) ||

View File

@@ -27,7 +27,6 @@ import java.util.*;
import java.util.concurrent.locks.ReentrantLock;
import processing.app.Base;
import processing.app.Editor;
import processing.app.Library;
import processing.core.PApplet;
@@ -383,39 +382,25 @@ public class ContributionListing {
}
boolean hasUpdates(Base base) {
System.out.println("here321");
try {
System.out.println((base/*.getModeContribs()*/==null) ? "Null :(" : "what?!");
}
catch (Exception e)
{
e.printStackTrace();
}
System.out.println("Here too?!");
for (ModeContribution m : base.getModeContribs())
if (m.isInstalled()) {
System.out.println(m.getName());
Contribution advertised = getAvailableContribution(m);
if (advertised == null) {
}
else {
System.out.println("Here2");
if (advertised.getVersion() > m.getVersion())
return true;
}
}
if (hasUpdates(m))
return true;
for (Library l : base.getActiveEditor().getMode().contribLibraries)
if (hasUpdates(l))
return true;
for (ToolContribution t : base.getActiveEditor().contribTools)
if (hasUpdates(t))
return true;
return false;
}
boolean hasUpdates(Contribution contribution) {
if (contribution.isInstalled()) {
System.out.println("Here");
Contribution advertised = getAvailableContribution(contribution);
if (advertised == null) {
return false;
}
System.out.println("Here2");
return advertised.getVersion() > contribution.getVersion();
}
return false;