Community
Participate
Working Groups
R3.5. The compare editor does not offer team actions (via context menu) which makes my life harder than it should be: each time a change is reviewed I have to manually search (due to bug 219570) that file in the Synchronize view in order to commit or update that file. Simplest fix would be to offer the Team menu like it's available in the normal editors.
First some general facts: - all context menu actions in the compare editor are added programmatically (see org.eclipse.compare.internal.MergeSourceViewer.menuAboutToShow(IMenuManager) in o.e.compare) - Team menu is defined in o.e.team.ui - a few Team actions are contributed in o.e.team.ui/plugin.xml - majority of actions we're interested in are defined using org.eclipse.ui.popupMenus and objectContributions in o.e.team.cvs.ui/plugin.xml I wonder what are my options... a) can I programmatically add objectContributions to the editor's context menu? b) can I programmatically add Team actions to the editor using IMenuService? c) would fixing bug 173457 or bug 175693 help here? Paul could you please shed light on this? I'm not sure where should I start.
(In reply to comment #1) > I wonder what are my options... > a) can I programmatically add objectContributions to the editor's context menu? > b) can I programmatically add Team actions to the editor using IMenuService? > c) would fixing bug 173457 or bug 175693 help here? A little background. We get the behaviour we want for for this because most editors include their editor input when they call registerContextMenu(menu, provider, true); Every time a context menu shows, the FileEditorInput (the most common) adapts to ResourceMapping (or is transformed) in the bowels of the ObjectActionContributionManager, and you get your Team menu and actions. Right now the compare editor returns a subclass of CompareEditorInput. I think that makes it hard to provide a general solution. Converting the popupMenus stuff to proper commands would give you more flexibility to try and solve this but then you are dealing with the variables available (activePart, activeMenuIds, activeEditor, activeEditorInput) and property testers. It's not obvious to me right now how you could define a team menu expression that would be valid for the compare editor (since team doesn't need to know about compare, right?). What if the CVSCompareEditorInput adapted to an IFile (for the case where there was one local file) or ResourceMapping (I'm a little less sure about this one) and your CompareEditor said it *would* include its input? it's not a general solution (what if the CompareEditorInput was to IFiles?) but would it allow the Team menu to show up in Dani's case? PW
Thanks for the comment Paul, at least I know now where to begin. I'll start with adopting CompareEditorInput to something useful as you suggested and see what happens.
Created attachment 154873 [details] Fix v01 Adapting to IContributorResourceAdapter.class and changing the flag[1] to consider compare editor input when adding object contributions looks promising. I'll install it into my Eclipse to play with it and see is it worth anything. [1] org.eclipse.ui.IEditorSite.registerContextMenu(MenuManager, ISelectionProvider, boolean)
Created attachment 154874 [details] mylyn/context/zip
Found one case (so far) which needs to be fixed before releasing the patch: 1. Synchronize a project, having at least one outgoing change. 2. Do "Open" and "Open in Compare Editor" for that file. 3. While in Compare Editor, right click in the left pane and do "Replace With > Latest from HEAD". 4. A warning about uncommitted changes to be overwritten shows up. This is expected. Select "OK". 5. Compare editor closes since there are no more changes to display. => "File not accessible" dialog pops out when focus gets back to the regular editor for the file. Workaround: Select "Close". After quick research, this seems to happen for all file types except plugin.xml...
It looks that we're pretty close to fixing it but I won't make it in 3.6M5. I'm too busy with blockers of bug 236169. Moving to 3.6M6.
Pawel, could please investigate why the dialog from comment 6 shows up. The patch is good imo, but I'm afraid I missed something and as we all know the Devil is in the details ;)
I can't reproduce the problem from comment 6. In step 5 I get a dialog saying "The file X has been changed on the files system. Do you want to replace the editor contents with these changes?" This dialog can be reproduced without a patch, one has to simply invoke Replace With > Latest from the other editor and switch to compare editor before the action ends (I did having both editors visible).
Created attachment 164367 [details] Patch_v02 Patch from comment 4 adjusted to HEAD.
Patch_v02 in HEAD. Tomasz, your concerns from comment 6 has been forked to bug 308637 as it's not something introduced by the patch. Marking as FIXED.