if (symfonyPage.isInLocalServer()) {
path = symfonyPage.getPath().removeLastSegments(1);
} else {
path = Platform.getLocation();
}
CreateProjectJob projectJob = new CreateProjectJob(path, firstPage.nameGroup.getName(), SymfonyCoreConstants.SYMFONY_STANDARD_EDITION, symfonyPage.getSymfonyVersion());
projectJob.setJobListener(new JobListener() {
@Override
public void jobStarted() {
latch.countDown();
}
@Override
public void jobFinished(final String projectName) {
latch.countDown();
}
@Override
public void jobFailed() {
latch.countDown();
}
});
projectJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
if (event.getResult() == null || event.getResult().getCode() == Status.ERROR) {
Logger.log(Logger.ERROR, "Could not run composer create-project");
return;
}
if (getProject() == null || getProject().getName() == null) {
Logger.log(Logger.ERROR, "Unable to initialize symfony project, cannot retrieve project");
return;
}
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getProject().getName());
if (project == null) {
Logger.log(Logger.WARNING, "Unable to retrieve project for running the console after project initialization");
return;
}
refreshProject(getProject().getName());
NopJob job = new NopJob();
job.setProject(project);
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
//now that the container has been dumped...
IProject project = getProject();
if (project == null) {
Logger.log(Logger.WARNING, "Could not retrieve project for saving the debug container");
return;
}
IFile dumpedContainer = project.getFile(SymfonyCoreConstants.DEFAULT_CONTAINER);
if (dumpedContainer == null || dumpedContainer.exists() == false) {
Logger.log(Logger.WARNING, "Could not retrieve project for saving the debug container");
return;
}
try {
Logger.debugMSG("Setting dumped service container");
IEclipsePreferences node = new ProjectScope(project).getNode(SymfonyCorePlugin.ID);
node.put(Keys.DUMPED_CONTAINER, dumpedContainer.getFullPath().removeFirstSegments(1).toOSString());
node.flush();
} catch (BackingStoreException e) {
Logger.logException(e);
}
}
});
job.schedule();
}
});
projectJob.schedule();
try {
latch.await();
} catch (InterruptedException e) {