Java Code Examples for org.eclipse.emf.ecore.util.EcoreUtil

The following are top voted examples for showing how to use org.eclipse.emf.ecore.util.EcoreUtil. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: neoscada   File: MasterImportImpl.java   Source Code and License 7 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setMaster ( MasterServer newMaster )
{
    if ( newMaster != eInternalContainer () || ( eContainerFeatureID () != InfrastructurePackage.MASTER_IMPORT__MASTER && newMaster != null ) )
    {
        if ( EcoreUtil.isAncestor ( this, newMaster ) )
            throw new IllegalArgumentException ( "Recursive containment not allowed for " + toString () ); //$NON-NLS-1$
        NotificationChain msgs = null;
        if ( eInternalContainer () != null )
            msgs = eBasicRemoveFromContainer ( msgs );
        if ( newMaster != null )
            msgs = ( (InternalEObject)newMaster ).eInverseAdd ( this, InfrastructurePackage.MASTER_SERVER__IMPORT_MASTER, MasterServer.class, msgs );
        msgs = basicSetMaster ( newMaster, msgs );
        if ( msgs != null )
            msgs.dispatch ();
    }
    else if ( eNotificationRequired () )
        eNotify ( new ENotificationImpl ( this, Notification.SET, InfrastructurePackage.MASTER_IMPORT__MASTER, newMaster, newMaster ) );
}
 
Example 2
Project: neoscada   File: TaskImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setDefinition ( Definition newDefinition )
{
    if ( newDefinition != eInternalContainer () || ( eContainerFeatureID () != RecipePackage.TASK__DEFINITION && newDefinition != null ) )
    {
        if ( EcoreUtil.isAncestor ( this, newDefinition ) )
            throw new IllegalArgumentException ( "Recursive containment not allowed for " + toString () ); //$NON-NLS-1$
        NotificationChain msgs = null;
        if ( eInternalContainer () != null )
            msgs = eBasicRemoveFromContainer ( msgs );
        if ( newDefinition != null )
            msgs = ( (InternalEObject)newDefinition ).eInverseAdd ( this, RecipePackage.DEFINITION__TASK, Definition.class, msgs );
        msgs = basicSetDefinition ( newDefinition, msgs );
        if ( msgs != null )
            msgs.dispatch ();
    }
    else if ( eNotificationRequired () )
        eNotify ( new ENotificationImpl ( this, Notification.SET, RecipePackage.TASK__DEFINITION, newDefinition, newDefinition ) );
}
 
Example 3
Project: time4sys   File: PortImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setParent(PortContainer newParent) {
	if (newParent != eInternalContainer() || (eContainerFeatureID() != AnalysisPackage.PORT__PARENT && newParent != null)) {
		if (EcoreUtil.isAncestor(this, newParent))
			throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
		NotificationChain msgs = null;
		if (eInternalContainer() != null)
			msgs = eBasicRemoveFromContainer(msgs);
		if (newParent != null)
			msgs = ((InternalEObject)newParent).eInverseAdd(this, AnalysisPackage.PORT_CONTAINER__PORTS, PortContainer.class, msgs);
		msgs = basicSetParent(newParent, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, AnalysisPackage.PORT__PARENT, newParent, newParent));
}
 
Example 4
Project: n4js   File: N4MemberAnnotationListImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setOwner(N4ClassifierDefinition newOwner) {
	if (newOwner != eInternalContainer() || (eContainerFeatureID() != N4JSPackage.N4_MEMBER_ANNOTATION_LIST__OWNER && newOwner != null)) {
		if (EcoreUtil.isAncestor(this, newOwner))
			throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
		NotificationChain msgs = null;
		if (eInternalContainer() != null)
			msgs = eBasicRemoveFromContainer(msgs);
		if (newOwner != null)
			msgs = ((InternalEObject)newOwner).eInverseAdd(this, N4JSPackage.N4_CLASSIFIER_DEFINITION__OWNED_MEMBERS_RAW, N4ClassifierDefinition.class, msgs);
		msgs = basicSetOwner(newOwner, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, N4JSPackage.N4_MEMBER_ANNOTATION_LIST__OWNER, newOwner, newOwner));
}
 
Example 5
Project: time4sys   File: ProtectionParameterValuePropertiesEditionComponent.java   Source Code and License 6 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		ProtectionParameterValuePropertiesEditionPart basePart = (ProtectionParameterValuePropertiesEditionPart)editingPart;
		if (AnalysisPackage.eINSTANCE.getProtectionParameterValue_Value().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(AnalysisViewsRepository.ProtectionParameterValue.Properties.value)) {
			if (msg.getNewValue() != null) {
				basePart.setValue(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				basePart.setValue("");
			}
		}
		if (AnalysisPackage.eINSTANCE.getProtectionParameterValue_Type().equals(msg.getFeature()) && basePart != null && isAccessible(AnalysisViewsRepository.ProtectionParameterValue.Properties.type))
			basePart.setType((EObject)msg.getNewValue());
		
	}
}
 
Example 6
Project: model-consistency   File: VertexImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setOwner(Graph newOwner) {
	if (newOwner != eInternalContainer() || (eContainerFeatureID() != GraphPackage.VERTEX__OWNER && newOwner != null)) {
		if (EcoreUtil.isAncestor(this, newOwner))
			throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
		NotificationChain msgs = null;
		if (eInternalContainer() != null)
			msgs = eBasicRemoveFromContainer(msgs);
		if (newOwner != null)
			msgs = ((InternalEObject)newOwner).eInverseAdd(this, GraphPackage.GRAPH__VERTICES, Graph.class, msgs);
		msgs = basicSetOwner(newOwner, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, GraphPackage.VERTEX__OWNER, newOwner, newOwner));
}
 
Example 7
Project: neoscada   File: DefaultValueArchiveServerImpl.java   Source Code and License 6 votes vote down vote up
@Override
public Profile getProfile ()
{
    if ( this.profile == null )
    {
        final ResourceSet rs = new ResourceSetImpl ();
        final Resource r = rs.createResource ( URI.createURI ( DEFAULT_URI ), "org.eclipse.scada.configuration.world.osgi.profile" );
        try
        {
            r.load ( null );
        }
        catch ( final IOException e )
        {
            throw new RuntimeException ( e );
        }
        this.profile = (Profile)EcoreUtil.getObjectByType ( r.getContents (), ProfilePackage.Literals.PROFILE );
        if ( this.profile == null )
        {
            throw new IllegalStateException ( String.format ( "Resource loaded from %s does not contain an object of type %s", DEFAULT_URI, Profile.class.getName () ) );
        }
    }

    return this.profile;
}
 
Example 8
Project: time4sys   File: SchedulingParameterPropertiesEditionComponent.java   Source Code and License 6 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		GeneralPropertiesEditionPart generalPart = (GeneralPropertiesEditionPart)editingPart;
		if (GrmPackage.eINSTANCE.getNamedElement_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && generalPart != null && isAccessible(GrmViewsRepository.General.Properties.name)) {
			if (msg.getNewValue() != null) {
				generalPart.setName(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				generalPart.setName("");
			}
		}
		if (GrmPackage.eINSTANCE.getSchedulingParameter_Value().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && generalPart != null && isAccessible(GrmViewsRepository.General.Properties.value)) {
			if (msg.getNewValue() != null) {
				generalPart.setValue(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				generalPart.setValue("");
			}
		}
		
	}
}
 
Example 9
Project: neoscada   File: DaveDriverImpl.java   Source Code and License 6 votes vote down vote up
/**
 * @generated NOT
 */
