Bug 192704 - [dnd] NPE when dropping a folder from Project Explorer into a folder below "Local Files"
Summary: [dnd] NPE when dropping a folder from Project Explorer into a folder below "L...
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P1 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: David McKnight CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 200557 200682
  Show dependency tree
 
Reported: 2007-06-14 12:08 EDT by Michael Scharf CLA
Modified: 2007-08-21 09:50 EDT (History)
2 users (show)

See Also:


Attachments
experimental hack for dnd from project explorer (3.56 KB, patch)
2007-06-15 11:49 EDT, David McKnight CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Scharf CLA 2007-06-14 12:08:39 EDT
with drop S-2.0RC3-200706140914:
- drag a file from the project explorer into a directory of a ssh connection
=> I can see visual feedback (a file icon), but nothing happenss. The visual feedback stays there when I release the mouse until I click into Remote Systems View again.

However, dragging from the remote system to the project explorer works.
Also dragging a file from one remote directory to another works as well...
Comment 1 David Dykstal CLA 2007-06-14 12:31:25 EDT
This may be a known limitation due to the way the project explorer works. Assigning to DaveM for evaluation.
Comment 2 Michael Scharf CLA 2007-06-14 12:37:22 EDT
how else would I get a file to a remote ssh site?
Comment 3 David McKnight CLA 2007-06-14 12:41:11 EDT
What happens if you use the Navigator?
Comment 4 Michael Scharf CLA 2007-06-14 18:47:16 EDT
With the navigator, it works just fine!
What's actually the difference between the two?
Comment 5 Michael Scharf CLA 2007-06-14 19:15:06 EDT
The project explorer is used by other plugins like CDT, therefore I think it's critical to support it....

I haven't used the navigator since quite some time... one of the problems is that is does not allow to group into working sets. I'm lost without that grouping -- too many projects in my workspace...
Comment 6 David McKnight CLA 2007-06-15 11:45:47 EDT
Actually, dropping from project explorer should work.  Copy/paste from project explorer to RSE seems fine to me but there seems to be a bug in the RSE drop adapter.  The known limitation is in dragging and dropping from RSE to project explorer.
Comment 7 David McKnight CLA 2007-06-15 11:49:09 EDT
Created attachment 71473 [details]
experimental hack for dnd from project explorer

Here's an experimental hack that gets resources from project explorer via drag and drop.  This isn't the right way to do it - I think we need to use common resources adapters but that requires a bit of investigation.
Comment 8 Martin Oberhuber CLA 2007-06-28 10:45:41 EDT
Workaround: I guess the safest is to drag&drop or copy&paste from the RSE "Local Files" subsystem to the remote.

I agree the the Project Explorer should be fixed. It's different than Resource Navigator, because PE can show any kind of contents whereas RN always shows only files -- so RN always uses FileTransfer whereas PE uses something different.
Comment 9 David McKnight CLA 2007-06-28 16:14:51 EDT
Martin, did you try the patch I put here?  It may be a suitable workaround for the time-being.  
Comment 10 Martin Oberhuber CLA 2007-06-29 05:36:19 EDT
I did not look into what you described as a hack - IMHO we have time until 2.0.1 so we should come up with a proper solution.
Comment 11 Martin Oberhuber CLA 2007-08-20 10:13:35 EDT
Reproduced this with RSE HEAD on both Windows and Linux. Got following NPE when dragging a folder from a project in project explorer into a folder below "Local Files"/My Home/aatmp. Changed summary, old value was:
   Dropping a file from the ProjectExplorer into a sftp directory does not work

The problem seems to be that RSE detects a PluginTransfer, tries to unmarshal it and thinks it was an RSE object being dragged. But the string unmarshaled is just "org.eclipse.ui.navigator" which does not map to a valid profile / connection, hence the NPE when trying to access the profile.

Attached patch fixes the issue, so I'm applying it into RSE HEAD for now.

The NPE is as follows:
java.lang.NullPointerException
at org.eclipse.rse.ui.internal.model.SystemRegistry.getHostPool(SystemRegistry.java:1343)
at org.eclipse.rse.ui.internal.model.SystemRegistry.getHost(SystemRegistry.java:1530)
at org.eclipse.rse.internal.ui.view.SystemViewDataDropAdapter.getObjectFor(SystemViewDataDropAdapter.java:260)
at org.eclipse.rse.internal.ui.view.SystemViewDataDropAdapter.getRSESourceObjects(SystemViewDataDropAdapter.java:112)
at org.eclipse.rse.internal.ui.view.SystemViewDataDropAdapter.getSourceObjects(SystemViewDataDropAdapter.java:127)
at org.eclipse.rse.internal.ui.view.SystemViewDataDropAdapter.performDrop(SystemViewDataDropAdapter.java:164)
at org.eclipse.jface.viewers.ViewerDropAdapter.drop(ViewerDropAdapter.java:233)
at org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java:90)
Comment 12 Martin Oberhuber CLA 2007-08-20 10:17:59 EDT
Patch applied:

[192704] work around drag&drop issues from Project Explorer
    SystemViewDragDropAdapter.java  1.4

Filed bug #200557 asking for review of the experimental hack to come up with a
proper solution
Comment 13 Martin Oberhuber CLA 2007-08-21 09:02:49 EDT
The fix is good for normal files (*.txt, ...) or simple projects.

It fails for *.c / *.h files in CDT projects. In that case, the file is simply not transferred, no error message is logged. Getting this to work is very import for our product!

To reproduce:
* Install CDT 4.0 (Help > Software Updates > Find and Install > New Features >
  Europa Discovery Site > C/C++)
* File > New > C Project
* Accept the Defaults
* File > New > Source Folder, name="src"
* File > New > C File, name="foo.c"
* Drag & Drop foo.c from project explorer into RSE System View, 
  Local Files/My Home/aatmp

The file is not transferred.
Comment 14 Martin Oberhuber CLA 2007-08-21 09:50:09 EDT
Since the original NPE is no longer seen, this bug is marked fixed.
The CDT issue is tracked by bug 200682.