refactoring, remove ui dependnecy from library plugin. Moved related mathods to library.ui.LibraryUIUtil
diff --git a/2.0/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/actions/MethodAddImageAction.java b/2.0/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/actions/MethodAddImageAction.java
index 2ab2d63..8548996 100644
--- a/2.0/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/actions/MethodAddImageAction.java
+++ b/2.0/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/actions/MethodAddImageAction.java
@@ -16,7 +16,7 @@
 import org.eclipse.epf.authoring.ui.dialogs.MethodAddImageDialog;
 import org.eclipse.epf.authoring.ui.richtext.IMethodRichText;
 import org.eclipse.epf.common.utils.NetUtil;
-import org.eclipse.epf.library.util.ResourceHelper;
+import org.eclipse.epf.library.ui.LibraryUIUtil;
 import org.eclipse.epf.richtext.IRichText;
 import org.eclipse.epf.richtext.RichTextCommand;
 import org.eclipse.epf.richtext.RichTextEditor;
@@ -63,7 +63,7 @@
 				if (dialog.getFileToCopy() != null) {
 					// Copy the image to the resource folder if necessary.
 					try {
-						String imageLink = NetUtil.decodedFileUrl(ResourceHelper.getURLForAttachment(Display
+						String imageLink = NetUtil.decodedFileUrl(LibraryUIUtil.getURLForAttachment(Display
 								.getCurrent().getActiveShell(), dialog
 								.getFileToCopy(),
 								((IMethodRichText) richText)
diff --git a/2.0/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/actions/MethodAddLinkAction.java b/2.0/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/actions/MethodAddLinkAction.java
index d91aaf4..fd0eafc 100644
--- a/2.0/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/actions/MethodAddLinkAction.java
+++ b/2.0/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/actions/MethodAddLinkAction.java
@@ -17,7 +17,7 @@
 import org.eclipse.epf.authoring.ui.dialogs.MethodAddLinkDialog;
 import org.eclipse.epf.authoring.ui.richtext.IMethodRichText;
 import org.eclipse.epf.common.utils.NetUtil;
-import org.eclipse.epf.library.util.ResourceHelper;
+import org.eclipse.epf.library.ui.LibraryUIUtil;
 import org.eclipse.epf.richtext.IRichText;
 import org.eclipse.epf.richtext.RichTextCommand;
 import org.eclipse.epf.richtext.RichTextEditor;
@@ -60,7 +60,7 @@
 						if (dialog.getFileToCopy() != null) {
 							// link to a file, create the URL
 							try {
-								linkURL = ResourceHelper.getURLForAttachment(Display
+								linkURL = LibraryUIUtil.getURLForAttachment(Display
 										.getCurrent().getActiveShell(), dialog
 										.getFileToCopy(),
 										((IMethodRichText) richText)
diff --git a/2.0/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/DescriptionFormPage.java b/2.0/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/DescriptionFormPage.java
index 9471bdb..04aba07 100644
--- a/2.0/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/DescriptionFormPage.java
+++ b/2.0/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/DescriptionFormPage.java
@@ -58,6 +58,7 @@
 import org.eclipse.epf.library.edit.validation.IValidator;
 import org.eclipse.epf.library.edit.validation.IValidatorFactory;
 import org.eclipse.epf.library.ui.LibraryUIText;
+import org.eclipse.epf.library.ui.LibraryUIUtil;
 import org.eclipse.epf.library.ui.actions.MethodElementDeleteAction;
 import org.eclipse.epf.library.util.ConvertGuidanceType;
 import org.eclipse.epf.library.util.ResourceHelper;
@@ -2409,7 +2410,7 @@
 	 */
 	protected String copyResourceToLib(Shell shell, String sFileName, String sFilePath,
 			MethodElement methodElement) throws IOException {
-		File newFile = ResourceHelper.copyResourceToLib(shell, new File(sFilePath, sFileName), methodElement);
+		File newFile = LibraryUIUtil.copyResourceToLib(shell, new File(sFilePath, sFileName), methodElement);
 		if (newFile != null)
 			return newFile.getAbsolutePath();
 		else 
diff --git a/2.0/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/GuidanceWithAttachmentsDescriptionPage.java b/2.0/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/GuidanceWithAttachmentsDescriptionPage.java
index c03d3d9..ae18cc3 100644
--- a/2.0/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/GuidanceWithAttachmentsDescriptionPage.java
+++ b/2.0/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/GuidanceWithAttachmentsDescriptionPage.java
@@ -26,6 +26,7 @@
 import org.eclipse.epf.common.utils.NetUtil;
 import org.eclipse.epf.library.edit.command.IActionManager;
 import org.eclipse.epf.library.edit.util.TngUtil;
+import org.eclipse.epf.library.ui.LibraryUIUtil;
 import org.eclipse.epf.library.util.ResourceHelper;
 import org.eclipse.epf.richtext.dialogs.AddLinkDialog;
 import org.eclipse.epf.uma.ContentDescription;
@@ -135,7 +136,7 @@
 					try {
 						File fileToAttach = new File(dialog.getFilterPath(),
 								dialog.getFileName());
-						String fileUrl = ResourceHelper.getURLForAttachment(ctrl_attach.getShell(),
+						String fileUrl = LibraryUIUtil.getURLForAttachment(ctrl_attach.getShell(),
 								fileToAttach, guidance, true);
 						if (fileUrl == null) {
 							// user hit cancel on RenameFileConflictDialog
diff --git a/2.0/plugins/org.eclipse.epf.library.ui/src/org/eclipse/epf/library/ui/LibraryUIUtil.java b/2.0/plugins/org.eclipse.epf.library.ui/src/org/eclipse/epf/library/ui/LibraryUIUtil.java
index 94f9efd..3f8ec3e 100644
--- a/2.0/plugins/org.eclipse.epf.library.ui/src/org/eclipse/epf/library/ui/LibraryUIUtil.java
+++ b/2.0/plugins/org.eclipse.epf.library.ui/src/org/eclipse/epf/library/ui/LibraryUIUtil.java
@@ -10,12 +10,26 @@
 //------------------------------------------------------------------------------
 package org.eclipse.epf.library.ui;
 
+import java.io.File;
+import java.io.IOException;
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.epf.common.serviceability.MsgBox;
 import org.eclipse.epf.common.serviceability.MsgDialog;
+import org.eclipse.epf.common.utils.FileUtil;
 import org.eclipse.epf.library.ILibraryManager;
+import org.eclipse.epf.library.LibraryPlugin;
 import org.eclipse.epf.library.LibraryService;
 import org.eclipse.epf.library.LibraryServiceUtil;
+import org.eclipse.epf.library.util.ResourceHelper;
+import org.eclipse.epf.persistence.FileManager;
+import org.eclipse.epf.ui.EPFUIResources;
+import org.eclipse.epf.ui.dialogs.RenameFileConflictDialog;
+import org.eclipse.epf.uma.MethodElement;
+import org.eclipse.epf.uma.util.UmaUtil;
+import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Shell;
@@ -96,4 +110,103 @@
 		return SWT.CANCEL;
 	}
 
+	/**
+	 * Returns file URL for an attachment
+	 * 
+	 * @param attachment
+	 *            the file to attach
+	 * @param element
+	 *            the MethodElement referencing the file
+	 * @param copyFile
+	 *            if true, will copy the file (if it isn't already in the plugin
+	 *            path)
+	 * @return URL of the form ./../<roles>/resources/<filename of
+	 *         attachment>
+	 * @throws IOException
+	 */
+	public static String getURLForAttachment(Shell shell, File attachment,
+			MethodElement element, boolean copyFile) throws IOException {
+		String pluginDir = FileUtil.appendSeparator(new File(UmaUtil.getMethodPlugin(element)
+				.eResource().getURI().toFileString()).getParent());
+		File formatFile = null;
+		String resourceLoc = ResourceHelper.getAbsoluteElementResourcePath(element);
+		// File resourceDir = new File(resourceLoc);
+		formatFile = new File(resourceLoc + File.separator
+				+ attachment.getName());
+		if (copyFile) {
+			File newFile = copyResourceToLib(shell, attachment, element);
+			if (newFile != null) {
+				formatFile = new File(resourceLoc + File.separator
+						+ newFile.getName());
+			} else {
+				// user hit cancel
+				return null;
+			}
+			IResource wsResource = FileManager.getResourceForLocation(formatFile.getAbsolutePath());
+			if(wsResource != null) {
+				try {
+					FileManager.refresh(wsResource);
+				}
+				catch(Exception e) {
+					LibraryPlugin.getDefault().getLogger().logError(e);
+				}
+			}
+		}
+
+		return ResourceHelper.getRelativePathToFileFromElement(element,
+				formatFile);
+
+	}
+	
+	/**
+	 * Copies the given file into the methodElement's resource folder.
+	 * Resolves filename conflict by prompting user to overwrite or rename
+	 * @param shell if null, will overwrite file without prompting
+	 * @param resource
+	 * @param methodElement
+	 * @return the File representing the user's final choice of library resource file
+	 */
+	public static File copyResourceToLib(Shell shell, File resource, MethodElement methodElement) {
+		String resourceLoc = ResourceHelper.getAbsoluteElementResourcePath(methodElement);
+
+		File libFile = new File(resourceLoc, resource.getName());
+	
+		if (resource.equals(libFile)) {
+			// source file is already in resources dir
+			return libFile;
+		}
+		
+		// if no shell, will just overwrite
+		if (libFile.exists() && shell != null) {
+			RenameFileConflictDialog dialog = new RenameFileConflictDialog(shell);
+			dialog.setMessageStr(MessageFormat.format(
+									EPFUIResources.Dialog_fileNameConflict_msg, 
+									new Object[] { resource.getName(), resourceLoc }));
+			dialog.setDestination(resourceLoc);
+			dialog.setFilePath(resource.getName());
+			dialog.open();
+
+			if (dialog.getReturnCode() == IDialogConstants.CANCEL_ID) {
+				return null;
+			} else {
+				libFile = new File(resourceLoc, dialog.getFilePath());
+			}
+		}
+
+		FileUtil.copyFile(resource, libFile);
+		
+		IResource wsResource = FileManager.getResourceForLocation(libFile.getAbsolutePath());
+		if(wsResource != null) {
+			try {
+				FileManager.refresh(wsResource);
+			}
+			catch(Exception e) {
+				LibraryPlugin.getDefault().getLogger().logError(e);
+			}
+		}
+
+
+		return libFile;
+	}
+	
 }
diff --git a/2.0/plugins/org.eclipse.epf.library/META-INF/MANIFEST.MF b/2.0/plugins/org.eclipse.epf.library/META-INF/MANIFEST.MF
index 356fc64..a827012 100644
--- a/2.0/plugins/org.eclipse.epf.library/META-INF/MANIFEST.MF
+++ b/2.0/plugins/org.eclipse.epf.library/META-INF/MANIFEST.MF
@@ -28,6 +28,5 @@
  org.eclipse.core.runtime,
  org.eclipse.core.resources,
  org.eclipse.emf.ecore.xmi;visibility:=reexport,
- org.eclipse.emf.edit.ui;visibility:=reexport,
- org.eclipse.epf.ui
+ org.eclipse.emf.edit.ui;visibility:=reexport
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/2.0/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/ResourceHelper.java b/2.0/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/ResourceHelper.java
index 1cb2f0e..8c4ae20 100644
--- a/2.0/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/ResourceHelper.java
+++ b/2.0/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/ResourceHelper.java
@@ -12,12 +12,10 @@
 
 import java.io.File;
 import java.io.FileOutputStream;
-import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URLDecoder;
-import java.text.MessageFormat;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -26,7 +24,6 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.eclipse.core.resources.IResource;
 import org.eclipse.epf.common.utils.FileUtil;
 import org.eclipse.epf.common.utils.NetUtil;
 import org.eclipse.epf.common.utils.XMLUtil;
@@ -45,17 +42,12 @@
 import org.eclipse.epf.library.layout.elements.ActivityLayout;
 import org.eclipse.epf.library.layout.util.XmlElement;
 import org.eclipse.epf.library.layout.util.XmlHelper;
-import org.eclipse.epf.persistence.FileManager;
 import org.eclipse.epf.persistence.MethodLibraryPersister;
-import org.eclipse.epf.ui.EPFUIResources;
-import org.eclipse.epf.ui.dialogs.RenameFileConflictDialog;
 import org.eclipse.epf.uma.MethodConfiguration;
 import org.eclipse.epf.uma.MethodElement;
 import org.eclipse.epf.uma.MethodLibrary;
 import org.eclipse.epf.uma.MethodPlugin;
 import org.eclipse.epf.uma.util.UmaUtil;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.widgets.Shell;
 
 /**
  * @author Jinhua Xi
@@ -1045,53 +1037,7 @@
 //		return relUri;
 //	}
 
-	/**
-	 * Returns file URL for an attachment
-	 * 
-	 * @param attachment
-	 *            the file to attach
-	 * @param element
-	 *            the MethodElement referencing the file
-	 * @param copyFile
-	 *            if true, will copy the file (if it isn't already in the plugin
-	 *            path)
-	 * @return URL of the form ./../<roles>/resources/<filename of
-	 *         attachment>
-	 * @throws IOException
-	 */
-	public static String getURLForAttachment(Shell shell, File attachment,
-			MethodElement element, boolean copyFile) throws IOException {
-		String pluginDir = FileUtil.appendSeparator(new File(UmaUtil.getMethodPlugin(element)
-				.eResource().getURI().toFileString()).getParent());
-		File formatFile = null;
-		String resourceLoc = getAbsoluteElementResourcePath(element);
-		// File resourceDir = new File(resourceLoc);
-		formatFile = new File(resourceLoc + File.separator
-				+ attachment.getName());
-		if (copyFile) {
-			File newFile = copyResourceToLib(shell, attachment, element);
-			if (newFile != null) {
-				formatFile = new File(resourceLoc + File.separator
-						+ newFile.getName());
-			} else {
-				// user hit cancel
-				return null;
-			}
-			IResource wsResource = FileManager.getResourceForLocation(formatFile.getAbsolutePath());
-			if(wsResource != null) {
-				try {
-					FileManager.refresh(wsResource);
-				}
-				catch(Exception e) {
-					LibraryPlugin.getDefault().getLogger().logError(e);
-				}
-			}
-		}
 
-		return ResourceHelper.getRelativePathToFileFromElement(element,
-				formatFile);
-
-	}
 
 	/**
 	 * 
@@ -1099,7 +1045,7 @@
 	 * @param attachment
 	 * @return String
 	 */
-	private static String getRelativePathToFileFromElement(
+	public static String getRelativePathToFileFromElement(
 			MethodElement element, File attachment) {
 		String elementLoc = getFolderAbsolutePath(element);	
 		return FileUtil.getRelativePath(attachment, new File(elementLoc));
@@ -1895,55 +1841,6 @@
 		return getFolderAbsolutePath(plugin);
 	}
 	
-	/**
-	 * Copies the given file into the methodElement's resource folder.
-	 * Resolves filename conflict by prompting user to overwrite or rename
-	 * @param shell if null, will overwrite file without prompting
-	 * @param resource
-	 * @param methodElement
-	 * @return the File representing the user's final choice of library resource file
-	 */
-	public static File copyResourceToLib(Shell shell, File resource, MethodElement methodElement) {
-		String resourceLoc = getAbsoluteElementResourcePath(methodElement);
 
-		File libFile = new File(resourceLoc, resource.getName());
-	
-		if (resource.equals(libFile)) {
-			// source file is already in resources dir
-			return libFile;
-		}
-		
-		// if no shell, will just overwrite
-		if (libFile.exists() && shell != null) {
-			RenameFileConflictDialog dialog = new RenameFileConflictDialog(shell);
-			dialog.setMessageStr(MessageFormat.format(
-									EPFUIResources.Dialog_fileNameConflict_msg, 
-									new Object[] { resource.getName(), resourceLoc }));
-			dialog.setDestination(resourceLoc);
-			dialog.setFilePath(resource.getName());
-			dialog.open();
-
-			if (dialog.getReturnCode() == IDialogConstants.CANCEL_ID) {
-				return null;
-			} else {
-				libFile = new File(resourceLoc, dialog.getFilePath());
-			}
-		}
-
-		FileUtil.copyFile(resource, libFile);
-		
-		IResource wsResource = FileManager.getResourceForLocation(libFile.getAbsolutePath());
-		if(wsResource != null) {
-			try {
-				FileManager.refresh(wsResource);
-			}
-			catch(Exception e) {
-				LibraryPlugin.getDefault().getLogger().logError(e);
-			}
-		}
-
-
-		return libFile;
-	}
 	
 }