270682 Refactor epf.library plugin
diff --git a/1.5/features/org.eclipse.epf.base.feature/feature.xml b/1.5/features/org.eclipse.epf.base.feature/feature.xml
index 7cd73f4..66a042a 100644
--- a/1.5/features/org.eclipse.epf.base.feature/feature.xml
+++ b/1.5/features/org.eclipse.epf.base.feature/feature.xml
@@ -197,6 +197,12 @@
          unpack="false"/>
 
    <plugin
+         id="org.eclipse.epf.publish.layout"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"/>
+         
+   <plugin
          id="org.eclipse.epf.publishing"
          download-size="0"
          install-size="0"
diff --git a/1.5/plugins/org.eclipse.epf.library/META-INF/MANIFEST.MF b/1.5/plugins/org.eclipse.epf.library/META-INF/MANIFEST.MF
index 70cf0e6..a4107e4 100644
--- a/1.5/plugins/org.eclipse.epf.library/META-INF/MANIFEST.MF
+++ b/1.5/plugins/org.eclipse.epf.library/META-INF/MANIFEST.MF
@@ -29,5 +29,6 @@
  org.eclipse.core.runtime,
  org.eclipse.core.resources,
  org.eclipse.emf.ecore.xmi;visibility:=reexport,
- org.eclipse.emf.edit.ui
+ org.eclipse.emf.edit.ui,
+ org.eclipse.epf.publish.layout
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/1.5/plugins/org.eclipse.epf.library/build.properties b/1.5/plugins/org.eclipse.epf.library/build.properties
index 1cfe429..1592906 100644
--- a/1.5/plugins/org.eclipse.epf.library/build.properties
+++ b/1.5/plugins/org.eclipse.epf.library/build.properties
@@ -4,7 +4,6 @@
                .options,\
                META-INF/,\
                icons/,\
-               layout/,\
                plugin.properties,\
                plugin.xml,\
                schema/
