use of org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation in project webtools.sourceediting by eclipse.
the class SimpleWebFacetInstallDelegate method execute.
@Override
public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor) throws CoreException {
if (monitor != null)
// $NON-NLS-1$
monitor.beginTask("", 1);
try {
IDataModel model = (IDataModel) config;
addNatures(project);
final IVirtualComponent c = ComponentCore.createComponent(project, false);
c.create(0, null);
final IWorkspace ws = ResourcesPlugin.getWorkspace();
final IPath pjpath = project.getFullPath();
final IPath contentdir = setContentPropertyIfNeeded(model, pjpath, project);
mkdirs(ws.getRoot().getFolder(contentdir));
final IVirtualFolder webroot = c.getRootFolder();
if (webroot.getProjectRelativePath().equals(new Path("/"))) {
// $NON-NLS-1$
// $NON-NLS-1$
webroot.createLink(new Path("/" + model.getStringProperty(ISimpleWebFacetInstallDataModelProperties.CONTENT_DIR)), 0, null);
}
ComponentUtilities.setServerContextRoot(project, model.getStringProperty(ISimpleWebFacetInstallDataModelProperties.CONTEXT_ROOT));
try {
((IDataModelOperation) model.getProperty(FacetDataModelProvider.NOTIFICATION_OPERATION)).execute(monitor, null);
} catch (ExecutionException e) {
WSTWebPlugin.logError(e);
}
} finally {
if (monitor != null)
monitor.done();
}
}
Aggregations