public static void persistMetamodel(ResourceSet resourceSet, EPackage generated, String path) throws IOException { if (new File(path).exists()) { EPackage existing = (EPackage) OcciHelper.getRootElement(resourceSet, "file:/" + path); for (Iterator<EObject> iterator = existing.eAllContents(); iterator.hasNext();) { EObject eo = iterator.next(); if (eo instanceof EAnnotation && isOCLRelated((EAnnotation) eo)) { EModelElement existingContainer = (EModelElement) eo.eContainer(); EModelElement generatedContainer = (EModelElement) getGeneratedElement(generated, existingContainer); if (generatedContainer == null) { throw new RuntimeException("Unable to find " + existingContainer + " to reattach " + eo + " " + ((EAnnotation) eo).getEAnnotations()); } else { generatedContainer.getEAnnotations().add((EAnnotation) EcoreUtil.copy(eo)); } } } } ConverterUtils.save(resourceSet, generated, "file:/" + path); }
/** * The heuristically computed this target, but not the directly containing function, in which the expression (or any * other object) is (indirectly) contained, may be null. This typically is an {@link ObjectLiteral}, an * {@link N4ClassDeclaration}, or another outer {@link FunctionDefinition}. Note that for expressions contained in * property name value pairs, it is <b>not</b> the object literal. * <p> * cf. ECMAScript spec 10.4.3 Entering Function Code * </p> */ public static ThisTarget getProbableThisTarget(EObject location) { if (location == null || location.eContainer() == null) { return null; } final ThisArgProvider thisArgProvider = location instanceof N4MethodDeclaration ? (N4MethodDeclaration) location : EcoreUtil2.getContainerOfType(location.eContainer(), ThisArgProvider.class); if (thisArgProvider == null) { return null; } final ThisTarget thisTarget = EcoreUtil2.getContainerOfType(thisArgProvider.eContainer(), ThisTarget.class); if (thisTarget != null) { ThisArgProvider indirectThisArgProvider = EcoreUtil2.getContainerOfType(thisArgProvider.eContainer(), ThisArgProvider.class); if (indirectThisArgProvider != null && EcoreUtil.isAncestor(thisTarget, indirectThisArgProvider)) { return null; // nested function } } return thisTarget; }
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case RepetitionPackage.COLUMN_MAPPING: return createColumnMapping(); case RepetitionPackage.FOR_EACH_REPETITION: return createForEachRepetition(); case RepetitionPackage.FOR_EACH_XPATH_REPETITION: return createForEachXPathRepetition(); case RepetitionPackage.FOR_REPETITION: return createForRepetition(); case RepetitionPackage.FOR_REPETITION_ITERATOR: return createForRepetitionIterator(); case RepetitionPackage.XPATH_MAPPING: return createXPathMapping(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } }
private void merge(final EObject extension, final EObject extendsEObject, final Map<String, EObject> idToEObject) { mergeAttributes(extension, extendsEObject); mergeCrossReferences(extension, extendsEObject, idToEObject); for (final EObject extensionChild : extension.eContents()) { final String uriFragment = uriFragmentBuilder.getURIFragment(extensionChild); if (idToEObject.containsKey(uriFragment)) { final EObject extendsChild = idToEObject.get(uriFragment); merge(extensionChild, extendsChild, idToEObject); } else { final EObject copy = copy(extensionChild); final EReference containmentFeature = extensionChild.eContainmentFeature(); if (containmentFeature.isMany()) { final List<EObject> containment = (List<EObject>) extendsEObject.eGet(containmentFeature); containment.add(copy); } else { extendsEObject.eSet(containmentFeature, copy); } } } }
/** * */ protected void addProcessingUnits() { TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(processingUnits.getInput(), processingUnitsFilters, processingUnitsBusinessFilters, "processingUnits", propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) { @Override public void process(IStructuredSelection selection) { for (Iterator<?> iter = selection.iterator(); iter.hasNext();) { EObject elem = (EObject) iter.next(); propertiesEditionComponent .firePropertiesChanged(new PropertiesEditionEvent(GeneralPropertiesEditionPartImpl.this, SrmViewsRepository.General.Properties.processingUnits, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem)); } processingUnits.refresh(); } }; dialog.open(); }
/** * Real job * * @throws TraceException */ public boolean run() throws TraceException { setState(RUNNING); atom2EClass.clear(); for (String alias : alias2Item.keySet()) { EObject eObject = alias2Item.get(alias).modelRoot; if (eObject instanceof EPackage) { EPackage ePackage = (EPackage) eObject; final String selectedClass = alias2Item.get(alias).containerClassName; EClass refClass = EcoreUtilities.findEClass(alias2Item.get(alias).modelRoot, selectedClass); if (refClass != null) { EObject container = ePackage.getEFactoryInstance().create(refClass); alias2Item.get(alias).container = container; } } } createEClassesFromAtoms(); createEReferencesFromSigs(); setState(FINISHED); return true; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case LNGroupRPackage.GROUP_R: return createGroupR(); case LNGroupRPackage.RDRE: return createRDRE(); case LNGroupRPackage.RDRS: return createRDRS(); case LNGroupRPackage.RPSB: return createRPSB(); case LNGroupRPackage.RBRF: return createRBRF(); case LNGroupRPackage.RADR: return createRADR(); case LNGroupRPackage.RBDR: return createRBDR(); case LNGroupRPackage.RDIR: return createRDIR(); case LNGroupRPackage.RFLO: return createRFLO(); case LNGroupRPackage.RREC: return createRREC(); case LNGroupRPackage.RSYN: return createRSYN(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } }
/** * */ protected void addWriteServices() { TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(writeServices.getInput(), writeServicesFilters, writeServicesBusinessFilters, "writeServices", propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) { @Override public void process(IStructuredSelection selection) { for (Iterator<?> iter = selection.iterator(); iter.hasNext();) { EObject elem = (EObject) iter.next(); propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent( OtherPropertiesEditionPartForm.this, SrmViewsRepository.Other.Properties.writeServices, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem)); } writeServices.refresh(); } }; dialog.open(); }
@Override public boolean validate ( final EObject eObject, final DiagnosticChain diagnostics, final Map<Object, Object> context ) { boolean result = true; for ( final EValidator v : this.otherValidators ) { if ( !v.validate ( eObject, diagnostics, context ) ) { result = false; } } ValidationPlugin.runValidation ( eObject, diagnostics, context ); return result; }
/** * */ protected void addDelayServices() { TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(delayServices.getInput(), delayServicesFilters, delayServicesBusinessFilters, "delayServices", propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) { @Override public void process(IStructuredSelection selection) { for (Iterator<?> iter = selection.iterator(); iter.hasNext();) { EObject elem = (EObject) iter.next(); propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent( OtherPropertiesEditionPartImpl.this, SrmViewsRepository.Other.Properties.delayServices, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem)); } delayServices.refresh(); } }; dialog.open(); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case InfMeteringPackage.WATER_METERING_FUNCTION: return createWaterMeteringFunction(); case InfMeteringPackage.GAS_METERING_FUNCTION: return createGasMeteringFunction(); case InfMeteringPackage.METERING_FUNCTION_CONFIGURATION: return createMeteringFunctionConfiguration(); case InfMeteringPackage.COM_PORT: return createComPort(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } }
/** * */ protected void removeFromWorkload(EObject element) { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent( GeneralPropertiesEditionPartForm.this, GrmViewsRepository.General.Properties.workload, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.REMOVE, null, element)); workload.refresh(); }
/** * Returns whether this factory is applicable for the type of the object. * <!-- begin-user-doc --> * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. * <!-- end-user-doc --> * @return whether this factory is applicable for the type of the object. * @generated */ @Override public boolean isFactoryForType(Object object) { if (object == modelPackage) { return true; } if (object instanceof EObject) { return ((EObject)object).eClass().getEPackage() == modelPackage; } return false; }
/** * Tells if the given {@link EObject instruction} is a currently * {@link IModelAnimator#activate(LogicalStep) activated}. * * This service works in a similar way as {@link AbstractGemocDebuggerServices isCurrentInstruction} * but will be activated even if the engine in not paused in order to act as an animation. * * @param instruction * the {@link EObject instruction} * @return <code>true</code> if the given {@link EObject instruction} is a * currently {@link IModelAnimator#activate(LogicalStep) activated}, * <code>false</code> otherwise */ public boolean hasBeenActivated(EObject instruction) { boolean res = false; final URI uri = EcoreUtil.getURI(instruction); for (Set<URI> instructions : ANIMATOR.activatedInstructions.values()) { if (instructions.contains(uri)) { res = true; break; } } return res; }
/** * @generated */ protected void editCommunicationsAffectedOn(EObject element) { EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(propertiesEditionComponent.getEditingContext(), propertiesEditionComponent, element, adapterFactory); PropertiesEditingProvider provider = (PropertiesEditingProvider)adapterFactory.adapt(element, PropertiesEditingProvider.class); if (provider != null) { PropertiesEditingPolicy policy = provider.getPolicy(context); if (policy != null) { policy.execute(); communicationsAffectedOn.refresh(); } } }
/** * */ protected void removeFromCause(EObject element) { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent( GeneralPropertiesEditionPartImpl.this, GqamViewsRepository.General.Properties.cause, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.REMOVE, null, element)); cause.refresh(); }
/** * {@inheritDoc} * * @see org.polarsys.time4sys.ui.grm.parts.GeneralPropertiesEditionPart#getHost() * */ public EObject getHost() { if (host.getSelection() instanceof StructuredSelection) { Object firstElement = ((StructuredSelection) host.getSelection()).getFirstElement(); if (firstElement instanceof EObject) return (EObject) firstElement; } return null; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case IEC61970Package.IEC61970_CIM_VERSION: return createIEC61970CIMVersion(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } }
/** * Installs proxies for all non containment references and only if the node representing the EObject that contains * the cross reference has got leaf nodes (as a leaf node represents the cross reference). * * @param resource * the N4JSResource * @param obj * the EObject containing the cross reference * @param producer * the error/warning producer * @param parentNode * the node representing obj inside the node model */ private void installProxies(N4JSResource resource, EObject obj, IDiagnosticProducer producer, ICompositeNode parentNode, boolean dontCheckParent) { final EClass eClass = obj.eClass(); if (eClass.getEAllReferences().size() - eClass.getEAllContainments().size() == 0) return; for (INode node = parentNode.getFirstChild(); node != null; node = node.getNextSibling()) { EObject grammarElement = node.getGrammarElement(); if (grammarElement instanceof CrossReference && hasLeafNodes(node)) { producer.setNode(node); CrossReference crossReference = (CrossReference) grammarElement; final EReference eRef = GrammarUtil.getReference(crossReference, eClass); if (eRef == null) { ParserRule parserRule = GrammarUtil.containingParserRule(crossReference); final String feature = GrammarUtil.containingAssignment(crossReference).getFeature(); throw new IllegalStateException("Couldn't find EReference for crossreference '" + eClass.getName() + "::" + feature + "' in parser rule '" + parserRule.getName() + "'."); } createAndSetProxy(resource, obj, node, eRef, crossReference, producer); afterCreateAndSetProxy(obj, node, eRef, crossReference, producer); } else if (grammarElement instanceof RuleCall && node instanceof ICompositeNode) { RuleCall ruleCall = (RuleCall) grammarElement; AbstractRule calledRule = ruleCall.getRule(); if (calledRule instanceof ParserRule && ((ParserRule) calledRule).isFragment()) { installProxies(resource, obj, producer, (ICompositeNode) node, true); } } } if (!dontCheckParent && shouldCheckParentNode(parentNode)) { installProxies(resource, obj, producer, parentNode.getParent(), dontCheckParent); } }
public EObject copy(EObject eObject) { final Link lnk = mappingFactory.createLink(); stack.push(lnk); final EObject theCopy = super.copy(eObject); final Link o = stack.pop(); assert(lnk == o); lnk.getSources().add(mappingFactory.createMappableArtefact("original", eObject)); lnk.getTargets().add(mappingFactory.createMappableArtefact("copy", theCopy)); lnk.setRationale(identityRule); stack.peek().getSubLinks().add(lnk); addMapEntry(eObject, lnk); addMapEntry(theCopy, lnk); return theCopy; }
/** * {@inheritDoc} * * @see org.eclipse.emf.eef.runtime.impl.components.ComposedPropertiesEditionComponent# * initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject, * org.eclipse.emf.ecore.resource.ResourceSet) * */ public void initPart(java.lang.Object key, int kind, EObject element, ResourceSet allResource) { if (key == HrmViewsRepository.General.class) { super.initPart(key, kind, element, allResource); } if (key == HrmViewsRepository.Timing.class) { super.initPart(key, kind, element, allResource); } if (key == HrmViewsRepository.Other.class) { super.initPart(key, kind, element, allResource); } }
/** * */ protected void moveEnableConcurrencyServices(EObject element, int oldIndex, int newIndex) { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(OtherPropertiesEditionPartForm.this, SrmViewsRepository.Other.Properties.enableConcurrencyServices, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.MOVE, element, newIndex)); enableConcurrencyServices.refresh(); }
/** * Default constructor * @generated */ public ComputingResourcePropertiesEditionComponent(PropertiesEditingContext editingContext, EObject computingResource, String editing_mode) { super(editingContext, computingResource, editing_mode); parts = new String[] { BASE_PART }; repositoryKey = AnalysisViewsRepository.class; partKey = AnalysisViewsRepository.ComputingResource.class; }
/** * */ protected void movePInterface(EObject element, int oldIndex, int newIndex) { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(OtherPropertiesEditionPartForm.this, HrmViewsRepository.Other.Properties.pInterface, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.MOVE, element, newIndex)); pInterface.refresh(); }
/** * {@inheritDoc} * * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject, * org.eclipse.emf.ecore.resource.ResourceSet) * */ public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) { setInitializing(true); if (editingPart != null && key == partKey) { editingPart.setContext(elt, allResource); final MutualExclusionProtocol mutualExclusionProtocol = (MutualExclusionProtocol)elt; final GeneralPropertiesEditionPart generalPart = (GeneralPropertiesEditionPart)editingPart; // init values if (isAccessible(GrmViewsRepository.General.Properties.name)) generalPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, mutualExclusionProtocol.getName())); if (isAccessible(GrmViewsRepository.General.Properties.protocol)) { generalPart.initProtocol(EEFUtils.choiceOfValues(mutualExclusionProtocol, GrmPackage.eINSTANCE.getMutualExclusionProtocol_Protocol()), mutualExclusionProtocol.getProtocol()); } if (isAccessible(GrmViewsRepository.General.Properties.otherProtocol)) generalPart.setOtherProtocol(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, mutualExclusionProtocol.getOtherProtocol())); // init filters // init values for referenced views // init filters for referenced views } setInitializing(false); }
/** * */ protected void removeFromManagedResource(EObject element) { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent( GeneralPropertiesEditionPartForm.this, SrmViewsRepository.General.Properties.managedResource, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.REMOVE, null, element)); managedResource.refresh(); }
/** * Default constructor * */ public AlarmOtherPropertiesEditionComponent(PropertiesEditingContext editingContext, EObject alarm, String editing_mode) { super(editingContext, alarm, editing_mode); parts = new String[] { OTHER_PART }; repositoryKey = SrmViewsRepository.class; partKey = SrmViewsRepository.Other.class; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case StepsPackage.ROOT_IMPLICIT_STEP: return createRootImplicitStep(); case StepsPackage.SPECIFIC_ROOT_STEP: return createSpecificRootStep(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } }
/** * Returns whether this factory is applicable for the type of the object. * <!-- begin-user-doc --> This implementation * returns <code>true</code> if the object is either the model's package or is an instance object of the model. <!-- * end-user-doc --> * @return whether this factory is applicable for the type of the object. * @generated */ @Override public boolean isFactoryForType(Object object) { if (object == modelPackage) { return true; } if (object instanceof EObject) { return ((EObject)object).eClass().getEPackage() == modelPackage; } return false; }
public static final Object[] pattern_PrivateMeterVoltage_1_1_performtransformation_blackBBBBFBB(MeterAsset asset, MeterAssetPhysicalDevicePair pair, ElectricityValues values, PhysicalDevice device, PrivateMeterVoltage _this, IsApplicableMatch isApplicableMatch) { for (EObject tmpCsp : isApplicableMatch.getAttributeInfo()) { if (tmpCsp instanceof CSP) { CSP csp = (CSP) tmpCsp; return new Object[] { asset, pair, values, device, csp, _this, isApplicableMatch }; } } return null; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EObject getAddedElement() { if (addedElement != null && addedElement.eIsProxy()) { InternalEObject oldAddedElement = (InternalEObject)addedElement; addedElement = eResolveProxy(oldAddedElement); if (addedElement != oldAddedElement) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, ChangesPackage.ASSOCIATION_LIST_INSERTION__ADDED_ELEMENT, oldAddedElement, addedElement)); } } return addedElement; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void registerObjects_FWD(PerformRuleResult ruleresult, EObject locationCorr, EObject srcLocation, EObject consumer, EObject assetToPMU, EObject trgLocation, EObject asset, EObject pair) { ruleresult.registerObject("locationCorr", locationCorr); ruleresult.registerObject("srcLocation", srcLocation); ruleresult.registerObject("consumer", consumer); ruleresult.registerObject("assetToPMU", assetToPMU); ruleresult.registerObject("trgLocation", trgLocation); ruleresult.registerObject("asset", asset); ruleresult.registerObject("pair", pair); }
/** * */ protected void editActivateServices(EObject element) { EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext( propertiesEditionComponent.getEditingContext(), propertiesEditionComponent, element, adapterFactory); PropertiesEditingProvider provider = (PropertiesEditingProvider) adapterFactory.adapt(element, PropertiesEditingProvider.class); if (provider != null) { PropertiesEditingPolicy policy = provider.getPolicy(context); if (policy != null) { policy.execute(); activateServices.refresh(); } } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<EObject> getResources() { if (resources == null) { resources = new EObjectResolvingEList<EObject>(EObject.class, this, ConstraintsPackage.LOAD_CONSTRAINT__RESOURCES); } return resources; }
/** * {@inheritDoc} * * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject, * org.eclipse.emf.ecore.resource.ResourceSet) * */ public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) { setInitializing(true); if (editingPart != null && key == partKey) { editingPart.setContext(elt, allResource); final DeadlineMonotonicSchedulingPolicy deadlineMonotonicSchedulingPolicy = (DeadlineMonotonicSchedulingPolicy)elt; final GeneralPropertiesEditionPart generalPart = (GeneralPropertiesEditionPart)editingPart; // init values if (isAccessible(LibraryViewsRepository.General.Properties.name)) generalPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, deadlineMonotonicSchedulingPolicy.getName())); if (isAccessible(LibraryViewsRepository.General.Properties.policy)) { generalPart.initPolicy(EEFUtils.choiceOfValues(deadlineMonotonicSchedulingPolicy, GrmPackage.eINSTANCE.getSchedulingPolicy_Policy()), deadlineMonotonicSchedulingPolicy.getPolicy()); } if (isAccessible(LibraryViewsRepository.General.Properties.otherSchedPolicy)) generalPart.setOtherSchedPolicy(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, deadlineMonotonicSchedulingPolicy.getOtherSchedPolicy())); // init filters // init values for referenced views // init filters for referenced views } setInitializing(false); }
public final EObject entryRuleScriptAnnotation() throws RecognitionException { EObject current = null; EObject iv_ruleScriptAnnotation = null; try { { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getScriptAnnotationRule()); } pushFollow(FOLLOW_1); iv_ruleScriptAnnotation=ruleScriptAnnotation(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current =iv_ruleScriptAnnotation; } match(input,EOF,FOLLOW_2); if (state.failed) return current; } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; }
/** * {@inheritDoc} * * @see org.polarsys.time4sys.ui.analysis.parts.MutualExclusionResourcePropertiesEditionPart#getProtectedBy() * @generated */ public EObject getProtectedBy() { if (protectedBy.getSelection() instanceof StructuredSelection) { Object firstElement = ((StructuredSelection) protectedBy.getSelection()).getFirstElement(); if (firstElement instanceof EObject) return (EObject) firstElement; } return null; }