Stage 1 complete: at least update manager opens

This commit is contained in:
Joel Moniz
2014-06-24 23:59:38 +05:30
parent 3e25ff63cd
commit 08fcd1923a
3 changed files with 39 additions and 5 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 = 24 * 60 * 60 * 1000;
static final long ONE_DAY = 0;//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(30 * 1000); // give the PDE time to get rolling
Thread.sleep(10 * 1000); // give the PDE time to get rolling
updateCheck();
} catch (Exception e) {
// this can safely be ignored, too many instances where no net
@@ -122,13 +122,14 @@ 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.libraryManagerFrame.hasUpdates(base)) ||
(!base.toolManagerFrame.hasAlreadyBeenOpened() &&
base.toolManagerFrame.hasUpdates()) ||
base.toolManagerFrame.hasUpdates(base)) ||
(!base.modeManagerFrame.hasAlreadyBeenOpened() &&
base.modeManagerFrame.hasUpdates())) {
base.modeManagerFrame.hasUpdates(base))) {
promptToOpenContributionManager();
}
}

View File

@@ -27,6 +27,8 @@ 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;
@@ -379,14 +381,41 @@ public class ContributionListing {
}
return false;
}
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;
}
}
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;

View File

@@ -74,6 +74,10 @@ public class ContributionManagerDialog {
}
public boolean hasUpdates(Base base) {
return contribListing.hasUpdates(base);
}
public void showFrame(Editor editor) {
this.editor = editor;