Changeset 7001 in josm for trunk/src


Ignore:
Timestamp:
2014-04-26T03:53:35+02:00 (11 years ago)
Author:
Don-vip
Message:

see #8465 - switch core to Java 7

Location:
trunk/src/org/openstreetmap/josm
Files:
43 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/Main.java

    r6992 r7001  
    11111111
    11121112    /**
    1113      * Checks that JOSM is at least running with Java 6.
    1114      * @since 3815
    1115      */
    1116     public static void checkJava6() {
     1113     * Checks that JOSM is at least running with Java 7.
     1114     * @since 7001
     1115     */
     1116    public static void checkJavaVersion() {
    11171117        String version = System.getProperty("java.version");
    11181118        if (version != null) {
    1119             if (version.matches("^(1\\.)?[6789].*"))
     1119            if (version.matches("^(1\\.)?[789].*"))
    11201120                return;
    1121             if (version.matches("^(1\\.)?[5].*")) {
     1121            if (version.matches("^(1\\.)?[56].*")) {
    11221122                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>"+
    11251125                                "You can <ul><li>update your Java (JRE) or</li>"+
    1126                                 "<li>use an earlier (Java 5 compatible) 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>");
    11281128                JTextArea link = new JTextArea(HelpUtil.getWikiBaseHelpUrl()+"/Help/SystemRequirements");
    11291129                link.setEditable(false);
  • trunk/src/org/openstreetmap/josm/actions/AbstractMergeAction.java

    r6889 r7001  
    3131
    3232        @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) {
    3534            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);
    3836            Icon icon = layer.getIcon();
    3937            label.setIcon(icon);
  • trunk/src/org/openstreetmap/josm/actions/PurgeAction.java

    r6336 r7001  
    5757public class PurgeAction extends JosmAction {
    5858
     59    /**
     60     * Constructs a new {@code PurgeAction}.
     61     */
    5962    public PurgeAction() {
    6063        /* translator note: other expressions for "purge" might be "forget", "clean", "obliterate", "prune" */
     
    245248                }
    246249            });
    247             JList list = new JList(toPurgeAdditionally.toArray(new OsmPrimitive[toPurgeAdditionally.size()]));
     250            JList<OsmPrimitive> list = new JList<OsmPrimitive>(toPurgeAdditionally.toArray(new OsmPrimitive[toPurgeAdditionally.size()]));
    248251            /* force selection to be active for all entries */
    249252            list.setCellRenderer(new OsmPrimitivRenderer() {
    250253                @Override
    251                 public Component getListCellRendererComponent(JList list,
    252                         Object value,
     254                public Component getListCellRendererComponent(JList<? extends OsmPrimitive> list,
     255                        OsmPrimitive value,
    253256                        int index,
    254257                        boolean isSelected,
  • trunk/src/org/openstreetmap/josm/gui/MainApplet.java

    r6889 r7001  
    9191    @Override public void start() {
    9292        I18n.init();
    93         Main.checkJava6();
     93        Main.checkJavaVersion();
    9494
    9595        String url = getParameter("load_url");
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r6995 r7001  
    267267    public static void main(final String[] argArray) {
    268268        I18n.init();
    269         Main.checkJava6();
     269        Main.checkJavaVersion();
    270270
    271271        // construct argument table
  • trunk/src/org/openstreetmap/josm/gui/OsmPrimitivRenderer.java

    r6830 r7001  
    2626 * @author Frederik Ramm
    2727 */
    28 public class OsmPrimitivRenderer implements ListCellRenderer, TableCellRenderer {
     28public class OsmPrimitivRenderer implements ListCellRenderer<OsmPrimitive>, TableCellRenderer {
    2929    private DefaultNameFormatter formatter = DefaultNameFormatter.getInstance();
    3030
     
    4343     */
    4444    @Override
    45     public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
     45    public Component getListCellRendererComponent(JList<? extends OsmPrimitive> list, OsmPrimitive value, int index, boolean isSelected, boolean cellHasFocus) {
    4646        Component def = defaultListCellRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    4747        return renderer(def, (OsmPrimitive) value);
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/ComparePairListCellRenderer.java

    r6084 r7001  
    1010import org.openstreetmap.josm.gui.conflict.ConflictColors;
    1111
    12 public class ComparePairListCellRenderer extends JLabel implements ListCellRenderer {
     12public class ComparePairListCellRenderer extends JLabel implements ListCellRenderer<ComparePairType> {
     13
     14    /**
     15     * Constructs a new {@code ComparePairListCellRenderer}.
     16     */
    1317    public ComparePairListCellRenderer() {
    1418        setOpaque(true);
    1519    }
     20
    1621    @Override
    1722    public Component getListCellRendererComponent(
    18             JList list,
    19             Object value,
     23            JList<? extends ComparePairType> list,
     24            ComparePairType value,
    2025            int index,
    2126            boolean isSelected,
    22             boolean cellHasFocus)
    23     {
    24         ComparePairType type = (ComparePairType)value;
    25         setText(type.getDisplayName());
     27            boolean cellHasFocus) {
     28        setText(value.getDisplayName());
    2629        setBackground(isSelected ? ConflictColors.BGCOLOR_SELECTED.get() : ConflictColors.BGCOLOR.get());
    2730        setForeground(ConflictColors.FGCOLOR.get());
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellEditor.java

    r6991 r7001  
    3535 * {@link KeyEvent#VK_ENTER} and {@link KeyEvent#VK_TAB} trigger a {@link NavigationListener#gotoNextDecision()}.
    3636 */
    37 public class MultiValueCellEditor extends AbstractCellEditor implements TableCellEditor{
     37public class MultiValueCellEditor extends AbstractCellEditor implements TableCellEditor {
    3838
    3939    /**
     
    224224
    225225        @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) {
    228227            renderColors(isSelected);
    229228            renderValue(value);
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictDecisionRenderer.java

    r6616 r7001  
    1414import org.openstreetmap.josm.gui.widgets.JosmComboBox;
    1515
    16 public class RelationMemberConflictDecisionRenderer extends JLabel implements TableCellRenderer, ListCellRenderer {
     16public class RelationMemberConflictDecisionRenderer extends JLabel implements TableCellRenderer, ListCellRenderer<RelationMemberConflictDecisionType> {
    1717
    1818    private JosmComboBox cbDecisionTypes;
     
    6363    /* --------------------------------------------------------------------------------- */
    6464    @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,
    6668            boolean cellHasFocus) {
    6769        resetListRenderer();
     
    7072            setForeground(UIManager.getColor("ComboBox.selectionForeground"));
    7173        }
    72         RelationMemberConflictDecisionType decision = (RelationMemberConflictDecisionType)value;
    7374        RelationMemberConflictDecisionType.prepareLabel(decision, this);
    7475        if (RelationMemberConflictDecisionType.UNDECIDED.equals(decision)) {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java

    r6643 r7001  
    7474    private ChangesetInSelectionListModel inSelectionModel;
    7575    private ChangesetsInActiveDataLayerListModel inActiveDataLayerModel;
    76     private JList lstInSelection;
    77     private JList lstInActiveDataLayer;
     76    private JList<Changeset> lstInSelection;
     77    private JList<Changeset> lstInActiveDataLayer;
    7878    private JCheckBox cbInSelectionOnly;
    7979    private JPanel pnlList;
     
    9292        inSelectionModel = new ChangesetInSelectionListModel(selectionModel);
    9393
    94         lstInSelection = new JList(inSelectionModel);
     94        lstInSelection = new JList<Changeset>(inSelectionModel);
    9595        lstInSelection.setSelectionModel(selectionModel);
    9696        lstInSelection.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
     
    9999        selectionModel = new DefaultListSelectionModel();
    100100        inActiveDataLayerModel = new ChangesetsInActiveDataLayerListModel(selectionModel);
    101         lstInActiveDataLayer = new JList(inActiveDataLayerModel);
     101        lstInActiveDataLayer = new JList<Changeset>(inActiveDataLayerModel);
    102102        lstInActiveDataLayer.setSelectionModel(selectionModel);
    103103        lstInActiveDataLayer.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
     
    110110
    111111    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
    114113        ChangesetCache.getInstance().addChangesetCacheListener(inSelectionModel);
    115114        MapView.addEditLayerChangeListener(inSelectionModel);
     
    222221    }
    223222
    224     protected JList getCurrentChangesetList() {
     223    protected JList<Changeset> getCurrentChangesetList() {
    225224        if (cbInSelectionOnly.isSelected())
    226225            return lstInSelection;
     
    546545
    547546    class ChangesetDialogPopup extends ListPopupMenu {
    548         public ChangesetDialogPopup(JList ... lists) {
     547        public ChangesetDialogPopup(JList<?> ... lists) {
    549548            super(lists);
    550549            add(selectObjectsAction);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

    r6889 r7001  
    8181    private ConflictListModel model;
    8282    /** the list widget for the list of conflicts */
    83     private JList lstConflicts;
     83    private JList<OsmPrimitive> lstConflicts;
    8484
    8585    private final JPopupMenu popupMenu = new JPopupMenu();
     
    9595        model = new ConflictListModel();
    9696
    97         lstConflicts = new JList(model);
     97        lstConflicts = new JList<OsmPrimitive>(model);
    9898        lstConflicts.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    9999        lstConflicts.setCellRenderer(new OsmPrimitivRenderer());
     
    272272            }
    273273        };
    274         for (Object o : lstConflicts.getSelectedValues()) {
    275             if (conflicts == null || !conflicts.hasConflictForMy((OsmPrimitive)o)) {
     274        for (OsmPrimitive o : lstConflicts.getSelectedValuesList()) {
     275            if (conflicts == null || !conflicts.hasConflictForMy(o)) {
    276276                continue;
    277277            }
    278             conflicts.getConflictForMy((OsmPrimitive)o).getTheir().accept(conflictPainter);
     278            conflicts.getConflictForMy(o).getTheir().accept(conflictPainter);
    279279        }
    280280    }
     
    359359     *
    360360     */
    361     class ConflictListModel implements ListModel {
     361    class ConflictListModel implements ListModel<OsmPrimitive> {
    362362
    363363        private CopyOnWriteArrayList<ListDataListener> listeners;
     
    392392
    393393        @Override
    394         public Object getElementAt(int index) {
     394        public OsmPrimitive getElementAt(int index) {
    395395            if (index < 0) return null;
    396396            if (index >= getSize()) return null;
     
    452452        public void actionPerformed(ActionEvent e) {
    453453            Collection<OsmPrimitive> sel = new LinkedList<OsmPrimitive>();
    454             for (Object o : lstConflicts.getSelectedValues()) {
    455                 sel.add((OsmPrimitive)o);
     454            for (OsmPrimitive o : lstConflicts.getSelectedValuesList()) {
     455                sel.add(o);
    456456            }
    457457            DataSet ds = Main.main.getCurrentDataSet();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r6726 r7001  
    8787public class RelationListDialog extends ToggleDialog implements DataSetListener {
    8888    /** The display list. */
    89     private final JList displaylist;
     89    private final JList<Relation> displaylist;
    9090    /** the list model used */
    9191    private final RelationListModel model;
     
    129129        DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
    130130        model = new RelationListModel(selectionModel);
    131         displaylist = new JList(model);
     131        displaylist = new JList<Relation>(model);
    132132        displaylist.setSelectionModel(selectionModel);
    133133        displaylist.setCellRenderer(new OsmPrimitivRenderer() {
     
    238238     */
    239239    private Relation getSelected() {
    240         if(model.getSize() == 1) {
     240        if (model.getSize() == 1) {
    241241            displaylist.setSelectedIndex(0);
    242242        }
    243         return (Relation) displaylist.getSelectedValue();
     243        return displaylist.getSelectedValue();
    244244    }
    245245
     
    363363        public void activeLayerChange(Layer oldLayer, Layer newLayer) {
    364364            updateEnabledState();
    365     }
     365        }
    366366
    367367        @Override
     
    377377
    378378    /**
    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.
    381380     *
    382381     */
    383     private class RelationListModel extends AbstractListModel {
     382    private class RelationListModel extends AbstractListModel<Relation> {
    384383        private final List<Relation> relations = new ArrayList<Relation>();
    385384        private List<Relation> filteredRelations;
     
    389388        public RelationListModel(DefaultListSelectionModel selectionModel) {
    390389            this.selectionModel = selectionModel;
    391         }
    392 
    393         public Relation getRelation(int idx) {
    394             return relations.get(idx);
    395390        }
    396391
     
    522517
    523518        @Override
    524         public Object getElementAt(int index) {
     519        public Relation getElementAt(int index) {
    525520            return getVisibleRelation(index);
    526521        }
     
    675670        if (!(prim instanceof Relation))
    676671            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
    679673        //
    680674        List<Relation> sel = model.getSelectedRelations();
     
    690684
    691685    @Override
    692     public void otherDatasetChange(AbstractDatasetChangedEvent event) {/* ignore */}
     686    public void otherDatasetChange(AbstractDatasetChangedEvent event) {
     687        /* ignore */
     688    }
    693689}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r6889 r7001  
    8181 */
    8282public class SelectionListDialog extends ToggleDialog  {
    83     private JList lstPrimitives;
     83    private JList<OsmPrimitive> lstPrimitives;
    8484    private DefaultListSelectionModel selectionModel  = new DefaultListSelectionModel();
    8585    private SelectionListModel model = new SelectionListModel(selectionModel);
     
    101101     */
    102102    protected void buildContentPanel() {
    103         lstPrimitives = new JList(model);
     103        lstPrimitives = new JList<OsmPrimitive>(model);
    104104        lstPrimitives.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    105105        lstPrimitives.setSelectionModel(selectionModel);
     
    407407     *
    408408     */
    409     private static class SelectionListModel extends AbstractListModel implements EditLayerChangeListener, SelectionChangedListener, DataSetListener{
     409    private static class SelectionListModel extends AbstractListModel<OsmPrimitive> implements EditLayerChangeListener, SelectionChangedListener, DataSetListener{
    410410
    411411        private static final int SELECTION_HISTORY_SIZE = 10;
     
    481481
    482482        @Override
    483         public Object getElementAt(int index) {
     483        public OsmPrimitive getElementAt(int index) {
    484484            return selection.get(index);
    485485        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetListCellRenderer.java

    r6822 r7001  
    1414import org.openstreetmap.josm.tools.ImageProvider;
    1515
    16 public class ChangesetListCellRenderer extends JLabel implements ListCellRenderer{
     16public class ChangesetListCellRenderer extends JLabel implements ListCellRenderer<Changeset> {
    1717
     18    /**
     19     * Constructs a new {@code ChangesetListCellRenderer}.
     20     */
    1821    public ChangesetListCellRenderer() {
    1922        setOpaque(true);
     
    4851
    4952    @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) {
    5354        renderColors(isSelected);
    5455        renderLabel(cs);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetListModel.java

    r6084 r7001  
    2121import org.openstreetmap.josm.data.osm.Storage;
    2222
    23 public class ChangesetListModel extends DefaultListModel  implements ChangesetCacheListener{
     23public class ChangesetListModel extends DefaultListModel<Changeset> implements ChangesetCacheListener {
    2424    private final List<Changeset> data = new ArrayList<Changeset>();
    2525    private final Storage<Changeset> shownChangesets = new Storage<Changeset>(true);
     
    131131
    132132    @Override
    133     public Object getElementAt(int idx) {
     133    public Changeset getElementAt(int idx) {
    134134        return data.get(idx);
    135135    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ReferringRelationsBrowser.java

    r6361 r7001  
    3030
    3131/**
    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
    3534 */
    3635public class ReferringRelationsBrowser extends JPanel {
    3736
    3837    /** the list of relations */
    39     private JList referrers;
     38    private JList<Relation> referrers;
    4039    private ReferringRelationsBrowserModel model;
    4140    private OsmDataLayer layer;
     
    4847    protected void build() {
    4948        setLayout(new BorderLayout());
    50         referrers = new JList(model);
     49        referrers = new JList<Relation>(model);
    5150        referrers.setCellRenderer(new OsmPrimitivRenderer());
    5251        add(new JScrollPane(referrers), BorderLayout.CENTER);
     
    160159            int idx = referrers.getSelectedIndex();
    161160            if (idx < 0) return;
    162             Relation r = model.get(idx);
     161            Relation r = model.getElementAt(idx);
    163162            if (r == null) return;
    164163            RelationEditor editor = RelationEditor.getEditor(getLayer(), r, null);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ReferringRelationsBrowserModel.java

    r6316 r7001  
    1111import org.openstreetmap.josm.data.osm.RelationMember;
    1212
    13 public class ReferringRelationsBrowserModel extends AbstractListModel {
     13public class ReferringRelationsBrowserModel extends AbstractListModel<Relation> {
    1414
    1515    /** the relation */
     
    1717    private List<Relation> referrers;
    1818
     19    /**
     20     * Constructs a new {@code ReferringRelationsBrowserModel}.
     21     */
    1922    public ReferringRelationsBrowserModel() {
    2023        relation = null;
    2124        referrers = new ArrayList<Relation>();
    2225    }
     26
    2327    public ReferringRelationsBrowserModel(Relation relation) {
    2428        this();
     
    3842
    3943    @Override
    40     public Object getElementAt(int index) {
     44    public Relation getElementAt(int index) {
    4145        return referrers.get(index);
    4246    }
     
    96100        return relation;
    97101    }
    98 
    99     public Relation get(int index) {
    100         return referrers.get(index);
    101     }
    102102}
  • trunk/src/org/openstreetmap/josm/gui/download/BookmarkList.java

    r6822 r7001  
    3636 * @since 6340
    3737 */
    38 public class BookmarkList extends JList {
     38public class BookmarkList extends JList<BookmarkList.Bookmark> {
    3939
    4040    /**
     
    153153     */
    154154    public BookmarkList() {
    155         setModel(new DefaultListModel());
     155        setModel(new DefaultListModel<Bookmark>());
    156156        load();
    157157        setVisibleRowCount(7);
     
    163163     */
    164164    public final void load() {
    165         DefaultListModel model = (DefaultListModel)getModel();
     165        DefaultListModel<Bookmark> model = (DefaultListModel<Bookmark>)getModel();
    166166        model.removeAllElements();
    167167        Collection<Collection<String>> args = Main.pref.getArray("bookmarks", null);
     
    241241    public final void save() {
    242242        LinkedList<Collection<String>> coll = new LinkedList<Collection<String>>();
    243         for (Object o : ((DefaultListModel)getModel()).toArray()) {
     243        for (Object o : ((DefaultListModel<Bookmark>)getModel()).toArray()) {
    244244            String[] array = new String[5];
    245             Bookmark b = (Bookmark)o;
     245            Bookmark b = (Bookmark) o;
    246246            array[0] = b.getName();
    247247            Bounds area = b.getArea();
     
    255255    }
    256256
    257     static class BookmarkCellRenderer extends JLabel implements ListCellRenderer {
     257    static class BookmarkCellRenderer extends JLabel implements ListCellRenderer<BookmarkList.Bookmark> {
    258258
    259259        private ImageIcon icon;
     
    287287
    288288        }
    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) {
    294292            renderColor(isSelected);
    295             setText(b.getName());
    296             setToolTipText(buildToolTipText(b));
     293            setText(value.getName());
     294            setToolTipText(buildToolTipText(value));
    297295            return this;
    298296        }
  • trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java

    r6890 r7001  
    1010import java.awt.event.MouseAdapter;
    1111import java.awt.event.MouseEvent;
     12import java.util.List;
    1213
    1314import javax.swing.AbstractAction;
     
    216217        @Override
    217218        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())
    220221                return;
    221222            for (Object sel: sels) {
     
    243244        @Override
    244245        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);
    249250            Object value =
    250251                JOptionPane.showInputDialog(
  • trunk/src/org/openstreetmap/josm/gui/io/ChangesetCellRenderer.java

    r6822 r7001  
    2121 *
    2222 */
    23 public class ChangesetCellRenderer extends JLabel implements ListCellRenderer {
    24     private ImageIcon icon ;
     23public class ChangesetCellRenderer extends JLabel implements ListCellRenderer<Changeset> {
     24    private ImageIcon icon;
     25
     26    /**
     27     * Constructs a new {@code ChangesetCellRenderer}.
     28     */
    2529    public ChangesetCellRenderer() {
    2630        icon = ImageProvider.get("data", "changeset");
     
    4246
    4347    @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) {
    4749        if (isSelected) {
    4850            setForeground(UIManager.getColor("List.selectionForeground"));
  • trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetDialog.java

    r6316 r7001  
    3838/**
    3939 * This dialog lets the user select changesets from a list of changesets.
    40  *
     40 * @since 2115
    4141 */
    4242public class CloseChangesetDialog extends JDialog {
    4343
    4444    /** the list */
    45     private JList lstOpenChangesets;
     45    private JList<Changeset> lstOpenChangesets;
    4646    /** true if the user canceled the dialog */
    4747    private boolean canceled;
     
    130130
    131131        protected void refreshEnabledState() {
    132             setEnabled(lstOpenChangesets.getSelectedValues() != null && lstOpenChangesets.getSelectedValues().length > 0);
     132            List list = lstOpenChangesets.getSelectedValuesList();
     133            setEnabled(list != null && !list.isEmpty());
    133134        }
    134135
     
    214215     */
    215216    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();
    222218    }
    223219}
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java

    r6965 r7001  
    173173            add(lblMessage = new JLabel(), gc);
    174174            lblMessage.setHorizontalAlignment(JLabel.LEFT);
    175             lstLayers = new JList();
     175            lstLayers = new JList<SaveLayerInfo>();
    176176            lstLayers.setCellRenderer(
    177177                    new DefaultListCellRenderer() {
  • trunk/src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java

    r6316 r7001  
    172172    }
    173173
    174     static class OsmPrimitiveList extends JList {
     174    static class OsmPrimitiveList extends JList<OsmPrimitive> {
    175175        protected void init() {
    176176            setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
     
    193193    }
    194194
    195     static class OsmPrimitiveListModel extends AbstractListModel {
     195    static class OsmPrimitiveListModel extends AbstractListModel<OsmPrimitive> {
    196196        private List<OsmPrimitive> data;
    197197
     
    231231
    232232        @Override
    233         public Object getElementAt(int index) {
     233        public OsmPrimitive getElementAt(int index) {
    234234            if (data == null)
    235235                return null;
  • trunk/src/org/openstreetmap/josm/gui/io/UploadedObjectsSummaryPanel.java

    r6889 r7001  
    140140     *
    141141     */
    142     static class PrimitiveList extends JList {
     142    static class PrimitiveList extends JList<OsmPrimitive> {
    143143        public PrimitiveList() {
    144144            super(new PrimitiveListModel());
     
    154154     *
    155155     */
    156     static class PrimitiveListModel extends AbstractListModel{
     156    static class PrimitiveListModel extends AbstractListModel<OsmPrimitive> {
    157157        private List<OsmPrimitive> primitives;
    158158
     
    175175
    176176        @Override
    177         public Object getElementAt(int index) {
     177        public OsmPrimitive getElementAt(int index) {
    178178            if (primitives == null) return null;
    179179            return primitives.get(index);
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r6883 r7001  
    229229        JosmComboBox cbTimezones;
    230230        ImageDisplay imgDisp;
    231         JList imgList;
     231        JList<String> imgList;
    232232
    233233        @Override
     
    331331            panelLst.setLayout(new BorderLayout());
    332332
    333             imgList = new JList(new AbstractListModel() {
     333            imgList = new JList<String>(new AbstractListModel<String>() {
    334334                @Override
    335                 public Object getElementAt(int i) {
     335                public String getElementAt(int i) {
    336336                    return yLayer.data.get(i).getFile().getName();
    337337                }
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadAlongPanel.java

    r6085 r7001  
    4141    private static final Integer[] area = { 20, 10, 5, 1 };
    4242   
    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;
    4646   
    4747    /**
     
    7474            s[i] = tr("{0} meters", dist[i]);
    7575        }
    76         buffer = new JList(s);
     76        buffer = new JList<String>(s);
    7777       
    7878        double distanceValue = Main.pref.getDouble(prefDist, dist[0]);
     
    9393            s[i] = tr("{0} sq km", area[i]);
    9494        }
    95         maxRect = new JList(s);
     95        maxRect = new JList<String>(s);
    9696
    9797        double areaValue = Main.pref.getDouble(prefArea, area[0]);
     
    109109        if (prefNear != null) {
    110110            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")});
    112112            downloadNear.setSelectedIndex(Main.pref.getInteger(prefNear, 0));
    113113            add(downloadNear, GBC.eol());
  • trunk/src/org/openstreetmap/josm/gui/oauth/AuthorizationProcedureComboBox.java

    r6883 r7001  
    2424    }
    2525
    26     private static class AuthorisationProcedureCellRenderer extends JLabel implements ListCellRenderer {
     26    private static class AuthorisationProcedureCellRenderer extends JLabel implements ListCellRenderer<AuthorizationProcedure> {
    2727        public AuthorisationProcedureCellRenderer() {
    2828            setOpaque(true);
     
    8080
    8181        @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) {
    8484            renderColors(isSelected);
    8585            renderText(procedure);
  • trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java

    r6890 r7001  
    103103    protected final JTable tblActiveSources;
    104104    protected final ActiveSourcesModel activeSourcesModel;
    105     protected final JList lstAvailableSources;
     105    protected final JList<ExtendedSourceEntry> lstAvailableSources;
    106106    protected final AvailableSourcesListModel availableSourcesModel;
    107107    protected final String availableSourcesUrl;
     
    127127        DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
    128128        this.availableSourcesModel = new AvailableSourcesListModel(selectionModel);
    129         this.lstAvailableSources = new JList(availableSourcesModel);
     129        this.lstAvailableSources = new JList<ExtendedSourceEntry>(availableSourcesModel);
    130130        this.lstAvailableSources.setSelectionModel(selectionModel);
    131131        this.lstAvailableSources.setCellRenderer(new SourceEntryListCellRenderer());
     
    441441    }
    442442
    443     protected static class AvailableSourcesListModel extends DefaultListModel {
     443    protected static class AvailableSourcesListModel extends DefaultListModel<ExtendedSourceEntry> {
    444444        private List<ExtendedSourceEntry> data;
    445445        private DefaultListSelectionModel selectionModel;
     
    459459
    460460        @Override
    461         public Object getElementAt(int index) {
     461        public ExtendedSourceEntry getElementAt(int index) {
    462462            return data.get(index);
    463463        }
     
    12101210    }
    12111211
    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) {
    12161216            String s = value.toString();
    12171217            setText(s);
     
    12271227            setFont(getFont().deriveFont(Font.PLAIN));
    12281228            setOpaque(true);
    1229             setToolTipText(((ExtendedSourceEntry) value).getTooltip());
     1229            setToolTipText(value.getTooltip());
    12301230            return this;
    12311231        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java

    r6990 r7001  
    381381        }
    382382
    383 
    384383        public void setCurrentAction(ActionDefinition currentAction) {
    385384            this.currentAction = currentAction;
    386385            fireTableDataChanged();
    387386        }
    388 
    389387    }
    390388
     
    508506                } else if ("up".equals(e.getActionCommand())) {
    509507                    int i = selectedList.getSelectedIndex();
    510                     Object o = selected.get(i);
     508                    ActionDefinition o = selected.get(i);
    511509                    if (i != 0) {
    512510                        selected.remove(i);
     
    516514                } else if ("down".equals(e.getActionCommand())) {
    517515                    int i = selectedList.getSelectedIndex();
    518                     Object o = selected.get(i);
     516                    ActionDefinition o = selected.get(i);
    519517                    if (i != selected.size()-1) {
    520518                        selected.remove(i);
     
    554552        private final Move moveAction = new Move();
    555553
    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);
    558556
    559557        private final DefaultTreeModel actionsTreeModel;
     
    658656                protected Transferable createTransferable(JComponent c) {
    659657                    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);
    662660                    }
    663661                    return new ActionTransferable(actions);
     
    688686                    try {
    689687                        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);
    691689
    692690                        Object leadItem = dropIndex >= 0 ? selected.elementAt(dropIndex) : null;
    693691                        int dataLength = draggedData.size();
    694 
    695692
    696693                        if (leadItem != null) {
     
    698695                                if (leadItem.equals(o))
    699696                                    return false;
    700 
    701697                            }
    702698                        }
     
    883879    }
    884880
     881    /**
     882     * Constructs a new {@code ToolbarPreferences}.
     883     */
    885884    public ToolbarPreferences() {
    886885        control.setFloatable(false);
     
    931930    }
    932931
    933     public Action getAction(String s)
    934     {
     932    public Action getAction(String s) {
    935933        Action e = actions.get(s);
    936934        if(e == null) {
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/ListListEditor.java

    r6890 r7001  
    4242    PrefEntry entry;
    4343
    44     JList entryList;
     44    JList<String> entryList;
    4545    Integer entryIdx;
    4646    JTable table;
     
    8282
    8383        entryModel = new EntryListModel();
    84         entryList = new JList(entryModel);
     84        entryList = new JList<String>(entryModel);
    8585        entryList.getSelectionModel().addListSelectionListener(new EntryListener());
    8686        JScrollPane scroll = new JScrollPane(entryList);
     
    115115    }
    116116
    117     class EntryListModel extends AbstractListModel {
    118         @Override
    119         public Object getElementAt(int index) {
     117    class EntryListModel extends AbstractListModel<String> {
     118        @Override
     119        public String getElementAt(int index) {
    120120            return (index+1) + ": " + data.get(index).toString();
    121121        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/MapListEditor.java

    r6890 r7001  
    4545    PrefEntry entry;
    4646
    47     JList entryList;
     47    JList<String> entryList;
    4848    JTable table;
    4949    MapTableModel tableModel;
     
    100100
    101101        entryModel = new EntryListModel();
    102         entryList = new JList(entryModel);
     102        entryList = new JList<String>(entryModel);
    103103        entryList.getSelectionModel().addListSelectionListener(new EntryListener());
    104104        JScrollPane scroll = new JScrollPane(entryList);
     
    133133    }
    134134
    135     class EntryListModel extends AbstractListModel {
    136         @Override
    137         public Object getElementAt(int index) {
     135    class EntryListModel extends AbstractListModel<String> {
     136        @Override
     137        public String getElementAt(int index) {
    138138            return tr("Entry {0}", index+1);
    139139        }
     
    213213
    214214    class MapTableModel extends AbstractTableModel {
    215         @SuppressWarnings("unchecked")
    216215        private List<List<String>> data() {
    217216            if (entryIdx == null) return Collections.emptyList();
  • trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java

    r6797 r7001  
    491491    private static class PluginConfigurationSitesPanel extends JPanel {
    492492
    493         private DefaultListModel model;
     493        private DefaultListModel<String> model;
    494494
    495495        protected final void build() {
    496496            setLayout(new GridBagLayout());
    497497            add(new JLabel(tr("Add JOSM Plugin description URL.")), GBC.eol());
    498             model = new DefaultListModel();
     498            model = new DefaultListModel<String>();
    499499            for (String s : Main.pref.getPluginSites()) {
    500500                model.addElement(s);
    501501            }
    502             final JList list = new JList(model);
     502            final JList<String> list = new JList<String>(model);
    503503            add(new JScrollPane(list), GBC.std().fill());
    504504            JPanel buttons = new JPanel(new GridBagLayout());
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java

    r6890 r7001  
    4747        public JosmTextField filter;
    4848        private ProjectionCodeListModel model;
    49         public JList selectionList;
     49        public JList<String> selectionList;
    5050        List<String> data;
    5151        List<String> filteredData;
     
    9191         * List model for the filtered view on the list of all codes.
    9292         */
    93         private class ProjectionCodeListModel extends AbstractListModel {
     93        private class ProjectionCodeListModel extends AbstractListModel<String> {
    9494            @Override
    9595            public int getSize() {
     
    9898
    9999            @Override
    100             public Object getElementAt(int index) {
     100            public String getElementAt(int index) {
    101101                if (index >= 0 && index < filteredData.size())
    102102                    return filteredData.get(index);
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java

    r6883 r7001  
    11101110        }
    11111111
    1112         private static final ListCellRenderer RENDERER = new ListCellRenderer() {
     1112        private static final ListCellRenderer<PresetListEntry> RENDERER = new ListCellRenderer<PresetListEntry>() {
    11131113
    11141114            JLabel lbl = new JLabel();
     
    11161116            @Override
    11171117            public Component getListCellRendererComponent(
    1118                     JList list,
    1119                     Object value,
     1118                    JList<? extends PresetListEntry> list,
     1119                    PresetListEntry item,
    11201120                    int index,
    11211121                    boolean isSelected,
    11221122                    boolean cellHasFocus) {
    1123                 PresetListEntry item = (PresetListEntry) value;
    11241123
    11251124                // Only return cached size, item is not shown
     
    11631162        };
    11641163
    1165 
    1166         protected ListCellRenderer getListCellRenderer() {
     1164        protected ListCellRenderer<PresetListEntry> getListCellRenderer() {
    11671165            return RENDERER;
    11681166        }
     
    11801178        public String length;
    11811179
     1180        /**
     1181         * Constructs a new {@code Combo}.
     1182         */
    11821183        public Combo() {
    11831184            delimiter = ",";
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetSelector.java

    r6883 r7001  
    6767    private static final BooleanProperty SEARCH_IN_TAGS = new BooleanProperty("taggingpreset.dialog.search-in-tags", true);
    6868    private static final BooleanProperty ONLY_APPLICABLE  = new BooleanProperty("taggingpreset.dialog.only-applicable-to-selection", true);
    69 
    7069   
    7170    private JosmTextField edSearchText;
    72     private JList lsResult;
     71    private JList<TaggingPreset> lsResult;
    7372    private JCheckBox ckOnlyApplicable;
    7473    private JCheckBox ckSearchInTags;
     
    9392    }
    9493
    95     private static class ResultListModel extends AbstractListModel {
     94    private static class ResultListModel extends AbstractListModel<TaggingPreset> {
    9695
    9796        private List<PresetClassification> presets = new ArrayList<PresetClassification>();
     
    107106
    108107        @Override
    109         public Object getElementAt(int index) {
     108        public TaggingPreset getElementAt(int index) {
    110109            return presets.get(index).preset;
    111110        }
     
    115114            return presets.size();
    116115        }
    117 
    118116    }
    119117
     
    247245        add(edSearchText, BorderLayout.NORTH);
    248246
    249         lsResult = new JList();
     247        lsResult = new JList<TaggingPreset>();
    250248        lsResult.setModel(lsResultModel);
    251249        lsResult.setCellRenderer(new ResultListCellRenderer());
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java

    r6437 r7001  
    301301     * renders an AutoCompletionListItem by showing only the string value part
    302302     */
    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         */
    305308        public AutoCompleteListCellRenderer() {
    306309            setOpaque(true);
     
    309312        @Override
    310313        public Component getListCellRendererComponent(
    311                 JList list,
    312                 Object value,
     314                JList<? extends AutoCompletionListItem> list,
     315                AutoCompletionListItem item,
    313316                int index,
    314317                boolean isSelected,
     
    323326            }
    324327
    325             AutoCompletionListItem item = (AutoCompletionListItem) value;
    326328            setText(item.getValue());
    327329            return this;
  • trunk/src/org/openstreetmap/josm/gui/widgets/EditableList.java

    r6603 r7001  
    2727
    2828    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>());
    3030    public final JButton addSrcButton = new JButton(tr("Add"));
    3131    public final JButton editSrcButton = new JButton(tr("Edit"));
     
    5454                        JOptionPane.QUESTION_MESSAGE);
    5555                if (source != null) {
    56                     ((DefaultListModel) sourcesList.getModel()).addElement(source);
     56                    ((DefaultListModel<String>) sourcesList.getModel()).addElement(source);
    5757                }
    5858                sourcesList.clearSelection();
     
    7272                        String source = JOptionPane.showInputDialog(Main.parent, title, title, JOptionPane.QUESTION_MESSAGE);
    7373                        if (source != null) {
    74                             ((DefaultListModel) sourcesList.getModel()).addElement(source);
     74                            ((DefaultListModel<String>) sourcesList.getModel()).addElement(source);
    7575                        }
    7676                    } else {
     
    8989                            sourcesList.getSelectedValue());
    9090                    if (source != null) {
    91                         ((DefaultListModel) sourcesList.getModel()).setElementAt(source, row);
     91                        ((DefaultListModel<String>) sourcesList.getModel()).setElementAt(source, row);
    9292                    }
    9393                }
     
    102102                    JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete."), tr("Information"), JOptionPane.QUESTION_MESSAGE);
    103103                } else {
    104                     ((DefaultListModel) sourcesList.getModel()).remove(sourcesList.getSelectedIndex());
     104                    ((DefaultListModel<String>) sourcesList.getModel()).remove(sourcesList.getSelectedIndex());
    105105                }
    106106            }
     
    126126    public void setItems(final Iterable<String> items) {
    127127        for (String source : items) {
    128             ((DefaultListModel) sourcesList.getModel()).addElement(source);
     128            ((DefaultListModel<String>) sourcesList.getModel()).addElement(source);
    129129        }
    130130    }
     
    133133        final List<String> items = new ArrayList<String>(sourcesList.getModel().getSize());
    134134        for (int i = 0; i < sourcesList.getModel().getSize(); ++i) {
    135             items.add((String) sourcesList.getModel().getElementAt(i));
     135            items.add(sourcesList.getModel().getElementAt(i));
    136136        }
    137137        return items;
  • trunk/src/org/openstreetmap/josm/gui/widgets/ListPopupMenu.java

    r6070 r7001  
    1414public class ListPopupMenu extends JPopupMenu {
    1515
    16     private JList[] lists;
     16    private JList<?>[] lists;
    1717
    18     public ListPopupMenu(JList ... lists) {
     18    public ListPopupMenu(JList<?> ... lists) {
    1919        this.lists = lists;
    2020    }
    2121
    22     /* (non-Javadoc)
    23      * @see javax.swing.JPopupMenu#add(javax.swing.Action)
    24      */
    2522    @Override
    2623    public JMenuItem add(Action a) {
    2724        if (lists != null && a instanceof ListSelectionListener) {
    28             for (JList list : lists) {
     25            for (JList<?> list : lists) {
    2926                list.addListSelectionListener((ListSelectionListener) a);
    3027            }
  • trunk/src/org/openstreetmap/josm/gui/widgets/PopupMenuLauncher.java

    r6070 r7001  
    7878    protected boolean checkSelection(Component component, Point p) {
    7979        if (component instanceof JList) {
    80             return checkListSelection((JList) component, p) > -1;
     80            return checkListSelection((JList<?>) component, p) > -1;
    8181        } else if (component instanceof JTable) {
    8282            return checkTableSelection((JTable) component, p) > -1;
     
    107107    }
    108108
    109     protected int checkListSelection(JList list, Point p) {
     109    protected int checkListSelection(JList<?> list, Point p) {
    110110        int idx = list.locationToIndex(p);
    111111        if (idx >= 0 && idx < list.getModel().getSize() && list.getSelectedIndices().length < 2 && !list.isSelectedIndex(idx)) {
  • trunk/src/org/openstreetmap/josm/io/GpxExporter.java

    r6920 r7001  
    290290                        "GNU Lesser Public License (LGPL)",
    291291                        "BSD License (MIT/X11)"};
    292                 JList l = new JList(licenses);
     292                JList<String> l = new JList<String>(licenses);
    293293                l.setVisibleRowCount(licenses.length);
    294294                l.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java

    r6977 r7001  
    4747            // We'll just ignore this for now. The user will still be able to close JOSM by closing all its windows.
    4848            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);
    5549        }
    5650    }
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java

    r6997 r7001  
    1616import java.net.URISyntaxException;
    1717import java.util.Arrays;
    18 import java.util.Calendar;
    1918
    2019import javax.swing.JOptionPane;
     
    4241    @Override
    4342    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         }
    6443    }
    6544
     
    360339    }
    361340
     341    // Method kept because strings have already been translated. To enable for Java 8 migration somewhere in 2016
    362342    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 version
    364         Calendar today = Calendar.getInstance();
    365         Calendar expiration = Calendar.getInstance();
    366         expiration.set(2014, Calendar.MAY, 25);
    367         if (!today.before(expiration)) {
    368             return;
    369         }
    370343        GuiHelper.runInEDTAndWait(new Runnable() {
    371344            @Override
     
    376349                        new String[]{tr("Update Java"), tr("Cancel")});
    377350                // Check if the dialog has not already been permanently hidden by user
    378                 if (!ed.toggleEnable("askUpdateJava7").toggleCheckState()) {
     351                if (!ed.toggleEnable("askUpdateJava8").toggleCheckState()) {
    379352                    ed.setButtonIcons(new String[]{"java.png", "cancel.png"}).setCancelButton(2);
    380353                    ed.setMinimumSize(new Dimension(480, 300));
     
    383356                    if ("Sun Microsystems Inc.".equals(System.getProperty("java.vendor")) && !isOpenJDK()) {
    384357                        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>";
    386359                    }
    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>"+
    388361                            tr("Would you like to update now ?");
    389362                    ed.setContent(content);
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java

    r6943 r7001  
    3636  */
    3737public class PlatformHookWindows extends PlatformHookUnixoid implements PlatformHook {
    38    
    39     @Override
    40     public void startupHook() {
    41         // Invite users to install Java 7 if they are still with Java 6
    42         String version = System.getProperty("java.version");
    43         if (version != null && version.startsWith("1.6")) {
    44             askUpdateJava(version);
    45         }
    46     }
    4738
    4839    @Override
Note: See TracChangeset for help on using the changeset viewer.