Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 21, 2025

Overview

Adds comprehensive documentation for calling commands programmatically in Eclipse 4 (E4) applications and migrating from Eclipse 3.x command execution patterns.

Changes

New Documentation: docs/Eclipse4_Commands.md

Created a complete guide for programmatically calling commands in E4 applications, covering:

  • ECommandService and EHandlerService usage
  • Basic command execution without parameters
  • Command execution with parameters using Map<String, Object>
  • Dependency injection patterns for parts and handlers
  • Complete working examples with SWT UI integration
  • Error handling and exception management
  • Common use cases (opening views, perspectives, saving files, etc.)
  • Required MANIFEST.MF dependencies
  • Key differences from Eclipse 3.x approach

All code examples are based on actual Eclipse Platform UI source code (e.g., PerspectiveSwitcher.java, LegacyHandlerService.java) to ensure technical accuracy.

Example from the new documentation:

@Inject
private ECommandService commandService;

@Inject
private EHandlerService handlerService;

public void showSpecificView(String viewId) {
    Map<String, Object> parameters = new HashMap<>();
    parameters.put("org.eclipse.ui.views.showView.viewId", viewId);
    
    ParameterizedCommand command = commandService.createCommand(
        "org.eclipse.ui.views.showView", 
        parameters
    );
    
    handlerService.executeHandler(command);
}

Enhanced Migration Guide: docs/Eclipse4_Migration.md

Added a new section "Migrate Programmatic Command Execution" that provides:

  • Side-by-side E3 vs E4 code examples
  • Step-by-step migration instructions
  • Comparison table highlighting key differences (service names, method names, parameter formats)
  • Migration patterns for common scenarios (opening views, saving, etc.)
  • Updated common pitfalls section with command-specific gotchas

E3 to E4 Migration Example:

Aspect Eclipse 3.x Eclipse 4.x
Command Service ICommandService ECommandService
Handler Service IHandlerService EHandlerService
Service Access getSite().getService() @Inject annotation
Command Creation getCommand() + new ParameterizedCommand() createCommand()
Parameter Format Parameterization[] array Map<String, Object>
Execution Method executeCommand() executeHandler()

Cross-References Added

  • Added prominent reference in docs/Eclipse4_RCP_FAQ.md (Commands and Handlers section)
  • Added reference in docs/Eclipse4_RCP_EAS_List_of_All_Provided_Services.md
  • Bidirectional links between Eclipse4_Commands.md and Eclipse4_Migration.md
  • Links to related documentation (Platform Command Framework, RCP FAQ, Dependency Injection)

Motivation

As noted in the issue, Eclipse Platform UI was missing clear documentation on how to programmatically call commands using the E4 approach. Developers needed guidance on:

  1. Using ECommandService and EHandlerService instead of the E3 services
  2. Migrating existing E3 command execution code to E4
  3. Understanding parameter handling differences between E3 and E4

This documentation provides developers with practical, copy-paste ready examples and comprehensive migration guidance.

References

Fixes eclipse-platform/eclipse.platform.ui#XXXX

Original prompt

Describe ho Commands are called in E4 and update the migration guide.

Currently we missing a description on how to call Commands using the E4 way

For this we want:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add documentation for calling commands in E4 and update migration guide Add Eclipse 4 Commands documentation and migration guide Oct 21, 2025
Copilot AI requested a review from laeubi October 21, 2025 07:46
Copilot finished work on behalf of laeubi October 21, 2025 07:46
Copy link
Contributor

@laeubi laeubi left a comment

Choose a reason for hiding this comment

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

Looks like a good starting point

@laeubi laeubi marked this pull request as ready for review October 21, 2025 07:58
Add cross-references to Eclipse4_Commands.md in FAQ and services
documentation

Co-authored-by: laeubi <[email protected]>
@laeubi laeubi force-pushed the copilot/update-eclipse4-commands-docs branch from 90be95b to 5db080f Compare October 21, 2025 08:00
@laeubi
Copy link
Contributor

laeubi commented Oct 21, 2025

Build will not test documentation changes, @vogella @opcoach @ruspl-afed please suggest further enhancements in separate PRs!

@laeubi laeubi merged commit 868cd97 into master Oct 21, 2025
4 of 7 checks passed
@laeubi laeubi deleted the copilot/update-eclipse4-commands-docs branch October 21, 2025 08:01
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.

2 participants