minor tweaks, extend timeout for contrib download

This commit is contained in:
Ben Fry
2013-02-20 17:35:51 -05:00
parent d57b4c8cf0
commit e24cd2c44f
3 changed files with 11 additions and 11 deletions

View File

@@ -22,6 +22,7 @@
package processing.app.contrib;
import java.io.*;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLConnection;
@@ -55,7 +56,7 @@ public class ContributionManager {
try {
// System.out.println("downloading file " + source);
URLConnection conn = source.openConnection();
conn.setConnectTimeout(1000);
conn.setConnectTimeout(2000);
conn.setReadTimeout(5000);
// TODO this is often -1, may need to set progress to indeterminate
@@ -78,6 +79,9 @@ public class ContributionManager {
out.close();
success = true;
} catch (SocketTimeoutException ste) {
progress.error(ste);
} catch (IOException ioe) {
progress.error(ioe);
ioe.printStackTrace();

View File

@@ -110,8 +110,8 @@ public class ContributionManagerDialog {
if (isError()) {
status.setErrorMessage("An error occured when downloading " +
"the list of available contributions.");
} else {
status.updateUI();
// } else {
// status.updateUI();
}
}
});
@@ -289,14 +289,12 @@ public class ContributionManagerDialog {
disposeFrame();
}
});
ActionListener disposer = new ActionListener() {
// handle window closing commands for ctrl/cmd-W or hitting ESC.
Toolkit.registerWindowCloseKeys(dialog.getRootPane(), new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
disposeFrame();
}
};
Toolkit.registerWindowCloseKeys(dialog.getRootPane(), disposer);
// handle window closing commands for ctrl/cmd-W or hitting ESC.
});
dialog.getContentPane().addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
@@ -422,7 +420,6 @@ public class ContributionManagerDialog {
public void updateStyle() {
if (showingHint) {
setText(filterHint);
// setForeground(UIManager.getColor("TextField.light")); // too light
setForeground(Color.gray);
setFont(getFont().deriveFont(Font.ITALIC));