402771 	Milestone do not allow assigning artifacts
diff --git a/1.5/plugins/org.eclipse.epf.authoring.ui/plugin.xml b/1.5/plugins/org.eclipse.epf.authoring.ui/plugin.xml
index 42ce826..a242646 100644
--- a/1.5/plugins/org.eclipse.epf.authoring.ui/plugin.xml
+++ b/1.5/plugins/org.eclipse.epf.authoring.ui/plugin.xml
@@ -289,6 +289,13 @@
                category="element"
                afterTab="properties.tab.RoleDescriptor.WorkProduct"
                id="properties.tab.RoleDescriptor.Team"/>
+                           
+         <!-- Milestone -->
+         <propertyTab
+               label="%_UI_Properties_WorkProducts"
+               category="element"
+               afterTab="properties.tab.BreakdownElement.Guidance"
+               id="properties.tab.Milestone.WorkProduct"/>
          
          <!-- TEAM PROFILE -->
          <propertyTab
@@ -468,6 +475,14 @@
             <input type="org.eclipse.epf.library.edit.process.RoleDescriptorWrapperItemProvider"/>
          </propertySection> 
       
+        <!-- Sections for Milestone -->
+         <propertySection
+               tab="properties.tab.Milestone.WorkProduct"
+               class="org.eclipse.epf.authoring.ui.properties.MilestoneWorkProductSection"
+               id="properties.section.Milestone.WorkProduct">
+            <input type="org.eclipse.epf.uma.Milestone"/>
+            <input type="org.eclipse.epf.library.edit.process.MilestoneWrapperItemProvider"/>
+         </propertySection> 
 
          <!-- Section for TeamProfile -->
          <propertySection
