Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Common Navigator Drop Problem
Common Navigator Drop Problem [message #330283] Thu, 24 July 2008 13:21 Go to next message
Mike Bernat is currently offline Mike BernatFriend
Messages: 12
Registered: July 2009
Junior Member
We are using the CommonNavigator to display a view of items that exists on
multiple servers. We support different logical views of the same server
and
therefore the same items could appear in the viewer more than once. We use
the ITreePathContentProvider to create the tree and ensure that each
remote item is represented by only one object in the tree, even if it is
visible in multiple places. Everything works well and ITreeSelections and
TreePaths seem to be available in all the right places, except in the
CommonDropAdapterAssistant subclasses. In both the validateDrop() and
handleDrop() methods, the drop target is available only as a simple object
from the tree. Since that object can occur more than once in the viewer
but only once in the underlying tree, it is not
possible to reliably determine the full parentage of the drop target,
since the target could have multiple parents.

Is there any way to get a TreePath for the drop target in validateDrop()
and handleDrop()?

Thanks in advance,
Mike
Re: Common Navigator Drop Problem [message #330334 is a reply to message #330283] Fri, 25 July 2008 15:45 Go to previous messageGo to next message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
Yes, you can do this by overriding the
ViewerDropAssistant.determineTarget() method. This is given the
TreeItem (event.item). You should be able to use this to construct the
parent from the SWT Tree and then you can store that as a new field in
your subclass. I have not actually tried this, so you should be careful
about making sure where you store this tree path it will always be
correct and what you want. But hopefully this should get you started.

I don't think their is an easier way.

Francis

Mike Bernat wrote:
> We are using the CommonNavigator to display a view of items that exists
> on multiple servers. We support different logical views of the same
> server and therefore the same items could appear in the viewer more than
> once. We use the ITreePathContentProvider to create the tree and ensure
> that each remote item is represented by only one object in the tree,
> even if it is visible in multiple places. Everything works well and
> ITreeSelections and TreePaths seem to be available in all the right
> places, except in the CommonDropAdapterAssistant subclasses. In both the
> validateDrop() and handleDrop() methods, the drop target is available
> only as a simple object from the tree. Since that object can occur more
> than once in the viewer but only once in the underlying tree, it is not
> possible to reliably determine the full parentage of the drop target,
> since the target could have multiple parents.
> Is there any way to get a TreePath for the drop target in validateDrop()
> and handleDrop()?
>
> Thanks in advance,
> Mike
>


--
*new* Common Navigator Framework section in:
3.4RC4 Platform Plugin Developer Guide (Programmer's Guide)
http://help.eclipse.org/ganymede/topic/org.eclipse.platform. doc.isv/guide/cnf.htm
http://dev.eclipse.org/blogs/francis
http://wiki.eclipse.org/Common_Navigator_Framework
http://wiki.eclipse.org/Common_Navigator_Framework_Use_Cases


You have brains in your head.
You have feet in your shoes.
- Dr Seuss, Oh the Places You'll Go


Re: Common Navigator Drop Problem [message #330337 is a reply to message #330334] Fri, 25 July 2008 17:26 Go to previous messageGo to next message
Mike Bernat is currently offline Mike BernatFriend
Messages: 12
Registered: July 2009
Junior Member
Thanks for the response. I did notice that the DropTargetEvent contains
the TreeItem, and the viewer provides a method, getTreePathFromItem(),
which does what I need. Unfortunately that method is protected so that
would mean a subclass of CommonViewer to override the visibility of the
method. This in addition to a subclass of the CommonDropAdapter to create
a way to make the DropTargetEvent visible to the validateDrop() method. I
was really hoping for a solution that does not involve so much subclassing.
Re: Common Navigator Drop Problem [message #330341 is a reply to message #330337] Fri, 25 July 2008 19:57 Go to previous messageGo to next message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
If I were you, I would just copy the implementation of
getTreePathFromItem() from the viewer and put it in your override of
determineTarget() (it's only a few lines of code); that way you only
have to subclass the drop adaptor. That should be a public static
method anyway since it's generally useful. There might even be
something in SWT that does the same thing.

Can you file an enhancement request about this? I think it's a useful
feature, so we should change the product to make this easier.

Francis

Mike Bernat wrote:
> Thanks for the response. I did notice that the DropTargetEvent contains
> the TreeItem, and the viewer provides a method, getTreePathFromItem(),
> which does what I need. Unfortunately that method is protected so that
> would mean a subclass of CommonViewer to override the visibility of the
> method. This in addition to a subclass of the CommonDropAdapter to
> create a way to make the DropTargetEvent visible to the validateDrop()
> method. I was really hoping for a solution that does not involve so much
> subclassing.
>
>
>


--
*new* Common Navigator Framework section in:
3.4RC4 Platform Plugin Developer Guide (Programmer's Guide)
http://help.eclipse.org/ganymede/topic/org.eclipse.platform. doc.isv/guide/cnf.htm
http://dev.eclipse.org/blogs/francis
http://wiki.eclipse.org/Common_Navigator_Framework
http://wiki.eclipse.org/Common_Navigator_Framework_Use_Cases


You have brains in your head.
You have feet in your shoes.
- Dr Seuss, Oh the Places You'll Go


Re: Common Navigator Drop Problem [message #330342 is a reply to message #330341] Fri, 25 July 2008 20:21 Go to previous messageGo to next message
Mike Bernat is currently offline Mike BernatFriend
Messages: 12
Registered: July 2009
Junior Member
That is the route I will probably take. There is already a Bugzilla entry
(222948) to make the getTreePathFromItem method public.

Thanks
Re: Common Navigator Drop Problem [message #330346 is a reply to message #330342] Fri, 25 July 2008 21:01 Go to previous messageGo to next message
Mike Bernat is currently offline Mike BernatFriend
Messages: 12
Registered: July 2009
Junior Member
Francis,

Unfortunately, the CommonDropAdapter, which is the last subclass of
ViewerDropAdapter, is declared as final so further subclassing is not
possible. I would really like to avoid cloning the CommonDropAdapter,
although that may be the only alternative. Can you think of anything else?

Thanks in advance

Mike Bernat wrote:

> That is the route I will probably take. There is already a Bugzilla entry
> (222948) to make the getTreePathFromItem method public.

> Thanks
Re: Common Navigator Drop Problem [message #330351 is a reply to message #330346] Fri, 25 July 2008 22:30 Go to previous message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
That sucks. Sorry I can't think of anything else. If you would not
mind filing a bug about that too, I would appreciate it. These things
need to be more extensible.

Francis

Mike Bernat wrote:
> Francis,
>
> Unfortunately, the CommonDropAdapter, which is the last subclass of
> ViewerDropAdapter, is declared as final so further subclassing is not
> possible. I would really like to avoid cloning the CommonDropAdapter,
> although that may be the only alternative. Can you think of anything else?
>
> Thanks in advance
>
> Mike Bernat wrote:
>
>> That is the route I will probably take. There is already a Bugzilla
>> entry (222948) to make the getTreePathFromItem method public.
>
>> Thanks
>
>


--
*new* Common Navigator Framework section in:
3.4RC4 Platform Plugin Developer Guide (Programmer's Guide)
http://help.eclipse.org/ganymede/topic/org.eclipse.platform. doc.isv/guide/cnf.htm
http://dev.eclipse.org/blogs/francis
http://wiki.eclipse.org/Common_Navigator_Framework
http://wiki.eclipse.org/Common_Navigator_Framework_Use_Cases


You have brains in your head.
You have feet in your shoes.
- Dr Seuss, Oh the Places You'll Go


Previous Topic:Build problem with plugins. (help needed)
Next Topic:Relative path for linked resources, why not?
Goto Forum:
  


Current Time: Thu Nov 21 16:26:17 GMT 2024

Powered by FUDForum. Page generated in 0.04432 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top