- Timestamp:
- 2014-04-26T03:53:35+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 43 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r6992 r7001 1111 1111 1112 1112 /** 1113 * Checks that JOSM is at least running with Java 6.1114 * @since 38151115 */ 1116 public static void checkJava 6() {1113 * Checks that JOSM is at least running with Java 7. 1114 * @since 7001 1115 */ 1116 public static void checkJavaVersion() { 1117 1117 String version = System.getProperty("java.version"); 1118 1118 if (version != null) { 1119 if (version.matches("^(1\\.)?[ 6789].*"))1119 if (version.matches("^(1\\.)?[789].*")) 1120 1120 return; 1121 if (version.matches("^(1\\.)?[5 ].*")) {1121 if (version.matches("^(1\\.)?[56].*")) { 1122 1122 JMultilineLabel ho = new JMultilineLabel("<html>"+ 1123 tr("<h2>JOSM requires Java version 6.</h2>"+1124 "Detected Java version: { 0}.<br>"+1123 tr("<h2>JOSM requires Java version {0}.</h2>"+ 1124 "Detected Java version: {1}.<br>"+ 1125 1125 "You can <ul><li>update your Java (JRE) or</li>"+ 1126 "<li>use an earlier (Java 5compatible) version of JOSM.</li></ul>"+1127 "More Info:", version)+"</html>");1126 "<li>use an earlier (Java {2} compatible) version of JOSM.</li></ul>"+ 1127 "More Info:", "7", version, "6")+"</html>"); 1128 1128 JTextArea link = new JTextArea(HelpUtil.getWikiBaseHelpUrl()+"/Help/SystemRequirements"); 1129 1129 link.setEditable(false); -
trunk/src/org/openstreetmap/josm/actions/AbstractMergeAction.java
r6889 r7001 31 31 32 32 @Override 33 public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, 34 boolean cellHasFocus) { 33 public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { 35 34 Layer layer = (Layer) value; 36 JLabel label = (JLabel) super.getListCellRendererComponent(list, layer.getName(), index, isSelected, 37 cellHasFocus); 35 JLabel label = (JLabel) super.getListCellRendererComponent(list, layer.getName(), index, isSelected, cellHasFocus); 38 36 Icon icon = layer.getIcon(); 39 37 label.setIcon(icon); -
trunk/src/org/openstreetmap/josm/actions/PurgeAction.java
r6336 r7001 57 57 public class PurgeAction extends JosmAction { 58 58 59 /** 60 * Constructs a new {@code PurgeAction}. 61 */ 59 62 public PurgeAction() { 60 63 /* translator note: other expressions for "purge" might be "forget", "clean", "obliterate", "prune" */ … … 245 248 } 246 249 }); 247 JList list = new JList(toPurgeAdditionally.toArray(new OsmPrimitive[toPurgeAdditionally.size()]));250 JList<OsmPrimitive> list = new JList<OsmPrimitive>(toPurgeAdditionally.toArray(new OsmPrimitive[toPurgeAdditionally.size()])); 248 251 /* force selection to be active for all entries */ 249 252 list.setCellRenderer(new OsmPrimitivRenderer() { 250 253 @Override 251 public Component getListCellRendererComponent(JList list,252 O bjectvalue,254 public Component getListCellRendererComponent(JList<? extends OsmPrimitive> list, 255 OsmPrimitive value, 253 256 int index, 254 257 boolean isSelected, -
trunk/src/org/openstreetmap/josm/gui/MainApplet.java
r6889 r7001 91 91 @Override public void start() { 92 92 I18n.init(); 93 Main.checkJava 6();93 Main.checkJavaVersion(); 94 94 95 95 String url = getParameter("load_url"); -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r6995 r7001 267 267 public static void main(final String[] argArray) { 268 268 I18n.init(); 269 Main.checkJava 6();269 Main.checkJavaVersion(); 270 270 271 271 // construct argument table -
trunk/src/org/openstreetmap/josm/gui/OsmPrimitivRenderer.java
r6830 r7001 26 26 * @author Frederik Ramm 27 27 */ 28 public class OsmPrimitivRenderer implements ListCellRenderer , TableCellRenderer {28 public class OsmPrimitivRenderer implements ListCellRenderer<OsmPrimitive>, TableCellRenderer { 29 29 private DefaultNameFormatter formatter = DefaultNameFormatter.getInstance(); 30 30 … … 43 43 */ 44 44 @Override 45 public Component getListCellRendererComponent(JList list, Objectvalue, int index, boolean isSelected, boolean cellHasFocus) {45 public Component getListCellRendererComponent(JList<? extends OsmPrimitive> list, OsmPrimitive value, int index, boolean isSelected, boolean cellHasFocus) { 46 46 Component def = defaultListCellRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); 47 47 return renderer(def, (OsmPrimitive) value); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ComparePairListCellRenderer.java
r6084 r7001 10 10 import org.openstreetmap.josm.gui.conflict.ConflictColors; 11 11 12 public class ComparePairListCellRenderer extends JLabel implements ListCellRenderer { 12 public class ComparePairListCellRenderer extends JLabel implements ListCellRenderer<ComparePairType> { 13 14 /** 15 * Constructs a new {@code ComparePairListCellRenderer}. 16 */ 13 17 public ComparePairListCellRenderer() { 14 18 setOpaque(true); 15 19 } 20 16 21 @Override 17 22 public Component getListCellRendererComponent( 18 JList list,19 Objectvalue,23 JList<? extends ComparePairType> list, 24 ComparePairType value, 20 25 int index, 21 26 boolean isSelected, 22 boolean cellHasFocus) 23 { 24 ComparePairType type = (ComparePairType)value; 25 setText(type.getDisplayName()); 27 boolean cellHasFocus) { 28 setText(value.getDisplayName()); 26 29 setBackground(isSelected ? ConflictColors.BGCOLOR_SELECTED.get() : ConflictColors.BGCOLOR.get()); 27 30 setForeground(ConflictColors.FGCOLOR.get()); -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellEditor.java
r6991 r7001 35 35 * {@link KeyEvent#VK_ENTER} and {@link KeyEvent#VK_TAB} trigger a {@link NavigationListener#gotoNextDecision()}. 36 36 */ 37 public class MultiValueCellEditor extends AbstractCellEditor implements TableCellEditor {37 public class MultiValueCellEditor extends AbstractCellEditor implements TableCellEditor { 38 38 39 39 /** … … 224 224 225 225 @Override 226 public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, 227 boolean cellHasFocus) { 226 public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { 228 227 renderColors(isSelected); 229 228 renderValue(value); -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictDecisionRenderer.java
r6616 r7001 14 14 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 15 15 16 public class RelationMemberConflictDecisionRenderer extends JLabel implements TableCellRenderer, ListCellRenderer {16 public class RelationMemberConflictDecisionRenderer extends JLabel implements TableCellRenderer, ListCellRenderer<RelationMemberConflictDecisionType> { 17 17 18 18 private JosmComboBox cbDecisionTypes; … … 63 63 /* --------------------------------------------------------------------------------- */ 64 64 @Override 65 public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, 65 public Component getListCellRendererComponent( 66 JList<? extends RelationMemberConflictDecisionType> list, 67 RelationMemberConflictDecisionType decision, int index, boolean isSelected, 66 68 boolean cellHasFocus) { 67 69 resetListRenderer(); … … 70 72 setForeground(UIManager.getColor("ComboBox.selectionForeground")); 71 73 } 72 RelationMemberConflictDecisionType decision = (RelationMemberConflictDecisionType)value;73 74 RelationMemberConflictDecisionType.prepareLabel(decision, this); 74 75 if (RelationMemberConflictDecisionType.UNDECIDED.equals(decision)) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java
r6643 r7001 74 74 private ChangesetInSelectionListModel inSelectionModel; 75 75 private ChangesetsInActiveDataLayerListModel inActiveDataLayerModel; 76 private JList lstInSelection;77 private JList lstInActiveDataLayer;76 private JList<Changeset> lstInSelection; 77 private JList<Changeset> lstInActiveDataLayer; 78 78 private JCheckBox cbInSelectionOnly; 79 79 private JPanel pnlList; … … 92 92 inSelectionModel = new ChangesetInSelectionListModel(selectionModel); 93 93 94 lstInSelection = new JList (inSelectionModel);94 lstInSelection = new JList<Changeset>(inSelectionModel); 95 95 lstInSelection.setSelectionModel(selectionModel); 96 96 lstInSelection.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); … … 99 99 selectionModel = new DefaultListSelectionModel(); 100 100 inActiveDataLayerModel = new ChangesetsInActiveDataLayerListModel(selectionModel); 101 lstInActiveDataLayer = new JList (inActiveDataLayerModel);101 lstInActiveDataLayer = new JList<Changeset>(inActiveDataLayerModel); 102 102 lstInActiveDataLayer.setSelectionModel(selectionModel); 103 103 lstInActiveDataLayer.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); … … 110 110 111 111 protected void registerAsListener() { 112 // let the model for changesets in the current selection listen to various 113 // events 112 // let the model for changesets in the current selection listen to various events 114 113 ChangesetCache.getInstance().addChangesetCacheListener(inSelectionModel); 115 114 MapView.addEditLayerChangeListener(inSelectionModel); … … 222 221 } 223 222 224 protected JList getCurrentChangesetList() {223 protected JList<Changeset> getCurrentChangesetList() { 225 224 if (cbInSelectionOnly.isSelected()) 226 225 return lstInSelection; … … 546 545 547 546 class ChangesetDialogPopup extends ListPopupMenu { 548 public ChangesetDialogPopup(JList ... lists) {547 public ChangesetDialogPopup(JList<?> ... lists) { 549 548 super(lists); 550 549 add(selectObjectsAction); -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r6889 r7001 81 81 private ConflictListModel model; 82 82 /** the list widget for the list of conflicts */ 83 private JList lstConflicts;83 private JList<OsmPrimitive> lstConflicts; 84 84 85 85 private final JPopupMenu popupMenu = new JPopupMenu(); … … 95 95 model = new ConflictListModel(); 96 96 97 lstConflicts = new JList (model);97 lstConflicts = new JList<OsmPrimitive>(model); 98 98 lstConflicts.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 99 99 lstConflicts.setCellRenderer(new OsmPrimitivRenderer()); … … 272 272 } 273 273 }; 274 for (O bject o : lstConflicts.getSelectedValues()) {275 if (conflicts == null || !conflicts.hasConflictForMy( (OsmPrimitive)o)) {274 for (OsmPrimitive o : lstConflicts.getSelectedValuesList()) { 275 if (conflicts == null || !conflicts.hasConflictForMy(o)) { 276 276 continue; 277 277 } 278 conflicts.getConflictForMy( (OsmPrimitive)o).getTheir().accept(conflictPainter);278 conflicts.getConflictForMy(o).getTheir().accept(conflictPainter); 279 279 } 280 280 } … … 359 359 * 360 360 */ 361 class ConflictListModel implements ListModel {361 class ConflictListModel implements ListModel<OsmPrimitive> { 362 362 363 363 private CopyOnWriteArrayList<ListDataListener> listeners; … … 392 392 393 393 @Override 394 public O bjectgetElementAt(int index) {394 public OsmPrimitive getElementAt(int index) { 395 395 if (index < 0) return null; 396 396 if (index >= getSize()) return null; … … 452 452 public void actionPerformed(ActionEvent e) { 453 453 Collection<OsmPrimitive> sel = new LinkedList<OsmPrimitive>(); 454 for (O bject o : lstConflicts.getSelectedValues()) {455 sel.add( (OsmPrimitive)o);454 for (OsmPrimitive o : lstConflicts.getSelectedValuesList()) { 455 sel.add(o); 456 456 } 457 457 DataSet ds = Main.main.getCurrentDataSet(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r6726 r7001 87 87 public class RelationListDialog extends ToggleDialog implements DataSetListener { 88 88 /** The display list. */ 89 private final JList displaylist;89 private final JList<Relation> displaylist; 90 90 /** the list model used */ 91 91 private final RelationListModel model; … … 129 129 DefaultListSelectionModel selectionModel = new DefaultListSelectionModel(); 130 130 model = new RelationListModel(selectionModel); 131 displaylist = new JList (model);131 displaylist = new JList<Relation>(model); 132 132 displaylist.setSelectionModel(selectionModel); 133 133 displaylist.setCellRenderer(new OsmPrimitivRenderer() { … … 238 238 */ 239 239 private Relation getSelected() { 240 if (model.getSize() == 1) {240 if (model.getSize() == 1) { 241 241 displaylist.setSelectedIndex(0); 242 242 } 243 return (Relation)displaylist.getSelectedValue();243 return displaylist.getSelectedValue(); 244 244 } 245 245 … … 363 363 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 364 364 updateEnabledState(); 365 }365 } 366 366 367 367 @Override … … 377 377 378 378 /** 379 * The list model for the list of relations displayed in the relation list 380 * dialog. 379 * The list model for the list of relations displayed in the relation list dialog. 381 380 * 382 381 */ 383 private class RelationListModel extends AbstractListModel {382 private class RelationListModel extends AbstractListModel<Relation> { 384 383 private final List<Relation> relations = new ArrayList<Relation>(); 385 384 private List<Relation> filteredRelations; … … 389 388 public RelationListModel(DefaultListSelectionModel selectionModel) { 390 389 this.selectionModel = selectionModel; 391 }392 393 public Relation getRelation(int idx) {394 return relations.get(idx);395 390 } 396 391 … … 522 517 523 518 @Override 524 public ObjectgetElementAt(int index) {519 public Relation getElementAt(int index) { 525 520 return getVisibleRelation(index); 526 521 } … … 675 670 if (!(prim instanceof Relation)) 676 671 return; 677 // trigger a sort of the relation list because the display name may 678 // have changed 672 // trigger a sort of the relation list because the display name may have changed 679 673 // 680 674 List<Relation> sel = model.getSelectedRelations(); … … 690 684 691 685 @Override 692 public void otherDatasetChange(AbstractDatasetChangedEvent event) {/* ignore */} 686 public void otherDatasetChange(AbstractDatasetChangedEvent event) { 687 /* ignore */ 688 } 693 689 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r6889 r7001 81 81 */ 82 82 public class SelectionListDialog extends ToggleDialog { 83 private JList lstPrimitives;83 private JList<OsmPrimitive> lstPrimitives; 84 84 private DefaultListSelectionModel selectionModel = new DefaultListSelectionModel(); 85 85 private SelectionListModel model = new SelectionListModel(selectionModel); … … 101 101 */ 102 102 protected void buildContentPanel() { 103 lstPrimitives = new JList (model);103 lstPrimitives = new JList<OsmPrimitive>(model); 104 104 lstPrimitives.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 105 105 lstPrimitives.setSelectionModel(selectionModel); … … 407 407 * 408 408 */ 409 private static class SelectionListModel extends AbstractListModel implements EditLayerChangeListener, SelectionChangedListener, DataSetListener{409 private static class SelectionListModel extends AbstractListModel<OsmPrimitive> implements EditLayerChangeListener, SelectionChangedListener, DataSetListener{ 410 410 411 411 private static final int SELECTION_HISTORY_SIZE = 10; … … 481 481 482 482 @Override 483 public O bjectgetElementAt(int index) {483 public OsmPrimitive getElementAt(int index) { 484 484 return selection.get(index); 485 485 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetListCellRenderer.java
r6822 r7001 14 14 import org.openstreetmap.josm.tools.ImageProvider; 15 15 16 public class ChangesetListCellRenderer extends JLabel implements ListCellRenderer {16 public class ChangesetListCellRenderer extends JLabel implements ListCellRenderer<Changeset> { 17 17 18 /** 19 * Constructs a new {@code ChangesetListCellRenderer}. 20 */ 18 21 public ChangesetListCellRenderer() { 19 22 setOpaque(true); … … 48 51 49 52 @Override 50 public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, 51 boolean cellHasFocus) { 52 Changeset cs = (Changeset)value; 53 public Component getListCellRendererComponent(JList<? extends Changeset> list, Changeset cs, int index, boolean isSelected, boolean cellHasFocus) { 53 54 renderColors(isSelected); 54 55 renderLabel(cs); -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetListModel.java
r6084 r7001 21 21 import org.openstreetmap.josm.data.osm.Storage; 22 22 23 public class ChangesetListModel extends DefaultListModel implements ChangesetCacheListener{23 public class ChangesetListModel extends DefaultListModel<Changeset> implements ChangesetCacheListener { 24 24 private final List<Changeset> data = new ArrayList<Changeset>(); 25 25 private final Storage<Changeset> shownChangesets = new Storage<Changeset>(true); … … 131 131 132 132 @Override 133 public Object getElementAt(int idx) {133 public Changeset getElementAt(int idx) { 134 134 return data.get(idx); 135 135 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ReferringRelationsBrowser.java
r6361 r7001 30 30 31 31 /** 32 * This is browser for a list of relations which refer to another relations 33 * 34 * 32 * This is browser for a list of relations which refer to another relations. 33 * @since 1806 35 34 */ 36 35 public class ReferringRelationsBrowser extends JPanel { 37 36 38 37 /** the list of relations */ 39 private JList referrers;38 private JList<Relation> referrers; 40 39 private ReferringRelationsBrowserModel model; 41 40 private OsmDataLayer layer; … … 48 47 protected void build() { 49 48 setLayout(new BorderLayout()); 50 referrers = new JList (model);49 referrers = new JList<Relation>(model); 51 50 referrers.setCellRenderer(new OsmPrimitivRenderer()); 52 51 add(new JScrollPane(referrers), BorderLayout.CENTER); … … 160 159 int idx = referrers.getSelectedIndex(); 161 160 if (idx < 0) return; 162 Relation r = model.get (idx);161 Relation r = model.getElementAt(idx); 163 162 if (r == null) return; 164 163 RelationEditor editor = RelationEditor.getEditor(getLayer(), r, null); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ReferringRelationsBrowserModel.java
r6316 r7001 11 11 import org.openstreetmap.josm.data.osm.RelationMember; 12 12 13 public class ReferringRelationsBrowserModel extends AbstractListModel {13 public class ReferringRelationsBrowserModel extends AbstractListModel<Relation> { 14 14 15 15 /** the relation */ … … 17 17 private List<Relation> referrers; 18 18 19 /** 20 * Constructs a new {@code ReferringRelationsBrowserModel}. 21 */ 19 22 public ReferringRelationsBrowserModel() { 20 23 relation = null; 21 24 referrers = new ArrayList<Relation>(); 22 25 } 26 23 27 public ReferringRelationsBrowserModel(Relation relation) { 24 28 this(); … … 38 42 39 43 @Override 40 public ObjectgetElementAt(int index) {44 public Relation getElementAt(int index) { 41 45 return referrers.get(index); 42 46 } … … 96 100 return relation; 97 101 } 98 99 public Relation get(int index) {100 return referrers.get(index);101 }102 102 } -
trunk/src/org/openstreetmap/josm/gui/download/BookmarkList.java
r6822 r7001 36 36 * @since 6340 37 37 */ 38 public class BookmarkList extends JList {38 public class BookmarkList extends JList<BookmarkList.Bookmark> { 39 39 40 40 /** … … 153 153 */ 154 154 public BookmarkList() { 155 setModel(new DefaultListModel ());155 setModel(new DefaultListModel<Bookmark>()); 156 156 load(); 157 157 setVisibleRowCount(7); … … 163 163 */ 164 164 public final void load() { 165 DefaultListModel model = (DefaultListModel)getModel();165 DefaultListModel<Bookmark> model = (DefaultListModel<Bookmark>)getModel(); 166 166 model.removeAllElements(); 167 167 Collection<Collection<String>> args = Main.pref.getArray("bookmarks", null); … … 241 241 public final void save() { 242 242 LinkedList<Collection<String>> coll = new LinkedList<Collection<String>>(); 243 for (Object o : ((DefaultListModel )getModel()).toArray()) {243 for (Object o : ((DefaultListModel<Bookmark>)getModel()).toArray()) { 244 244 String[] array = new String[5]; 245 Bookmark b = (Bookmark) o;245 Bookmark b = (Bookmark) o; 246 246 array[0] = b.getName(); 247 247 Bounds area = b.getArea(); … … 255 255 } 256 256 257 static class BookmarkCellRenderer extends JLabel implements ListCellRenderer {257 static class BookmarkCellRenderer extends JLabel implements ListCellRenderer<BookmarkList.Bookmark> { 258 258 259 259 private ImageIcon icon; … … 287 287 288 288 } 289 @Override 290 public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, 291 boolean cellHasFocus) { 292 293 Bookmark b = (Bookmark) value; 289 290 @Override 291 public Component getListCellRendererComponent(JList<? extends Bookmark> list, Bookmark value, int index, boolean isSelected, boolean cellHasFocus) { 294 292 renderColor(isSelected); 295 setText( b.getName());296 setToolTipText(buildToolTipText( b));293 setText(value.getName()); 294 setToolTipText(buildToolTipText(value)); 297 295 return this; 298 296 } -
trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java
r6890 r7001 10 10 import java.awt.event.MouseAdapter; 11 11 import java.awt.event.MouseEvent; 12 import java.util.List; 12 13 13 14 import javax.swing.AbstractAction; … … 216 217 @Override 217 218 public void actionPerformed(ActionEvent e) { 218 Object[] sels = bookmarks.getSelectedValues();219 if (sels == null || sels. length == 0)219 List<Bookmark> sels = bookmarks.getSelectedValuesList(); 220 if (sels == null || sels.isEmpty()) 220 221 return; 221 222 for (Object sel: sels) { … … 243 244 @Override 244 245 public void actionPerformed(ActionEvent e) { 245 Object[] sels = bookmarks.getSelectedValues();246 if (sels == null || sels. length!= 1)247 return; 248 Bookmark b = (Bookmark)sels[0];246 List<Bookmark> sels = bookmarks.getSelectedValuesList(); 247 if (sels == null || sels.size() != 1) 248 return; 249 Bookmark b = sels.get(0); 249 250 Object value = 250 251 JOptionPane.showInputDialog( -
trunk/src/org/openstreetmap/josm/gui/io/ChangesetCellRenderer.java
r6822 r7001 21 21 * 22 22 */ 23 public class ChangesetCellRenderer extends JLabel implements ListCellRenderer { 24 private ImageIcon icon ; 23 public class ChangesetCellRenderer extends JLabel implements ListCellRenderer<Changeset> { 24 private ImageIcon icon; 25 26 /** 27 * Constructs a new {@code ChangesetCellRenderer}. 28 */ 25 29 public ChangesetCellRenderer() { 26 30 icon = ImageProvider.get("data", "changeset"); … … 42 46 43 47 @Override 44 public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, 45 boolean cellHasFocus) { 46 Changeset cs = (Changeset)value; 48 public Component getListCellRendererComponent(JList<? extends Changeset> list, Changeset cs, int index, boolean isSelected, boolean cellHasFocus) { 47 49 if (isSelected) { 48 50 setForeground(UIManager.getColor("List.selectionForeground")); -
trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetDialog.java
r6316 r7001 38 38 /** 39 39 * This dialog lets the user select changesets from a list of changesets. 40 * 40 * @since 2115 41 41 */ 42 42 public class CloseChangesetDialog extends JDialog { 43 43 44 44 /** the list */ 45 private JList lstOpenChangesets;45 private JList<Changeset> lstOpenChangesets; 46 46 /** true if the user canceled the dialog */ 47 47 private boolean canceled; … … 130 130 131 131 protected void refreshEnabledState() { 132 setEnabled(lstOpenChangesets.getSelectedValues() != null && lstOpenChangesets.getSelectedValues().length > 0); 132 List list = lstOpenChangesets.getSelectedValuesList(); 133 setEnabled(list != null && !list.isEmpty()); 133 134 } 134 135 … … 214 215 */ 215 216 public Collection<Changeset> getSelectedChangesets() { 216 Object [] sel = lstOpenChangesets.getSelectedValues(); 217 List<Changeset> ret = new ArrayList<Changeset>(sel.length); 218 for (Object o: sel) { 219 ret.add((Changeset)o); 220 } 221 return ret; 217 return lstOpenChangesets.getSelectedValuesList(); 222 218 } 223 219 } -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java
r6965 r7001 173 173 add(lblMessage = new JLabel(), gc); 174 174 lblMessage.setHorizontalAlignment(JLabel.LEFT); 175 lstLayers = new JList ();175 lstLayers = new JList<SaveLayerInfo>(); 176 176 lstLayers.setCellRenderer( 177 177 new DefaultListCellRenderer() { -
trunk/src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java
r6316 r7001 172 172 } 173 173 174 static class OsmPrimitiveList extends JList {174 static class OsmPrimitiveList extends JList<OsmPrimitive> { 175 175 protected void init() { 176 176 setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); … … 193 193 } 194 194 195 static class OsmPrimitiveListModel extends AbstractListModel {195 static class OsmPrimitiveListModel extends AbstractListModel<OsmPrimitive> { 196 196 private List<OsmPrimitive> data; 197 197 … … 231 231 232 232 @Override 233 public O bjectgetElementAt(int index) {233 public OsmPrimitive getElementAt(int index) { 234 234 if (data == null) 235 235 return null; -
trunk/src/org/openstreetmap/josm/gui/io/UploadedObjectsSummaryPanel.java
r6889 r7001 140 140 * 141 141 */ 142 static class PrimitiveList extends JList {142 static class PrimitiveList extends JList<OsmPrimitive> { 143 143 public PrimitiveList() { 144 144 super(new PrimitiveListModel()); … … 154 154 * 155 155 */ 156 static class PrimitiveListModel extends AbstractListModel {156 static class PrimitiveListModel extends AbstractListModel<OsmPrimitive> { 157 157 private List<OsmPrimitive> primitives; 158 158 … … 175 175 176 176 @Override 177 public O bjectgetElementAt(int index) {177 public OsmPrimitive getElementAt(int index) { 178 178 if (primitives == null) return null; 179 179 return primitives.get(index); -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r6883 r7001 229 229 JosmComboBox cbTimezones; 230 230 ImageDisplay imgDisp; 231 JList imgList;231 JList<String> imgList; 232 232 233 233 @Override … … 331 331 panelLst.setLayout(new BorderLayout()); 332 332 333 imgList = new JList (new AbstractListModel() {333 imgList = new JList<String>(new AbstractListModel<String>() { 334 334 @Override 335 public ObjectgetElementAt(int i) {335 public String getElementAt(int i) { 336 336 return yLayer.data.get(i).getFile().getName(); 337 337 } -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadAlongPanel.java
r6085 r7001 41 41 private static final Integer[] area = { 20, 10, 5, 1 }; 42 42 43 private final JList buffer;44 private final JList maxRect;45 private final JList downloadNear;43 private final JList<String> buffer; 44 private final JList<String> maxRect; 45 private final JList<String> downloadNear; 46 46 47 47 /** … … 74 74 s[i] = tr("{0} meters", dist[i]); 75 75 } 76 buffer = new JList (s);76 buffer = new JList<String>(s); 77 77 78 78 double distanceValue = Main.pref.getDouble(prefDist, dist[0]); … … 93 93 s[i] = tr("{0} sq km", area[i]); 94 94 } 95 maxRect = new JList (s);95 maxRect = new JList<String>(s); 96 96 97 97 double areaValue = Main.pref.getDouble(prefArea, area[0]); … … 109 109 if (prefNear != null) { 110 110 add(new JLabel(tr("Download near:")), GBC.eol()); 111 downloadNear = new JList (new String[]{tr("track only"), tr("waypoints only"), tr("track and waypoints")});111 downloadNear = new JList<String>(new String[]{tr("track only"), tr("waypoints only"), tr("track and waypoints")}); 112 112 downloadNear.setSelectedIndex(Main.pref.getInteger(prefNear, 0)); 113 113 add(downloadNear, GBC.eol()); -
trunk/src/org/openstreetmap/josm/gui/oauth/AuthorizationProcedureComboBox.java
r6883 r7001 24 24 } 25 25 26 private static class AuthorisationProcedureCellRenderer extends JLabel implements ListCellRenderer {26 private static class AuthorisationProcedureCellRenderer extends JLabel implements ListCellRenderer<AuthorizationProcedure> { 27 27 public AuthorisationProcedureCellRenderer() { 28 28 setOpaque(true); … … 80 80 81 81 @Override 82 public Component getListCellRendererComponent(JList list, Object value, int idx, boolean isSelected, boolean hasFocus) {83 AuthorizationProcedure procedure = (AuthorizationProcedure)value;82 public Component getListCellRendererComponent(JList<? extends AuthorizationProcedure> list, AuthorizationProcedure procedure, 83 int idx, boolean isSelected, boolean hasFocus) { 84 84 renderColors(isSelected); 85 85 renderText(procedure); -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r6890 r7001 103 103 protected final JTable tblActiveSources; 104 104 protected final ActiveSourcesModel activeSourcesModel; 105 protected final JList lstAvailableSources;105 protected final JList<ExtendedSourceEntry> lstAvailableSources; 106 106 protected final AvailableSourcesListModel availableSourcesModel; 107 107 protected final String availableSourcesUrl; … … 127 127 DefaultListSelectionModel selectionModel = new DefaultListSelectionModel(); 128 128 this.availableSourcesModel = new AvailableSourcesListModel(selectionModel); 129 this.lstAvailableSources = new JList (availableSourcesModel);129 this.lstAvailableSources = new JList<ExtendedSourceEntry>(availableSourcesModel); 130 130 this.lstAvailableSources.setSelectionModel(selectionModel); 131 131 this.lstAvailableSources.setCellRenderer(new SourceEntryListCellRenderer()); … … 441 441 } 442 442 443 protected static class AvailableSourcesListModel extends DefaultListModel {443 protected static class AvailableSourcesListModel extends DefaultListModel<ExtendedSourceEntry> { 444 444 private List<ExtendedSourceEntry> data; 445 445 private DefaultListSelectionModel selectionModel; … … 459 459 460 460 @Override 461 public ObjectgetElementAt(int index) {461 public ExtendedSourceEntry getElementAt(int index) { 462 462 return data.get(index); 463 463 } … … 1210 1210 } 1211 1211 1212 static class SourceEntryListCellRenderer extends JLabel implements ListCellRenderer {1213 @Override 1214 public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,1215 boolean cellHasFocus) {1212 static class SourceEntryListCellRenderer extends JLabel implements ListCellRenderer<ExtendedSourceEntry> { 1213 @Override 1214 public Component getListCellRendererComponent(JList<? extends ExtendedSourceEntry> list, ExtendedSourceEntry value, 1215 int index, boolean isSelected, boolean cellHasFocus) { 1216 1216 String s = value.toString(); 1217 1217 setText(s); … … 1227 1227 setFont(getFont().deriveFont(Font.PLAIN)); 1228 1228 setOpaque(true); 1229 setToolTipText( ((ExtendedSourceEntry) value).getTooltip());1229 setToolTipText(value.getTooltip()); 1230 1230 return this; 1231 1231 } -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r6990 r7001 381 381 } 382 382 383 384 383 public void setCurrentAction(ActionDefinition currentAction) { 385 384 this.currentAction = currentAction; 386 385 fireTableDataChanged(); 387 386 } 388 389 387 } 390 388 … … 508 506 } else if ("up".equals(e.getActionCommand())) { 509 507 int i = selectedList.getSelectedIndex(); 510 Objecto = selected.get(i);508 ActionDefinition o = selected.get(i); 511 509 if (i != 0) { 512 510 selected.remove(i); … … 516 514 } else if ("down".equals(e.getActionCommand())) { 517 515 int i = selectedList.getSelectedIndex(); 518 Objecto = selected.get(i);516 ActionDefinition o = selected.get(i); 519 517 if (i != selected.size()-1) { 520 518 selected.remove(i); … … 554 552 private final Move moveAction = new Move(); 555 553 556 private final DefaultListModel selected = new DefaultListModel();557 private final JList selectedList = new JList(selected);554 private final DefaultListModel<ActionDefinition> selected = new DefaultListModel<ActionDefinition>(); 555 private final JList<ActionDefinition> selectedList = new JList<ActionDefinition>(selected); 558 556 559 557 private final DefaultTreeModel actionsTreeModel; … … 658 656 protected Transferable createTransferable(JComponent c) { 659 657 List<ActionDefinition> actions = new ArrayList<ActionDefinition>(); 660 for ( Object o: ((JList)c).getSelectedValues()) {661 actions.add( (ActionDefinition)o);658 for (ActionDefinition o: ((JList<ActionDefinition>)c).getSelectedValuesList()) { 659 actions.add(o); 662 660 } 663 661 return new ActionTransferable(actions); … … 688 686 try { 689 687 int dropIndex = selectedList.locationToIndex(selectedList.getMousePosition(true)); 690 List< ?> draggedData = (List<?>) t.getTransferData(ACTION_FLAVOR);688 List<ActionDefinition> draggedData = (List<ActionDefinition>) t.getTransferData(ACTION_FLAVOR); 691 689 692 690 Object leadItem = dropIndex >= 0 ? selected.elementAt(dropIndex) : null; 693 691 int dataLength = draggedData.size(); 694 695 692 696 693 if (leadItem != null) { … … 698 695 if (leadItem.equals(o)) 699 696 return false; 700 701 697 } 702 698 } … … 883 879 } 884 880 881 /** 882 * Constructs a new {@code ToolbarPreferences}. 883 */ 885 884 public ToolbarPreferences() { 886 885 control.setFloatable(false); … … 931 930 } 932 931 933 public Action getAction(String s) 934 { 932 public Action getAction(String s) { 935 933 Action e = actions.get(s); 936 934 if(e == null) { -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/ListListEditor.java
r6890 r7001 42 42 PrefEntry entry; 43 43 44 JList entryList;44 JList<String> entryList; 45 45 Integer entryIdx; 46 46 JTable table; … … 82 82 83 83 entryModel = new EntryListModel(); 84 entryList = new JList (entryModel);84 entryList = new JList<String>(entryModel); 85 85 entryList.getSelectionModel().addListSelectionListener(new EntryListener()); 86 86 JScrollPane scroll = new JScrollPane(entryList); … … 115 115 } 116 116 117 class EntryListModel extends AbstractListModel {118 @Override 119 public ObjectgetElementAt(int index) {117 class EntryListModel extends AbstractListModel<String> { 118 @Override 119 public String getElementAt(int index) { 120 120 return (index+1) + ": " + data.get(index).toString(); 121 121 } -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/MapListEditor.java
r6890 r7001 45 45 PrefEntry entry; 46 46 47 JList entryList;47 JList<String> entryList; 48 48 JTable table; 49 49 MapTableModel tableModel; … … 100 100 101 101 entryModel = new EntryListModel(); 102 entryList = new JList (entryModel);102 entryList = new JList<String>(entryModel); 103 103 entryList.getSelectionModel().addListSelectionListener(new EntryListener()); 104 104 JScrollPane scroll = new JScrollPane(entryList); … … 133 133 } 134 134 135 class EntryListModel extends AbstractListModel {136 @Override 137 public ObjectgetElementAt(int index) {135 class EntryListModel extends AbstractListModel<String> { 136 @Override 137 public String getElementAt(int index) { 138 138 return tr("Entry {0}", index+1); 139 139 } … … 213 213 214 214 class MapTableModel extends AbstractTableModel { 215 @SuppressWarnings("unchecked")216 215 private List<List<String>> data() { 217 216 if (entryIdx == null) return Collections.emptyList(); -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java
r6797 r7001 491 491 private static class PluginConfigurationSitesPanel extends JPanel { 492 492 493 private DefaultListModel model;493 private DefaultListModel<String> model; 494 494 495 495 protected final void build() { 496 496 setLayout(new GridBagLayout()); 497 497 add(new JLabel(tr("Add JOSM Plugin description URL.")), GBC.eol()); 498 model = new DefaultListModel ();498 model = new DefaultListModel<String>(); 499 499 for (String s : Main.pref.getPluginSites()) { 500 500 model.addElement(s); 501 501 } 502 final JList list = new JList(model);502 final JList<String> list = new JList<String>(model); 503 503 add(new JScrollPane(list), GBC.std().fill()); 504 504 JPanel buttons = new JPanel(new GridBagLayout()); -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java
r6890 r7001 47 47 public JosmTextField filter; 48 48 private ProjectionCodeListModel model; 49 public JList selectionList;49 public JList<String> selectionList; 50 50 List<String> data; 51 51 List<String> filteredData; … … 91 91 * List model for the filtered view on the list of all codes. 92 92 */ 93 private class ProjectionCodeListModel extends AbstractListModel {93 private class ProjectionCodeListModel extends AbstractListModel<String> { 94 94 @Override 95 95 public int getSize() { … … 98 98 99 99 @Override 100 public ObjectgetElementAt(int index) {100 public String getElementAt(int index) { 101 101 if (index >= 0 && index < filteredData.size()) 102 102 return filteredData.get(index); -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java
r6883 r7001 1110 1110 } 1111 1111 1112 private static final ListCellRenderer RENDERER = new ListCellRenderer() {1112 private static final ListCellRenderer<PresetListEntry> RENDERER = new ListCellRenderer<PresetListEntry>() { 1113 1113 1114 1114 JLabel lbl = new JLabel(); … … 1116 1116 @Override 1117 1117 public Component getListCellRendererComponent( 1118 JList list,1119 Object value,1118 JList<? extends PresetListEntry> list, 1119 PresetListEntry item, 1120 1120 int index, 1121 1121 boolean isSelected, 1122 1122 boolean cellHasFocus) { 1123 PresetListEntry item = (PresetListEntry) value;1124 1123 1125 1124 // Only return cached size, item is not shown … … 1163 1162 }; 1164 1163 1165 1166 protected ListCellRenderer getListCellRenderer() { 1164 protected ListCellRenderer<PresetListEntry> getListCellRenderer() { 1167 1165 return RENDERER; 1168 1166 } … … 1180 1178 public String length; 1181 1179 1180 /** 1181 * Constructs a new {@code Combo}. 1182 */ 1182 1183 public Combo() { 1183 1184 delimiter = ","; -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetSelector.java
r6883 r7001 67 67 private static final BooleanProperty SEARCH_IN_TAGS = new BooleanProperty("taggingpreset.dialog.search-in-tags", true); 68 68 private static final BooleanProperty ONLY_APPLICABLE = new BooleanProperty("taggingpreset.dialog.only-applicable-to-selection", true); 69 70 69 71 70 private JosmTextField edSearchText; 72 private JList lsResult;71 private JList<TaggingPreset> lsResult; 73 72 private JCheckBox ckOnlyApplicable; 74 73 private JCheckBox ckSearchInTags; … … 93 92 } 94 93 95 private static class ResultListModel extends AbstractListModel {94 private static class ResultListModel extends AbstractListModel<TaggingPreset> { 96 95 97 96 private List<PresetClassification> presets = new ArrayList<PresetClassification>(); … … 107 106 108 107 @Override 109 public Object getElementAt(int index) {108 public TaggingPreset getElementAt(int index) { 110 109 return presets.get(index).preset; 111 110 } … … 115 114 return presets.size(); 116 115 } 117 118 116 } 119 117 … … 247 245 add(edSearchText, BorderLayout.NORTH); 248 246 249 lsResult = new JList ();247 lsResult = new JList<TaggingPreset>(); 250 248 lsResult.setModel(lsResultModel); 251 249 lsResult.setCellRenderer(new ResultListCellRenderer()); -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java
r6437 r7001 301 301 * renders an AutoCompletionListItem by showing only the string value part 302 302 */ 303 public static class AutoCompleteListCellRenderer extends JLabel implements ListCellRenderer { 304 303 public static class AutoCompleteListCellRenderer extends JLabel implements ListCellRenderer<AutoCompletionListItem> { 304 305 /** 306 * Constructs a new {@code AutoCompleteListCellRenderer}. 307 */ 305 308 public AutoCompleteListCellRenderer() { 306 309 setOpaque(true); … … 309 312 @Override 310 313 public Component getListCellRendererComponent( 311 JList list,312 Object value,314 JList<? extends AutoCompletionListItem> list, 315 AutoCompletionListItem item, 313 316 int index, 314 317 boolean isSelected, … … 323 326 } 324 327 325 AutoCompletionListItem item = (AutoCompletionListItem) value;326 328 setText(item.getValue()); 327 329 return this; -
trunk/src/org/openstreetmap/josm/gui/widgets/EditableList.java
r6603 r7001 27 27 28 28 public final String title; 29 public final JList sourcesList = new JList(new DefaultListModel());29 public final JList<String> sourcesList = new JList<String>(new DefaultListModel<String>()); 30 30 public final JButton addSrcButton = new JButton(tr("Add")); 31 31 public final JButton editSrcButton = new JButton(tr("Edit")); … … 54 54 JOptionPane.QUESTION_MESSAGE); 55 55 if (source != null) { 56 ((DefaultListModel ) sourcesList.getModel()).addElement(source);56 ((DefaultListModel<String>) sourcesList.getModel()).addElement(source); 57 57 } 58 58 sourcesList.clearSelection(); … … 72 72 String source = JOptionPane.showInputDialog(Main.parent, title, title, JOptionPane.QUESTION_MESSAGE); 73 73 if (source != null) { 74 ((DefaultListModel ) sourcesList.getModel()).addElement(source);74 ((DefaultListModel<String>) sourcesList.getModel()).addElement(source); 75 75 } 76 76 } else { … … 89 89 sourcesList.getSelectedValue()); 90 90 if (source != null) { 91 ((DefaultListModel ) sourcesList.getModel()).setElementAt(source, row);91 ((DefaultListModel<String>) sourcesList.getModel()).setElementAt(source, row); 92 92 } 93 93 } … … 102 102 JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete."), tr("Information"), JOptionPane.QUESTION_MESSAGE); 103 103 } else { 104 ((DefaultListModel ) sourcesList.getModel()).remove(sourcesList.getSelectedIndex());104 ((DefaultListModel<String>) sourcesList.getModel()).remove(sourcesList.getSelectedIndex()); 105 105 } 106 106 } … … 126 126 public void setItems(final Iterable<String> items) { 127 127 for (String source : items) { 128 ((DefaultListModel ) sourcesList.getModel()).addElement(source);128 ((DefaultListModel<String>) sourcesList.getModel()).addElement(source); 129 129 } 130 130 } … … 133 133 final List<String> items = new ArrayList<String>(sourcesList.getModel().getSize()); 134 134 for (int i = 0; i < sourcesList.getModel().getSize(); ++i) { 135 items.add( (String)sourcesList.getModel().getElementAt(i));135 items.add(sourcesList.getModel().getElementAt(i)); 136 136 } 137 137 return items; -
trunk/src/org/openstreetmap/josm/gui/widgets/ListPopupMenu.java
r6070 r7001 14 14 public class ListPopupMenu extends JPopupMenu { 15 15 16 private JList [] lists;16 private JList<?>[] lists; 17 17 18 public ListPopupMenu(JList ... lists) {18 public ListPopupMenu(JList<?> ... lists) { 19 19 this.lists = lists; 20 20 } 21 21 22 /* (non-Javadoc)23 * @see javax.swing.JPopupMenu#add(javax.swing.Action)24 */25 22 @Override 26 23 public JMenuItem add(Action a) { 27 24 if (lists != null && a instanceof ListSelectionListener) { 28 for (JList list : lists) {25 for (JList<?> list : lists) { 29 26 list.addListSelectionListener((ListSelectionListener) a); 30 27 } -
trunk/src/org/openstreetmap/josm/gui/widgets/PopupMenuLauncher.java
r6070 r7001 78 78 protected boolean checkSelection(Component component, Point p) { 79 79 if (component instanceof JList) { 80 return checkListSelection((JList ) component, p) > -1;80 return checkListSelection((JList<?>) component, p) > -1; 81 81 } else if (component instanceof JTable) { 82 82 return checkTableSelection((JTable) component, p) > -1; … … 107 107 } 108 108 109 protected int checkListSelection(JList list, Point p) {109 protected int checkListSelection(JList<?> list, Point p) { 110 110 int idx = list.locationToIndex(p); 111 111 if (idx >= 0 && idx < list.getModel().getSize() && list.getSelectedIndices().length < 2 && !list.isSelectedIndex(idx)) { -
trunk/src/org/openstreetmap/josm/io/GpxExporter.java
r6920 r7001 290 290 "GNU Lesser Public License (LGPL)", 291 291 "BSD License (MIT/X11)"}; 292 JList l = new JList(licenses);292 JList<String> l = new JList<String>(licenses); 293 293 l.setVisibleRowCount(licenses.length); 294 294 l.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); -
trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java
r6977 r7001 47 47 // We'll just ignore this for now. The user will still be able to close JOSM by closing all its windows. 48 48 Main.warn("Failed to register with OSX: " + ex); 49 }50 // Invite users to install Java 7 if they are still with Java 6 and using a compatible OS X version (>= 10.7.3)51 String java = System.getProperty("java.version");52 String os = System.getProperty("os.version");53 if (java != null && java.startsWith("1.6") && os != null && os.matches("^10\\.[789].*")) {54 askUpdateJava(java);55 49 } 56 50 } -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r6997 r7001 16 16 import java.net.URISyntaxException; 17 17 import java.util.Arrays; 18 import java.util.Calendar;19 18 20 19 import javax.swing.JOptionPane; … … 42 41 @Override 43 42 public void startupHook() { 44 if (isDebianOrUbuntu()) {45 // Invite users to install Java 7 if they are still with Java 6 and using a compatible distrib (Debian >= 7 or Ubuntu >= 12.04)46 String java = System.getProperty("java.version");47 String os = getOSDescription();48 if (java != null && java.startsWith("1.6") && os != null && (49 os.startsWith("Linux Debian GNU/Linux 7") || os.startsWith("Linux Mint") || os.matches("^Linux Ubuntu 1[234].*"))) {50 String url;51 // apturl does not exist on Debian (see #8465)52 if (os.startsWith("Linux Debian")) {53 url = "https://packages.debian.org/stable/openjdk-7-jre";54 } else if (getPackageDetails("apturl") != null) {55 url = "apt://openjdk-7-jre";56 } else if (os.startsWith("Linux Mint")) {57 url = "http://community.linuxmint.com/software/view/openjdk-7-jre";58 } else {59 url = "http://packages.ubuntu.com/trusty/openjdk-7-jre";60 }61 askUpdateJava(java, url);62 }63 }64 43 } 65 44 … … 360 339 } 361 340 341 // Method kept because strings have already been translated. To enable for Java 8 migration somewhere in 2016 362 342 protected void askUpdateJava(final String version, final String url) { 363 // Expiration date of this feature around the expected release of our first Java 7 tested version364 Calendar today = Calendar.getInstance();365 Calendar expiration = Calendar.getInstance();366 expiration.set(2014, Calendar.MAY, 25);367 if (!today.before(expiration)) {368 return;369 }370 343 GuiHelper.runInEDTAndWait(new Runnable() { 371 344 @Override … … 376 349 new String[]{tr("Update Java"), tr("Cancel")}); 377 350 // Check if the dialog has not already been permanently hidden by user 378 if (!ed.toggleEnable("askUpdateJava 7").toggleCheckState()) {351 if (!ed.toggleEnable("askUpdateJava8").toggleCheckState()) { 379 352 ed.setButtonIcons(new String[]{"java.png", "cancel.png"}).setCancelButton(2); 380 353 ed.setMinimumSize(new Dimension(480, 300)); … … 383 356 if ("Sun Microsystems Inc.".equals(System.getProperty("java.vendor")) && !isOpenJDK()) { 384 357 content += "<b>"+tr("This version is no longer supported by {0} since {1} and is not recommended for use.", 385 "Oracle", tr(" February 2013"))+"</b><br><br>";358 "Oracle", tr("April 2015"))+"</b><br><br>"; 386 359 } 387 content += "<b>"+tr("JOSM will soon stop working with this version; we highly recommend you to update to Java {0}.", " 7")+"</b><br><br>"+360 content += "<b>"+tr("JOSM will soon stop working with this version; we highly recommend you to update to Java {0}.", "8")+"</b><br><br>"+ 388 361 tr("Would you like to update now ?"); 389 362 ed.setContent(content); -
trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
r6943 r7001 36 36 */ 37 37 public class PlatformHookWindows extends PlatformHookUnixoid implements PlatformHook { 38 39 @Override40 public void startupHook() {41 // Invite users to install Java 7 if they are still with Java 642 String version = System.getProperty("java.version");43 if (version != null && version.startsWith("1.6")) {44 askUpdateJava(version);45 }46 }47 38 48 39 @Override
Note:
See TracChangeset
for help on using the changeset viewer.