Ignore:
Timestamp:
2011-12-27T19:47:45+01:00 (13 years ago)
Author:
oliverw
Message:

Moved all action instance to class AddressActions.

Location:
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/OSMAddress.java

    r25373 r27322  
    1515
    1616import static org.openstreetmap.josm.tools.I18n.tr;
     17
    1718import java.util.Collection;
    1819import java.util.HashMap;
    1920
    2021import org.openstreetmap.josm.data.osm.OsmPrimitive;
     22import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.AddressActions;
    2123import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.ApplyAllGuessesAction;
    22 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.RemoveAddressTagsAction;
    2324import org.openstreetmap.josm.tools.CheckParameterUtil;
    2425
     
    728729                AddressSolution s = new AddressSolution(
    729730                                                tr("Remove all address tags"),
    730                                                 new RemoveAddressTagsAction(),
     731                                                AddressActions.getRemoveTagsAction(),
    731732                                                SolutionType.Remove);
    732733                problem.addSolution(s);
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/AddressEditDialog.java

    r25373 r27322  
    5757import org.openstreetmap.josm.plugins.fixAddresses.StringUtils;
    5858import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.AbstractAddressEditAction;
    59 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.ApplyAllGuessesAction;
    60 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.AssignAddressToStreetAction;
    61 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.ConvertAllToRelationAction;
    62 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.ConvertToRelationAction;
    63 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.GuessAddressDataAction;
    64 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.RemoveAddressTagsAction;
    65 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.SelectAddressesInMapAction;
     59import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.AddressActions;
    6660import org.openstreetmap.josm.tools.ImageProvider;
    6761
     
    7973        private JTable streetTable;
    8074
    81         /* Actions */
    82         private AssignAddressToStreetAction resolveAction = new AssignAddressToStreetAction();
    83         private ApplyAllGuessesAction applyAllGuessesAction = new ApplyAllGuessesAction();
    84         private GuessAddressDataAction guessAddressAction = new GuessAddressDataAction();
    85         private SelectAddressesInMapAction selectAddressesInMapAction = new SelectAddressesInMapAction();
    86         private RemoveAddressTagsAction removeAddressTagsAction = new RemoveAddressTagsAction();
    87         private ConvertToRelationAction convertToRelationAction = new ConvertToRelationAction();
    88         private ConvertAllToRelationAction convertAllToRelationAction = new ConvertAllToRelationAction();
    89 
    9075        private AbstractAddressEditAction[] actions = new AbstractAddressEditAction[] {
    91                 resolveAction,
    92                 guessAddressAction,
    93                 applyAllGuessesAction,
    94                 selectAddressesInMapAction,
    95                 removeAddressTagsAction,
    96                 convertToRelationAction,
    97                 convertAllToRelationAction
     76                AddressActions.getResolveAction(),
     77                AddressActions.getGuessAddressAction(),
     78                AddressActions.getApplyGuessesAction(),
     79                AddressActions.getSelectAction(),
     80                AddressActions.getRemoveTagsAction(),
     81                AddressActions.getConvertToRelationAction(),
     82                AddressActions.getConvertAllToRelationAction()
    9883        };
     84       
    9985        private JLabel streetLabel;
    10086        private JLabel unresolvedAddressesLabel;
     
    157143                        unresolvedTable.getSelectionModel().addListSelectionListener(this);
    158144                        unresolvedTable.getSelectionModel().addListSelectionListener(new IncompleteAddressListener());
    159                         unresolvedTable.addMouseListener(applyAllGuessesAction);
     145                        unresolvedTable.addMouseListener(AddressActions.getApplyGuessesAction());
    160146
    161147                        JTableHeader header = unresolvedTable.getTableHeader();
     
    178164                        try {
    179165                                JPanel unresolvedButtons = new JPanel(new GridLayout(2,5, 5, 5));
    180                                 SideButton assign = new SideButton(resolveAction);
     166                                SideButton assign = new SideButton(AddressActions.getResolveAction());
    181167                                unresolvedButtons.add(assign);
    182168
    183                                 SideButton guess = new SideButton(guessAddressAction);
     169                                SideButton guess = new SideButton(AddressActions.getGuessAddressAction());
    184170                                unresolvedButtons.add(guess);
    185                                 SideButton applyAllGuesses = new SideButton(applyAllGuessesAction);
     171                                SideButton applyAllGuesses = new SideButton(AddressActions.getApplyGuessesAction());
    186172                                unresolvedButtons.add(applyAllGuesses);
    187173
    188                                 SideButton removeAddressTags = new SideButton(removeAddressTagsAction);
     174                                SideButton removeAddressTags = new SideButton(AddressActions.getRemoveTagsAction());
    189175                                unresolvedButtons.add(removeAddressTags);
    190176
    191177                                unresolvedButtons.add(new JPanel());
    192178
    193                                 SideButton selectInMap = new SideButton(selectAddressesInMapAction);
     179                                SideButton selectInMap = new SideButton(AddressActions.getSelectAction());
    194180                                unresolvedButtons.add(selectInMap);
    195181                                headerPanel2.setMinimumSize(new Dimension(100, 70));
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/IncompleteAddressesDialog.java

    r26509 r27322  
    2121import javax.swing.JScrollPane;
    2222import javax.swing.JTable;
     23import javax.swing.SwingUtilities;
    2324import javax.swing.event.ListSelectionEvent;
    2425import javax.swing.event.ListSelectionListener;
     
    2930import org.openstreetmap.josm.data.osm.event.DataSetListener;
    3031import org.openstreetmap.josm.data.osm.event.DatasetEventManager;
     32import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode;
    3133import org.openstreetmap.josm.data.osm.event.NodeMovedEvent;
    3234import org.openstreetmap.josm.data.osm.event.PrimitivesAddedEvent;
     
    3537import org.openstreetmap.josm.data.osm.event.TagsChangedEvent;
    3638import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent;
    37 import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode;
    3839import org.openstreetmap.josm.gui.SideButton;
    3940import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
     
    4344import org.openstreetmap.josm.plugins.fixAddresses.OsmUtils;
    4445import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.AbstractAddressEditAction;
    45 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.ApplyAllGuessesAction;
    46 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.GuessAddressDataAction;
    47 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.RemoveAddressTagsAction;
    48 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.SelectAddressesInMapAction;
     46import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.AddressActions;
    4947
    5048@SuppressWarnings("serial")
     
    5452        private AddressEditContainer container;
    5553
    56         // Create action objects
    57         private SelectAddressesInMapAction selectAction = new SelectAddressesInMapAction();
    58         private GuessAddressDataAction guessDataAction = new GuessAddressDataAction();
    59         private ApplyAllGuessesAction applyGuessesAction = new ApplyAllGuessesAction();
    60         private RemoveAddressTagsAction removeTagsAction = new RemoveAddressTagsAction();
    6154
    6255        // Array containing the available actions
    6356        private AbstractAddressEditAction[] actions = new AbstractAddressEditAction[]{
    64                         selectAction,
    65                         guessDataAction,
    66                         applyGuessesAction,
    67                         removeTagsAction
     57                        AddressActions.getSelectAction(),
     58                        AddressActions.getGuessAddressAction(),
     59                        AddressActions.getApplyGuessesAction(),
     60                        AddressActions.getRemoveTagsAction(),
    6861        };
    6962
     
    215208        @Override
    216209        public void containerChanged(AddressEditContainer container) {
    217                 if (container != null && container.getNumberOfIncompleteAddresses() > 0) {
    218                         setTitle(String.format("%s (%d %s)", FIXED_DIALOG_TITLE, container.getNumberOfIncompleteAddresses(), tr("items")));
    219                 } else {
    220                         setTitle(String.format("%s (%s)", FIXED_DIALOG_TITLE, tr("no items")));
     210                if (SwingUtilities.isEventDispatchThread()) {
     211                        if (container != null && container.getNumberOfIncompleteAddresses() > 0) {
     212                                setTitle(String.format("%s (%d %s)", FIXED_DIALOG_TITLE, container.getNumberOfIncompleteAddresses(), tr("items")));
     213                        } else {
     214                                setTitle(String.format("%s (%s)", FIXED_DIALOG_TITLE, tr("no items")));
     215                        }
    221216                }
    222217        }
     
    227222        @Override
    228223        public void entityChanged(IOSMEntity node) {
    229                 container.invalidate();
     224                if (SwingUtilities.isEventDispatchThread()) {
     225                        container.invalidate();
     226                }
    230227        }
    231228}
Note: See TracChangeset for help on using the changeset viewer.