Changeset 3707 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2010-12-08T11:02:25+01:00 (14 years ago)
Author:
bastiK
Message:

Added remotecontrol plugin to josm core. This plugin was initially written by Frederik Ramm (frederik) and incorporates code taken from YWMS plugin by frsantos. Major contributions by Bodo Meissner (bomm) and stephankn. Note: The code has been added, but is not "active" yet (RemoteControl.on == false). This is because wmsplugin and imagery plugin has not been adapted to this change. They are about to be integrated as well, so this adaption is not necessary.

Location:
trunk/src/org/openstreetmap/josm
Files:
14 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r3671 r3707  
    4646import org.openstreetmap.josm.data.validation.tests.UntaggedWay;
    4747import org.openstreetmap.josm.data.validation.tests.WronglyOrderedWays;
    48 import org.openstreetmap.josm.data.validation.util.ValUtil;
    4948import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    50 import org.openstreetmap.josm.gui.dialogs.ValidatorDialog;
    5149import org.openstreetmap.josm.gui.layer.ValidatorLayer;
    5250import org.openstreetmap.josm.gui.layer.Layer;
     
    6664    /** The validate action */
    6765    public ValidateAction validateAction = new ValidateAction();
    68 
    69     /** The validation dialog */
    70     ValidatorDialog validationDialog;
    7166
    7267    /** Grid detail, multiplier of east,north values for valuable cell sizing */
     
    10398
    10499    public OsmValidator() {
    105         checkPluginDir();
     100        checkValidatorDir();
    106101        initializeGridDetail();
    107102        initializeTests(getTests());
     
    110105
    111106    /**
     107     * Returns the plugin's directory of the plugin
     108     *
     109     * @return The directory of the plugin
     110     */
     111    public static String getValidatorDir()
     112    {
     113        return Main.pref.getPreferencesDir() + "validator/";
     114    }
     115
     116    /**
    112117     * Check if plugin directory exists (store ignored errors file)
    113118     */
    114     private void checkPluginDir() {
     119    private void checkValidatorDir() {
    115120        try {
    116             File pathDir = new File(ValUtil.getPluginDir());
     121            File pathDir = new File(getValidatorDir());
    117122            if (!pathDir.exists()) {
    118123                pathDir.mkdirs();
     
    127132        if (Main.pref.getBoolean(ValidatorPreference.PREF_USE_IGNORE, true)) {
    128133            try {
    129                 final BufferedReader in = new BufferedReader(new FileReader(ValUtil.getPluginDir() + "ignorederrors"));
     134                final BufferedReader in = new BufferedReader(new FileReader(getValidatorDir() + "ignorederrors"));
    130135                for (String line = in.readLine(); line != null; line = in.readLine()) {
    131136                    ignoredErrors.add(line);
     
    149154    public static void saveIgnoredErrors() {
    150155        try {
    151             final PrintWriter out = new PrintWriter(new FileWriter(ValUtil.getPluginDir() + "ignorederrors"), false);
     156            final PrintWriter out = new PrintWriter(new FileWriter(getValidatorDir() + "ignorederrors"), false);
    152157            for (String e : ignoredErrors) {
    153158                out.println(e);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

    r3674 r3707  
    4848import org.openstreetmap.josm.data.osm.Relation;
    4949import org.openstreetmap.josm.data.osm.Way;
     50import org.openstreetmap.josm.data.validation.OsmValidator;
    5051import org.openstreetmap.josm.data.validation.Severity;
    5152import org.openstreetmap.josm.data.validation.Test;
    5253import org.openstreetmap.josm.data.validation.TestError;
    5354import org.openstreetmap.josm.data.validation.util.Entities;
    54 import org.openstreetmap.josm.data.validation.util.ValUtil;
    5555import org.openstreetmap.josm.gui.preferences.ValidatorPreference;
    5656import org.openstreetmap.josm.gui.preferences.TaggingPresetPreference;
     
    199199        for (String source : sources.split(";")) {
    200200            try {
    201                 MirroredInputStream s = new MirroredInputStream(source, ValUtil.getPluginDir(), -1);
     201                MirroredInputStream s = new MirroredInputStream(source, OsmValidator.getValidatorDir(), -1);
    202202                InputStreamReader r;
    203203                try {
  • trunk/src/org/openstreetmap/josm/data/validation/util/ValUtil.java

    r3671 r3707  
    1010import java.util.Set;
    1111
    12 import org.openstreetmap.josm.Main;
    1312import org.openstreetmap.josm.data.osm.Node;
    1413import org.openstreetmap.josm.data.osm.Way;
     
    2221public class ValUtil
    2322{
    24     /**
    25      * Returns the plugin's directory of the plugin
    26      *
    27      * @return The directory of the plugin
    28      */
    29     public static String getPluginDir()
    30     {
    31         return Main.pref.getPreferencesDir() + "validator/";
    32     }
    33 
    3423    /**
    3524     * Returns the start and end cells of a way.
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r3686 r3707  
    3939import org.openstreetmap.josm.io.auth.CredentialsManagerFactory;
    4040import org.openstreetmap.josm.io.auth.DefaultAuthenticator;
     41import org.openstreetmap.josm.io.remotecontrol.RemoteControl;
    4142import org.openstreetmap.josm.plugins.PluginHandler;
    4243import org.openstreetmap.josm.plugins.PluginInformation;
     
    220221        monitor.worked(1);
    221222
     223        if (RemoteControl.on && RemoteControl.PROP_REMOTECONTROL_ENABLED.get()) {
     224            RemoteControl.start();
     225        }
     226
    222227        monitor.indeterminateSubTask(tr("Creating main GUI"));
    223228        JFrame mainFrame = new JFrame(tr("Java OpenStreetMap Editor"));
  • trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java

    r3669 r3707  
    2626
    2727import org.openstreetmap.josm.Main;
     28import org.openstreetmap.josm.io.remotecontrol.RemoteControl;
    2829import org.openstreetmap.josm.plugins.PluginDownloadTask;
    2930import org.openstreetmap.josm.plugins.PluginHandler;
     
    226227            PreferenceSetting setting = factory.createPreferenceSetting();
    227228            if (setting != null) {
    228                 settings.add(factory.createPreferenceSetting());
     229                settings.add(setting);
    229230            }
    230231        }
     
    277278        settingsFactory.add(new ShortcutPreference.Factory());
    278279        settingsFactory.add(new ValidatorPreference.Factory());
     280        if (RemoteControl.on) {
     281            settingsFactory.add(new RemoteControlPreference.Factory());
     282        }
    279283
    280284        PluginHandler.getPreferenceSetting(settingsFactory);
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

    r3612 r3707  
    77
    88import java.awt.Component;
    9 import java.awt.Container;
    109import java.awt.GridBagLayout;
    1110import java.awt.Image;
     
    6160import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionItemPritority;
    6261import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList;
     62import org.openstreetmap.josm.gui.util.GuiHelper;
    6363import org.openstreetmap.josm.io.MirroredInputStream;
    6464import org.openstreetmap.josm.tools.GBC;
     
    896896        p.add(items, GBC.eol().fill());
    897897        if (selected.size() == 0 && !supportsRelation()) {
    898             setEnabledRec(items, false);
     898            GuiHelper.setEnabledRec(items, false);
    899899        }
    900900
     
    904904
    905905        return p;
    906     }
    907 
    908     /**
    909      * setEnabled() does not propagate to child elements, so we need this workaround.
    910      */
    911     static void setEnabledRec(Container root, boolean enabled) {
    912         root.setEnabled(enabled);
    913         Component children[] = root.getComponents();
    914         for(int i = 0; i < children.length; i++) {
    915             if(children[i] instanceof Container) {
    916                 setEnabledRec((Container)children[i], enabled);
    917             } else {
    918                 children[i].setEnabled(enabled);
    919             }
    920         }
    921906    }
    922907
Note: See TracChangeset for help on using the changeset viewer.