Ignore:
Timestamp:
2016-06-30T23:56:10+02:00 (9 years ago)
Author:
donvip
Message:

remove calls to deprecated methods

Location:
applications/editors/josm/plugins/walkingpapers
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/walkingpapers/.settings/org.eclipse.jdt.core.prefs

    r30736 r32476  
    8585org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
    8686org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
     87org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
    8788org.eclipse.jdt.core.compiler.problem.unusedImport=warning
    8889org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
  • applications/editors/josm/plugins/walkingpapers/.settings/org.eclipse.jdt.ui.prefs

    r16522 r32476  
    1 #Wed Jul 15 15:49:32 CEST 2009
    21eclipse.preferences.version=1
     2editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
    33internal.default.compliance=default
     4sp_cleanup.add_default_serial_version_id=true
     5sp_cleanup.add_generated_serial_version_id=false
     6sp_cleanup.add_missing_annotations=true
     7sp_cleanup.add_missing_deprecated_annotations=true
     8sp_cleanup.add_missing_methods=false
     9sp_cleanup.add_missing_nls_tags=false
     10sp_cleanup.add_missing_override_annotations=true
     11sp_cleanup.add_missing_override_annotations_interface_methods=true
     12sp_cleanup.add_serial_version_id=false
     13sp_cleanup.always_use_blocks=true
     14sp_cleanup.always_use_parentheses_in_expressions=false
     15sp_cleanup.always_use_this_for_non_static_field_access=false
     16sp_cleanup.always_use_this_for_non_static_method_access=false
     17sp_cleanup.convert_functional_interfaces=false
     18sp_cleanup.convert_to_enhanced_for_loop=false
     19sp_cleanup.correct_indentation=true
     20sp_cleanup.format_source_code=false
     21sp_cleanup.format_source_code_changes_only=false
     22sp_cleanup.insert_inferred_type_arguments=false
     23sp_cleanup.make_local_variable_final=true
     24sp_cleanup.make_parameters_final=false
     25sp_cleanup.make_private_fields_final=true
     26sp_cleanup.make_type_abstract_if_missing_method=false
     27sp_cleanup.make_variable_declarations_final=false
     28sp_cleanup.never_use_blocks=false
     29sp_cleanup.never_use_parentheses_in_expressions=true
     30sp_cleanup.on_save_use_additional_actions=true
     31sp_cleanup.organize_imports=true
     32sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
     33sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
     34sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
     35sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
     36sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
     37sp_cleanup.remove_private_constructors=true
     38sp_cleanup.remove_redundant_type_arguments=true
     39sp_cleanup.remove_trailing_whitespaces=true
     40sp_cleanup.remove_trailing_whitespaces_all=true
     41sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
     42sp_cleanup.remove_unnecessary_casts=true
     43sp_cleanup.remove_unnecessary_nls_tags=false
     44sp_cleanup.remove_unused_imports=true
     45sp_cleanup.remove_unused_local_variables=false
     46sp_cleanup.remove_unused_private_fields=true
     47sp_cleanup.remove_unused_private_members=false
     48sp_cleanup.remove_unused_private_methods=true
     49sp_cleanup.remove_unused_private_types=true
     50sp_cleanup.sort_members=false
     51sp_cleanup.sort_members_all=false
     52sp_cleanup.use_anonymous_class_creation=false
     53sp_cleanup.use_blocks=false
     54sp_cleanup.use_blocks_only_for_return_and_throw=false
     55sp_cleanup.use_lambda=true
     56sp_cleanup.use_parentheses_in_expressions=false
     57sp_cleanup.use_this_for_non_static_field_access=false
     58sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
     59sp_cleanup.use_this_for_non_static_method_access=false
     60sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
     61sp_cleanup.use_type_arguments=false
  • applications/editors/josm/plugins/walkingpapers/build.xml

    r31923 r32476  
    55    <property name="commit.message" value="Changed the constructor signature of the plugin main class"/>
    66    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    7     <property name="plugin.main.version" value="7817"/>
     7    <property name="plugin.main.version" value="10279"/>
    88
    99    <property name="plugin.author" value="Frederik Ram"/>
  • applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersAddLayerAction.java

    r30738 r32476  
    8585
    8686        WalkingPapersLayer wpl = new WalkingPapersLayer(mungedWpId, tile, b, minz, maxz);
    87         Main.main.addLayer(wpl);
    88 
     87        Main.getLayerManager().addLayer(wpl);
    8988    }
    9089
  • applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersLayer.java

    r31114 r32476  
    2121import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    2222import org.openstreetmap.josm.gui.MapView;
    23 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    2423import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
    2524import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
    2625import org.openstreetmap.josm.gui.layer.Layer;
     26import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent;
     27import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener;
     28import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent;
     29import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent;
     30import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent;
     31import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
    2732import org.openstreetmap.josm.tools.ImageProvider;
    2833
     
    6772        clearTileStorage();
    6873
    69         MapView.addLayerChangeListener(new LayerChangeListener() {
    70             public void activeLayerChange(Layer oldLayer, Layer newLayer) {
    71                 // if user changes to a walking papers layer, zoom there just as if
    72                 // it was newly added
    73                 layerAdded(newLayer);
    74             }
    75 
    76             public void layerAdded(Layer newLayer) {
    77                 // only do something if we are affected
    78                 if (newLayer != WalkingPapersLayer.this) return;
    79                 BoundingXYVisitor bbox = new BoundingXYVisitor();
    80                 bbox.visit(printBounds);
    81                 Main.map.mapView.zoomTo(bbox);
    82                 needRedraw = true;
    83             }
    84 
    85             public void layerRemoved(Layer oldLayer) {
    86                 if (oldLayer == WalkingPapersLayer.this) {
    87                     MapView.removeLayerChangeListener(this);
     74        final ActiveLayerChangeListener activeListener = new ActiveLayerChangeListener() {
     75            @Override
     76            public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {
     77                // if user changes to a walking papers layer, zoom there just as if it was newly added
     78                handleNewLayer(Main.getLayerManager().getActiveLayer());
     79            }
     80        };
     81
     82        Main.getLayerManager().addActiveLayerChangeListener(activeListener);
     83        Main.getLayerManager().addLayerChangeListener(new LayerChangeListener() {
     84
     85            @Override
     86            public void layerAdded(LayerAddEvent e) {
     87                handleNewLayer(e.getAddedLayer());
     88            }
     89
     90            @Override
     91            public void layerRemoving(LayerRemoveEvent e) {
     92                if (e.getRemovedLayer() == WalkingPapersLayer.this) {
     93                    Main.getLayerManager().removeLayerChangeListener(this);
     94                    Main.getLayerManager().removeActiveLayerChangeListener(activeListener);
    8895                }
    8996            }
     97
     98            @Override
     99            public void layerOrderChanged(LayerOrderChangeEvent e) {
     100            }
    90101        });
     102    }
     103
     104    private void handleNewLayer(Layer newLayer) {
     105        // only do something if we are affected
     106        if (newLayer != WalkingPapersLayer.this) return;
     107        BoundingXYVisitor bbox = new BoundingXYVisitor();
     108        bbox.visit(printBounds);
     109        Main.map.mapView.zoomTo(bbox);
     110        needRedraw = true;
    91111    }
    92112
     
    117137
    118138    static class TileTimeComp implements Comparator<WalkingPapersTile> {
     139        @Override
    119140        public int compare(WalkingPapersTile s1, WalkingPapersTile s2) {
    120141            long t1 = s1.access_time();
     
    170191        int realHeight = img.getHeight(this);
    171192        if (realWidth == -1 || realHeight == -1)
    172                 return null;
     193            return null;
    173194        int drawWidth = p1.x - p0.x;
    174195        int drawHeight = p1.x - p0.x;
     
    189210
    190211        if (botRight.lon() == 0.0 || botRight.lat() == 0) {
    191                 // probably still initializing
    192                 return;
     212            // probably still initializing
     213            return;
    193214        }
    194215        if (lastTopLeft != null && lastBotRight != null
     
    209230
    210231        if (!LatLon.isValidLat(topLeft.lat())  ||
    211             !LatLon.isValidLat(botRight.lat()) ||
    212             !LatLon.isValidLon(topLeft.lon())  ||
    213             !LatLon.isValidLon(botRight.lon()))
     232                !LatLon.isValidLat(botRight.lat()) ||
     233                !LatLon.isValidLon(topLeft.lon())  ||
     234                !LatLon.isValidLon(botRight.lon()))
    214235            return;
    215236
     
    257278                    // check if tile is in range
    258279                    Bounds tileBounds = new Bounds(new LatLon(tileYToLat(y+1), tileXToLon(x)),
    259                         new LatLon(tileYToLat(y), tileXToLon(x+1)));
     280                            new LatLon(tileYToLat(y), tileXToLon(x+1)));
    260281                    if (!tileBounds.asRect().intersects(printBounds.asRect())) continue;
    261282                    tile = new WalkingPapersTile(x, y, currentZoomLevel, this);
     
    397418    }
    398419
     420    @Override
    399421    public boolean imageUpdate(Image img, int infoflags, int x, int y,
    400422            int width, int height) {
     
    414436    public URL formatImageUrl(int x, int y, int z) {
    415437        String urlstr = tileUrlTemplate.
    416             replace("{x}", String.valueOf(x)).
    417             replace("{y}", String.valueOf(y)).
    418             replace("{z}", String.valueOf(z));
     438                replace("{x}", String.valueOf(x)).
     439                replace("{y}", String.valueOf(y)).
     440                replace("{z}", String.valueOf(z));
    419441        try {
    420442            return new URL(urlstr);
Note: See TracChangeset for help on using the changeset viewer.