Ignore:
Timestamp:
2015-08-12T12:39:58+02:00 (9 years ago)
Author:
nokutu
Message:

Fixed tests

Location:
applications/editors/josm/plugins/mapillary
Files:
1 added
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java

    r31490 r31492  
    1717import javax.swing.JSeparator;
    1818import javax.swing.JTree;
     19import javax.swing.SwingUtilities;
    1920import javax.swing.tree.DefaultTreeCellRenderer;
    2021import javax.swing.tree.DefaultTreeModel;
     
    8081    treesPanel.add(this.spacer, GBC.eol());
    8182    this.spacer.setVisible(false);
    82     treesPanel.add(this.undoTree, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
     83    treesPanel
     84        .add(this.undoTree, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
    8385    this.separator.setVisible(false);
    84     treesPanel.add(this.separator, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
    85     treesPanel.add(this.redoTree, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
     86    treesPanel.add(this.separator, GBC.eol()
     87        .fill(GridBagConstraints.HORIZONTAL));
     88    treesPanel
     89        .add(this.redoTree, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
    8690    treesPanel.add(Box.createRigidArea(new Dimension(0, 0)),
    8791        GBC.std().weight(0, 1));
     
    135139    }
    136140
    137     this.separator.setVisible(!undoCommands.isEmpty() || !redoCommands.isEmpty());
     141    this.separator.setVisible(!undoCommands.isEmpty()
     142        || !redoCommands.isEmpty());
    138143    this.spacer.setVisible(undoCommands.isEmpty() && !redoCommands.isEmpty());
    139144
     
    144149  @Override
    145150  public void recordChanged() {
    146     buildTree();
     151    if (!SwingUtilities.isEventDispatchThread()) {
     152      SwingUtilities.invokeLater(new Runnable() {
     153        @Override
     154        public void run() {
     155          recordChanged();
     156        }
     157      });
     158    } else {
     159      buildTree();
     160    }
    147161  }
    148162
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecord.java

    r31491 r31492  
    22
    33import java.util.ArrayList;
    4 
    5 import javax.swing.SwingUtilities;
    64
    75import org.openstreetmap.josm.plugins.mapillary.MapillaryAbstractImage;
     
    7371   */
    7472  public void addCommand(final MapillaryCommand command) {
    75     if (!SwingUtilities.isEventDispatchThread()) {
    76       SwingUtilities.invokeLater(new Runnable() {
    77         @Override
    78         public void run() {
    79           addCommand(command);
    80         }
    81       });
    82     } else {
    83       if (command instanceof MapillaryExecutableCommand)
    84         ((MapillaryExecutableCommand) command).execute();
    85       // Checks if it is a continuation of last command
    86       if (this.position != -1) {
    87         boolean equalSets = true;
    88         for (MapillaryAbstractImage img : this.commandList.get(this.position).images)
    89           if (!command.images.contains(img))
    90             equalSets = false;
    91         for (MapillaryAbstractImage img : command.images)
    92           if (!this.commandList.get(this.position).images.contains(img))
    93             equalSets = false;
    94         if (equalSets
    95             && this.commandList.get(this.position).getClass() == command
    96                 .getClass()) {
    97           this.commandList.get(this.position).sum(command);
    98           fireRecordChanged();
    99           return;
    100         }
     73
     74    if (command instanceof MapillaryExecutableCommand)
     75      ((MapillaryExecutableCommand) command).execute();
     76    // Checks if it is a continuation of last command
     77    if (this.position != -1) {
     78      boolean equalSets = true;
     79      for (MapillaryAbstractImage img : this.commandList.get(this.position).images)
     80        if (!command.images.contains(img))
     81          equalSets = false;
     82      for (MapillaryAbstractImage img : command.images)
     83        if (!this.commandList.get(this.position).images.contains(img))
     84          equalSets = false;
     85      if (equalSets
     86          && this.commandList.get(this.position).getClass() == command
     87              .getClass()) {
     88        this.commandList.get(this.position).sum(command);
     89        fireRecordChanged();
     90        return;
    10191      }
    102       // Adds the command to the last position of the list.
    103       this.commandList.add(this.position + 1, command);
    104       this.position++;
    105       while (this.commandList.size() > this.position + 1) {
    106         this.commandList.remove(this.position + 1);
    107       }
    108       fireRecordChanged();
    10992    }
     93    // Adds the command to the last position of the list.
     94    this.commandList.add(this.position + 1, command);
     95    this.position++;
     96    while (this.commandList.size() > this.position + 1) {
     97      this.commandList.remove(this.position + 1);
     98    }
     99    fireRecordChanged();
    110100  }
    111101
  • applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecordTest.java

    r31491 r31492  
    1 package org.openstreetmap.josm.plugins.mapillary.commands;
     1package org.openstreetmap.josm.plugins.mapillary.history;
    22
    33import static org.junit.Assert.assertEquals;
Note: See TracChangeset for help on using the changeset viewer.