Changeset 6046 in josm for trunk/src


Ignore:
Timestamp:
2013-07-02T11:43:39+02:00 (11 years ago)
Author:
akks
Message:

fix #7436 (shortcut/toolbar redefinition) and EDT violations in Update Data [minor]
(3 methods of UpdateSelectionAction was made static)

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/UpdateDataAction.java

    r4982 r6046  
    4444    }
    4545
     46    @Override
    4647    public void actionPerformed(ActionEvent e) {
    4748        if (! isEnabled())
     
    8384            // using a series of multi fetch requests
    8485            //
    85             new UpdateSelectionAction().updatePrimitives(getEditLayer().data.allPrimitives());
     86            UpdateSelectionAction.updatePrimitives(getEditLayer().data.allPrimitives());
    8687        } else {
    8788            // bounds defined? => use the bbox downloader
     
    9192            Main.worker.submit(
    9293                    new Runnable() {
     94                        @Override
    9395                        public void run() {
    9496                            try {
  • trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java

    r5360 r6046  
    3535     * @param id the primitive id
    3636     */
    37     public void handlePrimitiveGoneException(long id, OsmPrimitiveType type) {
     37    public static void handlePrimitiveGoneException(long id, OsmPrimitiveType type) {
    3838        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    3939        reader.append(getCurrentDataSet(),id, type);
     
    5353     *
    5454     */
    55     public void updatePrimitives(final Collection<OsmPrimitive> selection) {
     55    public static void updatePrimitives(final Collection<OsmPrimitive> selection) {
    5656        UpdatePrimitivesTask task = new UpdatePrimitivesTask(Main.main.getEditLayer(),selection);
    5757        Main.worker.submit(task);
     
    6969     *
    7070     */
    71     public void updatePrimitive(PrimitiveId id) throws IllegalStateException, IllegalArgumentException{
     71    public static void updatePrimitive(PrimitiveId id) throws IllegalStateException, IllegalArgumentException{
    7272        ensureParameterNotNull(id, "id");
    7373        if (getEditLayer() == null)
     
    114114     * action handler
    115115     */
     116    @Override
    116117    public void actionPerformed(ActionEvent e) {
    117118        if (! isEnabled())
    118119            return;
    119120        Collection<OsmPrimitive> toUpdate =getData();
    120         if (toUpdate.size() == 0) {
     121        if (toUpdate.isEmpty()) {
    121122            JOptionPane.showMessageDialog(
    122123                    Main.parent,
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskList.java

    r5648 r6046  
    1919
    2020import javax.swing.JOptionPane;
    21 import javax.swing.SwingUtilities;
    2221
    2322import org.openstreetmap.josm.Main;
     
    3231import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    3332import org.openstreetmap.josm.gui.progress.ProgressMonitor.CancelListener;
     33import org.openstreetmap.josm.gui.util.GuiHelper;
    3434import org.openstreetmap.josm.tools.ExceptionUtil;
    3535import org.openstreetmap.josm.tools.ImageProvider;
     
    7474        }
    7575        progressMonitor.addCancelListener(new CancelListener() {
     76            @Override
    7677            public void operationCanceled() {
    7778                for (DownloadTask dt : osmTasks) {
     
    134135        }
    135136        EventQueue.invokeLater(new Runnable() {
    136             public void run() {
    137                 new UpdateSelectionAction().updatePrimitives(toSelect);
     137            @Override public void run() {
     138                UpdateSelectionAction.updatePrimitives(toSelect);
    138139            }
    139140        });
     
    217218         * Grabs and displays the error messages after all download threads have finished.
    218219         */
     220        @Override
    219221        public void run() {
    220222            progressMonitor.finishTask();
     
    247249                sb.append("</ul>");
    248250
    249                 SwingUtilities.invokeLater(new Runnable() {
     251                GuiHelper.runInEDT(new Runnable() {
    250252                    @Override
    251253                    public void run() {
     
    272274            final OsmDataLayer editLayer = Main.map.mapView.getEditLayer();
    273275            if (editLayer != null) {
    274                 Set<OsmPrimitive> myPrimitives = getCompletePrimitives(editLayer.data);
     276                final Set<OsmPrimitive> myPrimitives = getCompletePrimitives(editLayer.data);
    275277                for (DownloadTask task : osmTasks) {
    276278                    if (task instanceof DownloadOsmTask) {
     
    285287                }
    286288                if (!myPrimitives.isEmpty()) {
    287                     handlePotentiallyDeletedPrimitives(myPrimitives);
     289                    GuiHelper.runInEDT(new Runnable() {
     290                        @Override public void run() {
     291                            handlePotentiallyDeletedPrimitives(myPrimitives);
     292                        }
     293                    });
    288294                }
    289295            }
  • trunk/src/org/openstreetmap/josm/gui/io/AbstractUploadTask.java

    r5319 r6046  
    294294    protected void handleGone(OsmApiPrimitiveGoneException e) {
    295295        if (e.isKnownPrimitive()) {
    296             new UpdateSelectionAction().handlePrimitiveGoneException(e.getPrimitiveId(),e.getPrimitiveType());
     296            UpdateSelectionAction.handlePrimitiveGoneException(e.getPrimitiveId(),e.getPrimitiveType());
    297297        } else {
    298298            ExceptionDialogUtil.explainGoneForUnknownPrimitive(e);
Note: See TracChangeset for help on using the changeset viewer.