@Override public void doExecute() { copyAttributes(); copyReferences(); }
/** * This creates a command instance that initializes a copied object */ public InitializeCopyOverrideCommand(MappingDomain domain, InitializeCopyCommand initializeCommand) { super(initializeCommand.doGetLabel(), initializeCommand.doGetDescription()); this.mappingDomain = domain; this.initializeCommand = initializeCommand; }
@Override public Collection<?> getResult() { return Collections.singleton(initializeCommand.getCopy()); }
public void execute() EObject owner = initializeCommand.getOwner(); EObject copy = initializeCommand.getCopy(); CopyCommand.Helper copyHelper = initializeCommand.getCopyHelper();
/** * This gives an abbreviated name using this object's own class' name, without package qualification, * followed by a space separated list of <tt>field:value</tt> pairs. */ @Override public String toString() { StringBuffer result = new StringBuffer(super.toString()); result.append(" (mappingDomain: " + mappingDomain + ")"); result.append(" (owner: " + initializeCommand.getOwner() + ")"); result.append(" (copy: " + initializeCommand.getCopy() + ")"); return result.toString(); } }
owners.add(((InitializeCopyCommand)command).getOwner());
@Override protected Collection<? extends EReference> getReferencesToCopy() { List<EReference> result = new ArrayList<EReference>(super.getReferencesToCopy()); result.remove(EcorePackage.Literals.EREFERENCE__EOPPOSITE); return result; }
@Override protected void copyAttributes() { XSDSchema ownerSchema = (XSDSchema)owner; XSDSchema copySchema = (XSDSchema)copy; copySchema.getQNamePrefixToNamespaceMap().putAll(ownerSchema.getQNamePrefixToNamespaceMap()); copySchema.setSchemaForSchemaQNamePrefix(ownerSchema.getSchemaForSchemaQNamePrefix()); super.copyAttributes(); } };
@Override protected void copyReferences() { super.copyReferences(); EReference reference = EcorePackage.Literals.EREFERENCE__EOPPOSITE; EObject value = (EObject)owner.eGet(reference); if (value != null) { EObject target = copyHelper.getCopyTarget(value, true); if (target != null) { copy.eSet(reference, target); } } } };
/** * This creates a primitive {@link org.eclipse.emf.edit.command.InitializeCopyCommand}. */ protected Command createInitializeCopyCommand(EditingDomain domain, EObject owner, CopyCommand.Helper helper) { return new InitializeCopyCommand(domain, owner, helper); }
public void execute() EObject owner = initializeCommand.getOwner(); EObject copy = initializeCommand.getCopy(); CopyCommand.Helper copyHelper = initializeCommand.getCopyHelper();
/** * This gives an abbreviated name using this object's own class' name, without package qualification, * followed by a space separated list of <tt>field:value</tt> pairs. */ @Override public String toString() { StringBuffer result = new StringBuffer(super.toString()); result.append(" (mappingDomain: " + mappingDomain + ")"); result.append(" (owner: " + initializeCommand.getOwner() + ")"); result.append(" (copy: " + initializeCommand.getCopy() + ")"); return result.toString(); } }
for (EReference reference : getReferencesToCopy())
/** * This creates a command instance that initializes a copied object */ public InitializeCopyOverrideCommand(MappingDomain domain, InitializeCopyCommand initializeCommand) { super(initializeCommand.doGetLabel(), initializeCommand.doGetDescription()); this.mappingDomain = domain; this.initializeCommand = initializeCommand; }
@Override public Collection<?> getAffectedObjects() { return Collections.singleton(initializeCommand.getCopy()); }
@Override public Collection<?> getResult() { return Collections.singleton(initializeCommand.getCopy()); }
@Override public Collection<?> getAffectedObjects() { return Collections.singleton(initializeCommand.getCopy()); }