Bug 190002 - [Viewers] Provide Way to Get Viewer From Control
Summary: [Viewers] Provide Way to Get Viewer From Control
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-30 14:50 EDT by Adam Cabler CLA
Modified: 2014-06-26 11:28 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Cabler CLA 2007-05-30 14:50:23 EDT
In trying to provide some simple expand operations in the properties view, I found it very difficult due to the inability to access the treeviewer.  Since I could only access the control, I had to send events instead of just calling the expand methods.  I also think there are other cases where you can only access a control, but would rather be able to get the viewer that wraps it.  Tom has suggested this as a possible fix for this:

Viewer v = (Viewer)Control.getData(Viewer.WIDGET_DATA_KEY);

Please note the WIDGET_DATA_KEY is already there but it isn't used.

1. We need to make this var API (public)
2. Need to fix hookControl()
Comment 1 Boris Bokowski CLA 2007-05-30 15:55:12 EDT
I'm not keen on doing this.  If you try to access the viewer for a control that you created, you can always store the viewer using setData() yourself.  However, if you try to get the viewer for a tree that you don't own, like in the case of the Properties view, chances are high that the code for the Properties view assumes that no one else has access to the tree viewer.

Basically, I am not convinced that an API that allows you to reach into other components' internals more easily is a good thing.
Comment 2 Thomas Schindl CLA 2007-05-30 16:04:18 EDT
Well, I'm not really against something like this. Let's leave this open and think about it later on. 

Is see the problem that people work-around this limitation using things that will break things miserably because they start accessing Viewer-Wrapped controls at the SWT-Level which will lead into many many problems.
Comment 3 Adam Cabler CLA 2007-05-30 19:28:59 EDT
I understand the issues with doing something like this.  For us, it isn't an issue since we are providing the workbench.  I can see it causing problems in a mixed plugin environment.  However, there are lots of things plugin authors have access to that can break the workbench for other plugins.  In this case, I had access to the tree control, so I could cause as much harm as with the viewer.
Bottom line for me is that it was way harder than it needed to be to simply add expand/collapse actions to the prop view.

Anyway, thanks for the consideration.
adam
Comment 4 Boris Bokowski CLA 2009-11-26 09:55:34 EST
Hitesh is now responsible for watching bugs in the [Viewers] component area.