Search in sources :

Example 1 with ECommandService

use of org.eclipse.e4.core.commands.ECommandService in project eclipse.platform.text by eclipse.

the class ShowInSystemExplorerHyperlink method open.

@Override
public void open() {
    ECommandService commandService = PlatformUI.getWorkbench().getService(ECommandService.class);
    EHandlerService handlerService = PlatformUI.getWorkbench().getService(EHandlerService.class);
    Command command = commandService.getCommand(ShowInSystemExplorerHandler.ID);
    if (command.isDefined()) {
        ParameterizedCommand parameterizedCommand = commandService.createCommand(ShowInSystemExplorerHandler.ID, Collections.singletonMap(ShowInSystemExplorerHandler.RESOURCE_PATH_PARAMETER, fileLocation));
        if (handlerService.canExecute(parameterizedCommand)) {
            handlerService.executeHandler(parameterizedCommand);
        }
    }
}
Also used : EHandlerService(org.eclipse.e4.core.commands.EHandlerService) ParameterizedCommand(org.eclipse.core.commands.ParameterizedCommand) Command(org.eclipse.core.commands.Command) ParameterizedCommand(org.eclipse.core.commands.ParameterizedCommand) ECommandService(org.eclipse.e4.core.commands.ECommandService)

Aggregations

Command (org.eclipse.core.commands.Command)1 ParameterizedCommand (org.eclipse.core.commands.ParameterizedCommand)1 ECommandService (org.eclipse.e4.core.commands.ECommandService)1 EHandlerService (org.eclipse.e4.core.commands.EHandlerService)1