Changeset 558 in josm
- Timestamp:
- 2008-02-24T18:25:31+01:00 (16 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CopyAction.java
r404 r558 10 10 import java.util.HashMap; 11 11 import java.util.List; 12 import java.util.LinkedList; 12 13 import java.util.Collection; 13 14 … … 26 27 public final class CopyAction extends JosmAction implements SelectionChangedListener { 27 28 29 private LinkedList<JosmAction> listeners; 30 28 31 public CopyAction() { 29 32 super(tr("Copy"), "copy", … … 32 35 setEnabled(false); 33 36 DataSet.selListeners.add(this); 37 listeners = new LinkedList<JosmAction>(); 34 38 } 35 39 40 @Override public void addListener(JosmAction a) { 41 listeners.add(a); 42 } 43 36 44 public void actionPerformed(ActionEvent e) { 37 45 Collection<OsmPrimitive> sel = Main.ds.getSelected(); … … 99 107 Main.pasteBuffer = pasteBuffer; 100 108 Main.main.menu.paste.setEnabled(true); /* now we have a paste buffer we can make paste available */ 109 110 for(JosmAction a : listeners) { 111 a.pasteBufferChanged(Main.pasteBuffer); 112 } 101 113 } 102 114 -
trunk/src/org/openstreetmap/josm/actions/JosmAction.java
r526 r558 8 8 9 9 import org.openstreetmap.josm.Main; 10 import org.openstreetmap.josm.data.osm.DataSet; 10 11 import org.openstreetmap.josm.tools.Destroyable; 11 12 import org.openstreetmap.josm.tools.ImageProvider; … … 51 52 } 52 53 53 54 /** 55 * needs to be overridden to be useful 56 */ 57 public void pasteBufferChanged(DataSet newPasteBuffer) { 58 return; 59 } 60 61 /** 62 * needs to be overridden to be useful 63 */ 64 public void addListener(JosmAction a) { 65 return; 66 } 67 54 68 private void setHelpId() { 55 69 String helpId = "Action/"+getClass().getName().substring(getClass().getName().lastIndexOf('.')+1); -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r369 r558 111 111 sel.addAll(getSelected(relations)); 112 112 return sel; 113 } 114 115 /** 116 * Return selected nodes. 117 */ 118 public Collection<OsmPrimitive> getSelectedNodes() { 119 return getSelected(nodes); 120 } 121 122 /** 123 * Return selected ways. 124 */ 125 public Collection<OsmPrimitive> getSelectedWays() { 126 return getSelected(ways); 127 } 128 129 /** 130 * Return selected relations. 131 */ 132 public Collection<OsmPrimitive> getSelectedRelations() { 133 return getSelected(relations); 113 134 } 114 135 -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r547 r558 31 31 import org.openstreetmap.josm.actions.OpenAction; 32 32 import org.openstreetmap.josm.actions.PasteAction; 33 import org.openstreetmap.josm.actions.PasteTagsAction; 33 34 import org.openstreetmap.josm.actions.PreferencesAction; 34 35 import org.openstreetmap.josm.actions.RedoAction; … … 74 75 public final JosmAction copy = new CopyAction(); 75 76 public final JosmAction paste = new PasteAction(); 77 public final JosmAction pasteTags = new PasteTagsAction(copy); 76 78 public final JosmAction duplicate = new DuplicateAction(); 77 79 public final JosmAction selectAll = new SelectAllAction(); … … 147 149 current = editMenu.add(paste); 148 150 current.setAccelerator(paste.shortCut); 151 current = editMenu.add(pasteTags); 152 current.setAccelerator(pasteTags.shortCut); 149 153 current = editMenu.add(duplicate); 150 154 current.setAccelerator(duplicate.shortCut);
Note:
See TracChangeset
for help on using the changeset viewer.