Modify

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

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 9 years ago.
patch-ccp-primitives-copy.patch (30.6 KB ) - added by michael2402 8 years ago.
patch-ccp-primitives-copy-only-layers.patch (27.0 KB ) - added by michael2402 8 years ago.
patch-patch-ccp-primitives-copy-no-layers.patch (162.3 KB ) - added by michael2402 8 years ago.

Download all attachments as: .zip

Change History (26)

by simon04, 9 years ago

Attachment: 12478-draft-v1.patch added

comment:1 by Don-vip, 9 years ago

Keywords: copy paste swing added
Milestone: 16.02

sounds good

comment:2 by Don-vip, 9 years ago

Milestone: 16.0216.03

comment:3 by Don-vip, 9 years ago

Milestone: 16.0316.04

Milestone renamed

comment:4 by Don-vip, 9 years ago

Milestone: 16.0416.05

comment:5 by michael2402, 9 years ago

Cc: michael2402 added

comment:6 by Don-vip, 8 years ago

Milestone: 16.0516.06

by michael2402, 8 years ago

comment:7 by michael2402, 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 Don-vip, 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 michael2402, 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 michael2402, 8 years ago

Milestone: 16.0616.07

comment:11 by michael2402, 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.

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

comment:12 by michael2402, 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 michael2402, 8 years ago

Keywords: gsoc-core added

comment:14 by michael2402, 8 years ago

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

comment:15 by Don-vip, 8 years ago

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 by Don-vip, 8 years ago

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

comment:17 by Don-vip, 8 years ago

Resolution: fixed
Status: closedreopened

I forgot the other patch

comment:18 by Don-vip, 8 years ago

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 by Don-vip, 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 michael2402, 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:21 by Don-vip, 8 years ago

In 10613/josm:

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

comment:22 by Don-vip, 8 years ago

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. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.