Changeset 31492 in osm for applications/editors/josm/plugins
- Timestamp:
- 2015-08-12T12:39:58+02:00 (9 years ago)
- 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 17 17 import javax.swing.JSeparator; 18 18 import javax.swing.JTree; 19 import javax.swing.SwingUtilities; 19 20 import javax.swing.tree.DefaultTreeCellRenderer; 20 21 import javax.swing.tree.DefaultTreeModel; … … 80 81 treesPanel.add(this.spacer, GBC.eol()); 81 82 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)); 83 85 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)); 86 90 treesPanel.add(Box.createRigidArea(new Dimension(0, 0)), 87 91 GBC.std().weight(0, 1)); … … 135 139 } 136 140 137 this.separator.setVisible(!undoCommands.isEmpty() || !redoCommands.isEmpty()); 141 this.separator.setVisible(!undoCommands.isEmpty() 142 || !redoCommands.isEmpty()); 138 143 this.spacer.setVisible(undoCommands.isEmpty() && !redoCommands.isEmpty()); 139 144 … … 144 149 @Override 145 150 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 } 147 161 } 148 162 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecord.java
r31491 r31492 2 2 3 3 import java.util.ArrayList; 4 5 import javax.swing.SwingUtilities;6 4 7 5 import org.openstreetmap.josm.plugins.mapillary.MapillaryAbstractImage; … … 73 71 */ 74 72 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; 101 91 } 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();109 92 } 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(); 110 100 } 111 101 -
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;1 package org.openstreetmap.josm.plugins.mapillary.history; 2 2 3 3 import static org.junit.Assert.assertEquals;
Note:
See TracChangeset
for help on using the changeset viewer.