@Override
public Profile getProfile ()
{
    if ( this.profile == null )
    {
        final ResourceSet rs = new ResourceSetImpl ();
        final Resource r = rs.createResource ( URI.createURI ( DEFAULT_URI ), "org.eclipse.scada.configuration.world.osgi.profile" );
        try
        {
            r.load ( null );
        }
        catch ( final IOException e )
        {
            throw new RuntimeException ( e );
        }
        this.profile = (Profile)EcoreUtil.getObjectByType ( r.getContents (), ProfilePackage.Literals.PROFILE );
        if ( this.profile == null )
        {
            throw new IllegalStateException ( String.format ( "Resource loaded from %s does not contain an object of type %s", DEFAULT_URI, Profile.class.getName () ) );
        }
    }

    return this.profile;
}
 
Example 10
Project: time4sys   File: OutputPortPropertiesEditionComponent.java   Source Code and License 6 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		OutputPortPropertiesEditionPart basePart = (OutputPortPropertiesEditionPart)editingPart;
		if (AnalysisPackage.eINSTANCE.getNamedElement_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(AnalysisViewsRepository.OutputPort.Properties.name)) {
			if (msg.getNewValue() != null) {
				basePart.setName(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				basePart.setName("");
			}
		}
		if (AnalysisPackage.eINSTANCE.getPort_Parent().equals(msg.getFeature()) && basePart != null && isAccessible(AnalysisViewsRepository.OutputPort.Properties.parent_))
			basePart.setParent_((EObject)msg.getNewValue());
		if (AnalysisPackage.eINSTANCE.getOutputPort_SendTo().equals(msg.getFeature()) && basePart != null && isAccessible(AnalysisViewsRepository.OutputPort.Properties.sendTo))
			basePart.setSendTo((EObject)msg.getNewValue());
		
	}
}
 
Example 11
Project: n4js   File: ASTGraphProvider.java   Source Code and License 6 votes vote down vote up
private void getConnectedEdgesForEObjectSingleCase(Node node, final List<Node> allNodes, final List<Edge> result,
		EReference currRef, final Object target) {

	final Node targetNode = GraphUtils.getNodeForElement(target, allNodes);
	final String targetNodeExternal;

	if (targetNode == null && ((EObject) target).eIsProxy())
		targetNodeExternal = EcoreUtil.getURI((EObject) target).toString();
	else
		targetNodeExternal = null;

	if (targetNode != null || targetNodeExternal != null) {
		Edge edge = new Edge(
				currRef.getName(),
				!currRef.isContainment(),
				node,
				asCollection(targetNode),
				asCollection(targetNodeExternal));

		result.add(edge);
	}
}
 
Example 12
Project: neoscada   File: EndpointImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setNode ( Node newNode )
{
    if ( newNode != eInternalContainer () || ( eContainerFeatureID () != WorldPackage.ENDPOINT__NODE && newNode != null ) )
    {
        if ( EcoreUtil.isAncestor ( this, newNode ) )
            throw new IllegalArgumentException ( "Recursive containment not allowed for " + toString () ); //$NON-NLS-1$
        NotificationChain msgs = null;
        if ( eInternalContainer () != null )
            msgs = eBasicRemoveFromContainer ( msgs );
        if ( newNode != null )
            msgs = ( (InternalEObject)newNode ).eInverseAdd ( this, WorldPackage.NODE__ENDPOINTS, Node.class, msgs );
        msgs = basicSetNode ( newNode, msgs );
        if ( msgs != null )
            msgs.dispatch ();
    }
    else if ( eNotificationRequired () )
        eNotify ( new ENotificationImpl ( this, Notification.SET, WorldPackage.ENDPOINT__NODE, newNode, newNode ) );
}
 
