Changeset 20701 in osm for applications


Ignore:
Timestamp:
2010-03-27T16:51:44+01:00 (15 years ago)
Author:
guggis
Message:

Added configuration of global shortcut in the preference settings
Fixed a couple of minor issues

Location:
applications/editors/josm/plugins/turnrestrictions
Files:
4 added
10 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/turnrestrictions/data/test-data-set-1.osm

    r20489 r20701  
    22<osm version='0.6' generator='JOSM'>
    33  <bounds minlat='46.9185552' minlon='7.3901081' maxlat='46.9271138' maxlon='7.4086475' origin='OpenStreetMap server' />
    4   <node id='-106' action='modify' visible='true' lat='46.92028078273882' lon='7.401045898188405' />
    5   <node id='-104' action='modify' visible='true' lat='46.919302014885396' lon='7.401068288768116'>
     4  <node id='-56' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.920401695281015' lon='7.392672484176534' />
     5  <node id='-54' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.91947481836078' lon='7.394608244994619' />
     6  <node id='-52' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.91947481836078' lon='7.392692440473628' />
     7  <node id='-50' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.9194611876982' lon='7.391036067814855' />
     8  <node id='-48' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.920906018634135' lon='7.399118368137783' />
     9  <node id='-46' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.921737460284035' lon='7.40135347341227' />
     10  <node id='-44' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.921737460284035' lon='7.39909841184069' />
     11  <node id='-42' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.921737460284035' lon='7.3971426947255114' />
     12  <node id='-40' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92280059638277' lon='7.392991784930033' />
     13  <node id='-38' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92175109036751' lon='7.394767895371367' />
     14  <node id='-36' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92175109036752' lon='7.393011741227126' />
     15  <node id='-34' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.921737460284014' lon='7.390916330032293' />
     16  <node id='-32' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92375467491946' lon='7.391245608934339' />
     17  <node id='-30' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92378193405656' lon='7.394298922389664' />
     18  <node id='-28' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92450429613562' lon='7.394298922389665' />
     19  <node id='-26' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.924517925515175' lon='7.391285521528527' />
     20  <node id='-24' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.925969434589156' lon='7.404077507965554' />
     21  <node id='-22' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.925955805578894' lon='7.401802490096877' />
     22  <node id='-20' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.925955805578894' lon='7.39940773444564' />
     23  <node id='-18' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.92569685372496' lon='7.3913653467169' />
     24  <node id='-16' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.92566959556225' lon='7.393261194940797' />
     25  <node id='-14' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.92654852689992' lon='7.393198680597321' />
     26  <node id='-12' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.9265827364623' lon='7.395296737244347' />
     27  <node id='-10' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.9265827364623' lon='7.397511886221743' />
     28  <node id='-8' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.925560562772716' lon='7.397471973627557' />
     29  <node id='-6' action='modify' timestamp='2010-03-15T22:32:09Z' visible='true' lat='46.91930201488541' lon='7.399142698913044' />
     30  <node id='-4' action='modify' timestamp='2010-03-15T22:32:09Z' visible='true' lat='46.919302014885396' lon='7.401068288768116'>
    631    <tag k='name' v='node 8.3' />
    732  </node>
    8   <node id='-103' action='modify' visible='true' lat='46.91930201488541' lon='7.399142698913044' />
    9   <node id='-50' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.925560562772716' lon='7.397471973627557' />
    10   <node id='-48' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.9265827364623' lon='7.397511886221743' />
    11   <node id='-46' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.9265827364623' lon='7.395296737244347' />
    12   <node id='-44' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.92662362300419' lon='7.39328115123789' />
    13   <node id='-42' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.92566959556225' lon='7.393261194940797' />
    14   <node id='-40' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.92569685372496' lon='7.3913653467169' />
    15   <node id='-38' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.925955805578894' lon='7.39940773444564' />
    16   <node id='-36' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.925955805578894' lon='7.401802490096877' />
    17   <node id='-34' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.925969434589156' lon='7.404077507965554' />
    18   <node id='-32' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.924517925515175' lon='7.391285521528527' />
    19   <node id='-30' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92450429613562' lon='7.394298922389665' />
    20   <node id='-28' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92378193405656' lon='7.394298922389664' />
    21   <node id='-26' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92375467491946' lon='7.391245608934339' />
    22   <node id='-24' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.921737460284014' lon='7.390916330032293' />
    23   <node id='-22' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92175109036752' lon='7.393011741227126' />
    24   <node id='-20' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92175109036751' lon='7.394767895371367' />
    25   <node id='-18' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92280059638277' lon='7.392991784930033' />
    26   <node id='-16' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.921737460284035' lon='7.3971426947255114' />
    27   <node id='-14' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.921737460284035' lon='7.39909841184069' />
    28   <node id='-12' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.921737460284035' lon='7.40135347341227' />
    29   <node id='-10' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.920906018634135' lon='7.399118368137783' />
    30   <node id='-8' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.9194611876982' lon='7.391036067814855' />
    31   <node id='-6' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.91947481836078' lon='7.392692440473628' />
    32   <node id='-4' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.91947481836078' lon='7.394608244994619' />
    33   <node id='-2' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.920401695281015' lon='7.392672484176534' />
    34   <way id='-107' action='modify' visible='true'>
    35     <nd ref='-104' />
    36     <nd ref='-106' />
    37     <tag k='name' v='way.8.2' />
     33  <node id='-2' action='modify' timestamp='2010-03-15T22:32:09Z' visible='true' lat='46.92028078273882' lon='7.401045898188405' />
     34  <way id='-96' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
     35    <nd ref='-52' />
     36    <nd ref='-54' />
     37    <tag k='name' v='way 7.2' />
    3838  </way>
    39   <way id='-105' action='modify' visible='true'>
    40     <nd ref='-103' />
    41     <nd ref='-104' />
    42     <tag k='name' v='way.8.1' />
     39  <way id='-94' timestamp='2010-03-15T09:31:53Z' visible='true'>
     40    <nd ref='-52' />
     41    <nd ref='-56' />
    4342  </way>
    44   <way id='-86' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'>
     43  <way id='-92' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
     44    <nd ref='-50' />
     45    <nd ref='-52' />
     46    <tag k='name' v='way 7.1' />
     47  </way>
     48  <way id='-90' timestamp='2010-03-15T09:31:53Z' visible='true'>
     49    <nd ref='-44' />
     50    <nd ref='-46' />
     51  </way>
     52  <way id='-88' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
     53    <nd ref='-44' />
    4554    <nd ref='-48' />
    46     <nd ref='-50' />
    47     <tag k='name' v='Weg 2.2' />
     55    <tag k='name' v='way 6.2' />
    4856  </way>
    49   <way id='-84' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'>
    50     <nd ref='-46' />
    51     <nd ref='-48' />
    52     <tag k='name' v='Weg 2.1' />
    53   </way>
    54   <way id='-82' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'>
     57  <way id='-86' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
    5558    <nd ref='-42' />
    5659    <nd ref='-44' />
    57     <tag k='name' v='Weg 1.2' />
     60    <tag k='name' v='way 6.1' />
    5861  </way>
    59   <way id='-80' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'>
     62  <way id='-84' timestamp='2010-03-15T09:31:53Z' visible='true'>
     63    <nd ref='-36' />
     64    <nd ref='-38' />
     65  </way>
     66  <way id='-82' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
     67    <nd ref='-36' />
    6068    <nd ref='-40' />
    61     <nd ref='-42' />
    62     <tag k='name' v='Weg 1.1' />
     69    <tag k='name' v='way 5.2' />
    6370  </way>
    64   <way id='-78' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
    65     <nd ref='-38' />
     71  <way id='-80' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
     72    <nd ref='-34' />
    6673    <nd ref='-36' />
    67     <tag k='name' v='Weg 3.1' />
     74    <tag k='name' v='way 5.1' />
     75  </way>
     76  <way id='-78' timestamp='2010-03-15T09:31:53Z' visible='true'>
     77    <nd ref='-28' />
     78    <nd ref='-30' />
    6879  </way>
    6980  <way id='-76' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
    70     <nd ref='-36' />
    71     <nd ref='-34' />
    72     <tag k='name' v='Weg 3.2' />
     81    <nd ref='-30' />
     82    <nd ref='-32' />
     83    <tag k='name' v='way 4.2' />
    7384  </way>
    7485  <way id='-74' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
    75     <nd ref='-32' />
    76     <nd ref='-30' />
     86    <nd ref='-26' />
     87    <nd ref='-28' />
    7788    <tag k='name' v='way 4.1' />
    7889  </way>
    7990  <way id='-72' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
    80     <nd ref='-28' />
    81     <nd ref='-26' />
    82     <tag k='name' v='way 4.2' />
     91    <nd ref='-22' />
     92    <nd ref='-24' />
     93    <tag k='name' v='Weg 3.2' />
    8394  </way>
    84   <way id='-70' timestamp='2010-03-15T09:31:53Z' visible='true'>
    85     <nd ref='-30' />
    86     <nd ref='-28' />
     95  <way id='-70' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
     96    <nd ref='-20' />
     97    <nd ref='-22' />
     98    <tag k='name' v='Weg 3.1' />
    8799  </way>
    88   <way id='-68' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
    89     <nd ref='-24' />
    90     <nd ref='-22' />
    91     <tag k='name' v='way 5.1' />
     100  <way id='-68' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'>
     101    <nd ref='-18' />
     102    <nd ref='-16' />
     103    <tag k='name' v='Weg 1.1' />
    92104  </way>
    93   <way id='-66' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
    94     <nd ref='-22' />
    95     <nd ref='-18' />
    96     <tag k='name' v='way 5.2' />
    97   </way>
    98   <way id='-64' timestamp='2010-03-15T09:31:53Z' visible='true'>
    99     <nd ref='-22' />
    100     <nd ref='-20' />
    101   </way>
    102   <way id='-62' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
     105  <way id='-66' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'>
    103106    <nd ref='-16' />
    104107    <nd ref='-14' />
    105     <tag k='name' v='way 6.1' />
     108    <tag k='name' v='Weg 1.2' />
    106109  </way>
    107   <way id='-60' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
    108     <nd ref='-14' />
     110  <way id='-64' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'>
     111    <nd ref='-12' />
    109112    <nd ref='-10' />
    110     <tag k='name' v='way 6.2' />
     113    <tag k='name' v='Weg 2.1' />
    111114  </way>
    112   <way id='-58' timestamp='2010-03-15T09:31:53Z' visible='true'>
    113     <nd ref='-14' />
    114     <nd ref='-12' />
     115  <way id='-62' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'>
     116    <nd ref='-10' />
     117    <nd ref='-8' />
     118    <tag k='name' v='Weg 2.2' />
    115119  </way>
    116   <way id='-56' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
    117     <nd ref='-8' />
    118     <nd ref='-6' />
    119     <tag k='name' v='way 7.1' />
    120   </way>
    121   <way id='-54' timestamp='2010-03-15T09:31:53Z' visible='true'>
    122     <nd ref='-6' />
    123     <nd ref='-2' />
    124   </way>
    125   <way id='-52' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
     120  <way id='-60' action='modify' timestamp='2010-03-15T22:32:09Z' visible='true'>
    126121    <nd ref='-6' />
    127122    <nd ref='-4' />
    128     <tag k='name' v='way 7.2' />
     123    <tag k='name' v='way.8.1' />
    129124  </way>
    130   <relation id='-100' timestamp='2010-03-09T09:06:53Z' visible='true'>
    131     <member type='way' ref='-84' role='from' />
    132     <member type='way' ref='-86' role='to' />
     125  <way id='-58' action='modify' timestamp='2010-03-15T22:32:09Z' visible='true'>
     126    <nd ref='-4' />
     127    <nd ref='-2' />
     128    <tag k='name' v='way.8.2' />
     129  </way>
     130  <relation id='-114' visible='true'>
     131    <member type='way' ref='-60' role='from' />
     132    <member type='way' ref='-58' role='to' />
     133    <member type='node' ref='-4' role='via' />
     134    <tag k='restriction' v='no_left_turn' />
     135    <tag k='type' v='restriction' />
     136  </relation>
     137  <relation id='-110' timestamp='2010-03-15T09:31:53Z' visible='true'>
     138    <member type='way' ref='-92' role='from' />
     139    <member type='way' ref='-96' role='to' />
     140    <member type='node' ref='-52' role='via' />
     141    <tag k='restriction' v='only_straight_on' />
     142    <tag k='type' v='restriction' />
     143  </relation>
     144  <relation id='-108' timestamp='2010-03-15T09:31:53Z' visible='true'>
     145    <member type='way' ref='-86' role='from' />
     146    <member type='way' ref='-88' role='to' />
     147    <member type='node' ref='-44' role='via' />
     148    <tag k='restriction' v='only_right_turn' />
     149    <tag k='type' v='restriction' />
     150  </relation>
     151  <relation id='-106' timestamp='2010-03-15T09:31:53Z' visible='true'>
     152    <member type='way' ref='-80' role='from' />
     153    <member type='way' ref='-82' role='to' />
     154    <member type='node' ref='-36' role='via' />
     155    <tag k='restriction' v='only_left_turn' />
     156    <tag k='type' v='restriction' />
     157  </relation>
     158  <relation id='-104' timestamp='2010-03-15T09:31:53Z' visible='true'>
     159    <member type='way' ref='-74' role='from' />
     160    <member type='way' ref='-76' role='to' />
     161    <member type='way' ref='-78' role='via' />
     162    <tag k='restriction' v='no_u_turn' />
     163    <tag k='type' v='restriction' />
     164  </relation>
     165  <relation id='-102' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>
     166    <member type='way' ref='-70' role='from' />
     167    <member type='way' ref='-72' role='to' />
     168    <member type='node' ref='-22' role='via' />
     169    <tag k='restriction' v='no_straight_on' />
     170    <tag k='type' v='restriction' />
     171  </relation>
     172  <relation id='-100' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'>
     173    <member type='way' ref='-68' role='from' />
     174    <member type='way' ref='-66' role='to' />
     175    <member type='node' ref='-16' role='via' />
     176    <tag k='restriction' v='no_left_turn' />
     177    <tag k='type' v='restriction' />
     178  </relation>
     179  <relation id='-98' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'>
     180    <member type='way' ref='-64' role='from' />
     181    <member type='way' ref='-62' role='to' />
     182    <member type='node' ref='-10' role='via' />
    133183    <tag k='restriction' v='no_right_turn' />
    134184    <tag k='type' v='restriction' />
    135185  </relation>
    136   <relation id='-98' timestamp='2010-03-09T09:06:53Z' visible='true'>
    137     <member type='way' ref='-80' role='from' />
    138     <member type='way' ref='-82' role='to' />
    139     <tag k='restriction' v='no_left_turn' />
    140     <tag k='type' v='restriction' />
    141   </relation>
    142   <relation id='-96' timestamp='2010-03-15T09:31:53Z' visible='true'>
    143     <member type='way' ref='-78' role='from' />
    144     <member type='way' ref='-76' role='to' />
    145     <tag k='restriction' v='no_straight_on' />
    146     <tag k='type' v='restriction' />
    147   </relation>
    148   <relation id='-94' timestamp='2010-03-15T09:31:53Z' visible='true'>
    149     <member type='way' ref='-74' role='from' />
    150     <member type='way' ref='-72' role='to' />
    151     <member type='way' ref='-70' role='via' />
    152     <tag k='restriction' v='no_u_turn' />
    153     <tag k='type' v='restriction' />
    154   </relation>
    155   <relation id='-92' timestamp='2010-03-15T09:31:53Z' visible='true'>
    156     <member type='way' ref='-68' role='from' />
    157     <member type='way' ref='-66' role='to' />
    158     <member type='node' ref='-22' role='via' />
    159     <tag k='restriction' v='only_left_turn' />
    160     <tag k='type' v='restriction' />
    161   </relation>
    162   <relation id='-90' timestamp='2010-03-15T09:31:53Z' visible='true'>
    163     <member type='way' ref='-62' role='from' />
    164     <member type='way' ref='-60' role='to' />
    165     <member type='node' ref='-14' role='via' />
    166     <tag k='restriction' v='only_right_turn' />
    167     <tag k='type' v='restriction' />
    168   </relation>
    169   <relation id='-88' timestamp='2010-03-15T09:31:53Z' visible='true'>
    170     <member type='way' ref='-56' role='from' />
    171     <member type='way' ref='-52' role='to' />
    172     <member type='node' ref='-6' role='via' />
    173     <tag k='restriction' v='only_straight_on' />
    174     <tag k='type' v='restriction' />
    175   </relation>
    176186</osm>
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/CreateOrEditTurnRestrictionAction.java

    r20556 r20701  
    44
    55import java.awt.event.ActionEvent;
    6 import java.awt.event.KeyEvent;
    76import java.util.Collection;
    87import java.util.logging.Logger;
     8
     9import javax.swing.ActionMap;
     10import javax.swing.InputMap;
     11import javax.swing.JComponent;
     12import javax.swing.KeyStroke;
    913
    1014import org.openstreetmap.josm.Main;
     
    1519import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionEditorManager;
    1620import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionSelectionPopupPanel;
    17 import org.openstreetmap.josm.tools.Shortcut;
     21import org.openstreetmap.josm.plugins.turnrestrictions.preferences.PreferenceKeys;
    1822
    1923/**
     
    2630public class CreateOrEditTurnRestrictionAction extends JosmAction {
    2731        static private final Logger logger = Logger.getLogger(CreateOrEditTurnRestrictionAction.class.getName());
    28         public CreateOrEditTurnRestrictionAction() {
     32       
     33        /**
     34         * Installs the global key stroke with which creating/editing a turn restriction
     35         * is triggered.
     36         *
     37         * @param keyStroke the key stroke
     38         */
     39        static public void install(KeyStroke keyStroke){
     40                InputMap im = Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
     41                Object actionMapKey = im.get(keyStroke);
     42                if (actionMapKey != null && !actionMapKey.toString().equals("turnrestrictions:create-or-edit")) {
     43                        System.out.println(tr("Warning: turnrestrictions plugin replaces already existing action ''{0}'' behind shortcut ''{1}'' by action ''{2}''", actionMapKey.toString(), keyStroke.toString(), "turnrestrictions:create-or-edit"));                       
     44                }
     45                KeyStroke[] keys = im.keys();
     46                if (keys != null){
     47                        for(KeyStroke ks: im.keys()){
     48                                if (im.get(ks).equals("turnrestrictions:create-or-edit")) {
     49                                        im.remove(ks);
     50                                }
     51                        }
     52                }
     53                im.put(keyStroke, "turnrestrictions:create-or-edit");
     54                ActionMap am = Main.contentPane.getActionMap();
     55                am.put("turnrestrictions:create-or-edit", getInstance());
     56        }
     57       
     58        /**
     59         * Installs  global key stroke configured in the preferences.
     60         *
     61         * @param keyStroke the key stroke
     62         */
     63        static public void install(){
     64                String value = Main.pref.get(PreferenceKeys.EDIT_SHORTCUT, "shift ctrl T");
     65                KeyStroke key = KeyStroke.getKeyStroke(value);
     66                if (key == null){
     67                        System.out.println(tr("Warning: illegal value ''{0}'' for preference key ''{1}''. Falling back to default value ''shift ctrl T''.", value, PreferenceKeys.EDIT_SHORTCUT));
     68                        key = KeyStroke.getKeyStroke("shift ctrl T");
     69                }
     70                install(key);
     71        }
     72       
     73        /** the singleton instance of this action */
     74        private static CreateOrEditTurnRestrictionAction instance;
     75       
     76        /**
     77         * Replies the unique instance of this action
     78         *
     79         * @return
     80         */
     81        public static CreateOrEditTurnRestrictionAction getInstance() {
     82                if (instance == null){
     83                        instance = new CreateOrEditTurnRestrictionAction();
     84                }
     85                return instance;
     86        }
     87       
     88        protected CreateOrEditTurnRestrictionAction() {
    2989                super(
    3090                    tr("Create/Edit turn restriction..."),
    3191                    null,
    3292                    tr("Create or edit a turn restriction."),
    33                     Shortcut.registerShortcut(
    34                                         "turnrestrictions:create-or-edit",
    35                                         tr("Turnrestrictions: Create or Edit"),
    36                                         // results in Shift-Ctrl-T on windows
    37                                         KeyEvent.VK_T,
    38                                         Shortcut.GROUPS_ALT1+Shortcut.GROUP_HOTKEY,
    39                                         Shortcut.SHIFT_DEFAULT
    40                         ),
    41                         true /* register action */
     93                    null, // shortcut is going to be registered later
     94                        false
    4295            );
    4396        }       
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsPlugin.java

    r20556 r20701  
    99
    1010/**
    11  * This is the main class for the turnrestriction plugin.
     11 * This is the main class for the turnrestrictions plugin.
    1212 *
    1313 */
    1414public class TurnRestrictionsPlugin extends Plugin{
    1515       
    16         private CreateOrEditTurnRestrictionAction actCreateOrEditTurnRestriction;
    17        
    1816        public TurnRestrictionsPlugin(PluginInformation info) {
    19                 super(info);
    20                 actCreateOrEditTurnRestriction = new CreateOrEditTurnRestrictionAction();
     17                super(info);           
    2118        }
    2219       
     
    3027                        // add the dialog
    3128                        newFrame.addToggleDialog(dialog);
     29                        CreateOrEditTurnRestrictionAction.install();
    3230                }
    3331        }
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditor.java

    r20586 r20701  
    156156                        lblOsmObject.setFont(UIManager.getFont("Label.font").deriveFont(Font.ITALIC));
    157157                        lblOsmObject.setIcon(null);
    158                         lblOsmObject.setText(tr("multiple objects with role ''{0}''",this.role.toString()));
     158                        lblOsmObject.setText(tr("multiple objects with role ''{0}''",this.role.getOsmRole()));
    159159                        lblOsmObject.setToolTipText(null);                     
    160160                }
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionCellRenderer.java

    r20666 r20701  
    9696         */
    9797        protected ImageIcon getIcon(String restrictionType) {
    98                 if (!isValidRestrictionType(restrictionType)) return null;
     98                if (!isValidRestrictionType(restrictionType)) {
     99                        return ImageProvider.get("types", "non-standard-type");
     100                }
    99101                return ImageProvider.get(buildImageName(restrictionType));
    100102        }
     
    146148        protected void renderIcon(Relation tr) {
    147149                String restrictionType = tr.get("restriction");
    148                 if (!isValidRestrictionType(restrictionType)) {
    149                         icon.setIcon(null);
    150                         return;
    151                 }
    152150                icon.setIcon(getIcon(restrictionType));
    153151        }
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferenceKeys.java

    r20675 r20701  
    11package org.openstreetmap.josm.plugins.turnrestrictions.preferences;
     2
     3import javax.swing.KeyStroke;
    24
    35/**
     
    2931         */
    3032        String SHOW_VIAS_IN_BASIC_EDITOR = "turnrestrictions.show-vias-in-basic-editor";
     33       
     34        /**
     35         * The shortcut which triggers creating a new or editing and existing turn
     36         * restriction. The value must be parseable by {@see KeyStroke#getKeyStroke(String)}.
     37         * If missing, the default value "ctrl shift T" is assumed.
     38         */
     39        String EDIT_SHORTCUT= "turnrestrictions.edit-shortcut";
    3140}
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferencesPanel.java

    r20675 r20701  
    1616import javax.swing.JPanel;
    1717import javax.swing.JRadioButton;
     18import javax.swing.JSeparator;
    1819
    1920import org.openstreetmap.josm.data.Preferences;
     
    3435        private ButtonGroup bgIconSet;
    3536        private JCheckBox cbShowViaListInBasicEditor;
     37        private ShortcutPreferencePanel pnlShortcutPreference;
    3638       
    3739        protected JPanel buildShowViaListInBasicEditorPanel() {
     
    4749                msg.setText("<html><body>"
    4850                                + tr("The Basic Editor can optionally display the list of via-objects "
    49                                          + "of a turn restrictions. If enabled, one can also edit them "
    50                                          + "in the Basic editor. If disabled, editing of via-objects is only "
    51                                          + "possible in the Advanced Editor."
     51                                         + "of a turn restriction. If enabled, one can edit them "
     52                                         + "in the Basic editor too. If disabled, editing of via-objects is "
     53                                         + "possible in the Advanced Editor only."
    5254                                  )
    5355                                + "</body></html>"
     
    153155                add(buildSetBPanel(), gc);
    154156                gc.gridy++;
     157                add(new JSeparator(), gc);             
     158                gc.gridy++;
    155159                add(buildShowViaListInBasicEditorPanel(), gc);
     160                gc.gridy++;
     161                add(new JSeparator(), gc);
     162                gc.gridy++;
     163                add(pnlShortcutPreference = new ShortcutPreferencePanel(), gc);
    156164               
    157165                // filler - just grab remaining space
     
    189197                boolean b = prefs.getBoolean(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, false);
    190198                cbShowViaListInBasicEditor.setSelected(b);
     199               
     200                pnlShortcutPreference.initFromPreferences(prefs);
    191201        }
    192202       
     
    213223                        prefs.put(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, newValue);
    214224                }               
     225               
     226                pnlShortcutPreference.saveToPreferences(prefs);
    215227        }
    216228       
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IdenticalTurnRestrictionLegsError.java

    r20622 r20701  
    2727        @Override
    2828        public String getText() {               
    29                 return tr("This turn restriction uses the OSM way <span class=\"object-name\">{0}</span> with role ''from'' <strong>and</strong> with role ''to''. "
    30                                 + "In a turn restriction, the way with role ''from'' should be different from the way with role ''to'', though.",
     29                return tr("This turn restriction uses the OSM way <span class=\"object-name\">{0}</span> with role <tt>from</tt> <strong>and</strong> with role <tt>to</tt>. "
     30                                + "In a turn restriction, the way with role <tt>from</tt> should be different from the way with role <tt>to</tt>, though.",
    3131                                leg.getDisplayName(DefaultNameFormatter.getInstance())
    3232                                );                             
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IntersectionMissingAsViaError.java

    r20622 r20701  
    3737                String msg = tr("The <strong>from</strong>-way <span class=\"object-name\">{0}</span> and the <strong>to</strong>-way <span class=\"object-name\">{1}</span> "
    3838                       + "interesect at node <span class=\"object-name\">{2}</span> but <span class=\"object-name\">{2}</span> isn''t a <strong>via</strong>-object.<br> "
    39                        + "It is recommended to set <span class=\"object-name\">{2}</span> as only <strong>via</strong>-object.",
     39                       + "It is recommended to set <span class=\"object-name\">{2}</span> as unique <strong>via</strong>-object.",
    4040                       this.from.getDisplayName(DefaultNameFormatter.getInstance()),
    4141                       this.to.getDisplayName(DefaultNameFormatter.getInstance()),
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/MultipleTurnRestrictionLegError.java

    r20622 r20701  
    2020         * Create the issue
    2121         *
    22          * @param parent the parant model
     22         * @param parent the parent model
    2323         * @param role the role of the turn restriction leg with multiple entries
    2424         * @param numLegs the number of legs
     
    3434        public String getText() {
    3535                switch(role){
    36                 case FROM: return
    37                         tr("A turn restriction requires exactly one way with role <tt>from</tt>. "
     36                case FROM:
     37                        return tr("A turn restriction requires exactly one way with role <tt>from</tt>. "
    3838                                + "This turn restriction has {0} ways in this role. Please remove "
    3939                                + "{1} of them.",
     
    4242                        );
    4343                case TO:
    44                         tr("A turn restriction requires exactly one way with role <tt>from</tt>. "
     44                        return tr("A turn restriction requires exactly one way with role <tt>to</tt>. "
    4545                                        + "This turn restriction has {0} ways in this role. Please remove "
    4646                                        + "{1} of them.",
Note: See TracChangeset for help on using the changeset viewer.