Bug 344023 - [var] Need a way to override Find action of Variables view and its derived classes.
Summary: [var] Need a way to override Find action of Variables view and its derived cl...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.8 M6   Edit
Assignee: Pawel Piech CLA
QA Contact:
URL:
Whiteboard:
Keywords: api, noteworthy
Depends on:
Blocks:
 
Reported: 2011-04-27 14:55 EDT by Winnie Lai CLA
Modified: 2012-03-09 18:35 EST (History)
4 users (show)

See Also:
Michael_Rennie: review+


Attachments
patch (4.76 KB, patch)
2011-04-27 17:53 EDT, Winnie Lai CLA
no flags Details | Diff
Validated fix. (15.81 KB, patch)
2012-03-08 01:16 EST, Pawel Piech CLA
no flags Details | Diff
Patch with getAction(). (16.18 KB, patch)
2012-03-08 12:11 EST, Pawel Piech CLA
no flags Details | Diff
Updated and tested patch. (37.69 KB, patch)
2012-03-08 14:47 EST, Pawel Piech CLA
no flags Details | Diff
Removed printfs (37.59 KB, patch)
2012-03-08 22:57 EST, Pawel Piech CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Winnie Lai CLA 2011-04-27 14:55:05 EDT
Build Identifier: 3.7 M6

For variables view, expressions view, registers view, modules view and any derived views of VariablesView class, we need a way to override the find action. The find action is currently VirtualFindAction which is a good one for general cases; but there are specific cases that some debuggers need to provide their own find action to overcome missing functionality and performance issues, both of which are hard to get agreement by everyone across every programming language and every debuggers. See all comments at 340891 for one of the many reasons.


Reproducible: Always
Comment 1 Winnie Lai CLA 2011-04-27 17:53:06 EDT
Created attachment 194218 [details]
patch

Please review and comment.
Comment 2 Pawel Piech CLA 2011-04-27 18:07:17 EDT
I'm sorry Winnie, but it's safe to say that it's too late to add new interface for 3.7.  Also, it should be possible to have the context menu action invoke the same command as the key binding.  Even then the change could interpreted as creating a form of a new API.
Comment 3 Patrick Chuong CLA 2011-04-28 10:12:41 EDT
I also need to replace the find action with my own dialog for the Modules view. Also, this patch is something that can be use to replace any internal actions for views that are derived from Variables.

Keybinding should work for the returning action by setting the action definition id as the VirtualFindAction.

I understanding that it is too late to have new interface, but can this interface be made as internal/private for 3.7 release and make public for post indigo?
Comment 4 Michael Rennie CLA 2012-02-28 16:58:51 EST
M6 is the last chance for 3.8 to get this in, Pawel can you review it before then?
Comment 5 Pawel Piech CLA 2012-03-08 01:16:18 EST
Created attachment 212272 [details]
Validated fix.

I finally started looking at this bug today and I think it's a very compelling feature.  It should allow debuggers to override not only the find action, but other standard actions such as double-click, etc.

On the implementation side, I ran into some complications: the variables view resets the global action when the detail pane is activated and the contributed patch didn't account for that.  In order to make it work I had to reorganize this remapping logic, which raises the risk that some bugs will creep in...
Comment 6 Pawel Piech CLA 2012-03-08 01:18:51 EST
Hi Mike,
If you have a sec, please take a look at this patch to see if you agree with how the API is being extended.  I still need to do some more testing and cleanup, but I could commit it by weekend.
Comment 7 Winnie Lai CLA 2012-03-08 11:53:36 EST
(In reply to comment #5)
> Created attachment 212272 [details]
> Validated fix.
> I finally started looking at this bug today and I think it's a very compelling
> feature.  It should allow debuggers to override not only the find action, but
> other standard actions such as double-click, etc.
> On the implementation side, I ran into some complications: the variables view
> resets the global action when the detail pane is activated and the contributed
> patch didn't account for that.  In order to make it work I had to reorganize
> this remapping logic, which raises the risk that some bugs will creep in...

Pawel,
I don't see how your code use IViewActionProvider.getAction while I see the code of using IViewActionProvider.getUpdatables. Is it just something you forgot to put in your patch?
Comment 8 Pawel Piech CLA 2012-03-08 12:11:49 EST
Created attachment 212309 [details]
Patch with getAction().

(In reply to comment #7)
> Pawel,
> I don't see how your code use IViewActionProvider.getAction while I see the
> code of using IViewActionProvider.getUpdatables. Is it just something you
> forgot to put in your patch?

Indeed.  I went back and forth between overriding getAction() and setAction().  Here's the one with getAction().
Comment 9 Pawel Piech CLA 2012-03-08 12:21:03 EST
As I'm testing, I'm seeing more problems with the patch.  Will post an update in a bit.
Comment 10 Michael Rennie CLA 2012-03-08 12:27:52 EST
-1 from me for this. 

If I understand what is wanted - a way to inject an action to override a default action (in this case specifically the find action) - then I am not sure this patch accomplishes that.

1. the getAction method is not used at all - I would assume it would be called during the view init to ensure the actions are overridden correctly

2. the new getUpdatables method makes no sense to me. could we not just add the custom actions to the global updatables map so they will be queried for their update status? why do we need more process for that? Or is that what / where that method is supposed to be used?

3. why the visibility change in VirtualFindAction?

4. the date + comments need clean up in IViewActionProvider
Comment 11 Pawel Piech CLA 2012-03-08 14:47:52 EST
Created attachment 212325 [details]
Updated and tested patch.

(In reply to comment #10)
> -1 from me for this. 
> 
> If I understand what is wanted - a way to inject an action to override a
> default action (in this case specifically the find action) - then I am not sure
> this patch accomplishes that.
Sorry, I rushed last night to get you to look at it because I wanted to know whether it was in the right direction.  But I obviously should have waited till I got it cleaned up.  This patch also includes an addition to the PDA example to use this API as a way of verifying it.

I've arrived at this version after a morning of testing.  It seems to work correctly though I was seeing one bug which I didn't definitively trace to any exception: the popup menu would stop being filled with the standard set of actions, instead it just had one element in it, and fillCotnextMenu was not being called.  It was somewhat intermittent when I saw it and I can't reproduce it in this latest version of the patch but I'll keep trying.  One curious thing I noticed in the process is that the Breakpoints view didn't properly re-update the redo/undo actions when detail pane was activated.  It also didn't register a find action.  

If you have a chance please take a look again.  The logic works for the attached PDA example, but it's grown to a fairly big change.

> 1. the getAction method is not used at all - I would assume it would be called
> during the view init to ensure the actions are overridden correctly
This was a refactoring error.

> 2. the new getUpdatables method makes no sense to me. could we not just add the
> custom actions to the global updatables map so they will be queried for their
> update status? why do we need more process for that? Or is that what / where
> that method is supposed to be used?
I was concerned that the overriden action would not be updated correctly.  With some refactoring I ended up removing this part.

> 3. why the visibility change in VirtualFindAction?
This was to enable the test code in PDA.  In this patch, I copied the action instead.

> 4. the date + comments need clean up in IViewActionProvider
Done.
Comment 12 Pawel Piech CLA 2012-03-08 22:57:23 EST
Created attachment 212350 [details]
Removed printfs
Comment 13 Michael Rennie CLA 2012-03-09 13:07:10 EST
+1 the only remaining issues are cosmetic:

1. unused imports in examples.ui
2. unused local var in debug.ui
3. spelling mistake in IViewActionProvider