Example 13
Project: neoscada   File: InfrastructureEditor.java   Source Code and License 6 votes vote down vote up
/**
 * Returns a diagnostic describing the errors and warnings listed in the resource
 * and the specified exception (if any).
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Diagnostic analyzeResourceProblems ( Resource resource, Exception exception )
{
    boolean hasErrors = !resource.getErrors ().isEmpty ();
    if ( hasErrors || !resource.getWarnings ().isEmpty () )
    {
        BasicDiagnostic basicDiagnostic = new BasicDiagnostic ( hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, "org.eclipse.scada.configuration.infrastructure.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception == null ? (Object)resource : exception } );
        basicDiagnostic.merge ( EcoreUtil.computeDiagnostic ( resource, true ) );
        return basicDiagnostic;
    }
    else if ( exception != null )
    {
        return new BasicDiagnostic ( Diagnostic.ERROR, "org.eclipse.scada.configuration.infrastructure.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 14
Project: neoscada   File: DaveBlockDefinitionImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setDevice ( DaveDevice newDevice )
{
    if ( newDevice != eInternalContainer () || ( eContainerFeatureID () != DavePackage.DAVE_BLOCK_DEFINITION__DEVICE && newDevice != null ) )
    {
        if ( EcoreUtil.isAncestor ( this, newDevice ) )
            throw new IllegalArgumentException ( "Recursive containment not allowed for " + toString () ); //$NON-NLS-1$
        NotificationChain msgs = null;
        if ( eInternalContainer () != null )
            msgs = eBasicRemoveFromContainer ( msgs );
        if ( newDevice != null )
            msgs = ( (InternalEObject)newDevice ).eInverseAdd ( this, DavePackage.DAVE_DEVICE__BLOCKS, DaveDevice.class, msgs );
        msgs = basicSetDevice ( newDevice, msgs );
        if ( msgs != null )
            msgs.dispatch ();
    }
    else if ( eNotificationRequired () )
        eNotify ( new ENotificationImpl ( this, Notification.SET, DavePackage.DAVE_BLOCK_DEFINITION__DEVICE, newDevice, newDevice ) );
}
 
Example 15
Project: gemoc-studio   File: StateImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setOwningFSM(StateMachine newOwningFSM) {
	if (newOwningFSM != eInternalContainer() || (eContainerFeatureID() != FsmPackage.STATE__OWNING_FSM && newOwningFSM != null)) {
		if (EcoreUtil.isAncestor(this, newOwningFSM))
			throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
		NotificationChain msgs = null;
		if (eInternalContainer() != null)
			msgs = eBasicRemoveFromContainer(msgs);
		if (newOwningFSM != null)
			msgs = ((InternalEObject)newOwningFSM).eInverseAdd(this, FsmPackage.STATE_MACHINE__OWNED_STATES, StateMachine.class, msgs);
		msgs = basicSetOwningFSM(newOwningFSM, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, FsmPackage.STATE__OWNING_FSM, newOwningFSM, newOwningFSM));
}
 
Example 16
Project: neoscada   File: DeviceImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setNode ( Node newNode )
{
    if ( newNode != eInternalContainer () || ( eContainerFeatureID () != InfrastructurePackage.DEVICE__NODE && newNode != null ) )
    {
        if ( EcoreUtil.isAncestor ( this, newNode ) )
            throw new IllegalArgumentException ( "Recursive containment not allowed for " + toString () ); //$NON-NLS-1$
        NotificationChain msgs = null;
        if ( eInternalContainer () != null )
            msgs = eBasicRemoveFromContainer ( msgs );
        if ( newNode != null )
            msgs = ( (InternalEObject)newNode ).eInverseAdd ( this, InfrastructurePackage.NODE__DEVICES, Node.class, msgs );
        msgs = basicSetNode ( newNode, msgs );
        if ( msgs != null )
            msgs.dispatch ();
    }
    else if ( eNotificationRequired () )
        eNotify ( new ENotificationImpl ( this, Notification.SET, InfrastructurePackage.DEVICE__NODE, newNode, newNode ) );
}
 
Example 17
Project: SurveyDSL   File: QueryITToXMIConverter.java   Source Code and License 6 votes vote down vote up
public static void convertERDSLtoXMI(String inputM, String outputM) {
	Injector injector = new QueryITStandaloneSetup().createInjectorAndDoEMFRegistration();

	XtextResourceSet resourceSet = injector.getInstance(XtextResourceSet.class);


	URI uri = URI.createURI(inputM);
	

	Resource xtextResource = resourceSet.getResource(uri, true);

	EcoreUtil.resolveAll(xtextResource);

	Resource xmiResource = resourceSet.createResource(URI.createURI(outputM));
	xmiResource.getContents().add(xtextResource.getContents().get(0));
	try {
		xmiResource.save(null);
		System.out.println("Saved " + outputM);
    	System.out.println("QueryIT file converted successfully to XMI");
    	System.out.println("-------------------------------------");
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
Example 18
Project: n4js   File: ConcreteSyntaxAwareReferenceFinder.java   Source Code and License 6 votes vote down vote up
@Override
protected EObject toValidInstanceOrNull(Resource resource, Predicate<URI> targetURIs, EObject value) {
	EObject result = value;
	if (result.eIsProxy()) {
		URI proxyURI = EcoreUtil.getURI(result);
		if (uriEncoder.isCrossLinkFragment(resource, proxyURI.fragment())) {
			INode node = uriEncoder.decode(resource, proxyURI.fragment()).getThird();
			String string = linkingHelper.getCrossRefNodeAsString(node, true);
			if (((TargetURIs) targetURIs).getUserData(TargetURIKey.KEY).isMatchingConcreteSyntax(string)) {
				result = resolveInternalProxy(value, resource);
			} else {
				result = null;
			}
		} else {
			result = resolveInternalProxy(value, resource);
		}
	}
	return result;
}
 
Example 19
Project: n4js   File: ContainerTypesHelper.java   Source Code and License 6 votes vote down vote up
private List<Type> getPolyfillTypesFromScope(QualifiedName fqn) {

			IScope contextScope = polyfillScopeAccess.getRecordingPolyfillScope(contextResource);
			List<Type> types = new ArrayList<>();

			// contextScope.getElements(fqn) returns all polyfills, since shadowing is handled differently
			// for them!
			for (IEObjectDescription descr : contextScope.getElements(fqn)) {
				Type polyfillType = (Type) descr.getEObjectOrProxy();
				if (polyfillType.eIsProxy()) {
					// TODO review: this seems odd... is this a test setup problem (since we do not use the
					// index
					// there and load the resource separately)?
					polyfillType = (Type) EcoreUtil.resolve(polyfillType, contextResource);
					if (polyfillType.eIsProxy()) {
						throw new IllegalStateException("unexpected proxy");
					}
				}
				types.add(polyfillType);
			}
			// }

			return types;
		}
 
Example 20
Project: neoscada   File: SetupEditor.java   Source Code and License 6 votes vote down vote up
/**
 * Returns a diagnostic describing the errors and warnings listed in the resource
 * and the specified exception (if any).
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Diagnostic analyzeResourceProblems ( Resource resource, Exception exception )
{
    boolean hasErrors = !resource.getErrors ().isEmpty ();
    if ( hasErrors || !resource.getWarnings ().isEmpty () )
    {
        BasicDiagnostic basicDiagnostic = new BasicDiagnostic ( hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, "org.eclipse.scada.configuration.world.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception == null ? (Object)resource : exception } );
        basicDiagnostic.merge ( EcoreUtil.computeDiagnostic ( resource, true ) );
        return basicDiagnostic;
    }
    else if ( exception != null )
    {
        return new BasicDiagnostic ( Diagnostic.ERROR, "org.eclipse.scada.configuration.world.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 21
Project: time4sys   File: SoftwareConcurrentResourceImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setAdressSpace(MemoryPartition newAdressSpace) {
	if (newAdressSpace != eInternalContainer() || (eContainerFeatureID() != SrmPackage.SOFTWARE_CONCURRENT_RESOURCE__ADRESS_SPACE && newAdressSpace != null)) {
		if (EcoreUtil.isAncestor(this, newAdressSpace))
			throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
		NotificationChain msgs = null;
		if (eInternalContainer() != null)
			msgs = eBasicRemoveFromContainer(msgs);
		if (newAdressSpace != null)
			msgs = ((InternalEObject)newAdressSpace).eInverseAdd(this, SrmPackage.MEMORY_PARTITION__CONCURRENT_RESOURCES, MemoryPartition.class, msgs);
		msgs = basicSetAdressSpace(newAdressSpace, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, SrmPackage.SOFTWARE_CONCURRENT_RESOURCE__ADRESS_SPACE, newAdressSpace, newAdressSpace));
}
 
Example 22
Project: time4sys   File: UsageDemandPropertiesEditionComponent.java   Source Code and License 6 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		GeneralPropertiesEditionPart generalPart = (GeneralPropertiesEditionPart)editingPart;
		if (GrmPackage.eINSTANCE.getUsageDemand_Usage().equals(msg.getFeature())  && isAccessible(GrmViewsRepository.General.Properties.usage))
			generalPart.updateUsage();
		if (GrmPackage.eINSTANCE.getUsageDemand_Event().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && generalPart != null && isAccessible(GrmViewsRepository.General.Properties.event)) {
			if (msg.getNewValue() != null) {
				generalPart.setEvent(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				generalPart.setEvent("");
			}
		}
		
	}
}
 
Example 23
Project: neoscada   File: CalculationComponentImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setLevel ( Level newLevel )
{
    if ( newLevel != eInternalContainer () || ( eContainerFeatureID () != ComponentPackage.CALCULATION_COMPONENT__LEVEL && newLevel != null ) )
    {
        if ( EcoreUtil.isAncestor ( this, newLevel ) )
            throw new IllegalArgumentException ( "Recursive containment not allowed for " + toString () ); //$NON-NLS-1$
        NotificationChain msgs = null;
        if ( eInternalContainer () != null )
            msgs = eBasicRemoveFromContainer ( msgs );
        if ( newLevel != null )
            msgs = ( (InternalEObject)newLevel ).eInverseAdd ( this, ComponentPackage.LEVEL__COMPONENTS, Level.class, msgs );
        msgs = basicSetLevel ( newLevel, msgs );
        if ( msgs != null )
            msgs.dispatch ();
    }
    else if ( eNotificationRequired () )
        eNotify ( new ENotificationImpl ( this, Notification.SET, ComponentPackage.CALCULATION_COMPONENT__LEVEL, newLevel, newLevel ) );
}
 
Example 24
Project: neoscada   File: ReleaseImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setVersion(Version newVersion) {
	if (newVersion != eInternalContainer() || (eContainerFeatureID() != WebPackage.RELEASE__VERSION && newVersion != null)) {
		if (EcoreUtil.isAncestor(this, newVersion))
			throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
		NotificationChain msgs = null;
		if (eInternalContainer() != null)
			msgs = eBasicRemoveFromContainer(msgs);
		if (newVersion != null)
			msgs = ((InternalEObject)newVersion).eInverseAdd(this, WebPackage.VERSION__RELEASES, Version.class, msgs);
		msgs = basicSetVersion(newVersion, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, WebPackage.RELEASE__VERSION, newVersion, newVersion));
}
 
Example 25
Project: n4js   File: ComposedContentImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setOwner(Composite newOwner) {
	if (newOwner != eInternalContainer() || (eContainerFeatureID() != DomPackage.COMPOSED_CONTENT__OWNER && newOwner != null)) {
		if (EcoreUtil.isAncestor(this, newOwner))
			throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
		NotificationChain msgs = null;
		if (eInternalContainer() != null)
			msgs = eBasicRemoveFromContainer(msgs);
		if (newOwner != null)
			msgs = ((InternalEObject)newOwner).eInverseAdd(this, DomPackage.COMPOSITE__CONTENTS, Composite.class, msgs);
		msgs = basicSetOwner(newOwner, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.COMPOSED_CONTENT__OWNER, newOwner, newOwner));
}
 
Example 26
Project: SimQRI   File: GaussianPropertiesEditionComponent.java   Source Code and License 6 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		GaussianPropertiesEditionPart basePart = (GaussianPropertiesEditionPart)editingPart;
		if (MetamodelPackage.eINSTANCE.getGaussian_Location().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(MetamodelViewsRepository.Gaussian.Properties.location)) {
			if (msg.getNewValue() != null) {
				basePart.setLocation(EcoreUtil.convertToString(EcorePackage.Literals.EDOUBLE, msg.getNewValue()));
			} else {
				basePart.setLocation("");
			}
		}
		if (MetamodelPackage.eINSTANCE.getGaussian_Scale().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(MetamodelViewsRepository.Gaussian.Properties.scale)) {
			if (msg.getNewValue() != null) {
				basePart.setScale(EcoreUtil.convertToString(MetamodelPackage.Literals.POSITIVE_DOUBLE_NOT_NULL, msg.getNewValue()));
			} else {
				basePart.setScale("");
			}
		}
		
	}
}
 
Example 27
Project: neoscada   File: ChartEditor.java   Source Code and License 6 votes vote down vote up
/**
 * Returns a diagnostic describing the errors and warnings listed in the
 * resource
 * and the specified exception (if any).
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
public Diagnostic analyzeResourceProblems ( final Resource resource,
        final Exception exception )
{
    if ( !resource.getErrors ().isEmpty ()
            || !resource.getWarnings ().isEmpty () )
    {
        final BasicDiagnostic basicDiagnostic = new BasicDiagnostic (
                Diagnostic.ERROR, "org.eclipse.scada.ui.chart.model.editor", //$NON-NLS-1$
                0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
                new Object[] { exception == null ? (Object)resource
                        : exception } );
        basicDiagnostic.merge ( EcoreUtil.computeDiagnostic ( resource, true ) );
        return basicDiagnostic;
    }
    else if ( exception != null )
    {
        return new BasicDiagnostic ( Diagnostic.ERROR, "org.eclipse.scada.ui.chart.model.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 28
Project: time4sys   File: ResourceProtectionParameterValuePropertiesEditionComponent.java   Source Code and License 6 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		ResourceProtectionParameterValuePropertiesEditionPart basePart = (ResourceProtectionParameterValuePropertiesEditionPart)editingPart;
		if (AnalysisPackage.eINSTANCE.getNamedElement_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(AnalysisViewsRepository.ResourceProtectionParameterValue.Properties.name)) {
			if (msg.getNewValue() != null) {
				basePart.setName(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				basePart.setName("");
			}
		}
		if (AnalysisPackage.eINSTANCE.getResourceProtectionParameterValue_Value().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(AnalysisViewsRepository.ResourceProtectionParameterValue.Properties.value)) {
			if (msg.getNewValue() != null) {
				basePart.setValue(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				basePart.setValue("");
			}
		}
		
	}
}
 
Example 29
Project: xmontiarc   File: ConnectorImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setParent(ComponentType newParent) {
	if (newParent != eInternalContainer() || (eContainerFeatureID() != XmontiarcPackage.CONNECTOR__PARENT && newParent != null)) {
		if (EcoreUtil.isAncestor(this, newParent))
			throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
		NotificationChain msgs = null;
		if (eInternalContainer() != null)
			msgs = eBasicRemoveFromContainer(msgs);
		if (newParent != null)
			msgs = ((InternalEObject)newParent).eInverseAdd(this, XmontiarcPackage.COMPONENT_TYPE__CONNECTORS, ComponentType.class, msgs);
		msgs = basicSetParent(newParent, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, XmontiarcPackage.CONNECTOR__PARENT, newParent, newParent));
}
 
Example 30
Project: SimQRI   File: QueryPropertiesEditionComponent.java   Source Code and License 6 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		QueryPropertiesEditionPart basePart = (QueryPropertiesEditionPart)editingPart;
		if (MetamodelPackage.eINSTANCE.getQuery_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(MetamodelViewsRepository.Query.Properties.name)) {
			if (msg.getNewValue() != null) {
				basePart.setName(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				basePart.setName("");
			}
		}
		if (MetamodelPackage.eINSTANCE.getQuery_Value().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(MetamodelViewsRepository.Query.Properties.value)){
			if (msg.getNewValue() != null) {
				basePart.setValue(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				basePart.setValue("");
			}
		}
		
	}
}
 
Example 31
Project: time4sys   File: HardwarePinOtherPropertiesEditionComponent.java   Source Code and License 6 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		OtherPropertiesEditionPart otherPart = (OtherPropertiesEditionPart)editingPart;
		if (HrmPackage.eINSTANCE.getHardwarePin_Width().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && otherPart != null && isAccessible(HrmViewsRepository.Other.Properties.width)) {
			if (msg.getNewValue() != null) {
				otherPart.setWidth(EcoreUtil.convertToString(EcorePackage.Literals.EINT, msg.getNewValue()));
			} else {
				otherPart.setWidth("");
			}
		}
		if (HrmPackage.eINSTANCE.getHardwarePin_Direction().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && isAccessible(HrmViewsRepository.Other.Properties.direction))
			otherPart.setDirection((Direction)msg.getNewValue());
		
		
	}
}
 
Example 32
Project: neoscada   File: SecurityEditor.java   Source Code and License 6 votes vote down vote up
/**
 * Returns a diagnostic describing the errors and warnings listed in the resource
 * and the specified exception (if any).
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Diagnostic analyzeResourceProblems ( Resource resource, Exception exception )
{
    if ( !resource.getErrors ().isEmpty () || !resource.getWarnings ().isEmpty () )
    {
        BasicDiagnostic basicDiagnostic =
                new BasicDiagnostic
                ( Diagnostic.ERROR, "org.eclipse.scada.configuration.security.editor", //$NON-NLS-1$
                        0,
                        getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
                        new Object[] { exception == null ? (Object)resource : exception } );
        basicDiagnostic.merge ( EcoreUtil.computeDiagnostic ( resource, true ) );
        return basicDiagnostic;
    }
    else if ( exception != null )
    {
        return new BasicDiagnostic ( Diagnostic.ERROR, "org.eclipse.scada.configuration.security.editor", //$NON-NLS-1$
                0,
                getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
                new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 33
Project: gemoc-studio-modeldebugging   File: DSLThreadAdapter.java   Source Code and License 6 votes vote down vote up
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.debug.core.model.IThread#getBreakpoints()
 */
