- Timestamp:
- 2010-01-25T22:15:44+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CopyAction.java
r2323 r2892 6 6 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 7 7 8 import java.awt.Toolkit; 9 import java.awt.datatransfer.Clipboard; 10 import java.awt.datatransfer.ClipboardOwner; 11 import java.awt.datatransfer.StringSelection; 12 import java.awt.datatransfer.Transferable; 8 13 import java.awt.event.ActionEvent; 9 14 import java.awt.event.KeyEvent; … … 35 40 public void actionPerformed(ActionEvent e) { 36 41 if(isEmptySelection()) return; 42 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); 37 43 38 Main.pasteBuffer.makeCopy(getCurrentDataSet().getSelected()); 44 /* copy ids to the clipboard */ 45 StringBuilder idsBuilder = new StringBuilder(); 46 for (OsmPrimitive p : selection) { 47 idsBuilder.append(p.getId()+","); 48 } 49 String ids = idsBuilder.substring(0, idsBuilder.length() - 1); 50 try { 51 Toolkit.getDefaultToolkit().getSystemClipboard().setContents( 52 new StringSelection(ids.toString()), new ClipboardOwner() { 53 public void lostOwnership(Clipboard clipboard, Transferable contents) {} 54 } 55 ); 56 } 57 catch (RuntimeException x) {} 58 59 Main.pasteBuffer.makeCopy(selection); 39 60 Main.pasteSource = getEditLayer(); 40 61 Main.main.menu.paste.setEnabled(true); /* now we have a paste buffer we can make paste available */
Note:
See TracChangeset
for help on using the changeset viewer.