protected void copyAndAdd(
     final Set additionalObjects, final EObject container, final EStructuralFeature feature) {
   final CopyCommand.Helper helper = this.mainCopyCommand.getCopyKeyedByOriginalMap();
   final Command copyCommand =
       ModelEditorImpl.createCopyCommand(this.domain, additionalObjects, helper);
   final boolean copied = this.appendAndExecute(copyCommand);
   if (copied) {
     // Create the add command to place all of the annotations into the annotation container ...
     final Collection copiedAnnotations = copyCommand.getResult();
     final Command addCommand =
         AddCommand.create(this.domain, container, feature, copiedAnnotations);
     final boolean added = this.appendAndExecute(addCommand);
     if (!added) {
       // Failed, but the copied objects will be left without a parent
       // and will simply be garbage collected.  However, log anyway ...
       final Object[] params =
           new Object[] {new Integer(copiedAnnotations.size()), feature.getName()};
       final String msg =
           ModelerCore.Util.getString(
               "CopyWithRelatedToClipboardCommand.Failed_to_add_{0}_copied_{1}_to_clipboard",
               params); //$NON-NLS-1$
       ModelerCore.Util.log(msg);
     }
   }
 }
Ejemplo n.º 2
0
 public static void setEnterpriseFacetValue(XSDSimpleTypeDefinition type, FacetValue newValue) {
   if (newValue.value != null) {
     // set new enterprise info:
     EnterpriseDatatypeInfo edi =
         ModelerCore.getWorkspaceDatatypeManager().getEnterpriseDatatypeInfo(type);
     if (edi == null) {
       edi = new EnterpriseDatatypeInfo();
     } // endif
     edi.setRuntimeTypeFixed(new Boolean(newValue.isFixedLocal));
     edi.setRuntimeType((String) newValue.value);
     ModelEditorImpl.fillWithDefaultValues(edi, type);
     ModelerCore.getModelEditor().setEnterpriseDatatypePropertyValue(type, edi);
   } else {
     // need to unset:
     ModelerCore.getModelEditor().unsetEnterpriseDatatypePropertyValue(type);
   } // endif
 }