public IBreakpoint[] getBreakpoints() {
	final List<IBreakpoint> res = new ArrayList<IBreakpoint>();

	if (isSuspended()) {
		final URI instructionUri = EcoreUtil.getURI(getHost().getTopStackFrame().getCurrentInstruction());
		for (IBreakpoint breakpoint : DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(
				getModelIdentifier())) {
			if (breakpoint instanceof DSLBreakpoint
					&& (((DSLBreakpoint)breakpoint).getURI().equals(instructionUri))) {
				res.add(breakpoint);
			}
		}
	}

	return res.toArray(new IBreakpoint[res.size()]);
}
 
Example 34
Project: gemoc-studio-modeldebugging   File: VariableImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * 
 * @generated
 */
public void setFrame(StackFrame newFrame) {
	if (newFrame != eInternalContainer() || (eContainerFeatureID() != DebugPackage.VARIABLE__FRAME
			&& newFrame != null)) {
		if (EcoreUtil.isAncestor(this, newFrame))
			throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
		NotificationChain msgs = null;
		if (eInternalContainer() != null)
			msgs = eBasicRemoveFromContainer(msgs);
		if (newFrame != null)
			msgs = ((InternalEObject)newFrame).eInverseAdd(this, DebugPackage.STACK_FRAME__VARIABLES,
					StackFrame.class, msgs);
		msgs = basicSetFrame(newFrame, msgs);
		if (msgs != null)
			msgs.dispatch();
	} else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, DebugPackage.VARIABLE__FRAME, newFrame,
				newFrame));
}
 
