Ignore:
Timestamp:
2013-12-22T12:27:11+01:00 (11 years ago)
Author:
donvip
Message:

[josm-plugins] global replacement of Main.map.mapview.getEditLayer() by Main.main.getEditLayer() (avoids NPEs)

Location:
applications/editors/josm/plugins/reltoolbox/src/relcontext
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextDialog.java

    r29535 r30145  
    243243                    Relation relation = (Relation)relationsData.getValueAt(row, 0);
    244244                    if( e.getClickCount() > 1 ) {
    245                         Main.map.mapView.getEditLayer().data.setSelected(relation);
     245                        Main.main.getEditLayer().data.setSelected(relation);
    246246                    }
    247247                }
     
    487487        public void mouseClicked( MouseEvent e ) {
    488488            if( e.isControlDown() || !(e.getComponent() instanceof JComboBox ) ) // do not use left click handler on combo box
    489             if( SwingUtilities.isLeftMouseButton(e) && chosenRelation.get() != null && Main.map.mapView.getEditLayer() != null ) {
    490                 Main.map.mapView.getEditLayer().data.setSelected(chosenRelation.get());
     489            if( SwingUtilities.isLeftMouseButton(e) && chosenRelation.get() != null && Main.main.getEditLayer() != null ) {
     490                Main.main.getEditLayer().data.setSelected(chosenRelation.get());
    491491            }
    492492        }
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DownloadChosenRelationAction.java

    r25695 r30145  
    6262    protected void downloadMembers( Relation rel ) {
    6363        if( !rel.isNew() ) {
    64             Main.worker.submit(new DownloadRelationTask(Collections.singletonList(rel), Main.map.mapView.getEditLayer()));
     64            Main.worker.submit(new DownloadRelationTask(Collections.singletonList(rel), Main.main.getEditLayer()));
    6565        }
    6666    }
     
    7171        ret.addAll(rel.getIncompleteMembers());
    7272        if( ret.isEmpty() ) return;
    73         Main.worker.submit(new DownloadRelationMemberTask(Collections.singletonList(rel), ret, Main.map.mapView.getEditLayer()));
     73        Main.worker.submit(new DownloadRelationMemberTask(Collections.singletonList(rel), ret, Main.main.getEditLayer()));
    7474    }
    7575}
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DownloadParentsAction.java

    r29535 r30145  
    3737        this.rel = rel;
    3838        rel.addChosenRelationListener(this);
    39         setEnabled(rel.get() != null && Main.map.mapView.getEditLayer() != null);
     39        setEnabled(rel.get() != null && Main.main.getEditLayer() != null);
    4040    }
    4141
     
    4646        objects.add(relation);
    4747        objects.addAll(relation.getMemberPrimitives());
    48         Main.worker.submit(new DownloadReferrersTask(Main.map.mapView.getEditLayer(), objects));
     48        Main.worker.submit(new DownloadReferrersTask(Main.main.getEditLayer(), objects));
    4949    }
    5050
    5151    public void chosenRelationChanged( Relation oldRelation, Relation newRelation ) {
    52         setEnabled(newRelation != null && Main.map.mapView.getEditLayer() != null);
     52        setEnabled(newRelation != null && Main.main.getEditLayer() != null);
    5353    }
    5454
    5555    protected void downloadMembers( Relation rel ) {
    5656        if( !rel.isNew() ) {
    57             Main.worker.submit(new DownloadRelationTask(Collections.singletonList(rel), Main.map.mapView.getEditLayer()));
     57            Main.worker.submit(new DownloadRelationTask(Collections.singletonList(rel), Main.main.getEditLayer()));
    5858        }
    5959    }
     
    6464        ret.addAll(rel.getIncompleteMembers());
    6565        if( ret.isEmpty() ) return;
    66         Main.worker.submit(new DownloadRelationMemberTask(Collections.singletonList(rel), ret, Main.map.mapView.getEditLayer()));
     66        Main.worker.submit(new DownloadRelationMemberTask(Collections.singletonList(rel), ret, Main.main.getEditLayer()));
    6767    }
    6868}
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/EditChosenRelationAction.java

    r25711 r30145  
    3232        Relation relation = rel.get();
    3333        if( relation == null ) return;
    34         RelationEditor.getEditor(Main.map.mapView.getEditLayer(), relation, null).setVisible(true);
     34        RelationEditor.getEditor(Main.main.getEditLayer(), relation, null).setVisible(true);
    3535    }
    3636
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SelectMembersAction.java

    r25711 r30145  
    2222
    2323    public void actionPerformed( ActionEvent e ) {
    24         Main.map.mapView.getEditLayer().data.setSelected(rel.get() == null ? null : rel.get().getMemberPrimitives());
     24        Main.main.getEditLayer().data.setSelected(rel.get() == null ? null : rel.get().getMemberPrimitives());
    2525    }
    2626
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SelectRelationAction.java

    r25711 r30145  
    2323
    2424    public void actionPerformed( ActionEvent e ) {
    25         Main.map.mapView.getEditLayer().data.setSelected(rel.get() == null ? null : rel.get());
     25        Main.main.getEditLayer().data.setSelected(rel.get() == null ? null : rel.get());
    2626    }
    2727
Note: See TracChangeset for help on using the changeset viewer.