Bug 132352 - [quick diff] "Live" Show Annotation should also be available from ruler context menu
Summary: [quick diff] "Live" Show Annotation should also be available from ruler conte...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: CVS (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Pawel Pogorzelski CLA
QA Contact:
URL:
Whiteboard:
Keywords: polish
: 133510 180991 (view as bug list)
Depends on: 134526 181916
Blocks:
  Show dependency tree
 
Reported: 2006-03-17 11:05 EST by Markus Keller CLA
Modified: 2009-04-29 05:28 EDT (History)
7 users (show)

See Also:


Attachments
Patch_v01 (4.44 KB, patch)
2009-04-28 05:51 EDT, Pawel Pogorzelski CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2006-03-17 11:05:36 EST
I20060315-1200

I keep trying to run the "Show Annotation" action from the annotation ruler context menu. Since the action now directly affects the annotation ruler, I think it should also appear in that context menu.
Comment 1 Tom Hofmann CLA 2006-04-03 06:35:48 EDT
*** Bug 133510 has been marked as a duplicate of this bug. ***
Comment 2 Dani Megert CLA 2006-04-03 06:41:09 EDT
Any chance to include this into 3.2?
Comment 3 Michael Valenta CLA 2006-04-03 08:44:00 EDT
Tom, can 3rd parties contribute menu items to the annotation ruler?
Comment 4 Tom Hofmann CLA 2006-04-03 11:04:13 EDT
(In reply to comment #3)
> Tom, can 3rd parties contribute menu items to the annotation ruler?

The ruler context menu is not specific per column, rather there is just a single context menu for the entire ruler.

3rd parties can contribute to the ruler context menu by contributing a viewerContribution to the org.eclipse.ui.popupMenus extension point - however, there is a caveat: Such contributions only work for a concrete instance of an editor (e.g. the Java editor), not on all text editors. The problem is really that a context menu can be registered for extension under only one ID - but in our case, we'd want to get generic (for all text editors) contributions as well as editor specific contributions...

You could use ITextEditorExtension::addRulerContextMenuListener which would inform you about the context menu being shown, and which would give you the chance to add a menu entry. However, for this to work you would need to register your menu listener on every text editor, which you may not want to track...

--

I see this is a problem - the other side of it is that it is a bad idea IMO for text to add menu entries (and actions and commands) for team-related functionality such as annotate.

Ideally, a similar mechanism should exist as for the context menu, where you contribute objectContributions that go via IAdaptable...
Comment 5 Michael Valenta CLA 2006-04-03 11:20:19 EDT
Based on Tom's comment, I don't think this is a good candidate for 3.2. To do this right, there would need to be some way for the QuickDiff provider to contribute a menu to the bar. I have logged bug 134526 to request this ability.
Comment 6 Michael Valenta CLA 2007-04-04 12:47:06 EDT
*** Bug 180991 has been marked as a duplicate of this bug. ***
Comment 7 Dani Megert CLA 2007-04-10 09:10:12 EDT
Time permitting for 3.3.
Comment 8 Michael Valenta CLA 2007-04-16 11:23:19 EDT
The required support for this was not put in place for 3.3 so we'll need to defer this.
Comment 9 Dani Megert CLA 2008-12-04 03:13:44 EST
Dependent bug 134526 is now almost there. What we need from CVS is a property tester for the action enablement in plugin.xml. It looks like there's already something in progress (commented out in /org.eclipse.team.cvs.ui/plugin.xml). This would test the editor input (access to editor input is the last remaining issue in Platform UI bug 134526).
Comment 10 Dani Megert CLA 2009-04-27 05:33:22 EDT
Here's my current code which adds the action to all editors but unfortunately
also in the case where the editor is open a non-shared file: 

<extension point="org.eclipse.ui.menus">
   <menuContribution
     
locationURI="popup:#AbstractTextEditorRulerContext?after=QuickDiff.Toggle">
      <command
         commandId="org.eclipse.team.cvs.ui.showAnnotation"
         style="push">
      </command>
   </menuContribution>
</extension>
Comment 11 Szymon Brandys CLA 2009-04-28 03:44:28 EDT
(In reply to comment #10)
When Show Annotation from the vertical ruler popup is called the first time, it starts to work as expected. It means that the next time when the popup is shown, the item is enabled only for shared files. 

This happens because before the first call, the show annotation delegate is not instantiated and its #isEnabled method is not consulted. I would like to see an option to force using #isEnable always, so far we have to create a tester that duplicates ShowAnnotationAction#isEnabled code.

Comment 12 Pawel Pogorzelski CLA 2009-04-28 05:51:42 EDT
Created attachment 133517 [details]
Patch_v01
Comment 13 Pawel Pogorzelski CLA 2009-04-28 06:22:59 EDT
Patch_v01 released to HEAD.
Comment 14 Dani Megert CLA 2009-04-29 05:28:24 EDT
Verified in I20090429-0100.

Minor issue: the menu has no mnemonic (see bug 274264).