return new ITemplateSection[]{template};
}
public boolean performFinish() {
final IFieldData data = new AlgorithmData();
final IProjectProvider provider = new AlgorithmProjectProvider();
final WorkspaceModifyOperation op = new NewProjectCreationOperation(data, provider, this);
try {
getContainer().run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Creating Algorithm Project...", 150);
try {
op.run(new SubProgressMonitor(monitor, 100));
} catch (Throwable e) {
e.printStackTrace();
}
File outFile = provider.getProject().getLocation().append(
"META-INF/MANIFEST.MF").toFile();
try {
PrintWriter out = new PrintWriter(new FileWriter(outFile,true));
out.println("X-AutoStart: true");
out.println("Service-Component: OSGI-INF/component.xml");
out.close();
provider.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (IOException e) {
e.printStackTrace();
} catch (CoreException e) {
e.printStackTrace();
}
monitor.worked(50);
monitor.done();
}
});
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
final IFile file = provider.getProject().getFile("META-INF/MANIFEST.MF");
final IWorkbenchWindow ww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
final IWorkbenchPage page = ww.getActivePage();
if (page != null) {
final IWorkbenchPart focusPart = page.getActivePart();
ww.getShell().getDisplay().asyncExec(new Runnable() {