Modify

Opened 3 years ago

Closed 3 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

From ticket:5546#comment:3

Is there a reason for a "custom" implementation of CopyAction and PasteAction in contrast to the Swing CCP?

Attachments (4)

12478-draft-v1.patch (8.5 KB) - added by simon04 3 years ago.
patch-ccp-primitives-copy.patch (30.6 KB) - added by michael2402 3 years ago.
patch-ccp-primitives-copy-only-layers.patch (27.0 KB) - added by michael2402 3 years ago.
patch-patch-ccp-primitives-copy-no-layers.patch (162.3 KB) - added by michael2402 3 years ago.

Download all attachments as: .zip

Change History (26)

Changed 3 years ago by simon04

Attachment: 12478-draft-v1.patch added

comment:1 Changed 3 years ago by Don-vip

Keywords: copy paste swing added
Milestone: 16.02

sounds good

comment:2 Changed 3 years ago by Don-vip

Milestone: 16.0216.03

comment:3 Changed 3 years ago by Don-vip

Milestone: 16.0316.04

Milestone renamed

comment:4 Changed 3 years ago by Don-vip

Milestone: 16.0416.05

comment:5 Changed 3 years ago by michael2402

Cc: michael2402 added

comment:6 Changed 3 years ago by Don-vip

Milestone: 16.0516.06

Changed 3 years ago by michael2402

comment:7 Changed 3 years ago by michael2402

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 Changed 3 years ago by Don-vip

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 Changed 3 years ago by michael2402

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 Changed 3 years ago by michael2402

Milestone: 16.0616.07

Changed 3 years ago by michael2402

comment:11 Changed 3 years ago by michael2402

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.

Last edited 3 years ago by michael2402 (previous) (diff)

comment:12 Changed 3 years ago by michael2402

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 Changed 3 years ago by michael2402

Keywords: gsoc-core added

Changed 3 years ago by michael2402

comment:14 Changed 3 years ago by michael2402

The patch is ready to be merged but further java 8 migration may create conflicts. Fixes #12565 and #11114.

comment:15 Changed 3 years ago by Don-vip

Resolution: fixed
Status: newclosed

In 10604/josm:

fix #12478, fix #12565, fix #11114 - Use ​Swing Copy/Paste instead of CopyAction/PasteAction with custom buffer (patch by michael2402, modified) - gsoc-core

comment:16 Changed 3 years ago by Don-vip

FileDrop is still used in GettingStarted, shouldn't it be replaced?

comment:17 Changed 3 years ago by Don-vip

Resolution: fixed
Status: closedreopened

I forgot the other patch

comment:18 Changed 3 years ago by Don-vip

In 10605/josm:

see #12478 - Use ​Swing Copy/Paste instead of CopyAction/PasteAction with custom buffer (layer part: patch by michael2402, modified) - gsoc-core

comment:19 Changed 3 years ago by Don-vip

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 Changed 3 years ago by michael2402

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:21 Changed 3 years ago by Don-vip

In 10613/josm:

see #12478 - do not try to enable dragging in headless mode

comment:22 Changed 3 years ago by Don-vip

Resolution: fixed
Status: reopenedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.