Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-ui-dev] Adding double-click listener to ExtendedMarkersView extender

Hi,

I have a view that extends ExtendedMarkersView - I know that this is
in internal package. 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. The only way I could get instance of
the viewer is using reflection:

Class<?> clazz = ExtendedMarkersView.class;
Field field = clazz.getDeclaredField("viewer");
field.setAccessible(true);
MarkersTreeViewer cachedViewer = (MarkersTreeViewer)
field.get(getViewSite().getPart());

However, while successful I cannot cast ISelection object to
MarkerEntry in IDoubleClickListener.doubleClick() because MarkerEntry
has no modifier. 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 so restricted? When I
use classes that are internal, I understand implications of such use.

Thanks,
Alex


Back to the top