jh: changes for copy
diff --git a/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/command/MethodElementAddCommand.java b/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/command/MethodElementAddCommand.java
index a091756..9cb7b19 100644
--- a/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/command/MethodElementAddCommand.java
+++ b/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/command/MethodElementAddCommand.java
@@ -873,23 +873,24 @@
//
ownerPlugin = UmaUtil.getMethodPlugin(addCommand.getOwner());
removeXRefRequired = false;
- find_xPluginRef: for (Iterator iter = addCommand.getCollection()
- .iterator(); iter.hasNext();) {
- Object element = iter.next();
-
- if (isExcludedFromOutgoingReferenceCheck(element)) {
- continue find_xPluginRef;
- }
-
- if (element instanceof MethodElement) {
- if (hasIllegalReferenceIncludingAllChildren(ownerPlugin,
- (MethodElement) element, addList)) {
- removeXRefRequired = true;
- break find_xPluginRef;
+ if (ownerPlugin != null) {
+ find_xPluginRef: for (Iterator iter = addCommand.getCollection()
+ .iterator(); iter.hasNext();) {
+ Object element = iter.next();
+
+ if (isExcludedFromOutgoingReferenceCheck(element)) {
+ continue find_xPluginRef;
+ }
+
+ if (element instanceof MethodElement) {
+ if (hasIllegalReferenceIncludingAllChildren(ownerPlugin,
+ (MethodElement) element, addList)) {
+ removeXRefRequired = true;
+ break find_xPluginRef;
+ }
}
}
- }
-
+ }
if (removeXRefRequired) {
return LibraryEditResources.invalidReferencesError_reason;
}
diff --git a/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/command/MethodPluginInitializeCopyCommand.java b/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/command/MethodPluginInitializeCopyCommand.java
index 92d5029..53d1d1c 100644
--- a/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/command/MethodPluginInitializeCopyCommand.java
+++ b/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/command/MethodPluginInitializeCopyCommand.java
@@ -54,27 +54,5 @@
}
}
}
- if (domain instanceof TraceableAdapterFactoryEditingDomain) {
- if (((TraceableAdapterFactoryEditingDomain)domain).isCreateContibuter()) {
- MethodPlugin plugin = UmaUtil.getMethodPlugin(owner);
- org.eclipse.epf.uma.ProcessPackage pkg = (org.eclipse.epf.uma.ProcessPackage) UmaUtil
- .findMethodPackage(plugin, ModelStructure.DEFAULT.capabilityPatternPath);
- pkg.getChildPackages().clear();
-
- pkg = (org.eclipse.epf.uma.ProcessPackage) UmaUtil
- .findMethodPackage(plugin, ModelStructure.DEFAULT.deliveryProcessPath);
- pkg.getChildPackages().clear();
-
- // create contribution association
- if (copy instanceof MethodPlugin) {
- Object originalObj = ((TraceableAdapterFactoryEditingDomain)domain).getCopyToOriginalMap().get(copy);
- if (originalObj instanceof MethodPlugin) {
- ((MethodPlugin)copy).getBases().add((MethodPlugin)originalObj);
- }
- }
-
- }
- }
-
}
}
diff --git a/1.5/plugins/org.eclipse.epf.uma.edit/src/org/eclipse/epf/uma/edit/command/MethodElementCreateCopyCommand.java b/1.5/plugins/org.eclipse.epf.uma.edit/src/org/eclipse/epf/uma/edit/command/MethodElementCreateCopyCommand.java
index 0d79ee3..8e09baa 100644
--- a/1.5/plugins/org.eclipse.epf.uma.edit/src/org/eclipse/epf/uma/edit/command/MethodElementCreateCopyCommand.java
+++ b/1.5/plugins/org.eclipse.epf.uma.edit/src/org/eclipse/epf/uma/edit/command/MethodElementCreateCopyCommand.java
@@ -11,12 +11,16 @@
package org.eclipse.epf.uma.edit.command;
import java.util.Collection;
+import java.util.Iterator;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.command.CreateCopyCommand;
import org.eclipse.emf.edit.command.CopyCommand.Helper;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.epf.uma.MethodElement;
+import org.eclipse.epf.uma.ProcessPackage;
import org.eclipse.epf.uma.edit.domain.TraceableAdapterFactoryEditingDomain;
+import org.eclipse.epf.uma.util.UmaUtil;
/**
* A command that creates an uninitialized copy of a method element. The
@@ -59,5 +63,23 @@
return collection;
}
+
+ @Override
+ public Collection<?> doGetChildrenToCopy() {
+ Collection<?> children = super.doGetChildrenToCopy();
+ if (domain instanceof TraceableAdapterFactoryEditingDomain &&
+ ((TraceableAdapterFactoryEditingDomain)domain).isCreateContibuter()) {
+ for (Iterator<?> iter = children.iterator();iter.hasNext();) {
+ Object child = iter.next();
+ if (child instanceof MethodElement) {
+ if (UmaUtil.getProcessComponent((MethodElement)child) != null ||
+ (child instanceof ProcessPackage && ((ProcessPackage)child).eContainer() instanceof ProcessPackage)) {
+ iter.remove();
+ }
+ }
+ }
+ }
+ return children;
+ }
}
diff --git a/1.5/plugins/org.eclipse.epf.uma.edit/src/org/eclipse/epf/uma/edit/command/MethodElementInitializeCopyCommand.java b/1.5/plugins/org.eclipse.epf.uma.edit/src/org/eclipse/epf/uma/edit/command/MethodElementInitializeCopyCommand.java
index ba3c11a..19c04f4 100644
--- a/1.5/plugins/org.eclipse.epf.uma.edit/src/org/eclipse/epf/uma/edit/command/MethodElementInitializeCopyCommand.java
+++ b/1.5/plugins/org.eclipse.epf.uma.edit/src/org/eclipse/epf/uma/edit/command/MethodElementInitializeCopyCommand.java
@@ -97,7 +97,6 @@
if (owner instanceof MethodElement) {
EList<EAttribute> attributes = new BasicEList<EAttribute>();
attributes.add(UmaPackage.Literals.NAMED_ELEMENT__NAME);
- attributes.add(UmaPackage.Literals.METHOD_ELEMENT__PRESENTATION_NAME);
return attributes;
} else {
return super.getAttributesToCopy();