@Override
public boolean performFinish() {
boolean result = super.performFinish();
if (result) {
final IJavaProject javaProj = (IJavaProject) getCreatedElement();
try {
// Run using the progress bar from the wizard dialog
getContainer().run(false, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
SubMonitor progress = SubMonitor.convert(monitor, 3);
// Generate the Bnd model
final BndEditModel bndModel = generateBndModel(progress.newChild(1));
// Make changes to the project
final IWorkspaceRunnable op = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
processGeneratedProject(ProjectPaths.get(pageOne.getProjectLayout()), bndModel, javaProj, monitor);
}
};
javaProj.getProject().getWorkspace().run(op, progress.newChild(2));
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
}
});
result = true;
} catch (InvocationTargetException e) {
logger.logError("Could not initialise the project", e);
ErrorDialog.openError(getShell(), "Error", "", new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, MessageFormat.format("Error creating Bnd project descriptor file ({0}).", Project.BNDFILE), e.getTargetException()));
result = false;
} catch (InterruptedException e) {
// Shouldn't happen
}
// Open the bnd.bnd file in the editor
IFile bndFile = javaProj.getProject().getFile(Project.BNDFILE);
try {
IDE.openEditor(getWorkbench().getActiveWorkbenchWindow().getActivePage(), bndFile);
} catch (PartInitException e) {
ErrorDialog.openError(getShell(), "Error", null, new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, MessageFormat.format("Failed to open project descriptor file {0} in the editor.", bndFile.getFullPath().toString()), e));
}