// Path: com.github.jarlakxen.scala.sbt/src/com/github/jarlakxen/scala/sbt/util/UIUtil.java
// public class UIUtil {
// 
// 	/**
// 	 * Creates the Label with the given text.
// 	 * 
// 	 * @param parent
// 	 *            the parent composite
// 	 * @param text
// 	 *            the label text
// 	 */
// 	public static Label createLabel(Composite parent, String text) {
// 		return createLabel(parent, text, null);
// 	}
// 
// 	/**
// 	 * Creates the Label with the given text.
// 	 * 
// 	 * @param parent
// 	 *            the parent composite
// 	 * @param text
// 	 *            the label text
// 	 */
// 	public static Label createLabel(Composite parent, String text, GridData gridData) {
// 		Label label = new Label(parent, SWT.NULL);
// 		label.setText(text);
// 		if (gridData != null) {
// 			label.setLayoutData(gridData);
// 		}
// 		label.setAlignment(SWT.VERTICAL + SWT.CENTER);
// 		return label;
// 	}
// 
// 	/**
// 	 * Shows the error dialog with the given message.
// 	 * 
// 	 * @param message
// 	 *            the error message to show in the dialog.
// 	 */
// 	public static void showErrorDialog(final String message) {
// 		Display.getDefault().syncExec(new Runnable() {
// 			@Override
// 			public void run() {
// 				MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", message);
// 			}
// 		});
// 	}
// 
// 	public static GridData createGridData(int option, int colspan) {
// 		GridData gd = new GridData(option);
// 		gd.horizontalSpan = colspan;
// 		return gd;
// 	}
// 
// 	public static GridData createGridDataWithWidth(int width) {
// 		GridData gd = new GridData();
// 		gd.minimumWidth = width;
// 		gd.widthHint = width;
// 		return gd;
// 	}
// }


import java.io.File;
import java.net.URI;
import java.net.URL;
import java.util.Arrays;
import org.eclipse.core.net.proxy.IProxyData;
import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.IStreamListener;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.core.model.IStreamMonitor;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
import org.eclipse.jdt.launching.JavaRuntime;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import com.github.jarlakxen.scala.sbt.util.UIUtil;


			// Creates new configuration
			ILaunchConfigurationWorkingCopy wc = null;
			if(command == null || command.length() == 0){
				wc = type.newInstance(null, String.format("sbt - %s", project.getName()));
			} else {
				wc = type.newInstance(null, String.format("sbt %s - %s", command, project.getName()));
			}

			// Sets the project name
			wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());

			// Sets the main class
			wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "xsbt.boot.Boot");

			// Sets the VM arguments
			wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, createVMarguments(projectConfig));

			// Sets the working directory if it's specified
			if(this.workDir != null){
				wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, workDir.getAbsolutePath());
			}

			// Sets the classpath
			File jarFile = projectConfig.getProjectSbtRuntime();
			URL sbtRuntimeUrl = null;
			if(jarFile != null){
				sbtRuntimeUrl = jarFile.toURI().toURL();
			}
			if(sbtRuntimeUrl == null){

// Path: com.github.jarlakxen.scala.sbt/src/com/github/jarlakxen/scala/sbt/util/UIUtil.java
// public class UIUtil {
// 
// 	/**
// 	 * Creates the Label with the given text.
// 	 * 
// 	 * @param parent
// 	 *            the parent composite
// 	 * @param text
// 	 *            the label text
// 	 */
// 	public static Label createLabel(Composite parent, String text) {
// 		return createLabel(parent, text, null);
// 	}
// 
// 	/**
// 	 * Creates the Label with the given text.
// 	 * 
// 	 * @param parent
// 	 *            the parent composite
// 	 * @param text
// 	 *            the label text
// 	 */
// 	public static Label createLabel(Composite parent, String text, GridData gridData) {
// 		Label label = new Label(parent, SWT.NULL);
// 		label.setText(text);
// 		if (gridData != null) {
// 			label.setLayoutData(gridData);
// 		}
// 		label.setAlignment(SWT.VERTICAL + SWT.CENTER);
// 		return label;
// 	}
// 
// 	/**
// 	 * Shows the error dialog with the given message.
// 	 * 
// 	 * @param message
// 	 *            the error message to show in the dialog.
// 	 */
// 	public static void showErrorDialog(final String message) {
// 		Display.getDefault().syncExec(new Runnable() {
// 			@Override
// 			public void run() {
// 				MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", message);
// 			}
// 		});
// 	}
// 
// 	public static GridData createGridData(int option, int colspan) {
// 		GridData gd = new GridData(option);
// 		gd.horizontalSpan = colspan;
// 		return gd;
// 	}
// 
// 	public static GridData createGridDataWithWidth(int width) {
// 		GridData gd = new GridData();
// 		gd.minimumWidth = width;
// 		gd.widthHint = width;
// 		return gd;
// 	}
// }


// Path: com.github.jarlakxen.scala.sbt/src/com/github/jarlakxen/scala/sbt/SbtExecutor.java
import java.io.File;
import java.net.URI;
import java.net.URL;
import java.util.Arrays;
import org.eclipse.core.net.proxy.IProxyData;
import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.IStreamListener;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.core.model.IStreamMonitor;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
import org.eclipse.jdt.launching.JavaRuntime;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import com.github.jarlakxen.scala.sbt.util.UIUtil;


			// Creates new configuration
			ILaunchConfigurationWorkingCopy wc = null;
			if(command == null || command.length() == 0){
				wc = type.newInstance(null, String.format("sbt - %s", project.getName()));
			} else {
				wc = type.newInstance(null, String.format("sbt %s - %s", command, project.getName()));
			}

			// Sets the project name
			wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());

			// Sets the main class
			wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "xsbt.boot.Boot");

			// Sets the VM arguments
			wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, createVMarguments(projectConfig));

			// Sets the working directory if it's specified
			if(this.workDir != null){
				wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, workDir.getAbsolutePath());
			}

			// Sets the classpath
			File jarFile = projectConfig.getProjectSbtRuntime();
			URL sbtRuntimeUrl = null;
			if(jarFile != null){
				sbtRuntimeUrl = jarFile.toURI().toURL();
			}
			if(sbtRuntimeUrl == null){

				UIUtil.showErrorDialog("Can't find SBT runtime in your project.");
