eclipse.platform.swt icon indicating copy to clipboard operation
eclipse.platform.swt copied to clipboard

Drag and Drop Not Working When Label Contains Image

Open BeckerWdf opened this issue 2 years ago • 13 comments

Describe the bug See https://github.com/eclipse-platform/eclipse.platform.ui/issues/706. There I discovered, that drag and drop breaks when there's a Label containing an image on a composite. The DrapAndDrop is installed on the composite. If I now drag something on the composite this works (you can drop it). As soon as I drag it into the area covered by label's image this no longer works (the green "+" sign disapears and nothing happens on drop). Labels with only text set (but no image) don't have that issue (dropping works fine),

To Reproduce See ReproducerExampler.zip

Expected behavior Also on the area covered by the label's image the gree "+" sign should be visible during drag and drop show also work - just like on the other lables

Screenshots See https://github.com/eclipse-platform/eclipse.platform.ui/issues/706

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • [ ] All OS
    • [ ] Windows
    • [ ] Linux
    • [x] macOS
  1. Additional OS info (e.g. OS version, Linux Desktop, etc)

  2. JRE/JDK version

Version since I think this happens on all SWT versions.

Workaround (or) Additional context There's no workaround

BeckerWdf avatar Apr 27 '23 11:04 BeckerWdf

I tried this out in MacOS , was able to reproduce it.I am looking into this issue.

elsazac avatar May 22 '23 11:05 elsazac

In the snippet provided , if we pass Label (label) as the parameter to DropTarget instead of Composite(comp) in the below line, the drag and drop works correctly over Label containing the image.Label is getting recognised but not the composite.

DropTarget target = new DropTarget(comp, DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_DEFAULT);

Also, For Label below code seems relevant since Label has got an imageView as an extra parameter that needs to be checked.

https://github.com/eclipse-platform/eclipse.platform.swt/blob/b4e274f00d43607d9df00dad6136c72430b823e2/bundles/org.eclipse.swt/Eclipse%20SWT%20Drag%20and%20Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java#L135-L141

Sharing some findings here.Working on this further, will keep you posted once i have next update.

elsazac avatar May 26 '23 10:05 elsazac

Any progress with this issue?

BeckerWdf avatar Jun 21 '23 13:06 BeckerWdf

Any progress with this issue?

Yes.There is progress. Will be raising a patch in 1 or 2 days

elsazac avatar Jun 21 '23 13:06 elsazac

@BeckerWdf Sorry for the delay.I will update soon.

elsazac avatar Jun 26 '23 09:06 elsazac

Thanks for fixing.

BeckerWdf avatar Apr 05 '24 08:04 BeckerWdf

I just re-tested with M1 built. The issue above still exists. So dropping a java file into the editor area does not work on image of the onboarding info.

BeckerWdf avatar Apr 08 '24 09:04 BeckerWdf

@elsazac and @lshanmug can you pls have a look?

BeckerWdf avatar Apr 08 '24 09:04 BeckerWdf

@BeckerWdf which build are you on?

I am on the below version

Version: 2024-06 (4.32)
Build id: I20240406-1800

and this is how it is for me

https://github.com/eclipse-platform/eclipse.platform.swt/assets/122080218/ecf52224-7d80-4f58-b88b-876ad5f7a637

elsazac avatar Apr 08 '24 11:04 elsazac

I did the same with the same i-build. it's not working for me. I used this download: https://download.eclipse.org/eclipse/downloads/drops4/I20240406-1800/download.php?dropFile=eclipse-SDK-I20240406-1800-macosx-cocoa-aarch64.dmg

do you also use aarch64? What macOS version do you have?

BeckerWdf avatar Apr 08 '24 12:04 BeckerWdf

do you also use aarch64? What macOS version do you have?

Yes. I use aarch64 and I am on Sonoma 14.4.

I will try to investigate on this.

elsazac avatar Apr 08 '24 13:04 elsazac

I am on 14.4.1

BeckerWdf avatar Apr 08 '24 13:04 BeckerWdf

I couldn't identify a probable reason on this but this is how it is in I20240406-1800 build on Mac for me.

https://github.com/eclipse-platform/eclipse.platform.swt/assets/122080218/664b0ad2-df4e-40cb-891a-545a3a55e67e

elsazac avatar Apr 08 '24 13:04 elsazac