Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 322894

Summary: PDT 2.2 NPEs when running on Eclipse 4.x
Product: z_Archived Reporter: Remy Suen <remy.suen>
Component: PDTAssignee: Jacek Pospychala <jacek.pospychala>
Status: CLOSED FIXED QA Contact: Ilina Stefanova <ilina.s>
Severity: normal    
Priority: P3 CC: emoffatt, ganoro, jacek.pospychala, kalin.a, pwebster
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
remove DNDUtils none

Description Remy Suen CLA 2010-08-17 08:12:23 EDT
Downcasting to the internal class WorkbenchPage is unsupported. While the method getClientComposite() physically exists at the moment, we are under no obligation to keep it lying around.Even if it returned something of use (right now it returns 'null'), the class org.eclipse.ui.internal.EditorStack no longer exists in 4.x so the code _will_ crash farther down the method.

Caused by: java.lang.NullPointerException
at org.eclipse.php.internal.ui.dnd.DNDUtils.pageEnableExternalDrop(DNDUtils.java:89)
at org.eclipse.php.internal.ui.dnd.DNDUtils.windowEnableExternalDrop(DNDUtils.java:80)
at org.eclipse.php.internal.ui.dnd.DNDUtils.initEditorSiteExternalDrop(DNDUtils.java:69)
at org.eclipse.php.internal.ui.PHPUiPlugin$1$1.run(PHPUiPlugin.java:145)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
... 47 more
Comment 1 Roy Ganor CLA 2010-08-17 10:15:32 EDT
thanks Remi!

Jacek I remember that you tweaked PDT to e4, so I pass this to you.
Comment 2 Remy Suen CLA 2010-10-27 13:54:40 EDT
I just hit this again while testing our M3 candidate build.

Can anyone explain to me what the point of these DND handlers are? I can already drag files from Windows Explorer and drop them into Eclipse's editor area to have the file be opened in Eclipse. I am having difficulties understanding why this extra code is needed in PDT.
Comment 3 Jacek Pospychala CLA 2010-10-28 03:52:55 EDT
hi Remy,
this DND code exists since 2007. Maybe it predates DND support in platform that you're talking about?
Comment 4 Remy Suen CLA 2010-10-28 07:48:39 EDT
(In reply to comment #3)
> this DND code exists since 2007. Maybe it predates DND support in platform that
> you're talking about?

Possibly. I tried doing DND on 3.2.0 (M20060629-1905) and it doesn't seem to work. It does work on 3.3.2 (M20080221-1800). So it is possible the original PDT was targeting 3.2.x which did not have this feature.
Comment 5 Jacek Pospychala CLA 2010-10-28 08:18:59 EDT
Created attachment 181927 [details]
remove DNDUtils
Comment 6 Jacek Pospychala CLA 2010-10-28 08:20:04 EDT
ok sounds fair. DragAndDrop to editor area still works after removing DNDUtils. I removed it in HEAD and attached patch with my change.
Comment 7 Jacek Pospychala CLA 2010-10-28 08:21:03 EDT
Thanks Remy!

is there anything else that needs to be fixed in PDT for Eclipse 4.x?
Comment 8 Remy Suen CLA 2010-10-28 08:25:09 EDT
(In reply to comment #6)
> ok sounds fair. DragAndDrop to editor area still works after removing DNDUtils.
> I removed it in HEAD and attached patch with my change.

Thanks, Jacek!

(In reply to comment #7)
> is there anything else that needs to be fixed in PDT for Eclipse 4.x?

I will be opening bugs as I find them. Unfortunately, I don't use PDT or program in PHP so I'm not really able to actually do much real testing for PDT on Eclipse 4.x.
Comment 9 Remy Suen CLA 2010-10-28 10:33:01 EDT
I think you can also delete ExternalFileDropAdapter? That file doesn't seem to be used anywhere.

I checked out the following projects from HEAD and they all seemed to compile cleanly for me on 4.x so there doesn't appear to be too much rampant usage of workbench internals.

org.eclipse.dltk.core
org.eclipse.dltk.core.manipulation
org.eclipse.dltk.launching
org.eclipse.dltk.ui
org.eclipse.php
org.eclipse.php.astview
org.eclipse.php.core
org.eclipse.php.core.parser
org.eclipse.php.debug.core
org.eclipse.php.debug.daemon
org.eclipse.php.debug.ui
org.eclipse.php.help
org.eclipse.php.server.core
org.eclipse.php.server.ui
org.eclipse.php.ui
Comment 10 Jacek Pospychala CLA 2010-10-28 10:46:49 EDT
yes, actually only PHPNavigatorDropAdapter and PHPViewerDropSupport seem to be only classes used outside this org.eclipse.php.internal.ui.dnd package.

probably it's a good time to install FindBugs :-)
Comment 11 Jacek Pospychala CLA 2010-10-28 10:51:16 EDT
removed BasicSelectionTransferDragAdapter, DelegatingDragAdapter, DelegatingDropAdapter, ExternalFileDropAdapter, PHPViewerDragAdapter, PHPViewerDropAdapter, ResourceTransferDragAdapter, TransferDropTargetListener
Comment 12 Kalin CLA 2011-08-03 02:14:28 EDT
Closing...