title: Unable to open multiple selected files and folders using Eclipse ShowInSystemExplorerHandler API
body: <p>Hi I am using Eclipse <code>ShowInSystemExplorerHandler</code> API, it is working fine if I select a single file or folder. But it does not work for multiple selection of files or folders. I provide below the code snippet. Please help me how to resolve so that I should be able to open multiple folders/files in OS specific explorer. By the way I am using <code>structuredSelection.forEach</code> so that I can open all the files and folders.</p>
  <p>Find below the code.</p>
  <pre class="lang-java prettyprint-override"><code>@SuppressWarnings(&quot;restriction&quot;)
  public class OpenExplorerHandler extends AbstractHandler {
      
      @Override
      public Object execute(ExecutionEvent event) throws ExecutionException {
          IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
          ISelectionService service = window.getSelectionService();
          IStructuredSelection structuredSelection = (IStructuredSelection) service.getSelection();
  
          structuredSelection.forEach( selctionElement -&gt; {
              if (selctionElement instanceof IAdaptable) {
                  IResource resource = (IResource) ((IAdaptable) selctionElement).getAdapter(IResource.class);
                  File selectedFileFolder = resource.getLocation().toFile();
                  String filePath = selectedFileFolder.getAbsolutePath();
                  
                  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, filePath));
                      if (handlerService.canExecute(parameterizedCommand)) {
                          handlerService.executeHandler(parameterizedCommand);
                      }
                  }
              }
          });
          
          return null;
      }
  }
  </code></pre>