Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Adding double-click listener to ExtendedMarkersView extender
Adding double-click listener to ExtendedMarkersView extender [message #900406] Mon, 06 August 2012 21:21 Go to next message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 393
Registered: November 2009
Senior Member
Hi,

I have a view that extends ExtendedMarkersView. I would like to add DoubleClickListener to the viewer, unfortunately it's marked as private and method getViewer has no modifier so I can't access it. I can try accessing viewer using reflection, but would like to avoid it if possible.

Thanks,
Alex

[Updated on: Mon, 06 August 2012 21:21]

Report message to a moderator

Re: Adding double-click listener to ExtendedMarkersView extender [message #900611 is a reply to message #900406] Tue, 07 August 2012 18:56 Go to previous message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 393
Registered: November 2009
Senior Member
The only solution I could find is using reflection API to get the viewer
Class<?> clazz = ExtendedMarkersView.class;
Field field = clazz.getDeclaredField("viewer");
field.setAccessible(true);
MarkersTreeViewer cachedViewer = (MarkersTreeViewer) field.get(getViewSite().getPart());

However, when adding IDoubleClickListener the ISelection is of type MarkerEntry with no modifier, so I can't cast selection to this type. Such restriction is evident throughout ExtendedMarkersView as well. I understand that these classes are internal, but why be so restrictive on their access? Why are ExtendedMarkersView.viewer and MarkerEntry are restricted? What is gained by making them as such?

[Updated on: Tue, 07 August 2012 18:56]

Report message to a moderator

Previous Topic:Adapter Factory Not loaded
Next Topic:Export Editor as image
Goto Forum:
  


Current Time: Mon Dec 22 15:08:06 GMT 2014

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

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