Example 35
Project: time4sys   File: RequiredSchedulingParameterImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setParent(Scheduler newParent) {
	if (newParent != eInternalContainer() || (eContainerFeatureID() != AnalysisPackage.REQUIRED_SCHEDULING_PARAMETER__PARENT && newParent != null)) {
		if (EcoreUtil.isAncestor(this, newParent))
			throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
		NotificationChain msgs = null;
		if (eInternalContainer() != null)
			msgs = eBasicRemoveFromContainer(msgs);
		if (newParent != null)
			msgs = ((InternalEObject)newParent).eInverseAdd(this, AnalysisPackage.SCHEDULER__REQUIRED_PARAMETERS, Scheduler.class, msgs);
		msgs = basicSetParent(newParent, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, AnalysisPackage.REQUIRED_SCHEDULING_PARAMETER__PARENT, newParent, newParent));
}
 
Example 36
Project: neoscada   File: Hive.java   Source Code and License 6 votes vote down vote up
private static RootType parse ( final URI uri ) throws IOException
{
    final ResourceSet rs = new ResourceSetImpl ();
    rs.getResourceFactoryRegistry ().getExtensionToFactoryMap ().put ( "*", new ConfigurationResourceFactoryImpl () );

    final Resource r = rs.createResource ( uri );
    r.load ( null );

    final DocumentRoot doc = (DocumentRoot)EcoreUtil.getObjectByType ( r.getContents (), ConfigurationPackage.Literals.DOCUMENT_ROOT );
    if ( doc == null )
    {
        return null;
    }
    else
    {
        return doc.getRoot ();
    }
}
 
Example 37
Project: time4sys   File: ProtectionParameterTimingPropertiesEditionComponent.java   Source Code and License 6 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		TimingPropertiesEditionPart timingPart = (TimingPropertiesEditionPart)editingPart;
		if (GrmPackage.eINSTANCE.getProtectionParameter_PriorityCeiling().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && timingPart != null && isAccessible(GrmViewsRepository.Timing.TimingProperties.priorityCeiling)) {
			if (msg.getNewValue() != null) {
				timingPart.setPriorityCeiling(EcoreUtil.convertToString(EcorePackage.Literals.EINT, msg.getNewValue()));
			} else {
				timingPart.setPriorityCeiling("");
			}
		}
		if (GrmPackage.eINSTANCE.getProtectionParameter_PreemptionLevel().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && timingPart != null && isAccessible(GrmViewsRepository.Timing.TimingProperties.preemptionLevel)) {
			if (msg.getNewValue() != null) {
				timingPart.setPreemptionLevel(EcoreUtil.convertToString(EcorePackage.Literals.EINT, msg.getNewValue()));
			} else {
				timingPart.setPreemptionLevel("");
			}
		}
		
	}
}
 
Example 38
Project: time4sys   File: SoftwareResourcePackagePropertiesEditionComponent.java   Source Code and License 6 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		GeneralPropertiesEditionPart generalPart = (GeneralPropertiesEditionPart)editingPart;
		if (GrmPackage.eINSTANCE.getNamedElement_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && generalPart != null && isAccessible(SrmViewsRepository.General.Properties.name)) {
			if (msg.getNewValue() != null) {
				generalPart.setName(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				generalPart.setName("");
			}
		}
		if (GrmPackage.eINSTANCE.getResourcePackage_OwnedElement().equals(msg.getFeature()) && isAccessible(SrmViewsRepository.General.Properties.ownedElement))
			generalPart.updateOwnedElement();
		
	}
}
 
Example 39
Project: time4sys   File: MutualExclusionResourcePropertiesEditionComponent.java   Source Code and License 6 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		MutualExclusionResourcePropertiesEditionPart basePart = (MutualExclusionResourcePropertiesEditionPart)editingPart;
		if (AnalysisPackage.eINSTANCE.getNamedElement_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(AnalysisViewsRepository.MutualExclusionResource.Properties.name)) {
			if (msg.getNewValue() != null) {
				basePart.setName(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				basePart.setName("");
			}
		}
		if (AnalysisPackage.eINSTANCE.getMutualExclusionResource_Elements().equals(msg.getFeature())  && isAccessible(AnalysisViewsRepository.MutualExclusionResource.Properties.elements))
			basePart.updateElements();
		if (AnalysisPackage.eINSTANCE.getMutualExclusionResource_ProtectionParameters().equals(msg.getFeature()) && isAccessible(AnalysisViewsRepository.MutualExclusionResource.Properties.protectionParameters))
			basePart.updateProtectionParameters();
		if (AnalysisPackage.eINSTANCE.getMutualExclusionResource_ProtectedBy().equals(msg.getFeature()) && basePart != null && isAccessible(AnalysisViewsRepository.MutualExclusionResource.Properties.protectedBy))
			basePart.setProtectedBy((EObject)msg.getNewValue());
		if (AnalysisPackage.eINSTANCE.getMutualExclusionResource_Parent().equals(msg.getFeature()) && basePart != null && isAccessible(AnalysisViewsRepository.MutualExclusionResource.Properties.parent_))
			basePart.setParent_((EObject)msg.getNewValue());
		
	}
}
 
Example 40
Project: time4sys   File: PeriodicPatternGeneralPropertiesEditionComponent.java   Source Code and License 6 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		GeneralPropertiesEditionPart generalPart = (GeneralPropertiesEditionPart)editingPart;
		if (GqamPackage.eINSTANCE.getPeriodicPattern_Occurences().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && generalPart != null && isAccessible(GqamViewsRepository.General.Properties.occurences)) {
			if (msg.getNewValue() != null) {
				generalPart.setOccurences(EcoreUtil.convertToString(EcorePackage.Literals.EINT, msg.getNewValue()));
			} else {
				generalPart.setOccurences("");
			}
		}
		if (GqamPackage.eINSTANCE.getArrivalPattern_Parent().equals(msg.getFeature()) && generalPart != null && isAccessible(GqamViewsRepository.General.Properties.parent_))
			generalPart.setParent_((EObject)msg.getNewValue());
		if (GqamPackage.eINSTANCE.getArrivalPattern_Reference().equals(msg.getFeature()) && generalPart != null && isAccessible(GqamViewsRepository.General.Properties.reference))
			generalPart.setReference((EObject)msg.getNewValue());
		
	}
}
 
Example 41
Project: neoscada   File: MessageImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setProtocol ( Protocol newProtocol )
{
    if ( newProtocol != eInternalContainer () || ( eContainerFeatureID () != ProtocolPackage.MESSAGE__PROTOCOL && newProtocol != null ) )
    {
        if ( EcoreUtil.isAncestor ( this, newProtocol ) )
            throw new IllegalArgumentException ( "Recursive containment not allowed for " + toString () ); //$NON-NLS-1$
        NotificationChain msgs = null;
        if ( eInternalContainer () != null )
            msgs = eBasicRemoveFromContainer ( msgs );
        if ( newProtocol != null )
            msgs = ( (InternalEObject)newProtocol ).eInverseAdd ( this, ProtocolPackage.PROTOCOL__MESSAGES, Protocol.class, msgs );
        msgs = basicSetProtocol ( newProtocol, msgs );
        if ( msgs != null )
            msgs.dispatch ();
    }
    else if ( eNotificationRequired () )
        eNotify ( new ENotificationImpl ( this, Notification.SET, ProtocolPackage.MESSAGE__PROTOCOL, newProtocol, newProtocol ) );
}
 
