Changeset 1653 in josm
- Timestamp:
- 2009-06-07T16:18:31+02:00 (15 years ago)
- Location:
- trunk/src/org
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java
r1637 r1653 11 11 import org.openstreetmap.josm.io.GpxImporter; 12 12 import org.openstreetmap.josm.io.NMEAImporter; 13 import org.openstreetmap.josm.io.OsmBzip2Importer; 14 import org.openstreetmap.josm.io.OsmGzipImporter; 13 15 import org.openstreetmap.josm.io.OsmImporter; 14 16 … … 25 27 26 28 public static ArrayList<FileImporter> importers = new ArrayList<FileImporter>(Arrays.asList(new OsmImporter(), 27 new GpxImporter(), new NMEAImporter()));29 new OsmGzipImporter(), new OsmBzip2Importer(), new GpxImporter(), new NMEAImporter())); 28 30 29 31 /** -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r1646 r1653 10 10 import java.io.FileOutputStream; 11 11 import java.io.IOException; 12 import java.io.OutputStream; 13 import java.io.OutputStreamWriter; 12 14 import java.io.PrintWriter; 13 14 import javax.swing.JFileChooser; 15 import java.io.Writer; 16 import java.util.zip.GZIPOutputStream; 17 15 18 import javax.swing.JOptionPane; 16 19 20 import org.apache.tools.bzip2.CBZip2OutputStream; 17 21 import org.openstreetmap.josm.Main; 18 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 23 27 import org.openstreetmap.josm.io.GpxImporter; 24 28 import org.openstreetmap.josm.io.GpxWriter; 29 import org.openstreetmap.josm.io.OsmBzip2Importer; 30 import org.openstreetmap.josm.io.OsmGzipImporter; 25 31 import org.openstreetmap.josm.io.OsmImporter; 26 32 import org.openstreetmap.josm.io.OsmWriter; … … 140 146 GpxImporter gpxImExporter = new GpxImporter(); 141 147 OsmImporter osmImExporter = new OsmImporter(); 148 OsmGzipImporter osmGzipImporter = new OsmGzipImporter(); 149 OsmBzip2Importer osmBzip2Importer = new OsmBzip2Importer(); 142 150 if (gpxImExporter.acceptFile(file)) 143 151 GpxExportAction.exportGpx(file, layer); 144 else if (osmImExporter.acceptFile(file)) { 152 else if (osmImExporter.acceptFile(file) 153 || osmGzipImporter.acceptFile(file) 154 || osmBzip2Importer.acceptFile(file)) 155 { 145 156 // use a tmp file because if something errors out in the 146 157 // process of writing the file, we might just end up with … … 150 161 copy(file, tmpFile); 151 162 } 152 OsmWriter w = new OsmWriter(new PrintWriter(file, "UTF-8"), false, layer.data.version); 163 164 // create outputstream and wrap it with gzip or bzip, if necessary 165 OutputStream out = new FileOutputStream(file); 166 if(osmGzipImporter.acceptFile(file)) { 167 out = new GZIPOutputStream(out); 168 } else if(osmBzip2Importer.acceptFile(file)) { 169 out.write('B'); 170 out.write('Z'); 171 out = new CBZip2OutputStream(out); 172 } 173 Writer writer = new OutputStreamWriter(out, "UTF-8"); 174 175 OsmWriter w = new OsmWriter(new PrintWriter(writer), false, layer.data.version); 153 176 w.header(); 154 177 w.writeDataSources(layer.data); -
trunk/src/org/openstreetmap/josm/gui/conflict/ListMerger.java
r1650 r1653 40 40 /** 41 41 * A UI component for resolving conflicts in two lists of entries of type T. 42 * 42 * 43 43 * @param T the type of the entries 44 44 * @see ListMergeModel … … 687 687 * Action for removing the selected entries in the list of merged entries 688 688 * from the list of merged entries. 689 * 689 * 690 690 */ 691 691 class RemoveMergedAction extends AbstractAction implements ListSelectionListener { … … 740 740 * such that the action gets notified about item state changes and the button gets 741 741 * notified about selection state changes of the action. 742 * 742 * 743 743 * @param btn a toggle button 744 744 */ … … 811 811 public void update(Observable o, Object arg) { 812 812 lblMyVersion.setText( 813 tr("My version ") 814 + trn("({0} entry)", "({0} entries)", model.getMyEntriesSize(), model.getMyEntriesSize()) 813 trn("My version ({0} entry)", "My version ({0} entries)", model.getMyEntriesSize(), model.getMyEntriesSize()) 815 814 ); 816 815 lblMergedVersion.setText( 817 tr("Merged version ") 818 + trn("({0} entry)", "({0} entries)", model.getMergedEntriesSize(), model.getMergedEntriesSize()) 816 trn("Merged version ({0} entry)", "Merged version ({0} entries)", model.getMergedEntriesSize(), model.getMergedEntriesSize()) 819 817 ); 820 818 lblTheirVersion.setText( 821 tr("Their version ") 822 + trn("({0} entry)", "({0} entries)", model.getTheirEntriesSize(), model.getTheirEntriesSize()) 819 trn("Their version ({0} entry)", "Their version ({0} entries)", model.getTheirEntriesSize(), model.getTheirEntriesSize()) 823 820 ); 824 821 } 825 826 827 822 828 823 /** … … 831 826 * the registerd Adjustables is updated the adjustment of 832 827 * the other registered Adjustables is adjusted too. 833 * 828 * 834 829 */ 835 830 class AdjustmentSynchronizer implements AdjustmentListener { … … 850 845 * registers an {@see Adjustable} for participation in synchronized 851 846 * scrolling. 852 * 847 * 853 848 * @param adjustable the adjustable 854 849 */ … … 865 860 /** 866 861 * event handler for {@see AdjustmentEvent}s 867 * 862 * 868 863 */ 869 864 public void adjustmentValueChanged(AdjustmentEvent e) { … … 880 875 * sets whether adjustable participates in adjustment synchronization 881 876 * or not 882 * 877 * 883 878 * @param adjustable the adjustable 884 879 */ … … 896 891 /** 897 892 * returns true if an adjustable is participating in synchronized scrolling 898 * 893 * 899 894 * @param adjustable the adjustable 900 895 * @return true, if the adjustable is participating in synchronized scrolling, false otherwise … … 916 911 * {@see JCheckBox}</ol> 917 912 * </li> 918 * 919 * 913 * 914 * 920 915 * @param view the checkbox to control whether an adjustable participates in synchronized 921 916 * adjustment -
trunk/src/org/openstreetmap/josm/io/OsmImporter.java
r1637 r1653 9 9 import java.io.FileNotFoundException; 10 10 import java.io.IOException; 11 import java.io.InputStream; 11 12 12 13 import javax.swing.JOptionPane; … … 24 25 } 25 26 27 public OsmImporter(ExtensionFileFilter filter) { 28 super(filter); 29 } 30 26 31 @Override public void importData(File file) throws IOException { 27 32 try { 28 OsmReader osm = OsmReader.parseDataSetOsm(new FileInputStream(file), null, Main.pleaseWaitDlg); 29 DataSet dataSet = osm.getDs(); 30 OsmDataLayer layer = new OsmDataLayer(dataSet, file.getName(), file); 31 Main.main.addLayer(layer); 32 layer.fireDataChange(); 33 if (osm.getParseNotes().length() != 0) { 34 /* display at most five lines */ 35 String notes = osm.getParseNotes(); 36 int j = 0; 37 for (int i = 0; i < 5; i++) 38 j = notes.indexOf('\n', j + 1); 39 j = j >= 0 ? j : notes.length(); 40 JOptionPane.showMessageDialog(Main.parent, notes.substring(0, j)); 41 } 33 FileInputStream in = new FileInputStream(file); 34 importData(in, file); 42 35 } catch (HeadlessException e) { 43 36 e.printStackTrace(); … … 51 44 } 52 45 } 46 47 protected void importData(InputStream in, File associatedFile) throws SAXException, IOException { 48 OsmReader osm = OsmReader.parseDataSetOsm(in, null, Main.pleaseWaitDlg); 49 DataSet dataSet = osm.getDs(); 50 OsmDataLayer layer = new OsmDataLayer(dataSet, associatedFile.getName(), associatedFile); 51 Main.main.addLayer(layer); 52 layer.fireDataChange(); 53 if (osm.getParseNotes().length() != 0) { 54 /* display at most five lines */ 55 String notes = osm.getParseNotes(); 56 int j = 0; 57 for (int i = 0; i < 5; i++) 58 j = notes.indexOf('\n', j + 1); 59 j = j >= 0 ? j : notes.length(); 60 JOptionPane.showMessageDialog(Main.parent, notes.substring(0, j)); 61 } 62 } 53 63 }
Note:
See TracChangeset
for help on using the changeset viewer.