Opened 9 years ago
Closed 8 years ago
#12478 closed enhancement (fixed)
Use Swing Copy/Paste instead of CopyAction/PasteAction with custom buffer?
Reported by: | simon04 | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 16.07 |
Component: | Core | Version: | |
Keywords: | copy paste swing gsoc-core | Cc: | stoecker, bastiK, Don-vip, michael2402 |
Description
Is there a reason for a "custom" implementation of
CopyAction
andPasteAction
in contrast to the Swing CCP?
Attachments (4)
Change History (26)
by , 9 years ago
Attachment: | 12478-draft-v1.patch added |
---|
comment:1 by , 9 years ago
Keywords: | copy paste swing added |
---|---|
Milestone: | → 16.02 |
comment:2 by , 9 years ago
Milestone: | 16.02 → 16.03 |
---|
comment:4 by , 9 years ago
Milestone: | 16.04 → 16.05 |
---|
comment:5 by , 9 years ago
Cc: | added |
---|
comment:6 by , 8 years ago
Milestone: | 16.05 → 16.06 |
---|
by , 8 years ago
Attachment: | patch-ccp-primitives-copy.patch added |
---|
comment:7 by , 8 years ago
I spend some time on this.
The patch still needs some cleanup, corner case handling, documentation and testing ;-).
Supported features:
- Replace FileDrop - Java provides a nice Transferable interface that does the same job
- Allow drop/paste of:
- Files (same as drop handling before)
- Primitive transfers
- Allow copy of:
- Primitives
Currently, primitives added to the internal copy buffer are automatically added to the system clippboard.
You can now open two JOSM instances and Copy/Paste between the two ;-). Cut is not (yet) supported.
I suggest Crtl+Alt+V to paste at the same postion the node was copied.
comment:8 by , 8 years ago
Sorry I didn't see you attached the patch file! It looks OK but it does not apply properly now, could you please attach an updated version?
comment:9 by , 8 years ago
I'll update it to the current version of JOSM and get the missing features (compatibility, cut, ...) working. I suggest moving this to 16.7 since I want to work on fixing the tests and not start an other big change that might break stuff before the 16.6 release.
comment:10 by , 8 years ago
Milestone: | 16.06 → 16.07 |
---|
by , 8 years ago
Attachment: | patch-ccp-primitives-copy-only-layers.patch added |
---|
comment:11 by , 8 years ago
I attached two patches that implement swing copy+paste for JOSM.
The Main.paste*
fields are deprecated and never used in JOSM code. The pasteBuffer
is read only, the pasteSource
not available.
There is a new ClipboardUtils
class that contains the methods used to access the clipboard. The clipboard will also work in headless mode.
I split this into two patches:
(1) patch-patch-ccp-primitives-copy-no-layers.patch
converts all copy/paste to use the swing buffer. This includes copying/pasting tags and relation members. It is quite big (~2000 lines added) but splitting it will be difficult. The main work is done by OsmTransferHandler
. Fixes #11114.
(2) patch-ccp-primitives-copy-only-layers.patch
adds drag+drop support for layers.
This will work now:
- Copy/Paste between JOSM instances
- Copy something in JOSM, paste it in the relation dialog as members
- Copy/Paste/Drag between relation dialogs
- Paste a file to open/load it
- Reorder and duplicate layers using drag+drop
In the future, if you use multiple layer lists, you can drag+drop between them. We could also add a nicer way to duplicate layers so that other layers like GPX, imagery, ... could be duplicated as well.
comment:12 by , 8 years ago
Summary: | [Patch draft] Use Swing Copy/Paste instead of CopyAction/PasteAction with custom buffer? → [Patch] Use Swing Copy/Paste instead of CopyAction/PasteAction with custom buffer? |
---|
comment:13 by , 8 years ago
Keywords: | gsoc-core added |
---|
by , 8 years ago
Attachment: | patch-patch-ccp-primitives-copy-no-layers.patch added |
---|
comment:14 by , 8 years ago
comment:19 by , 8 years ago
Summary: | [Patch] Use Swing Copy/Paste instead of CopyAction/PasteAction with custom buffer? → Use Swing Copy/Paste instead of CopyAction/PasteAction with custom buffer? |
---|
comment:20 by , 8 years ago
FileDrop
can be replaced. The nice thing about FileDrop
is that it adds a border to indicate the drop target. It already uses swing transferables to transfer objects but could be cleaned up a lot.
comment:22 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
sounds good