Example 42
Project: time4sys   File: RequiredSchedulingParameterPropertiesEditionComponent.java   Source Code and License 6 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		RequiredSchedulingParameterPropertiesEditionPart basePart = (RequiredSchedulingParameterPropertiesEditionPart)editingPart;
		if (AnalysisPackage.eINSTANCE.getNamedElement_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(AnalysisViewsRepository.RequiredSchedulingParameter.Properties.name)) {
			if (msg.getNewValue() != null) {
				basePart.setName(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				basePart.setName("");
			}
		}
		if (AnalysisPackage.eINSTANCE.getRequiredSchedulingParameter_Parent().equals(msg.getFeature()) && basePart != null && isAccessible(AnalysisViewsRepository.RequiredSchedulingParameter.Properties.parent_))
			basePart.setParent_((EObject)msg.getNewValue());
		
	}
}
 
Example 43
Project: n4js   File: XcoreReader.java   Source Code and License 5 votes vote down vote up
@Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor,
		Issues issues) {
	ResourceSet resourceSet = getResourceSet();

	// due to some Xcore peculiarity we have to access the IAllContainerState here
	// to trigger some lazy init logic
	IAllContainersState allContainerState = (IAllContainersState) EcoreUtil.getAdapter(resourceSet.eAdapters(),
			IAllContainersState.class);
	allContainerState.isEmpty("");

	Multimap<String, URI> uris = getPathTraverser().resolvePathes(pathes,
			new Predicate<URI>() {
		@Override
		public boolean apply(URI input) {
			return input.fileExtension().equals(XCORE_FILE_EXT);
		}
	});
	List<Resource> resources = new ArrayList<>();
	for (URI uri : uris.values()) {
		LOGGER.info(uri);
		try {
			resources.add(parse(uri, resourceSet));
		} catch (Exception e) {
			LOGGER.error("Problem during loading of resource @ " + uri, e);
		}
	}
	installIndex(resourceSet);
	for (Resource r : resources) {
		EcoreUtil.resolveAll(r);
		for (Diagnostic x : r.getErrors()) {
			issues.addError(x.getMessage(), x);
		}

	}
	ctx.set(slot, resources);
}
 
Example 44
Project: time4sys   File: SoftwareMutualExclusionResourceOtherPropertiesEditionComponent.java   Source Code and License 5 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		OtherPropertiesEditionPart otherPart = (OtherPropertiesEditionPart)editingPart;
		if (GrmPackage.eINSTANCE.getCommunicationEndPoint_PacketSize().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && otherPart != null && isAccessible(SrmViewsRepository.Other.Properties.packetSize)) {
			if (msg.getNewValue() != null) {
				otherPart.setPacketSize(EcoreUtil.convertToString(EcorePackage.Literals.EINT, msg.getNewValue()));
			} else {
				otherPart.setPacketSize("");
			}
		}
		if (GrmPackage.eINSTANCE.getResource_PServices().equals(msg.getFeature()) && isAccessible(SrmViewsRepository.Other.Properties.pServices))
			otherPart.updatePServices();
		if (GrmPackage.eINSTANCE.getResource_RServices().equals(msg.getFeature())  && isAccessible(SrmViewsRepository.Other.Properties.rServices))
			otherPart.updateRServices();
		if (SrmPackage.eINSTANCE.getSoftwareResource_CreateServices().equals(msg.getFeature())  && isAccessible(SrmViewsRepository.Other.Properties.createServices))
			otherPart.updateCreateServices();
		if (SrmPackage.eINSTANCE.getSoftwareResource_DeleteServices().equals(msg.getFeature())  && isAccessible(SrmViewsRepository.Other.Properties.deleteServices))
			otherPart.updateDeleteServices();
		if (SrmPackage.eINSTANCE.getSoftwareResource_InitializeServices().equals(msg.getFeature())  && isAccessible(SrmViewsRepository.Other.Properties.initializeServices))
			otherPart.updateInitializeServices();
		if (SrmPackage.eINSTANCE.getSoftwareInteractionResource_IsIntraMemoryPartitionInteraction().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && otherPart != null && isAccessible(SrmViewsRepository.Other.Properties.isIntraMemoryPartitionInteraction))
			otherPart.setIsIntraMemoryPartitionInteraction((Boolean)msg.getNewValue());
		
		if (SrmPackage.eINSTANCE.getSoftwareMutualExclusionResource_AcquireServices().equals(msg.getFeature())  && isAccessible(SrmViewsRepository.Other.Properties.acquireServices))
			otherPart.updateAcquireServices();
		if (SrmPackage.eINSTANCE.getSoftwareMutualExclusionResource_ReleaseServices().equals(msg.getFeature())  && isAccessible(SrmViewsRepository.Other.Properties.releaseServices))
			otherPart.updateReleaseServices();
		
	}
}
 
Example 45
Project: neoscada   File: Names.java   Source Code and License 5 votes vote down vote up
public static String makeName ( final NamedDocumentable documentable )
{
    if ( documentable.getName () != null )
    {
        return documentable.getName ();
    }
    else
    {
        return EcoreUtil.getID ( documentable );
    }
}
 
Example 46
Project: time4sys   File: FragmentPropertiesEditionComponent.java   Source Code and License 5 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		FragmentPropertiesEditionPart basePart = (FragmentPropertiesEditionPart)editingPart;
		if (AnalysisPackage.eINSTANCE.getNamedElement_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(AnalysisViewsRepository.Fragment.Properties.name)) {
			if (msg.getNewValue() != null) {
				basePart.setName(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				basePart.setName("");
			}
		}
		if (AnalysisPackage.eINSTANCE.getSynchronizableElement_LockedMutexes().equals(msg.getFeature())  && isAccessible(AnalysisViewsRepository.Fragment.Properties.lockedMutexes))
			basePart.updateLockedMutexes();
		if (AnalysisPackage.eINSTANCE.getFragment_Next().equals(msg.getFeature()) && basePart != null && isAccessible(AnalysisViewsRepository.Fragment.Properties.next))
			basePart.setNext((EObject)msg.getNewValue());
		if (AnalysisPackage.eINSTANCE.getFragment_Previous().equals(msg.getFeature()) && basePart != null && isAccessible(AnalysisViewsRepository.Fragment.Properties.previous))
			basePart.setPrevious((EObject)msg.getNewValue());
		if (AnalysisPackage.eINSTANCE.getFragment_Task().equals(msg.getFeature()) && basePart != null && isAccessible(AnalysisViewsRepository.Fragment.Properties.task))
			basePart.setTask((EObject)msg.getNewValue());
		if (AnalysisPackage.eINSTANCE.getFragment_CET().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(AnalysisViewsRepository.Fragment.Properties.cET)) {
			if (msg.getNewValue() != null) {
				basePart.setCET(EcoreUtil.convertToString(AnalysisPackage.Literals.NFP_TIME_INTERVAL, msg.getNewValue()));
			} else {
				basePart.setCET("");
			}
		}
		
	}
}
 
