Skip to content

Conversation

@deepika-u
Copy link
Contributor

@deepika-u deepika-u commented Nov 11, 2025

Fixes #2739

Description:
In the Project Explorer, the "Edit > Select All" menu item and Ctrl+A shortcut did not work reliably when a single project was selected. Specifically, pressing Ctrl+A after selecting a project for the first time had no effect. Only after clicking another project did Ctrl+A begin to work as expected.

Details of the fix:

  • Added a KeyListener to the Tree widget to handle Ctrl+A directly, ensuring selection works even without command activation.
  • Registered a IPartListener2 to activate the EDIT_SELECT_ALL command handler when the Project Explorer view becomes active, enabling the menu item.
  • Deactivated the handler when the view is no longer active to avoid stale references.

Note : No-ops - These methods are required by the IPartListener2 interface though unused but must be implemented. Yeah - i just tried even if removed it works(not sure if it added some warnings).

Open eclipse freshly, open Project Explorer view. Select a project and ctrl+A to select all the projects.
Before fix(unable to select, next click on 2nd project then ctrl+A will be enabled)
image

After fix(able to select)
image

@github-actions
Copy link
Contributor

github-actions bot commented Nov 11, 2025

Test Results

 3 018 files  ±0   3 018 suites  ±0   2h 16m 5s ⏱️ - 2m 28s
 8 234 tests ±0   7 985 ✅ ±0  249 💤 ±0  0 ❌ ±0 
23 622 runs  ±0  22 828 ✅ ±0  794 💤 ±0  0 ❌ ±0 

Results for commit a49db52. ± Comparison against base commit 6d2b614.

♻️ This comment has been updated with latest results.

}

// no-ops for the other methods:
@Override
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the methods have default implementations so these stubs are just useless noise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As suggested, removed them.

// Immediate fallback: handle Ctrl+A at the Tree level
commonViewer.getTree().addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow it seems like a hack to handle this one key directly, especially given the key binding appears to be configurable:

Image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, CommonViewer is a base class in CNF and can be extended. Adding key and part listeners that consumes key or register handlers here directly might affect others code. So please carefully change the code here, it is not only about Project Explorer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow it seems like a hack to handle this one key directly, especially given the key binding appears to be configurable:

Let me check on it.

reliably irrespective of first or subsequent selections.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edit/"Select All" Menu item disabled with single project selected in Project Explorer

3 participants