/*
 * Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eike Stepper - initial API and implementation
 */
package org.eclipse.oomph.ostools;

import org.eclipse.oomph.util.OS;

import java.io.File;

/**
 * @author Eike Stepper
 */
public class PromptHandler extends AbstractLocationHandler
{
  public PromptHandler()
  {
  }

  @Override
  protected void execute(File location) throws Exception
  {
    if (OS.INSTANCE.isWin())
    {
      Runtime.getRuntime().exec("cmd /c cd \"" + location + "\" && start cmd.exe");
    }
    else
    {
      Runtime.getRuntime().exec("bash \"" + location + "\"");
    }
  }
}

@@ -569,16 +569,98 @@
 ndler%0A%7B%0A
+  private static final String%5B%5D LINUX_TERMINALS = %7B %22gnome-terminal%22, %22xterm%22 %7D;%0A%0A
   public
@@ -895,76 +895,582 @@
 else
-%0A    %7B%0A      Runtime.getRuntime().exec(%22bash %5C%22%22 + location + %22%5C%22%22);
+ if (OS.INSTANCE.isMac())%0A    %7B%0A      ProcessBuilder builder = new ProcessBuilder(new String%5B%5D %7B %22/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal%22, location.toString() %7D);%0A      builder.start();%0A    %7D%0A    else if (OS.INSTANCE.isLinux())%0A    %7B%0A      for (String terminal : LINUX_TERMINALS)%0A      %7B%0A        try%0A        %7B%0A          ProcessBuilder builder = new ProcessBuilder(terminal);%0A          builder.directory(location);%0A          builder.start();%0A          return;%0A        %7D%0A        catch (Exception ex)%0A        %7B%0A          //$FALL-THROUGH$%0A        %7D%0A      %7D
 %0A   

Support the "System Explorer" and "Command Prompt" commands on Mac and Linux, too