Example 47
Project: time4sys   File: HardwareClockGeneralPropertiesEditionComponent.java   Source Code and License 5 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		GeneralPropertiesEditionPart generalPart = (GeneralPropertiesEditionPart)editingPart;
		if (GrmPackage.eINSTANCE.getNamedElement_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && generalPart != null && isAccessible(HrmViewsRepository.General.Properties.name)) {
			if (msg.getNewValue() != null) {
				generalPart.setName(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				generalPart.setName("");
			}
		}
		if (GrmPackage.eINSTANCE.getResource_OwnedResource().equals(msg.getFeature()) && isAccessible(HrmViewsRepository.General.Properties.ownedResource))
			generalPart.updateOwnedResource();
		if (GrmPackage.eINSTANCE.getResource_ResMult().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && generalPart != null && isAccessible(HrmViewsRepository.General.Properties.resMult)) {
			if (msg.getNewValue() != null) {
				generalPart.setResMult(EcoreUtil.convertToString(EcorePackage.Literals.EINT, msg.getNewValue()));
			} else {
				generalPart.setResMult("");
			}
		}
		if (GrmPackage.eINSTANCE.getResource_IsProtected().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && generalPart != null && isAccessible(HrmViewsRepository.General.Properties.isProtected))
			generalPart.setIsProtected((Boolean)msg.getNewValue());
		
		if (GrmPackage.eINSTANCE.getResource_IsActive().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && generalPart != null && isAccessible(HrmViewsRepository.General.Properties.isActive))
			generalPart.setIsActive((Boolean)msg.getNewValue());
		
		if (GrmPackage.eINSTANCE.getResource_OwnedConnector().equals(msg.getFeature()) && isAccessible(HrmViewsRepository.General.Properties.ownedConnector))
			generalPart.updateOwnedConnector();
		if (GrmPackage.eINSTANCE.getResource_UsedBy().equals(msg.getFeature())  && isAccessible(HrmViewsRepository.General.Properties.usedBy))
			generalPart.updateUsedBy();
		
	}
}
 
Example 48
Project: n4js   File: N4TSQualifiedNameProvider.java   Source Code and License 5 votes vote down vote up
/**
 * Static case: Returns the matching (internal) name of the polyfill matching the given classifier. There are no
 * polyfills of polyfills, so the returned name is independent from the polyfill flag of the given classifier.
 */
public static QualifiedName getStaticPolyfillFQN(TClassifier tClassifier,
		IQualifiedNameProvider qualifiedNameProvider) {
	QualifiedName prefix = qualifiedNameProvider.getFullyQualifiedName(EcoreUtil.getRootContainer(tClassifier));
	// if ("n4ts".equals(tClassifier.eResource().getURI().fileExtension())) { // } instanceof TObjectPrototype) {
	// prefix = append(prefix, GLOBAL_NAMESPACE_SEGMENT);
	// // TODO this has to be removed, instead, also n4ts files should use "#" as global namespace segment
	// }
	prefix = prepend(MODULE_POLYFILL_SEGMENT, prefix);
	prefix = append(prefix, POLYFILL_SEGMENT);
	return append(prefix, tClassifier.getName());
}
 
Example 49
Project: rest-modeling-framework   File: RamlModelBuilder.java   Source Code and License 5 votes vote down vote up
public Method resolve(final Trait trait) {
    for (final Header header : trait.getHeaders()) {
        final Header resolvedHeader = EcoreUtil.copy(header);
        typedElementResolver.resolveAll(resolvedHeader);
        method.getHeaders().add(resolvedHeader);
    }
    for (final QueryParameter queryParameter : trait.getQueryParameters()) {
        final QueryParameter resolvedQueryParameter = EcoreUtil.copy(queryParameter);
        typedElementResolver.resolveAll(resolvedQueryParameter);
        method.getQueryParameters().add(resolvedQueryParameter);
    }

    return method;
}
 
Example 50
Project: rest-modeling-framework   File: RamlModelBuilder.java   Source Code and License 5 votes vote down vote up
private void merge(final ApiExtension apiExtension, final Api api) {
    final TreeIterator<EObject> allProperContents = EcoreUtil.getAllProperContents(api, false);
    final Map<String, EObject> idToEObject = new HashMap<>();
    while (allProperContents.hasNext()) {
        final EObject eObject = allProperContents.next();
        final String uriFragment = uriFragmentBuilder.getURIFragment(eObject);
        idToEObject.put(uriFragment, eObject);
    }
    merge(apiExtension, api, idToEObject);
}
 
Example 51
Project: n4js   File: BuiltInTypeScope.java   Source Code and License 5 votes vote down vote up
/**
 * Obtains an instance in the context of the given resourceSet.
 * <p>
 * This is the preferred method of creating a BuiltInTypeScope if code needs to access built-in types. But note that
 * there are convenience methods available in RuleEnvironmentExtensions; so, if a RuleEnvironment is already
 * available those methods should be used.
 */
public static BuiltInTypeScope get(ResourceSet resourceSet) {
	BuiltInTypeScopeAccess result = (BuiltInTypeScopeAccess) EcoreUtil.getAdapter(resourceSet.eAdapters(),
			BuiltInTypeScope.class);
	if (result == null) {
		throw new IllegalStateException("Missing adapter for BuiltInTypeScope");
	}
	return result.getScope();
}
 
Example 52
Project: time4sys   File: SporadicPatternTimingPropertiesEditionComponent.java   Source Code and License 5 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		TimingPropertiesEditionPart timingPart = (TimingPropertiesEditionPart)editingPart;
		if (GqamPackage.eINSTANCE.getArrivalPattern_Jitter().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && timingPart != null && isAccessible(GqamViewsRepository.Timing.TimingProperties.jitter)) {
			if (msg.getNewValue() != null) {
				timingPart.setJitter(EcoreUtil.convertToString(GqamPackage.Literals.NFP_DURATION, msg.getNewValue()));
			} else {
				timingPart.setJitter("");
			}
		}
		if (GqamPackage.eINSTANCE.getSporadicPattern_MinInterarrival().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && timingPart != null && isAccessible(GqamViewsRepository.Timing.TimingProperties.minInterarrival)) {
			if (msg.getNewValue() != null) {
				timingPart.setMinInterarrival(EcoreUtil.convertToString(GqamPackage.Literals.NFP_DURATION, msg.getNewValue()));
			} else {
				timingPart.setMinInterarrival("");
			}
		}
		if (GqamPackage.eINSTANCE.getSporadicPattern_MaxInterarrival().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && timingPart != null && isAccessible(GqamViewsRepository.Timing.TimingProperties.maxInterarrival)) {
			if (msg.getNewValue() != null) {
				timingPart.setMaxInterarrival(EcoreUtil.convertToString(GqamPackage.Literals.NFP_DURATION, msg.getNewValue()));
			} else {
				timingPart.setMaxInterarrival("");
			}
		}
		
	}
}
 
Example 53
Project: rest-modeling-framework   File: TypeDeclarationResolver.java   Source Code and License 5 votes vote down vote up
private EObject constructType(final ParserRuleContext context, final EObject superType) {
    final EObject declaredType;
    final Token nameToken = context.getStart();
    final Optional<BuiltinType> optionalBuiltinType = BuiltinType.of(nameToken.getText());
    if (optionalBuiltinType.isPresent() || superType == null || !superType.eIsProxy()) {
        final EClass eClass = optionalBuiltinType
                .map(builtinType -> builtinType.getScopedMetaType(scope))
                .orElseGet(() -> superType == null ? BuiltinType.STRING.getScopedMetaType(scope) : superType.eClass());
        declaredType = create(eClass, context);
        final Scope typeScope = scope.with(declaredType);

        final String name = nameToken.getText();
        typeScope.with(declaredType.eClass().getEStructuralFeature("name"))
                .setValue(name, nameToken);
        if (!optionalBuiltinType.isPresent()) {
            typeScope.with(declaredType.eClass().getEStructuralFeature("type"))
                    .setValue(superType, nameToken);
        }
    } else {
        final InternalEObject proxy = (InternalEObject) EcoreUtil.create(superType.eClass());
        final String uriFragment = scope.getUriFragment(nameToken.getText());
        proxy.eSetProxyURI(scope.getResource().getURI().appendFragment(uriFragment));
        declaredType = proxy;
    }
    scope.setValue(declaredType, nameToken);
    return declaredType;
}
 