diff --git a/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/LibraryPlugin.java b/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/LibraryPlugin.java
index 8dcd47f..fa991ed 100644
--- a/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/LibraryPlugin.java
+++ b/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/LibraryPlugin.java
@@ -26,20 +26,9 @@
  */
 public class LibraryPlugin extends AbstractActivator {
 
-	private static final String LAYOUT_PATH = "layout/"; //$NON-NLS-1$;
-
-	public static final String LAYOUT_XSL_PATH = "layout/xsl/"; //$NON-NLS-1$;
-	private static final String LAYOUT_CSS_PATH = "layout/css/"; //$NON-NLS-1$;
-
-	public static final String LAYOUT_SCRIPTS_FOLDER = "scripts"; //$NON-NLS-1$;
-
-	public static final String LAYOUT_SCRIPTS_PATH = "layout/scripts/"; //$NON-NLS-1$;
-
 	// The shared plug-in instance.
 	private static LibraryPlugin plugin;
 
-	private String layoutPath, layoutXslPath, layoutCssPath;
-
 	/**
 	 * Creates a new instance.
 	 */
@@ -53,19 +42,6 @@
 	 */
 	public void start(BundleContext context) throws Exception {
 		super.start(context);
-		try {
-			URL url = new URL(super.getInstallURL(), LAYOUT_PATH);
-			layoutPath = FileLocator.resolve(url).getPath();
-
-			url = new URL(super.getInstallURL(), LAYOUT_XSL_PATH);
-			layoutXslPath = FileLocator.resolve(url).getPath();
-
-			url = new URL(super.getInstallURL(), LAYOUT_CSS_PATH);
-			layoutCssPath = FileLocator.resolve(url).getPath();
-
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
 		
 		LibraryService.getInstance().getLibraryProblemMonitor();
 	}
@@ -86,16 +62,4 @@
 	public static LibraryPlugin getDefault() {
 		return plugin;
 	}
-
-	public String getLayoutPath() {
-		return layoutPath;
-	}
-
-	public String getLayoutXslPath() {
-		return layoutXslPath;
-	}
-
-	public String getLayoutCssPath() {
-		return layoutCssPath;
-	}
 }
\ No newline at end of file
diff --git a/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/layout/HtmlBuilder.java b/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/layout/HtmlBuilder.java
index 6439dd1..13f8f58 100644
--- a/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/layout/HtmlBuilder.java
+++ b/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/layout/HtmlBuilder.java
@@ -33,6 +33,7 @@
 import org.eclipse.epf.library.prefs.PreferenceUtil;
 import org.eclipse.epf.library.util.LibraryUtil;
 import org.eclipse.epf.library.util.ResourceHelper;
+import org.eclipse.epf.publish.layout.LayoutPlugin;
 import org.eclipse.epf.uma.MethodElement;
 
 import com.ibm.icu.util.Calendar;
@@ -66,7 +67,7 @@
 	//private IContentValidator validator = null;
 
 	// override this path to specify xsl path
-	private String layoutXslRootPath = LibraryPlugin.getDefault().getLayoutXslPath();
+	private String layoutXslRootPath = LayoutPlugin.getDefault().getLayoutXslPath();
 	
 	/**
 	 * Creates a new instance.
@@ -119,9 +120,9 @@
 	}
 
 	public void loadDefaultLayoutXsl() {
-		layoutXslRootPath = LibraryPlugin.getDefault().getLayoutXslPath();
+		layoutXslRootPath = LayoutPlugin.getDefault().getLayoutXslPath();
 		try {
-			xslParams = LibraryPlugin.getDefault().getProperties(
+			xslParams = LayoutPlugin.getDefault().getProperties(
 					"/layout/xsl/resources.properties"); //$NON-NLS-1$
 			
 			// add the colon property, 
diff --git a/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/layout/LayoutResources.java b/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/layout/LayoutResources.java
index 50d5548..9750805 100644
--- a/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/layout/LayoutResources.java
+++ b/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/layout/LayoutResources.java
@@ -20,6 +20,7 @@
 import org.apache.tools.ant.types.FileSet;
 import org.eclipse.epf.common.utils.FileUtil;
 import org.eclipse.epf.library.LibraryPlugin;
+import org.eclipse.epf.publish.layout.LayoutPlugin;
 
 import com.ibm.icu.util.Calendar;
 
@@ -109,7 +110,7 @@
 
 		if (url != null) {
 			// resolve the file
-			return LibraryPlugin.getDefault().getLayoutXslPath() + url;
+			return LayoutPlugin.getDefault().getLayoutXslPath() + url;
 		}
 
 		return ""; //$NON-NLS-1$
@@ -243,13 +244,13 @@
 	 */
 	public static void copyLayoutFiles(String toDir) {
 		// copy the layout files to the temp folder
-		String sourceDir = LibraryPlugin.getDefault().getLayoutPath();
+		String sourceDir = LayoutPlugin.getDefault().getLayoutPath();
 		copyDir(sourceDir, toDir);
 
 		try {
 			LibraryPlugin.getDefault().copyLocalizedFiles(
-					LibraryPlugin.LAYOUT_SCRIPTS_PATH,
-					new File(toDir, LibraryPlugin.LAYOUT_SCRIPTS_FOLDER), true,
+					LayoutPlugin.LAYOUT_SCRIPTS_PATH,
+					new File(toDir, LayoutPlugin.LAYOUT_SCRIPTS_FOLDER), true,
 					false);
 
 		} catch (Exception ex) {
diff --git a/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/layout/LinkInfo.java b/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/layout/LinkInfo.java
index 98f71a3..073d2f7 100644
--- a/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/layout/LinkInfo.java
+++ b/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/layout/LinkInfo.java
@@ -24,7 +24,6 @@
 
 import org.eclipse.epf.common.xml.XSLTProcessor;
 import org.eclipse.epf.library.ILibraryManager;
-import org.eclipse.epf.library.LibraryPlugin;
 import org.eclipse.epf.library.LibraryService;
 import org.eclipse.epf.library.configuration.ConfigurationHelper;
 import org.eclipse.epf.library.layout.util.XmlElement;
@@ -32,7 +31,7 @@
 import org.eclipse.epf.library.persistence.ILibraryResourceSet;
 import org.eclipse.epf.library.util.LibraryUtil;
 import org.eclipse.epf.library.util.ResourceHelper;
-import org.eclipse.epf.uma.ContentCategory;
+import org.eclipse.epf.publish.layout.LayoutPlugin;
 import org.eclipse.epf.uma.MethodConfiguration;
 import org.eclipse.epf.uma.MethodElement;
 import org.eclipse.epf.uma.MethodLibrary;
@@ -440,7 +439,7 @@
 
 			OutputStreamWriter output = new OutputStreamWriter(
 					new FileOutputStream(outputFile), "utf-8"); //$NON-NLS-1$
-			Properties xslParams = LibraryPlugin.getDefault().getProperties(
+			Properties xslParams = LayoutPlugin.getDefault().getProperties(
 					"/layout/xsl/resources.properties"); //$NON-NLS-1$
 
 			XSLTProcessor.transform(xsl_uri, xml.toString(), xslParams, output);
diff --git a/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/prefs/PreferenceUtil.java b/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/prefs/PreferenceUtil.java
index b82eeb5..b064434 100644
--- a/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/prefs/PreferenceUtil.java
+++ b/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/prefs/PreferenceUtil.java
@@ -20,6 +20,7 @@
 import org.eclipse.epf.common.preferences.IPreferenceStoreWrapper;
 import org.eclipse.epf.library.LibraryPlugin;
 import org.eclipse.epf.library.edit.process.IBSItemProvider;
+import org.eclipse.epf.publish.layout.LayoutPlugin;
 
 import com.ibm.icu.util.StringTokenizer;
 
@@ -42,7 +43,7 @@
 	private static final String ID_STEPS = "steps"; //$NON-NLS-1$
 	static {
 		try {
-			Properties params = LibraryPlugin.getDefault().getProperties(
+			Properties params = LayoutPlugin.getDefault().getProperties(
 					"/layout/xsl/resources.properties"); //$NON-NLS-1$
 			
 			setXslProperties(params);
diff --git a/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/ResourceHelper.java b/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/ResourceHelper.java
index f4f58f1..6f471da 100644
--- a/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/ResourceHelper.java
+++ b/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/ResourceHelper.java
@@ -22,14 +22,12 @@
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
-import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.eclipse.epf.common.utils.FileUtil;
-import org.eclipse.epf.common.utils.I18nUtil;
 import org.eclipse.epf.common.utils.NetUtil;
 import org.eclipse.epf.common.utils.StrUtil;
 import org.eclipse.epf.common.utils.XMLUtil;
@@ -50,6 +48,7 @@
 import org.eclipse.epf.library.layout.util.XmlElement;
 import org.eclipse.epf.library.layout.util.XmlHelper;
 import org.eclipse.epf.persistence.MethodLibraryPersister;
+import org.eclipse.epf.publish.layout.LayoutPlugin;
 import org.eclipse.epf.uma.MethodConfiguration;
 import org.eclipse.epf.uma.MethodElement;
 import org.eclipse.epf.uma.MethodLibrary;
@@ -1509,7 +1508,7 @@
 		
 		// if the file is not in the library, check the plugin layout folder
 		if (!source.exists()) {
-			source = new File(LibraryPlugin.getDefault().getLayoutPath(),
+			source = new File(LayoutPlugin.getDefault().getLayoutPath(),
 					filePath);
 		}
 
@@ -1789,7 +1788,7 @@
 
 			OutputStreamWriter output = new OutputStreamWriter(
 					new FileOutputStream(outputFile), "utf-8"); //$NON-NLS-1$
-			Properties xslParams = LibraryPlugin.getDefault().getProperties(
+			Properties xslParams = LayoutPlugin.getDefault().getProperties(
 					"/layout/xsl/resources.properties"); //$NON-NLS-1$
 
 			XSLTProcessor
diff --git a/1.5/releng/maps/epf_en.map b/1.5/releng/maps/epf_en.map
index 11f5d0c..8b51407 100644
--- a/1.5/releng/maps/epf_en.map
+++ b/1.5/releng/maps/epf_en.map
@@ -39,6 +39,7 @@
 plugin@org.eclipse.epf.migration.diagram=v20080124-1611,:pserver:anonymous@dev.eclipse.org:/cvsroot/technology,,org.eclipse.epf/composer/1.5/plugins/org.eclipse.epf.migration.diagram
 plugin@org.eclipse.epf.msproject=v20080124-1611,:pserver:anonymous@dev.eclipse.org:/cvsroot/technology,,org.eclipse.epf/composer/1.5/plugins/org.eclipse.epf.msproject
 plugin@org.eclipse.epf.platform=v20080124-1611,:pserver:anonymous@dev.eclipse.org:/cvsroot/technology,,org.eclipse.epf/composer/1.5/plugins/org.eclipse.epf.platform
+plugin@org.eclipse.epf.publish.layout=v20080124-1611,:pserver:anonymous@dev.eclipse.org:/cvsroot/technology,,org.eclipse.epf/composer/1.5/plugins/org.eclipse.epf.publish.layout
 plugin@org.eclipse.epf.publishing=v20090211-1044,:pserver:anonymous@dev.eclipse.org:/cvsroot/technology,,org.eclipse.epf/composer/1.5/plugins/org.eclipse.epf.publishing
 plugin@org.eclipse.epf.publishing.cmdline=v20080826-1929,:pserver:anonymous@dev.eclipse.org:/cvsroot/technology,,org.eclipse.epf/composer/1.5/plugins/org.eclipse.epf.publishing.cmdline
 plugin@org.eclipse.epf.publishing.ui=v20090220-1101,:pserver:anonymous@dev.eclipse.org:/cvsroot/technology,,org.eclipse.epf/composer/1.5/plugins/org.eclipse.epf.publishing.ui