Changeset 33530 in osm for applications


Ignore:
Timestamp:
2017-08-26T02:16:05+02:00 (7 years ago)
Author:
donvip
Message:

update to JOSM 12663

Location:
applications/editors/josm/plugins/reltoolbox
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/reltoolbox/build.xml

    r32680 r33530  
    44    <property name="commit.message" value="RelToolbox: make natural sort for relation and find relation lists"/>
    55    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    6     <property name="plugin.main.version" value="10580"/>
     6    <property name="plugin.main.version" value="12663"/>
    77
    88    <property name="plugin.author" value="Ilya Zverev"/>
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/ChosenRelation.java

    r33311 r33530  
    1313import java.util.Set;
    1414
    15 import org.openstreetmap.josm.Main;
    1615import org.openstreetmap.josm.data.Bounds;
    1716import org.openstreetmap.josm.data.osm.Node;
     
    2827import org.openstreetmap.josm.data.osm.event.TagsChangedEvent;
    2928import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent;
     29import org.openstreetmap.josm.gui.MainApplication;
    3030import org.openstreetmap.josm.gui.MapView;
    3131import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent;
     
    4949        chosenRelation = rel;
    5050        analyse();
    51         Main.map.mapView.repaint();
     51        MainApplication.getMap().mapView.repaint();
    5252        fireRelationChanged(oldRel);
    5353    }
     
    124124        // todo: dim chosen relation when changing layer
    125125        // todo: check this WTF!
    126         OsmDataLayer newLayer = Main.getLayerManager().getEditLayer();
     126        OsmDataLayer newLayer = MainApplication.getLayerManager().getEditLayer();
    127127        clear();
    128128        if (newLayer != null && e.getPreviousEditLayer() == null) {
    129             Main.map.mapView.addTemporaryLayer(this);
     129            MainApplication.getMap().mapView.addTemporaryLayer(this);
    130130        } else if (newLayer == null) {
    131             Main.map.mapView.removeTemporaryLayer(this);
     131            MainApplication.getMap().mapView.removeTemporaryLayer(this);
    132132        }
    133133    }
     
    159159            visitedRelations.add(rel);
    160160            for (OsmPrimitive element : rel.getMemberPrimitives()) {
    161                 if (null != element.getType()) switch(element.getType()) {
     161                if (null != element.getType()) {
     162                    switch(element.getType()) {
    162163                    case NODE:
    163164                        Node node = (Node) element;
     
    185186                    default:
    186187                        break;
     188                    }
    187189                }
    188190            }
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/ExtraNameFormatHook.java

    r32398 r33530  
    55import org.openstreetmap.josm.data.osm.IRelation;
    66import org.openstreetmap.josm.data.osm.IWay;
    7 import org.openstreetmap.josm.gui.NameFormatterHook;
     7import org.openstreetmap.josm.data.osm.NameFormatterHook;
    88
    99/**
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextDialog.java

    r33311 r33530  
    6464import org.openstreetmap.josm.command.SequenceCommand;
    6565import org.openstreetmap.josm.data.SelectionChangedListener;
     66import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
    6667import org.openstreetmap.josm.data.osm.OsmPrimitive;
    6768import org.openstreetmap.josm.data.osm.Relation;
     
    7071import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode;
    7172import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
    72 import org.openstreetmap.josm.gui.DefaultNameFormatter;
     73import org.openstreetmap.josm.gui.MainApplication;
    7374import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
    7475import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
     
    7778import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox;
    7879import org.openstreetmap.josm.tools.GBC;
     80import org.openstreetmap.josm.tools.Logging;
    7981import org.openstreetmap.josm.tools.Shortcut;
    8082
     
    125127        chosenRelation = new ChosenRelation();
    126128        chosenRelation.addChosenRelationListener(this);
    127         Main.getLayerManager().addActiveLayerChangeListener(chosenRelation);
     129        MainApplication.getLayerManager().addActiveLayerChangeListener(chosenRelation);
    128130
    129131        popupMenu = new ChosenRelationPopupMenu(chosenRelation);
     
    252254                    Relation relation = (Relation) relationsData.getValueAt(row, 0);
    253255                    if (e.getClickCount() > 1) {
    254                         Main.getLayerManager().getEditLayer().data.setSelected(relation);
     256                        MainApplication.getLayerManager().getEditLayer().data.setSelected(relation);
    255257                    }
    256258                }
     
    337339    public void hideNotify() {
    338340        SelectionEventManager.getInstance().removeSelectionListener(this);
    339         Main.getLayerManager().removeActiveLayerChangeListener(this);
     341        MainApplication.getLayerManager().removeActiveLayerChangeListener(this);
    340342        DatasetEventManager.getInstance().removeDatasetListener(chosenRelation);
    341343        chosenRelation.clear();
     
    345347    public void showNotify() {
    346348        SelectionEventManager.getInstance().addSelectionListener(this, FireMode.IN_EDT_CONSOLIDATED);
    347         Main.getLayerManager().addActiveLayerChangeListener(this);
     349        MainApplication.getLayerManager().addActiveLayerChangeListener(this);
    348350        DatasetEventManager.getInstance().addDatasetListener(chosenRelation, FireMode.IN_EDT);
    349351    }
     
    358360            chosenRelationPanel.setVisible(newRelation != null);
    359361        }
    360         if (Main.getLayerManager().getEditDataSet() != null) {
    361             selectionChanged(Main.getLayerManager().getEditDataSet().getSelected());
     362        if (MainApplication.getLayerManager().getEditDataSet() != null) {
     363            selectionChanged(MainApplication.getLayerManager().getEditDataSet().getSelected());
    362364        }
    363365        roleBoxModel.update();
     
    409411
    410412    private void updateSelection() {
    411         if (Main.getLayerManager().getEditDataSet() == null) {
     413        if (MainApplication.getLayerManager().getEditDataSet() == null) {
    412414            selectionChanged(Collections.<OsmPrimitive>emptyList());
    413415        } else {
    414             selectionChanged(Main.getLayerManager().getEditDataSet().getSelected());
     416            selectionChanged(MainApplication.getLayerManager().getEditDataSet().getSelected());
    415417        }
    416418    }
     
    455457            }
    456458        } catch (Exception e) {
    457             Main.error("[RelToolbox] Error reading possible roles file.");
    458             Main.error(e);
     459            Logging.error("[RelToolbox] Error reading possible roles file.");
     460            Logging.error(e);
    459461        }
    460462        return result;
     
    510512        public void mouseClicked(MouseEvent e) {
    511513            if (e.isControlDown() || !(e.getComponent() instanceof JComboBox)) // do not use left click handler on combo box
    512                 if (SwingUtilities.isLeftMouseButton(e) && chosenRelation.get() != null && Main.getLayerManager().getEditLayer() != null) {
    513                     Main.getLayerManager().getEditLayer().data.setSelected(chosenRelation.get());
     514                if (SwingUtilities.isLeftMouseButton(e) && chosenRelation.get() != null
     515                && MainApplication.getLayerManager().getEditLayer() != null) {
     516                    MainApplication.getLayerManager().getEditLayer().data.setSelected(chosenRelation.get());
    514517                }
    515518        }
     
    549552    protected void applyRoleToSelection(String role) {
    550553        if (chosenRelation != null && chosenRelation.get() != null
    551                 && Main.getLayerManager().getEditDataSet() != null && !Main.getLayerManager().getEditDataSet().selectionEmpty()) {
    552             Collection<OsmPrimitive> selected = Main.getLayerManager().getEditDataSet().getSelected();
     554                && MainApplication.getLayerManager().getEditDataSet() != null
     555                && !MainApplication.getLayerManager().getEditDataSet().selectionEmpty()) {
     556            Collection<OsmPrimitive> selected = MainApplication.getLayerManager().getEditDataSet().getSelected();
    553557            Relation r = chosenRelation.get();
    554558            List<Command> commands = new ArrayList<>();
     
    563567            if (!commands.isEmpty()) {
    564568                //                Main.main.undoRedo.add(new ChangeCommand(chosenRelation.get(), r));
    565                 Main.main.undoRedo.add(new SequenceCommand(tr("Change relation member roles to {0}", role), commands));
     569                MainApplication.undoRedo.add(new SequenceCommand(tr("Change relation member roles to {0}", role), commands));
    566570            }
    567571        }
     
    706710            String role = null;
    707711            if (chosenRelation != null && chosenRelation.get() != null
    708                     && Main.getLayerManager().getEditDataSet() != null && !Main.getLayerManager().getEditDataSet().selectionEmpty()) {
    709                 Collection<OsmPrimitive> selected = Main.getLayerManager().getEditDataSet().getSelected();
     712                    && MainApplication.getLayerManager().getEditDataSet() != null
     713                    && !MainApplication.getLayerManager().getEditDataSet().selectionEmpty()) {
     714                Collection<OsmPrimitive> selected = MainApplication.getLayerManager().getEditDataSet().getSelected();
    710715                for (RelationMember m : chosenRelation.get().getMembers()) {
    711716                    if (selected.contains(m.getMember())) {
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextPlugin.java

    r32395 r33530  
    22package relcontext;
    33
    4 import org.openstreetmap.josm.gui.DefaultNameFormatter;
     4import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
    55import org.openstreetmap.josm.gui.MapFrame;
    66import org.openstreetmap.josm.plugins.Plugin;
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/AddRemoveMemberAction.java

    r32398 r33530  
    99import java.util.Collection;
    1010
    11 import org.openstreetmap.josm.Main;
    1211import org.openstreetmap.josm.actions.JosmAction;
    1312import org.openstreetmap.josm.command.ChangeCommand;
     
    2019import org.openstreetmap.josm.data.osm.RelationMember;
    2120import org.openstreetmap.josm.data.osm.Way;
     21import org.openstreetmap.josm.gui.MainApplication;
    2222import org.openstreetmap.josm.gui.util.GuiHelper;
    2323import org.openstreetmap.josm.tools.ImageProvider;
     
    8282
    8383        if (!r.getMemberPrimitives().equals(rel.get().getMemberPrimitives())) {
    84             Main.main.undoRedo.add(new ChangeCommand(rel.get(), r));
     84            MainApplication.undoRedo.add(new ChangeCommand(rel.get(), r));
    8585        }
    8686    }
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateMultipolygonAction.java

    r32398 r33530  
    4141import org.openstreetmap.josm.data.osm.RelationMember;
    4242import org.openstreetmap.josm.data.osm.Way;
     43import org.openstreetmap.josm.gui.MainApplication;
    4344import org.openstreetmap.josm.tools.GBC;
    4445import org.openstreetmap.josm.tools.Shortcut;
     
    104105                    rels = TheRing.makeManySimpleMultipolygons(ds.getSelectedWays(), commands);
    105106                    if (!commands.isEmpty()) {
    106                         Main.main.undoRedo.add(new SequenceCommand(tr("Create multipolygons from rings"), commands));
     107                        MainApplication.undoRedo.add(new SequenceCommand(tr("Create multipolygons from rings"), commands));
    107108                    }
    108109                }
     
    147148        List<Command> list = removeTagsFromInnerWays(rel);
    148149        if (!list.isEmpty() && isBoundary) {
    149             Main.main.undoRedo.add(new SequenceCommand(tr("Move tags from ways to relation"), list));
     150            MainApplication.undoRedo.add(new SequenceCommand(tr("Move tags from ways to relation"), list));
    150151            list = new ArrayList<>();
    151152        }
     
    159160        }
    160161        list.add(new AddCommand(rel));
    161         Main.main.undoRedo.add(new SequenceCommand(tr("Create multipolygon"), list));
     162        MainApplication.undoRedo.add(new SequenceCommand(tr("Create multipolygon"), list));
    162163
    163164        if (chRel != null) {
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateRelationAction.java

    r32398 r33530  
    2525import org.openstreetmap.josm.data.osm.Relation;
    2626import org.openstreetmap.josm.data.osm.RelationMember;
     27import org.openstreetmap.josm.gui.MainApplication;
    2728import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox;
    2829import org.openstreetmap.josm.tools.GBC;
     
    6768        }
    6869
    69         Main.main.undoRedo.add(new AddCommand(rel));
     70        MainApplication.undoRedo.add(new AddCommand(rel));
    7071
    7172        if (chRel != null) {
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DeleteChosenRelationAction.java

    r32398 r33530  
    99import javax.swing.AbstractAction;
    1010
    11 import org.openstreetmap.josm.Main;
    1211import org.openstreetmap.josm.command.Command;
    1312import org.openstreetmap.josm.command.DeleteCommand;
    1413import org.openstreetmap.josm.data.osm.Relation;
     14import org.openstreetmap.josm.gui.MainApplication;
    1515import org.openstreetmap.josm.tools.ImageProvider;
    1616
     
    3333        Relation r = rel.get();
    3434        rel.clear();
    35         Command c = DeleteCommand.delete(Main.getLayerManager().getEditLayer(), Collections.singleton(r), true, true);
     35        Command c = DeleteCommand.delete(MainApplication.getLayerManager().getEditLayer(), Collections.singleton(r), true, true);
    3636        if (c != null) {
    37             Main.main.undoRedo.add(c);
     37            MainApplication.undoRedo.add(c);
    3838        }
    3939    }
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DownloadChosenRelationAction.java

    r32398 r33530  
    1111import javax.swing.AbstractAction;
    1212
    13 import org.openstreetmap.josm.Main;
    1413import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1514import org.openstreetmap.josm.data.osm.Relation;
    1615import org.openstreetmap.josm.data.osm.RelationMember;
     16import org.openstreetmap.josm.gui.MainApplication;
    1717import org.openstreetmap.josm.gui.dialogs.relation.DownloadRelationMemberTask;
    1818import org.openstreetmap.josm.gui.dialogs.relation.DownloadRelationTask;
     
    6767    protected void downloadMembers(Relation rel) {
    6868        if (!rel.isNew()) {
    69             Main.worker.submit(new DownloadRelationTask(Collections.singletonList(rel), Main.getLayerManager().getEditLayer()));
     69            MainApplication.worker.submit(
     70                    new DownloadRelationTask(Collections.singletonList(rel), MainApplication.getLayerManager().getEditLayer()));
    7071        }
    7172    }
     
    7677        ret.addAll(rel.getIncompleteMembers());
    7778        if (ret.isEmpty()) return;
    78         Main.worker.submit(new DownloadRelationMemberTask(Collections.singletonList(rel), ret, Main.getLayerManager().getEditLayer()));
     79        MainApplication.worker.submit(
     80                new DownloadRelationMemberTask(Collections.singletonList(rel), ret, MainApplication.getLayerManager().getEditLayer()));
    7981    }
    8082}
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DownloadParentsAction.java

    r32398 r33530  
    1313import javax.swing.AbstractAction;
    1414
    15 import org.openstreetmap.josm.Main;
    1615import org.openstreetmap.josm.actions.downloadtasks.DownloadReferrersTask;
    1716import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1817import org.openstreetmap.josm.data.osm.Relation;
     18import org.openstreetmap.josm.gui.MainApplication;
    1919import org.openstreetmap.josm.gui.dialogs.relation.DownloadRelationMemberTask;
    2020import org.openstreetmap.josm.gui.dialogs.relation.DownloadRelationTask;
     
    3838        this.rel = rel;
    3939        rel.addChosenRelationListener(this);
    40         setEnabled(rel.get() != null && Main.getLayerManager().getEditLayer() != null);
     40        setEnabled(rel.get() != null && MainApplication.getLayerManager().getEditLayer() != null);
    4141    }
    4242
     
    4848        objects.add(relation);
    4949        objects.addAll(relation.getMemberPrimitives());
    50         Main.worker.submit(new DownloadReferrersTask(Main.getLayerManager().getEditLayer(), objects));
     50        MainApplication.worker.submit(
     51                new DownloadReferrersTask(MainApplication.getLayerManager().getEditLayer(), objects));
    5152    }
    5253
    5354    @Override
    5455    public void chosenRelationChanged(Relation oldRelation, Relation newRelation) {
    55         setEnabled(newRelation != null && Main.getLayerManager().getEditLayer() != null);
     56        setEnabled(newRelation != null && MainApplication.getLayerManager().getEditLayer() != null);
    5657    }
    5758
    5859    protected void downloadMembers(Relation rel) {
    5960        if (!rel.isNew()) {
    60             Main.worker.submit(new DownloadRelationTask(Collections.singletonList(rel), Main.getLayerManager().getEditLayer()));
     61            MainApplication.worker.submit(
     62                    new DownloadRelationTask(Collections.singletonList(rel), MainApplication.getLayerManager().getEditLayer()));
    6163        }
    6264    }
     
    6769        ret.addAll(rel.getIncompleteMembers());
    6870        if (ret.isEmpty()) return;
    69         Main.worker.submit(new DownloadRelationMemberTask(Collections.singletonList(rel), ret, Main.getLayerManager().getEditLayer()));
     71        MainApplication.worker.submit(
     72                new DownloadRelationMemberTask(Collections.singletonList(rel), ret, MainApplication.getLayerManager().getEditLayer()));
    7073    }
    7174}
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DuplicateChosenRelationAction.java

    r32398 r33530  
    88import javax.swing.AbstractAction;
    99
    10 import org.openstreetmap.josm.Main;
    1110import org.openstreetmap.josm.command.AddCommand;
    1211import org.openstreetmap.josm.data.osm.Relation;
     12import org.openstreetmap.josm.gui.MainApplication;
    1313import org.openstreetmap.josm.tools.ImageProvider;
    1414
     
    3232        Relation r = rel.get();
    3333        Relation copy = new Relation(r, true);
    34         Main.main.undoRedo.add(new AddCommand(copy));
     34        MainApplication.undoRedo.add(new AddCommand(copy));
    3535        rel.set(copy);
    36         if (Main.getLayerManager().getEditDataSet() != null) {
    37             Main.getLayerManager().getEditDataSet().setSelected(copy);
     36        if (MainApplication.getLayerManager().getEditDataSet() != null) {
     37            MainApplication.getLayerManager().getEditDataSet().setSelected(copy);
    3838        }
    3939    }
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/EditChosenRelationAction.java

    r32398 r33530  
    88import javax.swing.AbstractAction;
    99
    10 import org.openstreetmap.josm.Main;
    1110import org.openstreetmap.josm.data.osm.Relation;
     11import org.openstreetmap.josm.gui.MainApplication;
    1212import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor;
    1313import org.openstreetmap.josm.tools.ImageProvider;
     
    3636        Relation relation = rel.get();
    3737        if (relation == null) return;
    38         RelationEditor.getEditor(Main.getLayerManager().getEditLayer(), relation, null).setVisible(true);
     38        RelationEditor.getEditor(MainApplication.getLayerManager().getEditLayer(), relation, null).setVisible(true);
    3939    }
    4040
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/FindRelationAction.java

    r33265 r33530  
    3131import org.openstreetmap.josm.Main;
    3232import org.openstreetmap.josm.actions.JosmAction;
     33import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
    3334import org.openstreetmap.josm.data.osm.Relation;
    34 import org.openstreetmap.josm.gui.DefaultNameFormatter;
    3535import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
     36import org.openstreetmap.josm.tools.Logging;
    3637import org.openstreetmap.josm.tools.Shortcut;
    3738
     
    159160        }
    160161
    161         if (Main.isDebugEnabled()) {
    162             Main.debug("keywords.length = " + keywords.length);
     162        if (Logging.isDebugEnabled()) {
     163            Logging.debug("keywords.length = " + keywords.length);
    163164            for (int i = 0; i < keywords.length; i++) {
    164                 Main.debug("keyword["+i+"] = " + keywords[i]);
     165                Logging.debug("keyword["+i+"] = " + keywords[i]);
    165166            }
    166167        }
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructPolygonAction.java

    r33265 r33530  
    2424import org.openstreetmap.josm.command.SequenceCommand;
    2525import org.openstreetmap.josm.data.coor.EastNorth;
     26import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
    2627import org.openstreetmap.josm.data.osm.MultipolygonBuilder;
    2728import org.openstreetmap.josm.data.osm.MultipolygonBuilder.JoinedPolygon;
     
    3031import org.openstreetmap.josm.data.osm.RelationMember;
    3132import org.openstreetmap.josm.data.osm.Way;
    32 import org.openstreetmap.josm.gui.DefaultNameFormatter;
     33import org.openstreetmap.josm.gui.MainApplication;
    3334import org.openstreetmap.josm.tools.ImageProvider;
    3435
     
    8485        List<OsmPrimitive> newSelection = new ArrayList<>();
    8586        List<Command> commands = new ArrayList<>();
    86         Command relationDeleteCommand = DeleteCommand.delete(Main.getLayerManager().getEditLayer(), Collections.singleton(r), true, true);
     87        Command relationDeleteCommand = DeleteCommand.delete(
     88                MainApplication.getLayerManager().getEditLayer(), Collections.singleton(r), true, true);
    8789        if (relationDeleteCommand == null)
    8890            return;
     
    195197        }
    196198
    197         Main.main.undoRedo.add(new SequenceCommand(tr("Reconstruct polygons from relation {0}",
     199        MainApplication.undoRedo.add(new SequenceCommand(tr("Reconstruct polygons from relation {0}",
    198200                r.getDisplayName(DefaultNameFormatter.getInstance())), commands));
    199         Main.getLayerManager().getEditDataSet().setSelected(newSelection);
     201        MainApplication.getLayerManager().getEditDataSet().setSelected(newSelection);
    200202    }
    201203
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructRouteAction.java

    r32398 r33530  
    1212import javax.swing.AbstractAction;
    1313
    14 import org.openstreetmap.josm.Main;
    1514import org.openstreetmap.josm.command.ChangeCommand;
    1615import org.openstreetmap.josm.command.Command;
     
    2221import org.openstreetmap.josm.data.osm.RelationMember;
    2322import org.openstreetmap.josm.data.osm.Way;
     23import org.openstreetmap.josm.gui.MainApplication;
    2424import org.openstreetmap.josm.gui.dialogs.relation.sort.RelationSorter;
    2525import org.openstreetmap.josm.tools.Geometry;
     
    190190        }
    191191        Command command = new ChangeCommand(r, recRel);
    192         Main.main.undoRedo.add(command);
     192        MainApplication.undoRedo.add(command);
    193193    }
    194194
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/RelationHelpAction.java

    r32398 r33530  
    1515import org.openstreetmap.josm.Main;
    1616import org.openstreetmap.josm.data.osm.Relation;
     17import org.openstreetmap.josm.gui.MainApplication;
    1718import org.openstreetmap.josm.tools.ImageProvider;
    1819import org.openstreetmap.josm.tools.LanguageInfo;
     
    6162            uris.add(new URI(String.format("%sRelations", base)));
    6263
    63             Main.worker.execute(new Runnable() {
    64                 @Override
    65                 public void run() {
    66                     try {
    67                         // find a page that actually exists in the wiki
    68                         HttpURLConnection conn;
    69                         for (URI u : uris) {
    70                             conn = (HttpURLConnection) u.toURL().openConnection();
     64            MainApplication.worker.execute(() -> {
     65                try {
     66                    // find a page that actually exists in the wiki
     67                    HttpURLConnection conn;
     68                    for (URI u : uris) {
     69                        conn = (HttpURLConnection) u.toURL().openConnection();
     70                        conn.setConnectTimeout(5000);
     71
     72                        if (conn.getResponseCode() != 200) {
     73                            System.out.println("INFO: " + u + " does not exist");
     74                            conn.disconnect();
     75                        } else {
     76                            int osize = conn.getContentLength();
     77                            conn.disconnect();
     78
     79                            conn = (HttpURLConnection) new URI(u.toString()
     80                                    .replace("=", "%3D") /* do not URLencode whole string! */
     81                                    .replaceFirst("/wiki/", "/w/index.php?redirect=no&title=")
     82                                    ).toURL().openConnection();
    7183                            conn.setConnectTimeout(5000);
    7284
    73                             if (conn.getResponseCode() != 200) {
    74                                 System.out.println("INFO: " + u + " does not exist");
     85                            /* redirect pages have different content length, but retrieving a "nonredirect"
     86                             *  page using index.php and the direct-link method gives slightly different
     87                             *  content lengths, so we have to be fuzzy.. (this is UGLY, recode if u know better)
     88                             */
     89                            if (Math.abs(conn.getContentLength() - osize) > 200) {
     90                                System.out.println("INFO: " + u + " is a mediawiki redirect");
    7591                                conn.disconnect();
    7692                            } else {
    77                                 int osize = conn.getContentLength();
     93                                System.out.println("INFO: browsing to " + u);
    7894                                conn.disconnect();
    7995
    80                                 conn = (HttpURLConnection) new URI(u.toString()
    81                                         .replace("=", "%3D") /* do not URLencode whole string! */
    82                                         .replaceFirst("/wiki/", "/w/index.php?redirect=no&title=")
    83                                         ).toURL().openConnection();
    84                                 conn.setConnectTimeout(5000);
    85 
    86                                 /* redirect pages have different content length, but retrieving a "nonredirect"
    87                                  *  page using index.php and the direct-link method gives slightly different
    88                                  *  content lengths, so we have to be fuzzy.. (this is UGLY, recode if u know better)
    89                                  */
    90                                 if (Math.abs(conn.getContentLength() - osize) > 200) {
    91                                     System.out.println("INFO: " + u + " is a mediawiki redirect");
    92                                     conn.disconnect();
    93                                 } else {
    94                                     System.out.println("INFO: browsing to " + u);
    95                                     conn.disconnect();
    96 
    97                                     OpenBrowser.displayUrl(u.toString());
    98                                     break;
    99                                 }
     96                                OpenBrowser.displayUrl(u.toString());
     97                                break;
    10098                            }
    10199                        }
    102                     } catch (Exception e) {
    103                         e.printStackTrace();
    104100                    }
     101                } catch (Exception e1) {
     102                    e1.printStackTrace();
    105103                }
    106104            });
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SelectInRelationPanelAction.java

    r32395 r33530  
    88import javax.swing.AbstractAction;
    99
    10 import org.openstreetmap.josm.Main;
    1110import org.openstreetmap.josm.data.osm.Relation;
     11import org.openstreetmap.josm.gui.MainApplication;
    1212import org.openstreetmap.josm.tools.ImageProvider;
    1313
     
    3131    public void actionPerformed(ActionEvent e) {
    3232        if (rel.get() != null) {
    33             Main.map.relationListDialog.selectRelation(rel.get());
    34             Main.map.relationListDialog.unfurlDialog();
     33            MainApplication.getMap().relationListDialog.selectRelation(rel.get());
     34            MainApplication.getMap().relationListDialog.unfurlDialog();
    3535        }
    3636    }
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SelectMembersAction.java

    r32398 r33530  
    88import javax.swing.AbstractAction;
    99
    10 import org.openstreetmap.josm.Main;
    1110import org.openstreetmap.josm.data.osm.Relation;
     11import org.openstreetmap.josm.gui.MainApplication;
    1212import org.openstreetmap.josm.tools.ImageProvider;
    1313
     
    2828    @Override
    2929    public void actionPerformed(ActionEvent e) {
    30         Main.getLayerManager().getEditLayer().data.setSelected(rel.get() == null ? null : rel.get().getMemberPrimitives());
     30        MainApplication.getLayerManager().getEditLayer().data.setSelected(rel.get() == null ? null : rel.get().getMemberPrimitives());
    3131    }
    3232
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SelectRelationAction.java

    r32398 r33530  
    88import javax.swing.AbstractAction;
    99
    10 import org.openstreetmap.josm.Main;
    1110import org.openstreetmap.josm.data.osm.Relation;
     11import org.openstreetmap.josm.gui.MainApplication;
    1212import org.openstreetmap.josm.tools.ImageProvider;
    1313
     
    2929    @Override
    3030    public void actionPerformed(ActionEvent e) {
    31         Main.getLayerManager().getEditLayer().data.setSelected(rel.get() == null ? null : rel.get());
     31        MainApplication.getLayerManager().getEditLayer().data.setSelected(rel.get() == null ? null : rel.get());
    3232    }
    3333
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SortAndFixAction.java

    r32398 r33530  
    1111import javax.swing.Action;
    1212
    13 import org.openstreetmap.josm.Main;
    1413import org.openstreetmap.josm.command.Command;
    1514import org.openstreetmap.josm.data.osm.Relation;
    1615import org.openstreetmap.josm.data.osm.RelationMember;
     16import org.openstreetmap.josm.gui.MainApplication;
    1717import org.openstreetmap.josm.tools.ImageProvider;
    1818
     
    5757        Command c = fixRelation(rel.get());
    5858        if (c != null) {
    59             Main.main.undoRedo.add(c);
     59            MainApplication.undoRedo.add(c);
    6060        }
    6161    }
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SplittingMultipolygons.java

    r32398 r33530  
    2020import org.openstreetmap.josm.data.coor.EastNorth;
    2121import org.openstreetmap.josm.data.coor.LatLon;
     22import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
    2223import org.openstreetmap.josm.data.osm.Node;
    2324import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    2526import org.openstreetmap.josm.data.osm.RelationMember;
    2627import org.openstreetmap.josm.data.osm.Way;
    27 import org.openstreetmap.josm.gui.DefaultNameFormatter;
     28import org.openstreetmap.josm.gui.MainApplication;
    2829import org.openstreetmap.josm.tools.Geometry;
    2930import org.openstreetmap.josm.tools.Geometry.PolygonIntersection;
     
    4344        List<Way> rings = new ArrayList<>();
    4445        List<Way> arcs = new ArrayList<>();
    45         Area a = Main.getLayerManager().getEditDataSet().getDataSourceArea();
     46        Area a = MainApplication.getLayerManager().getEditDataSet().getDataSourceArea();
    4647        for (Way way : ways) {
    4748            if (way.isDeleted())
     
    104105            Relation newRelation = SplittingMultipolygons.attachRingToNeighbours(ring, commands);
    105106            if (newRelation != null && !commands.isEmpty()) {
    106                 Main.main.undoRedo.add(commands.get(0));
     107                MainApplication.undoRedo.add(commands.get(0));
    107108                result.add(newRelation);
    108109            }
     
    113114            Relation newRelation = SplittingMultipolygons.tryToCloseOneWay(arc, commands);
    114115            if (newRelation != null && !commands.isEmpty()) {
    115                 Main.main.undoRedo.add(commands.get(0));
     116                MainApplication.undoRedo.add(commands.get(0));
    116117                result.add(newRelation);
    117118            }
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/TheRing.java

    r32398 r33530  
    2424import org.openstreetmap.josm.tools.Geometry;
    2525import org.openstreetmap.josm.tools.Geometry.PolygonIntersection;
     26import org.openstreetmap.josm.tools.Logging;
    2627
    2728/**
     
    431432
    432433    private static void log(String s) {
    433         Main.debug(s);
     434        Logging.debug(s);
    434435    }
    435436
Note: See TracChangeset for help on using the changeset viewer.