Example 54
Project: time4sys   File: TimerResourceTimingPropertiesEditionComponent.java   Source Code and License 5 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		TimingPropertiesEditionPart timingPart = (TimingPropertiesEditionPart)editingPart;
		if (GrmPackage.eINSTANCE.getTimerResource_Duration().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && timingPart != null && isAccessible(GrmViewsRepository.Timing.TimingProperties.duration)) {
			if (msg.getNewValue() != null) {
				timingPart.setDuration(EcoreUtil.convertToString(EcorePackage.Literals.EFLOAT, msg.getNewValue()));
			} else {
				timingPart.setDuration("");
			}
		}
		
	}
}
 
Example 55
Project: time4sys   File: InterruptResourceTimingPropertiesEditionComponent.java   Source Code and License 5 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		TimingPropertiesEditionPart timingPart = (TimingPropertiesEditionPart)editingPart;
		if (GrmPackage.eINSTANCE.getResourceManager_ResCtrlPolicy().equals(msg.getFeature()) && isAccessible(SrmViewsRepository.Timing.Properties.resCtrlPolicy))
			timingPart.updateResCtrlPolicy();
		if (SrmPackage.eINSTANCE.getSoftwareConcurrentResource_PriorityElements().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && timingPart != null && isAccessible(SrmViewsRepository.Timing.Properties.priorityElements)) {
			if (msg.getNewValue() instanceof EList<?>) {
				timingPart.setPriorityElements((EList<?>)msg.getNewValue());
			} else if (msg.getNewValue() == null) {
				timingPart.setPriorityElements(new BasicEList<Object>());
			} else {
				BasicEList<Object> newValueAsList = new BasicEList<Object>();
				newValueAsList.add(msg.getNewValue());
				timingPart.setPriorityElements(newValueAsList);
			}
		}
		
		if (SrmPackage.eINSTANCE.getSoftwareConcurrentResource_MutualExclusionResources().equals(msg.getFeature())  && isAccessible(SrmViewsRepository.Timing.Properties.mutualExclusionResources))
			timingPart.updateMutualExclusionResources();
		if (SrmPackage.eINSTANCE.getSoftwareConcurrentResource_ArrivalPattern().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && timingPart != null && isAccessible(SrmViewsRepository.Timing.Properties.arrivalPattern)) {
			if (msg.getNewValue() != null) {
				timingPart.setArrivalPattern(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				timingPart.setArrivalPattern("");
			}
		}
		
	}
}
 
Example 56
Project: n4js   File: N4JSPostProcessor.java   Source Code and License 5 votes vote down vote up
private void postProcessN4JSResource(N4JSResource resource, CancelIndicator cancelIndicator) {
	// step 1: process the AST (resolve all proxies in AST, infer type of all typable AST nodes, etc.)
	astProcessor.processAST(resource, cancelIndicator);
	// step 2: expose internal types visible from outside
	// (i.e. if they are referenced from a type that is visible form the outside)
	exposeReferencedInternalTypes(resource);
	// step 3: resolve remaining proxies in TModule
	// (the TModule was created programmatically, so it usually does not contain proxies; however, in case of
	// explicitly declared types, the types builder copies type references from the AST to the corresponding
	// TModule element *without* resolving proxies, so the TModule might contain lazy-cross-ref proxies; most of
	// these should have been resolved during AST traversal and exposing internal types, but some can be left)
	EcoreUtil.resolveAll(resource.getModule());
}
 
Example 57
Project: n4js   File: N4JSMemberRedefinitionValidator.java   Source Code and License 5 votes vote down vote up
private void messageOverrideFinal(RedefinitionType redefinitionType, TMember overriding, TMember overridden) {
	String message = getMessageForCLF_OVERRIDE_FINAL(
			validatorMessageHelper.descriptionDifferentFrom(overriding, overridden),
			validatorMessageHelper.descriptionDifferentFrom(overridden, overriding));
	addIssueToMemberOrInterfaceReference(redefinitionType, overriding, overridden, message,
			CLF_OVERRIDE_FINAL,
			IssueUserDataKeys.CLF_OVERRIDE_FINAL.OVERRIDDEN_MEMBER_URI,
			EcoreUtil.getURI(overridden).toString());
}
 
Example 58
Project: rest-modeling-framework   File: RamlModelBuilder.java   Source Code and License 5 votes vote down vote up
private void mergeMethod(final Method resolvedMethod) {
    final Method existingMethod = resource.getMethod(resolvedMethod.getMethod());
    if (existingMethod == null) {
        if (resolvedMethod.isRequired()) {
            resource.getMethods().add(resolvedMethod);
            typedElementResolver.resolveAll(resolvedMethod);
        }
    } else {
        typedElementResolver.resolveAll(resolvedMethod);
        final EList<EAttribute> allAttributes = ResourcesPackage.Literals.METHOD.getEAllAttributes();
        final Consumer<EAttribute> copyAttribute = attribute -> existingMethod.eSet(attribute, resolvedMethod.eGet(attribute));
        allAttributes.stream()
                .filter(attribute -> !existingMethod.eIsSet(attribute))
                .filter(attribute -> resolvedMethod.eIsSet(attribute))
                .forEach(copyAttribute);
        final Consumer<EReference> copyReference = eReference -> {
            final Object value;
            if (eReference.isContainment()) {
                if (eReference.isMany()) {
                    value = EcoreUtil.copyAll((List) resolvedMethod.eGet(eReference));
                } else {
                    value = EcoreUtil.copy((EObject) resolvedMethod.eGet(eReference));
                }
            } else {
                value = resolvedMethod.eGet(eReference);
            }
            existingMethod.eSet(eReference, value);
        };
        ResourcesPackage.Literals.METHOD.getEAllReferences().stream()
                .filter(reference -> !existingMethod.eIsSet(reference))
                .filter(reference -> resolvedMethod.eIsSet(reference))
                .forEach(copyReference);
    }
}
 
Example 59
Project: n4js   File: N4JSResource.java   Source Code and License 5 votes vote down vote up
private void proxifyASTReferences(EObject object) {
	if (object instanceof SyntaxRelatedTElement) {
		SyntaxRelatedTElement element = (SyntaxRelatedTElement) object;
		EObject astElement = element.getAstElement();
		if (astElement != null && !astElement.eIsProxy()) {
			InternalEObject proxy = (InternalEObject) EcoreUtil.create(astElement.eClass());
			proxy.eSetProxyURI(EcoreUtil.getURI(astElement));
			element.setAstElement(proxy);
		}
	}

	for (EObject child : object.eContents()) {
		proxifyASTReferences(child);
	}
}
 
Example 60
Project: time4sys   File: ProtectionParameterGeneralPropertiesEditionComponent.java   Source Code and License 5 votes vote down vote up
/**
 * {@inheritDoc}
 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
 */
public void updatePart(Notification msg) {
	super.updatePart(msg);
	if (editingPart.isVisible()) {
		GeneralPropertiesEditionPart generalPart = (GeneralPropertiesEditionPart)editingPart;
		if (GrmPackage.eINSTANCE.getNamedElement_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && generalPart != null && isAccessible(GrmViewsRepository.General.Properties.name)) {
			if (msg.getNewValue() != null) {
				generalPart.setName(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				generalPart.setName("");
			}
		}
		
	}
}