public class RunSketchAsAppletShortcut implements ILaunchShortcut {
protected ILaunchConfiguration createConfiguration(IProject project) {
if (project == null) return null;
SketchProject sketch = SketchProject.forProject(project);
ILaunchConfiguration config = null;
try{
ILaunchConfigurationType configType = getConfigurationType();
ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, project.getName());
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, sketch.getMainType());
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_APPLET_WIDTH, sketch.getWidth());
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_APPLET_HEIGHT, sketch.getHeight());
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_APPLET_NAME, "Processing Sketch");
wc.setAttribute("wasLastBuildSuccessful", sketch.wasLastBuildSuccessful());
wc.setMappedResources(new IResource[] { sketch.getJavaProject().getUnderlyingResource() });
// config =wc.doSave();
config = wc; // this prevents a run config from being saved and sticking around.
} catch (CoreException ce) {
ProcessingPlugin.logError(ce);
}