if (monitor != null) {
monitor.beginTask("", 1); //$NON-NLS-1$
}
try {
IDataModel config = null;
if (cfg != null) {
config = (IDataModel) cfg;
} else {
throw new JSFFacetException(
Messages.JSFFacetInstallDelegate_InternalErr);
}
final JSFUtils jsfUtil = new JSFUtilFactory().create(fv, ModelProviderManager.getModelProvider(project));
if (jsfUtil == null)
{
throw new JSFFacetException(NLS.bind(
Messages.Could_Not_GetJSFVersion, fv.toString()));
}
if (jsfFacetConfigurationEnabled)
{
// Before we do any configuration, verify that web.xml is // available for update
final IModelProvider provider = jsfUtil
.getModelProvider();
if (provider == null)
{
throw new JSFFacetException(NLS.bind(
Messages.JSFFacetInstallDelegate_ConfigErr,
project.getName()));
}
else if (!(provider.validateEdit(null, null).isOK()))
{
if (!(provider.validateEdit(null, null).isOK()))
{// checks for web.xml file being read-only and allows
// user to set writeable
throw new JSFFacetException(
NLS.bind(
Messages.JSFFacetInstallDelegate_NonUpdateableWebXML,
project.getName()));
}
}
}
// // Create JSF Libs as classpath containers and set WTP dependencies
// // as required
// createClasspathEntries(project, fv, config, monitor);
//Configure libraries
( (LibraryInstallDelegate) config.getProperty( IJSFFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE ) ).execute( new NullProgressMonitor() );
final LibraryInstallDelegate libDelegate = (LibraryInstallDelegate) (config.getProperty( IJSFFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE));
final LibraryProviderOperationConfig libConfig = libDelegate.getLibraryProviderOperationConfig();
if (jsfFacetConfigurationEnabled)
{
// Create config file
createConfigFile(project, fv, config, monitor, jsfUtil);
final Boolean configureServlet = (Boolean) config.getProperty(IJSFFacetInstallDataModelProperties.CONFIGURE_SERVLET);
if (configureServlet == null || configureServlet.booleanValue()) {
// Update web model
createServletAndModifyWebXML(project, config, monitor, jsfUtil);
updateWebXmlByJsfVendor(libConfig, project, monitor);
}