Changeset 158 in josm
- Timestamp:
- 2006-10-08T21:45:13+02:00 (18 years ago)
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
.classpath
r154 r158 8 8 <classpathentry kind="lib" path="lib/MinML2.jar"/> 9 9 <classpathentry kind="lib" path="lib/metadata-extractor-2.3.1.jar"/> 10 <classpathentry kind="lib" path="lib/gettext-commons-0.9.jar"/>10 <classpathentry sourcepath="C:/Download/gettext-commons-0.9-src.zip" kind="lib" path="lib/gettext-commons-0.9.jar"/> 11 11 <classpathentry exported="true" kind="lib" path="po"/> 12 12 <classpathentry kind="lib" path="lib/easymock.jar"/> -
src/org/openstreetmap/josm/actions/DownloadAction.java
r153 r158 262 262 else if (!anySelected) 263 263 JOptionPane.showMessageDialog(Main.parent,tr("Please select at least one download data type.")); 264 } while (b == null &&anySelected);264 } while (b == null || !anySelected); 265 265 266 266 double minlon = b.latlon[0]; -
src/org/openstreetmap/josm/actions/mapmode/MoveAction.java
r151 r158 83 83 if (selectionMode) 84 84 return; 85 85 86 86 if (mousePos == null) 87 87 mousePos = e.getPoint(); … … 131 131 OsmPrimitive osm = Main.map.mapView.getNearest(e.getPoint(), (e.getModifiersEx() & MouseEvent.ALT_DOWN_MASK) != 0); 132 132 if (osm != null) { 133 134 135 136 137 138 133 if (!sel.contains(osm)) 134 Main.ds.setSelected(osm); 135 oldCursor = Main.map.mapView.getCursor(); 136 Main.map.mapView.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); 137 } else { 138 selectionMode = true; 139 139 selectionManager.register(Main.map.mapView); 140 140 } 141 141 142 142 Main.map.mapView.repaint(); … … 156 156 } 157 157 158 158 159 159 public void selectionEnded(Rectangle r, boolean alt, boolean shift, boolean ctrl) { 160 160 SelectionAction.selectEverythingInRectangle(selectionManager, r, alt, shift, ctrl); 161 161 } 162 162 } -
src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r155 r158 6 6 import java.awt.Component; 7 7 import java.awt.GridLayout; 8 import java.awt.Point; 8 9 import java.awt.event.ActionEvent; 9 10 import java.awt.event.ActionListener; … … 49 50 */ 50 51 static JList instance; 51 52 private JScrollPane listScrollPane; 53 52 54 public final static class DeleteLayerAction extends AbstractAction { 53 55 … … 120 122 super(tr("Layers"), "layerlist", tr("Open a list of all loaded layers."), KeyEvent.VK_L, 100); 121 123 instance = new JList(model); 122 add(new JScrollPane(instance), BorderLayout.CENTER); 124 listScrollPane = new JScrollPane(instance); 125 add(listScrollPane, BorderLayout.CENTER); 123 126 instance.setBackground(UIManager.getColor("Button.background")); 124 127 instance.setCellRenderer(new DefaultListCellRenderer(){ … … 160 163 Layer layer = (Layer)instance.getModel().getElementAt(index); 161 164 LayerListPopup menu = new LayerListPopup(instance, layer); 162 menu.show(LayerListDialog.this, e.getX(), e.getY()); 165 Point p = listScrollPane.getMousePosition(); 166 menu.show(listScrollPane, p.x, p.y-3); 163 167 } 164 168 @Override public void mousePressed(MouseEvent e) { -
src/org/openstreetmap/josm/tools/I18n.java
r115 r158 1 1 package org.openstreetmap.josm.tools; 2 2 3 import java.io.File; 4 import java.net.URL; 5 import java.net.URLClassLoader; 3 6 import java.text.MessageFormat; 4 7 import java.util.Locale; … … 15 18 public class I18n { 16 19 private static org.xnap.commons.i18n.I18n i18n; 17 20 18 21 static { 22 String localeFile = Main.pref.getPreferencesDir()+"lang/"+Locale.getDefault()+".jar"; 23 Class<?> klass = Main.class; 24 if (new File(localeFile).exists()) { 25 try { 26 String url = localeFile.replace('\\','/'); 27 if (System.getProperty("os.name").startsWith("Windows")) 28 url = "file:/"+url; 29 else 30 url = "file://"+url; 31 URLClassLoader loader = new URLClassLoader(new URL[]{new URL(url)}); 32 klass = Class.forName("org.openstreetmap.josm.Translation_"+Locale.getDefault(), true, loader); 33 } catch (Exception e) { 34 System.out.println("Couldn't load locale file "+localeFile); 35 e.printStackTrace(); 36 } 37 } 19 38 try { 20 i18n = I18nFactory.getI18n(Main.class);21 22 23 39 i18n = I18nFactory.getI18n(klass); 40 } catch (MissingResourceException e) { 41 System.out.println("Locale '"+Locale.getDefault()+"' not found. Using default."); 42 } 24 43 } 25 44 26 45 public static String tr(String text, Object... objects) { 27 46 if (i18n == null) … … 39 58 if (i18n == null) 40 59 return n == 1 ? tr(text, objects) : tr(pluralText, objects); 41 return i18n.trn(text, pluralText, n, objects);60 return i18n.trn(text, pluralText, n, objects); 42 61 } 43 62 … … 45 64 if (i18n == null) 46 65 return n == 1 ? tr(text) : tr(pluralText); 47 return i18n.trn(text, pluralText, n);66 return i18n.trn(text, pluralText, n); 48 67 } 49 68 } -
test/org/openstreetmap/josm/data/osm/visitor/AllNodesVisitorTest.java
r146 r158 2 2 3 3 import java.util.Collection; 4 import java.util.Iterator;5 4 import java.util.LinkedList; 6 5 … … 31 30 s.visit(v); 32 31 assertEquals(2, v.nodes.size()); 33 Iterator<Node> it = v.nodes.iterator(); 34 assertSame(s.from, it.next()); 35 assertSame(s.to, it.next()); 32 assertTrue(v.nodes.contains(s.from)); 33 assertTrue(v.nodes.contains(s.to)); 36 34 } 37 35 … … 41 39 int numberOfNodes = 2*w.segments.size(); 42 40 assertEquals(numberOfNodes, v.nodes.size()); 43 Iterator<Node> itNodes = v.nodes.iterator();44 Iterator<Segment> it = w.segments.iterator();45 for (int i = 0; i < numberOfNodes; ++i)46 assertSame(i%2==0?it.next().from:it.next().to, itNodes.next());41 for (Segment s : w.segments) { 42 assertTrue(v.nodes.contains(s.from)); 43 assertTrue(v.nodes.contains(s.to)); 44 } 47 45 } 48 46 -
test/org/openstreetmap/josm/testframework/MotherObject.java
r146 r158 90 90 assertEquals(0, copy.size()); 91 91 } 92 93 /** 94 * To have JUnit shut up. 95 */ 96 public void test() { 97 } 92 98 }
Note:
See TracChangeset
for help on using the changeset viewer.