private static void inheritCompositeContent(Content cc, EList<SetOfGuiElements> setItems, EList<ComposedElement> composedItems) { if (setItems.size()>0) { cc.getWidgetSetItems().addAll(EcoreUtil.copyAll(setItems)); } if (composedItems.size()>0) { cc.getElements().addAll(EcoreUtil.copyAll(composedItems)); } }
private static void inheritDataObjectVariables(XmadslPage xmadslPage, Page superPage) { // Copy commands Collection<DataObjectVariable> dos = (Collection<DataObjectVariable>)EcoreUtil.copyAll(superPage.getDataobjects()); xmadslPage.getDataobjects().addAll(dos); }
private static void inheritCommands(XmadslPage xmadslPage, Page superPage) { // Copy commands Collection<Command> commands = (Collection<Command>)EcoreUtil.copyAll(superPage.getCommands()); xmadslPage.getCommands().addAll(commands); }
/** * Obtains the operations declared on the specified type. * * @param classifierName * The name of the classifier which operation are sought. * @return The operations it declares. <code>null</code> if none. */ public EList<EOperation> getExistingOperations(String classifierName) { EList<EOperation> result = new BasicEList<EOperation>(); if (PRIMITIVE_STRING_NAME.equals(classifierName)) { result.addAll(EcoreUtil.copyAll(stringType.getEOperations())); } else if (PRIMITIVE_INTEGER_NAME.equals(classifierName)) { result.addAll(EcoreUtil.copyAll(integerType.getEOperations())); } else if (PRIMITIVE_REAL_NAME.equals(classifierName)) { result.addAll(EcoreUtil.copyAll(realType.getEOperations())); } return result; } }
/** * @generated NOT */ public Collection<Attribute> copyAttributes() { Collection<Attribute> attributes = EcoreUtil.copyAll(getAttributes()); if (getSuperType() != null) { Collection<Attribute> superTypeAttributes = getSuperType().copyAttributes(); attributes.addAll(EcoreUtil.copyAll(superTypeAttributes)); } return attributes; }
/** * Obtains the operations declared on the specified type. * * @param classifierName * The name of the classifier which operation are sought. * @return The operations it declares. <code>null</code> if none. */ public synchronized EList<EOperation> getExistingOperations(String classifierName) { EList<EOperation> result = new BasicEList<EOperation>(); if (PRIMITIVE_STRING_NAME.equals(classifierName)) { result.addAll(EcoreUtil.copyAll(stringType.getEOperations())); } else if (TYPE_OCLANY_NAME.equals(classifierName)) { result.addAll(EcoreUtil.copyAll(oclAnyType.getEOperations())); } else if (TYPE_EOBJECT_NAME.equals(classifierName)) { result.addAll(EcoreUtil.copyAll(eObjectType.getEOperations())); } else if (TYPE_COLLECTION_NAME.equals(classifierName)) { result.addAll(EcoreUtil.copyAll(collectionType.getEOperations())); } else if (TYPE_ORDEREDSET_NAME.equals(classifierName)) { result.addAll(EcoreUtil.copyAll(orderedSetType.getEOperations())); } else if (TYPE_SEQUENCE_NAME.equals(classifierName)) { result.addAll(EcoreUtil.copyAll(sequenceType.getEOperations())); } return result; } }
/** * Returns a collection of the self-contained copies of each attribute. * * @param entity * the collection of attribute to copy. * @return the collection of attribute. */ private static Collection<Attribute> cloneAttributes(Entity entity) { Collection<Attribute> attributes = EcoreUtil.copyAll(entity.getAttributes()); if (entity.getSuperType() != null) { Collection<Attribute> superTypeAttributes = cloneAttributes(entity.getSuperType()); attributes.addAll(EcoreUtil.copyAll(superTypeAttributes)); } return attributes; }
private void copyProperties(Widget source, Widget target) { target.setItem(source.getItem()); target.setIcon(source.getIcon()); target.setLabel(source.getLabel()); target.getVisibility().addAll(EcoreUtil.copyAll(source.getVisibility())); target.getLabelColor().addAll(EcoreUtil.copyAll(source.getLabelColor())); target.getValueColor().addAll(EcoreUtil.copyAll(source.getValueColor())); }
private void copyProperties(Widget source, Widget target) { target.setItem(source.getItem()); target.setIcon(source.getIcon()); target.setLabel(source.getLabel()); target.getVisibility().addAll(EcoreUtil.copyAll(source.getVisibility())); target.getLabelColor().addAll(EcoreUtil.copyAll(source.getLabelColor())); target.getValueColor().addAll(EcoreUtil.copyAll(source.getValueColor())); }
/** * @param entity * @return true or false whether the given entity contains derived attributes */ public static boolean containsDerivedAttributes(Entity entity, boolean localAttributesOnly) { Collection<Attribute> cloneAttributes = localAttributesOnly ? EcoreUtil.copyAll(entity.getAttributes()) : entity.copyAttributes(); for (Attribute attribute : cloneAttributes) { if (attribute.isDerived()) { return true; } } return false; }
static void mergeIntoProfile ( final Profile source, final Profile target ) { target.getInstallationUnits ().addAll ( source.getInstallationUnits () ); target.getJvmArguments ().addAll ( source.getJvmArguments () ); target.getArguments ().addAll ( source.getArguments () ); target.getNotes ().addAll ( source.getNotes () ); target.getSetbsl ().addAll ( EcoreUtil.copyAll ( source.getSetbsl () ) ); target.getStart ().addAll ( EcoreUtil.copyAll ( source.getStart () ) ); target.getProperty ().addAll ( EcoreUtil.copyAll ( source.getProperty () ) ); // merge sub profiles for ( final SubProfile subProfile : source.getProfile () ) { mergeSubProfile ( subProfile, findTargetSubProfile ( subProfile.getName (), target ) ); } }
static void mergeIntoProfile ( final Profile source, final Profile target ) { target.getInstallationUnits ().addAll ( source.getInstallationUnits () ); target.getJvmArguments ().addAll ( source.getJvmArguments () ); target.getArguments ().addAll ( source.getArguments () ); target.getNotes ().addAll ( source.getNotes () ); target.getSetbsl ().addAll ( EcoreUtil.copyAll ( source.getSetbsl () ) ); target.getStart ().addAll ( EcoreUtil.copyAll ( source.getStart () ) ); target.getProperty ().addAll ( EcoreUtil.copyAll ( source.getProperty () ) ); // merge sub profiles for ( final SubProfile subProfile : source.getProfile () ) { mergeSubProfile ( subProfile, findTargetSubProfile ( subProfile.getName (), target ) ); } }
public static Collection<ApplicationModule> makeModules ( final org.eclipse.scada.configuration.infrastructure.World world, final org.eclipse.scada.configuration.infrastructure.EquinoxBase app, final EquinoxApplication implApp ) { final Collection<ApplicationModule> result = new LinkedList<> (); // process application configurations result.addAll ( EcoreUtil.copyAll ( world.getApplicationConfigurations () ) ); ExclusiveGroups.removeGroups ( result, app.getConfigurations () ); result.addAll ( EcoreUtil.copyAll ( app.getConfigurations () ) ); final List<Module> modules = new ArrayList<> (); // process infrastructure configuration final org.eclipse.scada.configuration.infrastructure.ApplicationConfiguration cfg = app.getConfiguration (); // TODO: add a default configuration if ( cfg != null ) { // add configurations ExclusiveGroups.removeGroups ( result, cfg.getConfigurations () ); result.addAll ( EcoreUtil.copyAll ( cfg.getConfigurations () ) ); // process modules modules.addAll ( cfg.getModules () ); } // process direct modules ExclusiveGroups.removeGroups ( result, app.getModules () ); modules.addAll ( app.getModules () ); processModules ( app, implApp, result, modules ); // final check is done in the target model return result; // we don't copy here, since the module handlers might have created actual objects }
public void merge(BuildPlan source) { Assert.isNotNull(source); @SuppressWarnings("serial") EcoreUtil.Copier copier = new EcoreUtil.Copier() { @Override protected EObject createCopy(EObject source) { return BuildPlan.this; // TODO This will certainly fail for nested plans! }; @Override protected void copyAttribute(EAttribute eAttribute, EObject eObject, EObject copyEObject) { super.copyAttribute(eAttribute, eObject, copyEObject); } @Override protected void copyContainment(EReference eReference, EObject eObject, EObject copyEObject) { // XXX do nothing, throws a ClassCastException due to overridded createCopy() method } }; copier.copy(source); // FIXME implement proper merge getParameterDefinitions().clear(); getParameterDefinitions().addAll(EcoreUtil.copyAll(source.getParameterDefinitions())); getFlags().clear(); getFlags().addAll(source.getFlags()); getHealthReports().clear(); getHealthReports().addAll(EcoreUtil.copyAll(source.getHealthReports())); getAttributes().clear(); getAttributes().putAll(source.getAttributes()); }
public EList<FEnumerator> getEnumElementsAndBaseEnumElements(final FEnumerationType enumType) { boolean _hasExtendsDeclaration = this.hasExtendsDeclaration(enumType); if (_hasExtendsDeclaration) { final FEnumerationType baseEnumType = this.getExtendedType(enumType); BasicEList<FEnumerator> enumAndBaseEnumElements = new BasicEList<FEnumerator>(); final EList<FEnumerator> baseEnumElements = this.getEnumElementsAndBaseEnumElements(baseEnumType); enumAndBaseEnumElements.addAll(EcoreUtil.<FEnumerator>copyAll(baseEnumElements)); final EList<FEnumerator> enumElements = this.getEnumElements(enumType); enumAndBaseEnumElements.addAll(EcoreUtil.<FEnumerator>copyAll(enumElements)); return enumAndBaseEnumElements; } else { return this.getEnumElements(enumType); } }
private static void inheritStatusFlags(XmadslPage xmadslPage, Page superPage) { if (superPage.getConditionsBlock() == null) { return; } // Copy statusFlags Collection<StatusFlag> statusFlags = (Collection<StatusFlag>)EcoreUtil.copyAll(superPage.getConditionsBlock().getStatusFlags()); if (xmadslPage.getConditionsBlock() == null) { xmadslPage.setConditionsBlock(CoreFactory.eINSTANCE.createConditionsBlock()); } xmadslPage.getConditionsBlock().getStatusFlags().addAll(statusFlags); }
markerGroup.getMarkers ().addAll ( EcoreUtil.copyAll ( cfg.getMarkers () ) );
composeData = createComposeDataAndSetStylesFromComposite(composite); composeData.getTabulators().addAll(EcoreUtil.copyAll(pcd.getTabulators())); return;
public static void setTabulatorFromStyle(StylePropertyTabulator sp, GuiElement gel) { if (gel instanceof XmadslComposite) { XmadslComposite xc = (XmadslComposite)gel; if (xc.getContent() == null) { xc.setContent(PomFactory.eINSTANCE.createContent()); } if (xc.getContent().getComposeLayout() == null) { xc.getContent().setComposeLayout(PomFactory.eINSTANCE.createComposeData()); } if (xc.getContent().getComposeLayout().getTabulators().size() == 0) { xc.getContent().getComposeLayout().getTabulators().addAll(EcoreUtil.copyAll(sp.getTabulators())); } } }
private MPart createPart(MPartDescriptor descriptor) { if (descriptor == null) { return null; } MPart part = modelService.createModelElement(MPart.class); part.setElementId(descriptor.getElementId()); part.getMenus().addAll(EcoreUtil.copyAll(descriptor.getMenus())); if (descriptor.getToolbar() != null) { part.setToolbar((MToolBar) EcoreUtil.copy((EObject) descriptor.getToolbar())); } part.setContributorURI(descriptor.getContributorURI()); part.setCloseable(descriptor.isCloseable()); part.setContributionURI(descriptor.getContributionURI()); part.setLabel(descriptor.getLabel()); part.setIconURI(descriptor.getIconURI()); part.setTooltip(descriptor.getTooltip()); part.getHandlers().addAll(EcoreUtil.copyAll(descriptor.getHandlers())); part.getTags().addAll(descriptor.getTags()); part.getVariables().addAll(descriptor.getVariables()); part.getProperties().putAll(descriptor.getProperties()); part.getPersistedState().putAll(descriptor.getPersistedState()); part.getBindingContexts().addAll(descriptor.getBindingContexts()); return part; }