This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 281107 - [Compatibility] cannot paste with key shortcut from clipboard into dialog
Summary: [Compatibility] cannot paste with key shortcut from clipboard into dialog
Status: RESOLVED FIXED
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 0.9   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 0.9 RC2   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-22 12:13 EDT by Susan McCourt CLA
Modified: 2009-07-23 14:45 EDT (History)
3 users (show)

See Also:


Attachments
working with dialogs v01 (7.05 KB, patch)
2009-07-22 20:14 EDT, Paul Webster CLA
no flags Details | Diff
Working with dialogs v02 (13.10 KB, patch)
2009-07-23 13:34 EDT, Paul Webster CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Susan McCourt CLA 2009-06-22 12:13:55 EDT
WinXP, e4 Compatibility Platform	0.9.0.I20090617-1930

Pasting via Ctrl-V on WinXP does not work properly.
- copy text into clipboard
- Help->Install New Software...
- Ctrl-V to paste
- nothing appears to happen
- cancel the dialog
- notice that a snippet has been opened in an editor and the text pasted there.
Comment 1 Eric Moffatt CLA 2009-06-22 15:47:08 EDT
Susan, Key bindings are not fully functional yet (it may be that these are parameterized commands). 

As a workaround you might be able to use the context menu instead (I did this for my demo).
Comment 2 Susan McCourt CLA 2009-06-22 19:05:09 EDT
yes, I was able to use the context menu.
Just wanted to report the problem...
Comment 3 Oleg Besedin CLA 2009-07-17 10:52:54 EDT
This is a manifestation of a problem with multiple handlers overriding each other.

In this case the proper handler would be WidgetMethodHandler:paste. It is properly read and registered with the WorkbenchContext. However, later Eclipse plugins such as Package Explorer contribute their own handlers for the same id:

ID:      org.eclipse.ui.edit.paste
  Handle1: WidgetMethodHandler:paste
  Handle2: ActionHandler: PasteAction (has "enabledWhen")
  Handle3: Java editor contributes ...
  ...

There are two generic problems with this:

1) handles are stored directly in the context using ID. As such, multiple handles with the same ID will overwirite each other.

2) the "enabledWhen" part gets lost (specific place is LegacyHandlerService.activateHandler() but there is no processing of it in the new code anywhay). 

So even if handles weren't overwritten in (1), the absence of "enabledWhen" resolution effectively selects the last processed handle, not the one fitting the desired scenario.
Comment 4 Paul Webster CLA 2009-07-17 11:17:22 EDT
It sounds like this should be addressed by bug 283536

PW
Comment 5 Paul Webster CLA 2009-07-21 14:54:05 EDT
(In reply to comment #3)
> So even if handles weren't overwritten in (1), the absence of "enabledWhen"
> resolution effectively selects the last processed handle, not the one fitting
> the desired scenario.
> 

OK, multiple handlers now work through their activeWhen clauses or programmatic expressions to determine which one is really active, a la bug 283536

But there is still work here, as having the dialog as the active shell should remove most of the other handlers.  It doesn't ATM because they use the WorkbenchWindowExpression which is not invalidated by a dialog.

PW
Comment 6 Paul Webster CLA 2009-07-22 20:14:46 EDT
Created attachment 142335 [details]
working with dialogs v01

OK, things worth noting.  When executing in a dialog you end up with the MWorkbenchWindow context (the dialog Shell has the WW Shell as a parent).

For things like copy, paste, look at org.eclipse.ui.SubActionBars.setGlobalActionHandler(String, IAction).  The Java Editor operation actions are being added with LegacyEditorActionBarExpression to the WW context.  Handlers added at the window or site level used to be scoped by the slave services on the way up, so this expression would have been ANDed with at least a WorkbenchWindowExpression, possibly an ActivePartExpression as well.  With those at least it wouldn't be active, even if it was visible at the WW level.

The patch is a work in progress, but there are other "more correct" paths.  What about creating a context for a Dialog that was parented off of the Workbench context and was the active child.  That would isolate it from all but the workbench level variables.  Of course, the WW would need to be set active when the shell became active.

PW
Comment 7 Paul Webster CLA 2009-07-23 13:34:46 EDT
Created attachment 142425 [details]
Working with dialogs v02

This adds restrictions to the WorkbenchWindow if the LegacyHandlerService can see the IWW.

But it also adds a context to each dialog off of the workbench context, so that they cannot see the state of the workbench window.

This seems to have brought back CTRL+C/V in commit, in open type, and in the about dialog.

PW
Comment 8 Paul Webster CLA 2009-07-23 13:38:03 EDT
Oleg, could you please have a look at patch v02?

PW
Comment 9 Oleg Besedin CLA 2009-07-23 14:28:49 EDT
The patch v02 looks good to me. Cut/Copy/Paste seem to work as expected.
Comment 10 Paul Webster CLA 2009-07-23 14:45:02 EDT
(In reply to comment #7)
> Created an attachment (id=142425) [details]
> Working with dialogs v02

Released for I20090723-1930

PW
Comment 11 Paul Webster CLA 2009-07-23 14:45:21 EDT
.