This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 431714 - EModelService.findElements does not find handlers and commands
Summary: EModelService.findElements does not find handlers and commands
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 4.4 M7   Edit
Assignee: Eric Moffatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 424367
Blocks:
  Show dependency tree
 
Reported: 2014-04-01 10:25 EDT by Lars Vogel CLA
Modified: 2014-05-01 10:15 EDT (History)
5 users (show)

See Also:


Attachments
ModelServiceImpl (4.26 KB, patch)
2014-04-02 01:40 EDT, Louis-Michel Mathurin CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2014-04-01 10:25:29 EDT
Bug 383403 had the purpose to define a generic find API. Current we cannot find handlers and commands.
Comment 1 Eric Moffatt CLA 2014-04-01 13:49:22 EDT
Finding a Command is trivial to write. Handlers are more complex as are KeyBindings since they may be contained in MParts (MWindows ?) as well as in the application.

Perhaps we can extend the scope of our search iterator by adding some more 'searchFlags' like BINDING_CONTAINERS and HANDLER_CONTAINERS ?
Comment 2 Eric Moffatt CLA 2014-04-01 14:02:28 EDT
Note: I've opened bug 431738 to track the necessity of adding a Class<T> parameter to the new find API to allow for typing the returned list. This can also be used to optimize the search tree.

For example if I'm searching for an MHandler we could start by using findElements to find all the MHandlerContainers first and then iterate only over those.
Comment 3 Louis-Michel Mathurin CLA 2014-04-02 01:40:15 EDT
Created attachment 241496 [details]
ModelServiceImpl

@Eric: Let me know if this what you are looking for.  It works on my side.

Another comment:
For me semantically the code bellow will return all MHandler in all parts

findElements = service.findElements(application, null, MHandler.class, null, EModelService.IN_PART);

But according to the javadocs, it will never return elements, because this only navigate in menu and toolbar of a part.

In the patch there is some code in comments (if you uncomment it, the example code will return all handlers in parts)
Comment 4 Lars Vogel CLA 2014-04-02 01:52:23 EDT
Louis, can you create a Gerrit review instead of a patch?
Comment 5 Lars Vogel CLA 2014-04-02 01:54:38 EDT
Louis, can you create a Gerrit review instead of a patch?(In reply to Louis-Michel Mathurin from comment #3)
> Created attachment 241496 [details]
> ModelServiceImpl
> 
> @Eric: Let me know if this what you are looking for.  It works on my side.
> 
> Another comment:
> For me semantically the code bellow will return all MHandler in all parts
> 
> findElements = service.findElements(application, null, MHandler.class, null,
> EModelService.IN_PART);
> 
> But according to the javadocs, it will never return elements, because this
> only navigate in menu and toolbar of a part.
> 
> In the patch there is some code in comments (if you uncomment it, the
> example code will return all handlers in parts)

+1 for returning all handlers and adjusting the Javadoc
Comment 6 Paul Webster CLA 2014-04-04 10:37:20 EDT
(In reply to Louis-Michel Mathurin from comment #3)
> Created attachment 241496 [details]
> ModelServiceImpl

Review: https://git.eclipse.org/r/#/c/24315/ (please remember to add this to the bug).

Released as http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=cf7be5c8f93e003afa54c4928cda1d57130ce10f

Thanks Louis-Michel.

PW
Comment 8 Paul Webster CLA 2014-05-01 10:15:46 EDT
In 4.4.0.I20140501-0200

PW