- Timestamp:
- 2016-11-30T01:38:40+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/relation/RecentRelationsAction.java
r10446 r11348 61 61 Shortcut.SHIFT 62 62 ); 63 Main.registerActionShortcut(new AbstractAction() { 64 @Override 65 public void actionPerformed(ActionEvent e) { 66 EditRelationAction.launchEditor(getLastRelation()); 67 } 68 }, shortcut); 63 Main.registerActionShortcut(new LaunchEditorAction(), shortcut); 69 64 } 70 65 … … 148 143 } 149 144 145 protected static class LaunchEditorAction extends AbstractAction { 146 @Override 147 public void actionPerformed(ActionEvent e) { 148 EditRelationAction.launchEditor(getLastRelation()); 149 } 150 } 151 150 152 protected static class RecentRelationsPopupMenu extends JPopupMenu { 151 153 /** -
trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java
r10663 r11348 6 6 import static org.openstreetmap.josm.tools.I18n.trn; 7 7 8 import java.util.ArrayList;9 8 import java.util.Arrays; 10 9 import java.util.Collection; … … 15 14 import java.util.Map; 16 15 import java.util.Objects; 16 import java.util.stream.Collectors; 17 17 18 18 import javax.swing.Icon; … … 33 33 */ 34 34 public class ChangePropertyCommand extends Command { 35 36 static final class OsmPseudoCommand implements PseudoCommand { 37 private final OsmPrimitive osm; 38 39 OsmPseudoCommand(OsmPrimitive osm) { 40 this.osm = osm; 41 } 42 43 @Override 44 public String getDescriptionText() { 45 return osm.getDisplayName(DefaultNameFormatter.getInstance()); 46 } 47 48 @Override 49 public Icon getDescriptionIcon() { 50 return ImageProvider.get(osm.getDisplayType()); 51 } 52 53 @Override 54 public Collection<? extends OsmPrimitive> getParticipatingPrimitives() { 55 return Collections.singleton(osm); 56 } 57 } 58 35 59 /** 36 60 * All primitives that are affected with this command. … … 212 236 if (objects.size() == 1) 213 237 return null; 214 List<PseudoCommand> children = new ArrayList<>(); 215 for (final OsmPrimitive osm : objects) { 216 children.add(new PseudoCommand() { 217 @Override public String getDescriptionText() { 218 return osm.getDisplayName(DefaultNameFormatter.getInstance()); 219 } 220 221 @Override public Icon getDescriptionIcon() { 222 return ImageProvider.get(osm.getDisplayType()); 223 } 224 225 @Override public Collection<? extends OsmPrimitive> getParticipatingPrimitives() { 226 return Collections.singleton(osm); 227 } 228 }); 229 } 230 return children; 238 return objects.stream().map(OsmPseudoCommand::new).collect(Collectors.toList()); 231 239 } 232 240 -
trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java
r11203 r11348 42 42 /** 43 43 * Imagery menu, holding entries for imagery preferences, offset actions and dynamic imagery entries 44 * depending on current ma view coordinates.44 * depending on current mapview coordinates. 45 45 * @since 3737 46 46 */ 47 47 public class ImageryMenu extends JMenu implements LayerChangeListener { 48 48 49 /** 50 * Compare ImageryInfo objects alphabetically by name. 51 * 52 * ImageryInfo objects are normally sorted by country code first 53 * (for the preferences). We don't want this in the imagery menu. 54 */ 55 public static final Comparator<ImageryInfo> alphabeticImageryComparator = 56 (ii1, ii2) -> ii1.getName().toLowerCase(Locale.ENGLISH).compareTo(ii2.getName().toLowerCase(Locale.ENGLISH)); 57 58 private final transient Action offsetAction = new JosmAction( 59 tr("Imagery offset"), "mapmode/adjustimg", tr("Adjust imagery offset"), null, false, false) { 60 { 49 static final class AdjustImageryOffsetAction extends JosmAction { 50 51 AdjustImageryOffsetAction() { 52 super(tr("Imagery offset"), "mapmode/adjustimg", tr("Adjust imagery offset"), null, false, false); 61 53 putValue("toolbar", "imagery-offset"); 62 54 Main.toolbar.register(this); … … 94 86 popup.show(source, source.getWidth()/2, source.getHeight()/2); 95 87 } 96 }; 88 } 89 90 /** 91 * Compare ImageryInfo objects alphabetically by name. 92 * 93 * ImageryInfo objects are normally sorted by country code first 94 * (for the preferences). We don't want this in the imagery menu. 95 */ 96 public static final Comparator<ImageryInfo> alphabeticImageryComparator = 97 (ii1, ii2) -> ii1.getName().toLowerCase(Locale.ENGLISH).compareTo(ii2.getName().toLowerCase(Locale.ENGLISH)); 98 99 private final transient Action offsetAction = new AdjustImageryOffsetAction(); 97 100 98 101 private final JMenuItem singleOffset = new JMenuItem(offsetAction); … … 227 230 } 228 231 232 /** 233 * Refresh offset menu item. 234 */ 229 235 public void refreshOffsetMenu() { 230 236 offsetMenuItem = getNewOffsetMenu(); -
trunk/src/org/openstreetmap/josm/gui/MainFrame.java
r11093 r11348 89 89 l.add(ImageProvider.get("logo").getImage()); 90 90 setIconImages(l); 91 addWindowListener(new WindowAdapter() { 92 @Override 93 public void windowClosing(final WindowEvent evt) { 94 Main.exitJosm(true, 0, null); 95 } 96 }); 91 addWindowListener(new ExitWindowAdapter()); 97 92 setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); 98 93 … … 159 154 if (layer == Main.getLayerManager().getEditLayer()) { 160 155 refreshTitle(); 156 } 157 } 158 159 static final class ExitWindowAdapter extends WindowAdapter { 160 @Override 161 public void windowClosing(final WindowEvent evt) { 162 Main.exitJosm(true, 0, null); 161 163 } 162 164 } -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r11173 r11348 213 213 splitPane.setDividerSize(5); 214 214 splitPane.setBorder(null); 215 splitPane.setUI(new BasicSplitPaneUI() { 216 @Override 217 public BasicSplitPaneDivider createDefaultDivider() { 218 return new BasicSplitPaneDivider(this) { 219 @Override 220 public void setBorder(Border b) { 221 // Do nothing 222 } 223 }; 224 } 225 }); 215 splitPane.setUI(new NoBorderSplitPaneUI()); 226 216 227 217 // JSplitPane supports F6 and F8 shortcuts by default, but we need them for Audio actions … … 533 523 } 534 524 525 static final class NoBorderSplitPaneUI extends BasicSplitPaneUI { 526 @Override 527 public BasicSplitPaneDivider createDefaultDivider() { 528 return new BasicSplitPaneDivider(this) { 529 @Override 530 public void setBorder(Border b) { 531 // Do nothing 532 } 533 }; 534 } 535 } 536 535 537 private final class SideToolbarPopupMenu extends JPopupMenu { 536 538 private static final int staticMenuEntryCount = 2; -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r11085 r11348 134 134 private final transient Collector collector; 135 135 136 static final class ShowMonitorDialogMouseAdapter extends MouseAdapter { 137 @Override 138 public void mouseClicked(MouseEvent e) { 139 PleaseWaitProgressMonitor monitor = Main.currentProgressMonitor; 140 if (monitor != null) { 141 monitor.showForegroundDialog(); 142 } 143 } 144 } 145 146 static final class JumpToOnLeftClickMouseAdapter extends MouseAdapter { 147 @Override 148 public void mouseClicked(MouseEvent e) { 149 if (e.getButton() != MouseEvent.BUTTON3) { 150 Main.main.menu.jumpToAct.showJumpToDialog(); 151 } 152 } 153 } 154 136 155 public class BackgroundProgressMonitor implements ProgressMonitorDialog { 137 156 … … 829 848 830 849 // also show Jump To dialog on mouse click (except context menu) 831 MouseListener jumpToOnLeftClick = new MouseAdapter() { 832 @Override 833 public void mouseClicked(MouseEvent e) { 834 if (e.getButton() != MouseEvent.BUTTON3) { 835 Main.main.menu.jumpToAct.showJumpToDialog(); 836 } 837 } 838 }; 850 MouseListener jumpToOnLeftClick = new JumpToOnLeftClickMouseAdapter(); 839 851 840 852 // Listen for mouse movements and set the position text field … … 918 930 gbc.ipadx = 100; 919 931 add(progressBar, gbc); 920 progressBar.addMouseListener(new MouseAdapter() { 921 @Override 922 public void mouseClicked(MouseEvent e) { 923 PleaseWaitProgressMonitor monitor = Main.currentProgressMonitor; 924 if (monitor != null) { 925 monitor.showForegroundDialog(); 926 } 927 } 928 }); 932 progressBar.addMouseListener(new ShowMonitorDialogMouseAdapter()); 929 933 930 934 Main.pref.addPreferenceChangeListener(this); -
trunk/src/org/openstreetmap/josm/gui/NotificationManager.java
r10893 r11348 183 183 private static class NotificationPanel extends JPanel { 184 184 185 static final class ShowNoteHelpAction extends AbstractAction { 186 private final Notification note; 187 188 private ShowNoteHelpAction(Notification note) { 189 this.note = note; 190 } 191 192 @Override 193 public void actionPerformed(ActionEvent e) { 194 SwingUtilities.invokeLater(() -> HelpBrowser.setUrlForHelpTopic(note.getHelpTopic())); 195 } 196 } 197 185 198 private JPanel innerPanel; 186 199 … … 214 227 btnHelp.setToolTipText(tr("Show help information")); 215 228 HelpUtil.setHelpContext(btnHelp, note.getHelpTopic()); 216 btnHelp.addActionListener(new AbstractAction() { 217 @Override 218 public void actionPerformed(ActionEvent e) { 219 SwingUtilities.invokeLater(() -> HelpBrowser.setUrlForHelpTopic(note.getHelpTopic())); 220 } 221 }); 229 btnHelp.addActionListener(new ShowNoteHelpAction(note)); 222 230 btnHelp.setOpaque(false); 223 231 tbHelp = new JToolBar(); -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverColumnModel.java
r10611 r11348 18 18 public class RelationMemberConflictResolverColumnModel extends DefaultTableColumnModel { 19 19 20 private final DefaultTableCellRenderer defaultTableCellRenderer = new DefaultTableCellRenderer(); 21 22 private final transient OsmPrimitivRenderer primitiveRenderer = new OsmPrimitivRenderer() { 20 static final class MemberRenderer extends OsmPrimitivRenderer { 23 21 @Override 24 22 public Component getTableCellRendererComponent(JTable table, … … 27 25 table, isSelected, row); 28 26 } 29 }; 27 } 28 29 private final DefaultTableCellRenderer defaultTableCellRenderer = new DefaultTableCellRenderer(); 30 31 private final transient OsmPrimitivRenderer primitiveRenderer = new MemberRenderer(); 30 32 31 33 private final transient TableCellRenderer tableRenderer = (table, value, isSelected, hasFocus, row, column) 32 34 -> setColors(defaultTableCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column), 33 35 table, isSelected, row); 36 37 /** 38 * Constructs a new {@code RelationMemberConflictResolverColumnModel}. 39 */ 40 public RelationMemberConflictResolverColumnModel() { 41 createColumns(); 42 } 34 43 35 44 private static Component setColors(Component comp, JTable table, boolean isSelected, int row) { … … 110 119 addColumn(col); 111 120 } 112 113 /**114 * Constructs a new {@code RelationMemberConflictResolverColumnModel}.115 */116 public RelationMemberConflictResolverColumnModel() {117 createColumns();118 }119 121 }
Note:
See TracChangeset
for help on using the changeset viewer.