/* @inheritDoc */
@Override
protected ILaunchConfiguration createConfiguration(IType type) {
ILaunchConfiguration iConf = super.createConfiguration(type);
ILaunchConfigurationWorkingCopy iConfWC;
try {
/*
* Tune the default launch configuration: setup run-time classpath
* manually
*/
iConfWC = iConf.getWorkingCopy();
iConfWC.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
List<String> classPath = new ArrayList<String>();
IResource resource = type.getResource();
IJavaProject project = (IJavaProject) resource.getProject().getNature(JavaCore.NATURE_ID);
IRuntimeClasspathEntry cpEntry = JavaRuntime.newDefaultProjectClasspathEntry(project);
classPath.add(0, cpEntry.getMemento());
iConfWC.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classPath);
} catch (CoreException e) {
e.printStackTrace();
// FIXME Error dialog
return null;
}
/*
* Update the selected configuration with a specific Hadoop location
* target
*/
IResource resource = type.getResource();
if (!(resource instanceof IFile))
return null;
RunOnHadoopWizard wizard = new RunOnHadoopWizard((IFile) resource, iConfWC);
WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
dialog.create();
dialog.setBlockOnOpen(true);
if (dialog.open() != WizardDialog.OK)
return null;
try {
// Only save if some configuration is different.
if (!iConfWC.contentsEqual(iConf))
iConfWC.doSave();
} catch (CoreException e) {
e.printStackTrace();
// FIXME Error dialog
return null;