diff --git a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/AbstractSection.java b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/AbstractSection.java
index ff67e11..8da2cd6 100644
--- a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/AbstractSection.java
+++ b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/AbstractSection.java
@@ -53,7 +53,7 @@
 public class AbstractSection extends AbstractPropertySection implements
 		PropertyChangeListener {
 
-	private BreakdownElement element;
+	protected BreakdownElement element;
 
 	protected boolean editable = false;
 
diff --git a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/MilestoneWorkProductSection.java b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/MilestoneWorkProductSection.java
new file mode 100644
index 0000000..8b85008
--- /dev/null
+++ b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/MilestoneWorkProductSection.java
@@ -0,0 +1,239 @@
+//------------------------------------------------------------------------------
+// Copyright (c) 2005, 2008 IBM Corporation and others.
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// which accompanies this distribution, and is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// Contributors:
+// IBM Corporation - initial implementation
+//------------------------------------------------------------------------------
+package org.eclipse.epf.authoring.ui.properties;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.epf.authoring.ui.filters.DescriptorProcessFilter;
+import org.eclipse.epf.authoring.ui.filters.ProcessWorkProductFilter;
+import org.eclipse.epf.library.edit.IFilter;
+import org.eclipse.epf.library.edit.TngAdapterFactory;
+import org.eclipse.epf.library.edit.command.IActionManager;
+import org.eclipse.epf.library.edit.itemsfilter.FilterConstants;
+import org.eclipse.epf.library.edit.process.command.AssignWPToMilestone;
+import org.eclipse.epf.library.edit.process.command.IActionTypeConstants;
+import org.eclipse.epf.library.edit.util.ProcessUtil;
+import org.eclipse.epf.uma.Activity;
+import org.eclipse.epf.uma.Milestone;
+import org.eclipse.epf.uma.Process;
+import org.eclipse.epf.uma.UmaPackage;
+import org.eclipse.epf.uma.WorkProductDescriptor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+
+/**
+ * Milestone - work product section
+ * 
+ * @author Shilpa Toraskar
+ * @since 1.5
+ * 
+ */
+public class MilestoneWorkProductSection extends RelationSection {
+	private IFilter filter = null;
+
+	private Milestone milestone;
+	/**
+	 * Get process work product filter
+	 */
+	public IFilter getFilter() {
+		if (filter == null) {
+			filter = new ProcessWorkProductFilter(getConfiguration(),
+					null, FilterConstants.WORKPRODUCTS);
+		}
+		return filter;
+	}
+
+
+	/**
+	 * @see org.eclipse.epf.authoring.ui.properties.RelationSection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+	 */
+	public void createControls(Composite parent,
+			TabbedPropertySheetPage tabbedPropertySheetPage) {
+
+		super.createControls(parent, tabbedPropertySheetPage);
+	}
+
+	/**
+	 * @see org.eclipse.epf.authoring.ui.properties.RelationSection#initContentProvider1()
+	 */
+	protected void initContentProvider1() {
+		contentProvider = new AdapterFactoryContentProvider(getAdapterFactory()) {
+			public Object[] getElements(Object object) {
+				
+				return getFilteredList(
+						((Milestone) milestone).getRequiredResults())
+						.toArray();
+			}
+		};
+		tableViewer1.setContentProvider(contentProvider);
+	}
+
+	
+
+	/**
+	 * @see org.eclipse.epf.authoring.ui.properties.RelationSection#init()
+	 */
+	protected void init() {
+		if (getElement() instanceof Milestone) {
+			milestone = (Milestone) getElement();
+		}
+		super.init();
+
+		labelProvider = new AdapterFactoryLabelProvider(
+				TngAdapterFactory.INSTANCE.getWBS_ComposedAdapterFactory());
+
+		int numOfTables = 1;
+		
+		setTabData(PropertiesResources.RoleDescriptor_WorkProducts_SectionTitle,
+				PropertiesResources.Milestone_WorkProducts_SectionDescription,
+				PropertiesResources.Milestone_WorkProducts_Table1,
+				null,
+				null,
+				null,
+				FilterConstants.WORKPRODUCTS); 
+
+		boolean[] changesAllowed = { true };
+		setTableData(numOfTables, changesAllowed);
+	}
+
+
+	/**
+	 * @see org.eclipse.epf.authoring.ui.properties.RelationSection#refresh()
+	 */
+	public void refresh() {
+		if (getElement() instanceof Milestone) {
+			milestone = (Milestone) getElement();
+		}
+		super.refresh();
+	}
+
+
+	/**
+	 * @see org.eclipse.epf.authoring.ui.properties.RelationSection#getDescriptorsFromProcess()
+	 */
+	protected List getDescriptorsFromProcess() {
+		List items = new ArrayList();
+		return ProcessUtil.getElementsInScope(getAdapterFactory(), milestone,
+				WorkProductDescriptor.class, items);
+	}
+
+	/**
+	 * @see org.eclipse.epf.authoring.ui.properties.RelationSection#addItems1(java.util.List)
+	 */
+	protected void addItems1(List items) {
+		if (!items.isEmpty()) {
+			AssignWPToMilestone cmd = new AssignWPToMilestone(
+					(Milestone) element, items,
+					IActionTypeConstants.ADD_REQUIRED_RESULT, getConfiguration());
+			actionMgr.execute(cmd);
+		}
+	};
+
+	/**
+	 * @see org.eclipse.epf.authoring.ui.properties.RelationSection#removeItems1(java.util.List)
+	 */
+	protected void removeItems1(List items) {
+		if (!items.isEmpty()) {
+			actionMgr.doAction(IActionManager.REMOVE_MANY, milestone,
+					UmaPackage.eINSTANCE.getMilestone_RequiredResults(),
+					items, -1);
+			
+		}
+	};
+
+	private List getWorkProducts(List items) {
+		List wpList = new ArrayList();
+		if (!items.isEmpty()) {
+			for (int i = 0; i < items.size(); i++) {
+				wpList.add(((WorkProductDescriptor) items.get(i))
+						.getWorkProduct());
+			}
+		}
+
+		return wpList;
+	}
+
+	/**
+	 * @see org.eclipse.epf.authoring.ui.properties.RelationSection#getExistingElements1()
+	 */
+	protected List getExistingElements1() {
+		return getWorkProducts(((Milestone) milestone).getRequiredResults());
+	};
+
+	/**
+	 * @see org.eclipse.epf.authoring.ui.properties.RelationSection#getProcess()
+	 */
+	protected Process getProcess() {
+		AdapterFactory aFactory = TngAdapterFactory.INSTANCE
+				.getOBS_ComposedAdapterFactory();
+		ItemProviderAdapter adapter = (ItemProviderAdapter) aFactory.adapt(
+				milestone, ITreeItemContentProvider.class);
+		Object obj = ProcessUtil.getRootProcess(aFactory, adapter, milestone);
+		return (Process) obj;
+	}
+
+	/**
+	 * @see org.eclipse.epf.authoring.ui.properties.RelationSection#getFilterForDescriptors()
+	 */
+	protected IFilter getFilterForDescriptors() {
+		return new DescriptorProcessFilter(getConfiguration()) {
+			protected boolean childAccept(Object obj) {
+				if (obj instanceof Activity) {
+					List list = new ArrayList();
+					getActivitiesInScope(TngAdapterFactory.INSTANCE
+							.getWBS_ComposedAdapterFactory(), milestone, list);
+					if (list.contains(obj))
+						return true;
+					else
+						return false;
+				}
+				// Uncomment to show extended activity's workproducts
+				// if(obj instanceof WorkProductDescriptorWrapperItemProvider){
+				// Object object =
+				// ((BreakdownElementWrapperItemProvider)obj).getParent(obj);
+				// List list = new ArrayList();
+				// getActivitiesInScope(
+				// TngAdapterFactory.INSTANCE.getOBS_ComposedAdapterFactory(),
+				// element, list);
+				// if(list.contains(object)) return true;
+				// }
+				if (obj instanceof WorkProductDescriptor)
+					return true;
+				return false;
+			}
+		};
+	}
+
+	/**
+	 * @see org.eclipse.epf.authoring.ui.properties.RelationSection#getDescriptorTabName()
+	 */
+	protected String getDescriptorTabName() {
+		return FilterConstants.WORK_PRODUCT_DESCRIPTORS;
+	}
+
+	/**
+	 * @see org.eclipse.epf.authoring.ui.properties.RelationSection#addFromProcessItems1(java.util.List)
+	 */
+	protected void addFromProcessItems1(List items) {
+		if (!items.isEmpty()) {
+			actionMgr.doAction(IActionManager.ADD_MANY, milestone,
+					UmaPackage.eINSTANCE.getMilestone_RequiredResults(),
+					items, -1);
+		}
+	}
+}
\ No newline at end of file
diff --git a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/PropertiesResources.java b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/PropertiesResources.java
index 1b82ddf..d749417 100644
--- a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/PropertiesResources.java
+++ b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/PropertiesResources.java
@@ -155,6 +155,8 @@
 	public static String TeamProfile_Role_SectionTitle;
 	public static String TeamProfile_Role_SectionDescription;
 	public static String TeamProfile_Role_Table1;
+	public static String Milestone_WorkProducts_SectionDescription;
+	public static String Milestone_WorkProducts_Table1;
 	public static String Process_RichText_CollapseImage;
 	public static String Process_RichText_ExpandImage;
 	public static String Process_Add;
diff --git a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/RelationSection.java b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/RelationSection.java
index d749eae..671bd49 100644
--- a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/RelationSection.java
+++ b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/RelationSection.java
@@ -17,7 +17,8 @@
 import org.eclipse.epf.library.edit.IFilter;
 import org.eclipse.epf.library.edit.command.IActionManager;
 import org.eclipse.epf.library.edit.util.ProcessUtil;
-import org.eclipse.epf.uma.Descriptor;
+import org.eclipse.epf.uma.BreakdownElement;
+//import org.eclipse.epf.uma.Descriptor;
 import org.eclipse.epf.uma.MethodElement;
 import org.eclipse.epf.uma.Process;
 import org.eclipse.jface.viewers.ILabelProvider;
@@ -55,7 +56,7 @@
 	protected IStructuredContentProvider contentProvider = null;
 
 	// element
-	protected Descriptor element;
+	protected BreakdownElement element;
 
 	// action manager
 	protected IActionManager actionMgr;
@@ -142,7 +143,7 @@
 
 	protected void init() {
 		// get descriptor object
-		element = (Descriptor) getElement();
+		element = (BreakdownElement) getElement();
 
 		// get toolkit
 		toolkit = getWidgetFactory();
@@ -157,8 +158,8 @@
 	 */
 	public void refresh() {
 		try {
-			if (getElement() instanceof Descriptor) {
-				element = (Descriptor) getElement();
+			if (getElement() instanceof BreakdownElement) {
+				element = (BreakdownElement) getElement();
 
 				initContentProvider1();
 				initContentProvider2();
diff --git a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/Resources.properties b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/Resources.properties
index adb08ca..ab75b2a 100644
--- a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/Resources.properties
+++ b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/Resources.properties
@@ -166,6 +166,9 @@
 TeamProfile_Role_SectionDescription=Add or remove roles to/from the team profile.
 TeamProfile_Role_Table1=Roles:
 
+Milestone_WorkProducts_SectionDescription=Specify work product descriptors representing required results of this milestone.
+Milestone_WorkProducts_Table1=Required Results:
+	
 Process_RichText_CollapseImage=collapsed.gif
 Process_RichText_ExpandImage=expanded.gif
 Process_Add=Add...
diff --git a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/RoleDescriptorWorkProductSection.java b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/RoleDescriptorWorkProductSection.java
index 415fea5..cd5e844 100644
--- a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/RoleDescriptorWorkProductSection.java
+++ b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/RoleDescriptorWorkProductSection.java
@@ -28,6 +28,7 @@
 import org.eclipse.epf.library.edit.process.command.IActionTypeConstants;
 import org.eclipse.epf.library.edit.util.ProcessUtil;
 import org.eclipse.epf.uma.Activity;
+import org.eclipse.epf.uma.Descriptor;
 import org.eclipse.epf.uma.Process;
 import org.eclipse.epf.uma.RoleDescriptor;
 import org.eclipse.epf.uma.UmaPackage;
@@ -155,7 +156,7 @@
 	 */
 	protected void removeItems1(List items) {
 		if (!items.isEmpty()) {
-			RemoveDescriptorCommand cmd = new RemoveDescriptorCommand(element,
+			RemoveDescriptorCommand cmd = new RemoveDescriptorCommand((Descriptor) element,
 					items, UmaPackage.ROLE_DESCRIPTOR__RESPONSIBLE_FOR);
 			actionMgr.execute(cmd);
 		}
diff --git a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/TaskDescriptorRoleSection.java b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/TaskDescriptorRoleSection.java
index 1f3d418..7f2507e 100644
--- a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/TaskDescriptorRoleSection.java
+++ b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/TaskDescriptorRoleSection.java
@@ -28,6 +28,7 @@
 import org.eclipse.epf.library.edit.process.command.IActionTypeConstants;
 import org.eclipse.epf.library.edit.util.ProcessUtil;
 import org.eclipse.epf.uma.Activity;
+import org.eclipse.epf.uma.Descriptor;
 import org.eclipse.epf.uma.Process;
 import org.eclipse.epf.uma.Role;
 import org.eclipse.epf.uma.RoleDescriptor;
@@ -304,7 +305,7 @@
 	 */
 	protected void removeItems1(List items) {
 		if (!items.isEmpty()) {
-			RemoveDescriptorCommand cmd = new RemoveDescriptorCommand(element,
+			RemoveDescriptorCommand cmd = new RemoveDescriptorCommand((Descriptor)element,
 					items, UmaPackage.TASK_DESCRIPTOR__PERFORMED_PRIMARILY_BY);
 			actionMgr.execute(cmd);
 		}
@@ -315,7 +316,7 @@
 	 */
 	protected void removeItems2(List items) {
 		if (!items.isEmpty()) {
-			RemoveDescriptorCommand cmd = new RemoveDescriptorCommand(element,
+			RemoveDescriptorCommand cmd = new RemoveDescriptorCommand((Descriptor)element,
 					items,
 					UmaPackage.TASK_DESCRIPTOR__ADDITIONALLY_PERFORMED_BY);
 			actionMgr.execute(cmd);
@@ -327,7 +328,7 @@
 	 */
 	protected void removeItems3(List items) {
 		if (!items.isEmpty()) {
-			RemoveDescriptorCommand cmd = new RemoveDescriptorCommand(element,
+			RemoveDescriptorCommand cmd = new RemoveDescriptorCommand((Descriptor)element,
 					items, UmaPackage.TASK_DESCRIPTOR__ASSISTED_BY);
 			actionMgr.execute(cmd);
 		}
diff --git a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/TaskDescriptorWorkProductSection.java b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/TaskDescriptorWorkProductSection.java
index c8c1b1c..0cb6517 100644
--- a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/TaskDescriptorWorkProductSection.java
+++ b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/TaskDescriptorWorkProductSection.java
@@ -28,6 +28,7 @@
 import org.eclipse.epf.library.edit.process.command.IActionTypeConstants;
 import org.eclipse.epf.library.edit.util.ProcessUtil;
 import org.eclipse.epf.uma.Activity;
+import org.eclipse.epf.uma.Descriptor;
 import org.eclipse.epf.uma.Process;
 import org.eclipse.epf.uma.TaskDescriptor;
 import org.eclipse.epf.uma.UmaPackage;
@@ -284,7 +285,7 @@
 	 */
 	protected void removeItems1(List items) {
 		if (!items.isEmpty()) {
-			RemoveDescriptorCommand cmd = new RemoveDescriptorCommand(element,
+			RemoveDescriptorCommand cmd = new RemoveDescriptorCommand((Descriptor)element,
 					items, UmaPackage.TASK_DESCRIPTOR__MANDATORY_INPUT);
 			actionMgr.execute(cmd);
 		}
@@ -295,7 +296,7 @@
 	 */
 	protected void removeItems2(List items) {
 		if (!items.isEmpty()) {
-			RemoveDescriptorCommand cmd = new RemoveDescriptorCommand(element,
+			RemoveDescriptorCommand cmd = new RemoveDescriptorCommand((Descriptor)element,
 					items, UmaPackage.TASK_DESCRIPTOR__OPTIONAL_INPUT);
 			actionMgr.execute(cmd);
 		}
@@ -306,7 +307,7 @@
 	 */
 	protected void removeItems3(List items) {
 		if (!items.isEmpty()) {
-			RemoveDescriptorCommand cmd = new RemoveDescriptorCommand(element,
+			RemoveDescriptorCommand cmd = new RemoveDescriptorCommand((Descriptor)element,
 					items, UmaPackage.TASK_DESCRIPTOR__EXTERNAL_INPUT);
 			actionMgr.execute(cmd);
 		}
@@ -317,7 +318,7 @@
 	 */
 	protected void removeItems4(List items) {
 		if (!items.isEmpty()) {
-			RemoveDescriptorCommand cmd = new RemoveDescriptorCommand(element,
+			RemoveDescriptorCommand cmd = new RemoveDescriptorCommand((Descriptor)element,
 					items, UmaPackage.TASK_DESCRIPTOR__OUTPUT);
 			actionMgr.execute(cmd);
 		}
diff --git a/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/process/command/AssignWPToMilestone.java b/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/process/command/AssignWPToMilestone.java
new file mode 100644
index 0000000..2bfb268
--- /dev/null
+++ b/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/process/command/AssignWPToMilestone.java
@@ -0,0 +1,198 @@
+//------------------------------------------------------------------------------
+// Copyright (c) 2005, 2008 IBM Corporation and others.
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// which accompanies this distribution, and is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// Contributors:
+// IBM Corporation - initial implementation
+//------------------------------------------------------------------------------
+package org.eclipse.epf.library.edit.process.command;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.epf.library.edit.TngAdapterFactory;
+import org.eclipse.epf.library.edit.ui.UserInteractionHelper;
+import org.eclipse.epf.library.edit.util.ProcessUtil;
+import org.eclipse.epf.library.edit.util.TngUtil;
+import org.eclipse.epf.uma.Activity;
+import org.eclipse.epf.uma.MethodConfiguration;
+import org.eclipse.epf.uma.Milestone;
+import org.eclipse.epf.uma.WorkProduct;
+import org.eclipse.epf.uma.WorkProductDescriptor;
+
+/**
+ * Command to assign work products to milestone. It will set required result
+ * feaute
+ * 
+ * @author Shilpa Toraskar
+ * @since 1.5
+ */
+public class AssignWPToMilestone extends AddMethodElementCommand {
+
+	private List workProducts;
+
+	private Activity activity;
+
+	private Milestone milestone;
+
+	private Collection modifiedResources;
+
+	private HashMap map = new HashMap();
+
+	private int action;
+
+	List existingWPDescList = new ArrayList();
+
+	List newWPDescList = new ArrayList();
+
+	private MethodConfiguration config;
+
+	/**
+	 * 
+	 */
+	public AssignWPToMilestone(Milestone milestone, List workProducts,
+			int action, MethodConfiguration config) {
+
+		super(TngUtil.getOwningProcess(milestone));
+
+		this.workProducts = workProducts;
+		this.milestone = milestone;
+		this.action = action;
+		this.config = config;
+
+		AdapterFactory aFactory = TngAdapterFactory.INSTANCE
+				.getWBS_ComposedAdapterFactory();
+		ItemProviderAdapter adapter = (ItemProviderAdapter) aFactory.adapt(
+				milestone, ITreeItemContentProvider.class);
+		Object parent = adapter.getParent(milestone);
+		if (parent instanceof Activity) {
+			this.activity = (Activity) parent;
+		}
+		this.modifiedResources = new HashSet();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.emf.common.command.Command#execute()
+	 */
+	public void execute() {
+		// add to default configuration if not there already
+		if (!super.addToDefaultConfiguration(workProducts))
+			return;
+
+		for (Iterator it = workProducts.iterator(); it.hasNext();) {
+			WorkProduct wp = (WorkProduct) it.next();
+			WorkProductDescriptor newWpDesc = null;
+
+			boolean isNewDescriptor = false;
+			// check for local descriptor
+			newWpDesc = (WorkProductDescriptor) ProcessCommandUtil
+					.getDescriptor(wp, activity, config);
+			if (newWpDesc == null) {
+				// check for inherited descriptor
+				newWpDesc = (WorkProductDescriptor) ProcessCommandUtil
+						.getInheritedDescriptor(wp, activity, config);
+				if (newWpDesc == null) {
+					newWpDesc = ProcessUtil.createWorkProductDescriptor(wp);
+					isNewDescriptor = true;
+
+				}
+			}
+			if (isNewDescriptor)
+				newWPDescList.add(newWpDesc);
+			else
+				existingWPDescList.add(newWpDesc);
+
+			// get deliverable
+			WorkProductDescriptor deliverable = UserInteractionHelper
+					.getDeliverable(activity, wp);
+			if (deliverable != null) {
+				map.put(newWpDesc, deliverable);
+			}
+		}
+
+		redo();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.emf.common.command.Command#redo()
+	 */
+	public void redo() {
+
+		if (action == IActionTypeConstants.ADD_REQUIRED_RESULT) {
+			milestone.getRequiredResults().addAll(existingWPDescList);
+			milestone.getRequiredResults().addAll(newWPDescList);
+		}
+
+		activity.getBreakdownElements().addAll(newWPDescList);
+
+		if (map != null) {
+			Set keyset = map.keySet();
+			for (Iterator itor = keyset.iterator(); itor.hasNext();) {
+				Object key = itor.next();
+				WorkProductDescriptor wpDesc = (WorkProductDescriptor) map
+						.get(key);
+
+				// add to deliverable
+				wpDesc.getDeliverableParts().add((WorkProductDescriptor) key);
+			}
+		}
+
+	}
+
+	public void undo() {
+
+		// remove from configuration if anything was added
+		super.undo();
+
+		if (action == IActionTypeConstants.ADD_REQUIRED_RESULT) {
+			milestone.getRequiredResults().removeAll(existingWPDescList);
+			milestone.getRequiredResults().removeAll(newWPDescList);
+		}
+
+		activity.getBreakdownElements().removeAll(newWPDescList);
+
+		if (map != null) {
+			Set keyset = map.keySet();
+			for (Iterator itor = keyset.iterator(); itor.hasNext();) {
+				Object key = itor.next();
+				WorkProductDescriptor wpDesc = (WorkProductDescriptor) map
+						.get(key);
+
+				// remove it from deliverable
+				wpDesc.getDeliverableParts()
+						.remove((WorkProductDescriptor) key);
+			}
+		}
+	}
+
+	protected boolean prepare() {
+		return true;
+	}
+
+	public Collection getModifiedResources() {
+		if (workProducts != null && !workProducts.isEmpty()) {
+			if (activity.eResource() != null) {
+				modifiedResources.add(activity.eResource());
+			}
+			if (milestone.eResource() != null) {
+				modifiedResources.add(milestone.eResource());
+			}
+		}
+		return modifiedResources;
+	}
+}
diff --git a/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/process/command/IActionTypeConstants.java b/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/process/command/IActionTypeConstants.java
index de58a1c..ccfabe6 100644
--- a/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/process/command/IActionTypeConstants.java
+++ b/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/process/command/IActionTypeConstants.java
@@ -27,4 +27,6 @@
 	public static final int ADD_OUTPUT = 6;
 
 	public static final int ADD_RESPONSIBLE_FOR = 7;
+	
+	public static final int ADD_REQUIRED_RESULT = 8;
 }