Changeset 1733 in josm for trunk/src/org/openstreetmap/josm/plugins
- Timestamp:
- 2009-07-05T10:48:09+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/plugins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/plugins/PluginDownloader.java
r1732 r1733 11 11 import java.io.BufferedWriter; 12 12 import java.io.File; 13 import java.io.FileNotFoundException;14 13 import java.io.FileOutputStream; 15 import java.io.FileWriter;16 14 import java.io.FilenameFilter; 17 15 import java.io.IOException; … … 20 18 import java.io.OutputStream; 21 19 import java.io.OutputStreamWriter; 22 import java.net.MalformedURLException;23 20 import java.net.URL; 24 21 import java.util.Arrays; 25 import java.util.concurrent.Future;26 22 import java.util.Collection; 27 23 import java.util.LinkedList; … … 29 25 import javax.swing.JOptionPane; 30 26 27 import org.openstreetmap.josm.Main; 31 28 import org.openstreetmap.josm.actions.AboutAction; 32 import org.openstreetmap.josm.Main;33 29 import org.openstreetmap.josm.gui.ExtendedDialog; 34 30 import org.openstreetmap.josm.gui.PleaseWaitRunnable; … … 66 62 if (!pluginDir.exists()) 67 63 pluginDir.mkdirs(); 64 Main.pleaseWaitDlg.progress.setMaximum(toUpdate.size()); 65 int progressValue = 0; 68 66 for (PluginInformation d : toUpdate) { 67 Main.pleaseWaitDlg.progress.setValue(progressValue++); 69 68 Main.pleaseWaitDlg.currentAction.setText(tr("Downloading Plugin {0}...", d.name)); 70 69 File pluginFile = new File(pluginDir, d.name + ".jar.new"); … … 145 144 146 145 public Collection<PluginInformation> download(Collection<PluginInformation> download) { 146 // Execute task in current thread instead of executing it in other thread and waiting for result 147 // Waiting for result is not a good idea because the waiting thread will probably be either EDT 148 // or worker thread. Blocking one of these threads will cause deadlock 147 149 UpdateTask t = new UpdateTask(download, false); 148 try { 149 Future<UpdateTask> ta = Main.worker.submit(t, t); 150 t = ta.get(); 151 return t.failed; 152 } 153 catch(java.lang.InterruptedException e) {e.printStackTrace();} 154 catch(java.util.concurrent.ExecutionException e) {e.printStackTrace();} 155 return download; 150 t.run(); 151 return t.failed; 156 152 } 157 153 -
trunk/src/org/openstreetmap/josm/plugins/PluginSelection.java
r1672 r1733 9 9 import java.awt.event.ActionEvent; 10 10 import java.awt.event.ActionListener; 11 12 11 import java.io.BufferedReader; 13 12 import java.io.ByteArrayInputStream; … … 15 14 import java.io.FileInputStream; 16 15 import java.io.InputStreamReader; 17 import java.io.IOException;18 16 import java.util.Arrays; 19 17 import java.util.Collection; … … 97 95 } 98 96 99 public Boolean finish() {97 public boolean finish() { 100 98 Collection<PluginInformation> toDownload = new LinkedList<PluginInformation>(); 101 99 String msg = "";
Note:
See TracChangeset
for help on using the changeset viewer.