Ignore:
Timestamp:
2010-09-19T10:38:40+02:00 (14 years ago)
Author:
jttt
Message:

Fix #5461 turn-restriction-plugin broken

Location:
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/CreateOrEditTurnRestrictionAction.java

    r23192 r23254  
    2222
    2323/**
    24  * This action is triggered by a global shortcut (default is Shift-Ctrl-T on windows). 
     24 * This action is triggered by a global shortcut (default is Shift-Ctrl-T on windows).
    2525 * Depending on the current selection it either launches an editor for a new turn
    2626 * restriction or a popup component from which one can choose a turn restriction to
    27  * edit. 
     27 * edit.
    2828 *
    2929 */
    3030public class CreateOrEditTurnRestrictionAction extends JosmAction {
    3131    static private final Logger logger = Logger.getLogger(CreateOrEditTurnRestrictionAction.class.getName());
    32    
     32
    3333    /**
    3434     * Installs the global key stroke with which creating/editing a turn restriction
    3535     * is triggered.
    36      * 
    37      * @param keyStroke the key stroke 
     36     *
     37     * @param keyStroke the key stroke
    3838     */
    3939    static public void install(KeyStroke keyStroke){
     
    4141        Object actionMapKey = im.get(keyStroke);
    4242        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"));           
     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"));
    4444        }
    4545        KeyStroke[] keys = im.keys();
     
    5555        am.put("turnrestrictions:create-or-edit", getInstance());
    5656    }
    57    
     57
    5858    /**
    5959     * Installs  global key stroke configured in the preferences.
    60      * 
    61      * @param keyStroke the key stroke 
     60     *
     61     * @param keyStroke the key stroke
    6262     */
    6363    static public void install(){
     
    7070        install(key);
    7171    }
    72    
     72
    7373    /** the singleton instance of this action */
    7474    private static CreateOrEditTurnRestrictionAction instance;
    75    
     75
    7676    /**
    7777     * Replies the unique instance of this action
    78      * 
     78     *
    7979     * @return
    8080     */
     
    8585        return instance;
    8686    }
    87    
     87
    8888    protected CreateOrEditTurnRestrictionAction() {
    8989        super(
     
    9191            null,
    9292            tr("Create or edit a turn restriction."),
    93             null, // shortcut is going to be registered later 
    94             false 
     93            null, // shortcut is going to be registered later
     94            false
    9595        );
    96     }   
    97    
     96    }
     97
    9898    public void actionPerformed(ActionEvent e) {
    9999        OsmDataLayer layer = Main.main.getEditLayer();
    100100        if (layer == null) return;
    101101        Collection<Relation> trs = TurnRestrictionSelectionPopupPanel.getTurnRestrictionsParticipatingIn(layer.data.getSelected());
    102         if (layer == null) return;
    103102        if (trs.isEmpty()){
    104103            // current selection isn't participating in turn restrictions. Launch
    105             // an editor for a new turn restriction 
     104            // an editor for a new turn restriction
    106105            //
    107106            Relation tr = new TurnRestrictionBuilder().buildFromSelection(layer);
     
    112111        } else {
    113112            // let the user choose whether he wants to create a new turn restriction or
    114             // edit one of the turn restrictions participating in the current selection 
     113            // edit one of the turn restrictions participating in the current selection
    115114            TurnRestrictionSelectionPopupPanel pnl = new TurnRestrictionSelectionPopupPanel(
    116115                    layer
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/AdvancedEditorPanel.java

    r23192 r23254  
    11package org.openstreetmap.josm.plugins.turnrestrictions.editor;
    22
     3import static org.openstreetmap.josm.tools.I18n.tr;
     4
    35import java.awt.BorderLayout;
    4 
    56import java.awt.event.HierarchyEvent;
    67import java.awt.event.HierarchyListener;
     
    1617import org.openstreetmap.josm.gui.widgets.HtmlPanel;
    1718import org.openstreetmap.josm.tools.CheckParameterUtil;
    18 import static org.openstreetmap.josm.tools.I18n.tr;
    1919
    2020/**
     
    2626
    2727    private TurnRestrictionEditorModel model;
    28     private TagEditorPanel pnlTagEditor; 
     28    private TagEditorPanel pnlTagEditor;
    2929    private JPanel pnlRelationMemberEditor;
    3030    private JTable tblRelationMemberEditor;
    3131    private JSplitPane spEditors;
    32    
     32
    3333    /**
    34      * Creates the panel with the tag editor 
    35      * 
     34     * Creates the panel with the tag editor
     35     *
    3636     * @return
    3737     */
     
    3939        JPanel pnl = new JPanel(new BorderLayout());
    4040        HtmlPanel msg = new HtmlPanel();
    41         msg.setText("<html><body>" + 
     41        msg.setText("<html><body>" +
    4242                tr("In the following table you can edit the <strong>raw tags</strong>"
    4343              + " of the OSM relation representing this turn restriction.")
     
    4545        );
    4646        pnl.add(msg, BorderLayout.NORTH);
    47         pnlTagEditor = new TagEditorPanel(model.getTagEditorModel());   
     47        pnlTagEditor = new TagEditorPanel(model.getTagEditorModel(), null);
    4848        pnlTagEditor.initAutoCompletion(model.getLayer());
    4949        pnl.add(pnlTagEditor, BorderLayout.CENTER);
    5050        return pnl;
    5151    }
    52    
     52
    5353    /**
    5454     * Builds the panel with the table for editing relation members
    55      * 
     55     *
    5656     * @return
    5757     */
     
    5959        JPanel pnl = new JPanel(new BorderLayout());
    6060        HtmlPanel msg = new HtmlPanel();
    61         msg.setText("<html><body>" 
     61        msg.setText("<html><body>"
    6262              + tr("In the following table you can edit the <strong>raw members</strong>"
    6363              + " of the OSM relation representing this turn restriction.") + "</body></html>"
    6464        );
    6565        pnl.add(msg, BorderLayout.NORTH);
    66        
     66
    6767        tblRelationMemberEditor = new RelationMemberTable(model);
    6868        JScrollPane pane = new JScrollPane(tblRelationMemberEditor);
     
    7272        return pnl;
    7373    }
    74    
     74
    7575    /**
    76      * Creates the main split panel 
     76     * Creates the main split panel
    7777     * @return
    7878     */
     
    8686        return spEditors;
    8787    }
    88    
     88
    8989    /**
    9090     * Builds the user interface
     
    9494        add(buildSplitPane(), BorderLayout.CENTER);
    9595    }
    96    
     96
    9797    /**
    9898     * Creates the advanced editor
    99      * 
     99     *
    100100     * @param model the editor model. Must not be null.
    101101     * @throws IllegalArgumentException thrown if model is null
     
    107107        HelpUtil.setHelpContext(this, HelpUtil.ht("/Plugins/turnrestrictions#AdvancedEditor"));
    108108    }
    109    
     109
    110110    /**
    111111     * Initializes the divider location when the components becomes visible the
    112      * first time 
     112     * first time
    113113     */
    114114    class SplitPaneDividerInitializer implements HierarchyListener {
     
    117117                spEditors.setDividerLocation(0.5);
    118118                spEditors.removeHierarchyListener(this);
    119             }           
    120         }       
     119            }
     120        }
    121121    }
    122122}
Note: See TracChangeset for help on using the changeset viewer.