Changeset 34498 in osm


Ignore:
Timestamp:
2018-08-18T03:17:09+02:00 (6 years ago)
Author:
donvip
Message:

update to JOSM 14153

Location:
applications/editors/josm/plugins/CommandLine
Files:
3 edited

Legend:

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

    r34276 r34498  
    44    <property name="commit.message" value="JOSM/CommandLine: fix exception after JOSM update"/>
    55    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    6     <property name="plugin.main.version" value="13914"/>
     6    <property name="plugin.main.version" value="14153"/>
    77
    88    <!-- Configure these properties (replace "..." accordingly).
  • applications/editors/josm/plugins/CommandLine/src/CommandLine/CommandLine.java

    r34342 r34498  
    3333import javax.swing.SwingUtilities;
    3434
    35 import org.openstreetmap.josm.Main;
    3635import org.openstreetmap.josm.actions.mapmode.MapMode;
    3736import org.openstreetmap.josm.command.SequenceCommand;
     37import org.openstreetmap.josm.data.Preferences;
     38import org.openstreetmap.josm.data.UndoRedoHandler;
    3839import org.openstreetmap.josm.data.imagery.ImageryInfo;
    3940import org.openstreetmap.josm.data.osm.BBox;
     
    5758import org.openstreetmap.josm.plugins.Plugin;
    5859import org.openstreetmap.josm.plugins.PluginInformation;
     60import org.openstreetmap.josm.spi.preferences.Config;
    5961import org.openstreetmap.josm.tools.HttpClient;
    6062import org.openstreetmap.josm.tools.Logging;
     
    7577    protected MapMode previousMode;
    7678
    77     static final String pluginDir = Main.pref.getPluginsDirectory().getAbsolutePath() + "/CommandLine/";
     79    static final String pluginDir = Preferences.main().getPluginsDirectory().getAbsolutePath() + "/CommandLine/";
    7880
    7981    public CommandLine(PluginInformation info) {
     
    148150        commands = (new Loader(getPluginDirs().getUserDataDirectory(false))).load();
    149151        if (commands.isEmpty()) {
    150             if (!GraphicsEnvironment.isHeadless() && JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(Main.parent,
     152            if (!GraphicsEnvironment.isHeadless() && JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(MainApplication.getMainFrame(),
    151153                    tr("No command has been found. Would you like to download and install default commands now?"),
    152154                    tr("No command found"), JOptionPane.YES_NO_CANCEL_OPTION)) {
     
    154156                    downloadAndInstallDefaultCommands();
    155157                    commands = (new Loader(getPluginDirs().getUserDataDirectory(false))).load();
    156                     JOptionPane.showMessageDialog(Main.parent, tr("Default commands have been successfully installed"),
     158                    JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Default commands have been successfully installed"),
    157159                            tr("Success"), JOptionPane.INFORMATION_MESSAGE);
    158160                } catch (IOException e) {
    159161                    Logging.warn(e);
    160                     JOptionPane.showMessageDialog(Main.parent,
     162                    JOptionPane.showMessageDialog(MainApplication.getMainFrame(),
    161163                            tr("Failed to download and install default commands.\n\nError: {0}", e.getMessage()),
    162164                            tr("Warning"), JOptionPane.WARNING_MESSAGE);
     
    170172
    171173    private void downloadAndInstallDefaultCommands() throws IOException {
    172         String url = Main.pref.get("commandline.default.commands.url",
     174        String url = Config.getPref().get("commandline.default.commands.url",
    173175                "https://github.com/Foxhind/JOSM-CommandLine-commands/archive/master.zip");
    174176        try (ZipInputStream zis = new ZipInputStream(HttpClient.create(new URL(url)).connect().getContent(), StandardCharsets.UTF_8)) {
     
    256258                break;
    257259            case USERNAME:
    258                 loadParameter(Main.pref.get("osm-server.username", null), true);
     260                loadParameter(Config.getPref().get("osm-server.username", null), true);
    259261                action = new DummyAction(this);
    260262                break;
     
    613615                if (!cmdlist.isEmpty()) {
    614616                    final SequenceCommand cmd = new SequenceCommand(commandName, cmdlist);
    615                     SwingUtilities.invokeLater(() -> Main.main.undoRedo.add(cmd));
     617                    SwingUtilities.invokeLater(() -> UndoRedoHandler.getInstance().add(cmd));
    616618                }
    617619            } catch (Exception e) {
     
    630632        synchronized (syncObj) {
    631633            try {
    632                 syncObj.wait(Main.pref.getInt("commandline.timeout", 20000));
     634                syncObj.wait(Config.getPref().getInt("commandline.timeout", 20000));
    633635            } catch (InterruptedException e) {
    634636                Logging.warn(e);
  • applications/editors/josm/plugins/CommandLine/src/CommandLine/PointAction.java

    r33984 r34498  
    1616import javax.swing.JOptionPane;
    1717
    18 import org.openstreetmap.josm.Main;
    1918import org.openstreetmap.josm.actions.mapmode.MapMode;
    2019import org.openstreetmap.josm.data.coor.LatLon;
     
    8786                    coor = nearestNode.getCoor();
    8887                if (coor.isOutSideWorld()) {
    89                     JOptionPane.showMessageDialog(Main.parent, tr("Can not draw outside of the world."));
     88                    JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Can not draw outside of the world."));
    9089                    return;
    9190                }
Note: See TracChangeset for help on using the changeset viewer.