blob: bb35756eeee8174baba4b11520f5c518557d80c0 [file] [log] [blame]
package org.eclipse.epf.library.layout;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class BrowsingLayoutSettings {
public static BrowsingLayoutSettings INSTANCE = new BrowsingLayoutSettings();
private File xslPath = null;
private File cssPath = null;
// record all the sites updated since the last change
private List updatedSites = new ArrayList();
public void setXslPath(File path) {
xslPath = path;
}
public void setCssPath(File path) {
cssPath = path;
}
public File getXslPath() {
return xslPath;
}
public File getCssPath() {
return cssPath;
}
public void setChanged() {
updatedSites.clear();
}
public boolean needUpdate(HtmlBuilder builder) {
return !updatedSites.contains(builder.getPublishDir());
}
public void update(HtmlBuilder builder) {
if ( (builder == null) || !needUpdate(builder) ) {
return;
}
if ( xslPath != null ) {
builder.setLayoutXslRootPath(xslPath.getAbsolutePath());
}
if ( cssPath != null ) {
// copy the fils to the publish folder
String include = "*.*,**/*.*";
String exclude = null;
boolean override = true;
File folder = new File(builder.getPublishDir(), "css");
LayoutResources.copyDir(cssPath, folder, include, exclude, override);
}
updatedSites.add(builder.getPublishDir());
}
}