Community
Participate
Working Groups
3.3 N0510 The Package Explorer and other navigators have one "Show In" menu, with a submenu with entries for each of the different target views. The Plug-ins view has two menus, "Show in Resource Navigator" and "Show in Package Explorer". It would be good to have some consistency in this regard and I'd suggest we follow the Package Explorer pattern, since a submenu makes it easier to add targets and takes up less top level menu space. Thus: 1. The plug-ins view should be one menu with a submenu with "Navigator" and "Packapge Explorer". 2. The Show-In menu should probably be bound to Alt-Shift-W like in the Package Explorer.
Nice polish defect for Noam.
The menu reorganization is done, but unfortunately the keybinding is a little more complicated. It looks like the original 'Alt+Shift+W' command is bound to the window context, so it seems that I can't override the original behaviour. In every case, pressing Alt+Shift+W in the Plugins view brings up a context menu that says '<No available views>', but it should say the two options available in our 'Show In' submenu from the right-click context. Paul, I've been told by Wassim that you understand the 'black art' of keybinding. Any advice would be appreciated. :) I've tried two things: 1) In the view code itself, I've tried to set the action associated with the existing command to a new action (using a call to setGlobalActionHandler). This still results in the original action showing through. 2) Create a PDE context that is a child of the window context and bind my own command to that context. Then map the command I've created to the action I want in the same way as done above. Same result.
Views like the problems view take advantage of ContributionItemFactory.VIEWS_SHOW_IN to populate their showIn items. for example check out org.eclipse.ui.views.markers.internal.MarkerView getAdapter(*) which provides the IShowInSource and createShowInMenu(*) which creates the correct menu for the context menu ... although this isn't strictly necessary. Then the ALT+SHIFT+W menu is created for free. That's how the other parts use the Show In menu and keybindings. But your option 2) should definitely work. 1. create your command 2. create a context, child of org.eclipse.ui.contexts.window 3. create a keybinding for that context->command 4. in your view createPartControl, use getSite().getService(*) to get the IContextService and IHandlerService 5. activate your context 6. if you declare a handler you don't need the IHandlerService. But if you are instantiating a handler programmatically (or sticking an Action in an ActionHandler) you do that in the createPartControl(*) as well. Later, PW
Created attachment 67530 [details] Patch for bug 186578. As per Paul's suggestion, this code overrides the getAdapter(*) class to use the existing 'Alt+Shift+W' functionality. I've noticed that a History option appears in the context that pops up. This option is not in the right-click context menu yet. We'll investigate and correct that later, but for now the existing functionality has been fixed and is consistent with the Package Explorer. Paul, thank you very much for your help.
Brian, please review. The History issue is covered in bug 170156
Created attachment 67867 [details] Revised patch for 186578. The original patch encountered problems populating the 'Show In' context with views when the user invokes the context from the Plug-In Development perspective. Currently, as mentioned in bug 173649, there's no way to alter the Show In contexts application-wide whenever a new resource view is added to Eclipse that should appear in the 'Show In' menu. Until there's a solution to the above bug, we're down to the two solutions described in the bug description. Since the first option doesn't affect non-PDE perspectives, the Plug-In Development view's 'Show In' context might be left unpopulated in certain perspectives that are not under our control. As a result, we're going with Option B, which is to let the Plug-in Development view specify which views will appear in its "Show In" context. Please keep in mind that until bug 173649 is fixed, this means that the View needs to be updated whenever we want to change how the 'Show In' context is populated (i.e. adding or removing a 'Show In' view).
Noam, the patch works great.
If I didn't know any better, I would have thought Noam hacked my computer and saw my solution :) The only thing I added to the patch was the removal of ShowInWorkspaceAction. Other than that, the patch was perfect. Nice job Noam.