Skip to content

'Paste' is executed twice #4080

@wahlbrink

Description

@wahlbrink

Text from the clipboard is pasted twice into Combo widgets when using the keyboard shortcut under certain conditions.
The issue may also affect other widgets and actions like cut.

Steps to reproduce

In the IDE:

  • Copy some text -> text copied into the clipboard
  • Activate the Project Explorer and make sure that nothing is selected -> the Paste command is disabled
  • Open the "Install New Software" wizard
  • Press shortcut for 'Paste' (Ctrl+V) to paste the text in the combo field for the repositories -> the text is pasted twice

Analysis

Paste is performed:

  1. Via KeyBindingDispatcher -> HandlerService -> WidgetMethodHandler
  2. Via OS event handler (key event -> paste event)

I get the impression, the problem is in KeyBindingDispatcher.

The stack trace for the first paste looks like this:
Image
KeyBindingDispatcher.press -> KeyBindingDispatcher.executeCommand returns wrongly false even though 'Paste' is executed. So the Event in KeyBindingDispatcher.processKeyEvent is not marked as done (doit = false).
KeyBindingDispatcher.executeCommand returns false because command.isEnabled() evaluates to false. This check was added here: 35f5f09 / #3614

I am wondering if shouldn't it use

IEclipseContext staticContext = createContext(trigger);
boolean commandEnabled = handlerService.canExecute(parameterizedCommand, staticContext);

with the correct context instead of command.isEnabled() to evaluate if the command is enabled?

Tested under this environment:

Eclipse IDE
Version: 2026-06 (4.40)
Build id: I20260601-0713
Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions