本文整理匯總了Java中org.eclipse.emf.ecore.util.EcoreUtil類的典型用法代碼示例。如果您正苦於以下問題:Java EcoreUtil類的具體用法?Java EcoreUtil怎麽用?Java EcoreUtil使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EcoreUtil類屬於org.eclipse.emf.ecore.util包,在下文中一共展示了EcoreUtil類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setMaster
import org.eclipse.emf.ecore.util.EcoreUtil; //導入依賴的package包/類
/**
* <!-- 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 ) );
}
示例2: setDefinition
import org.eclipse.emf.ecore.util.EcoreUtil; //導入依賴的package包/類
/**
* <!-- 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 ) );
}
示例3: setParent
import org.eclipse.emf.ecore.util.EcoreUtil; //導入依賴的package包/類
/**
* <!-- 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));
}
示例4: setOwner
import org.eclipse.emf.ecore.util.EcoreUtil; //導入依賴的package包/類
/**
* <!-- 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));
}
示例5: updatePart
import org.eclipse.emf.ecore.util.EcoreUtil; //導入依賴的package包/類
/**
* {@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());
}
}
示例6: setOwner
import org.eclipse.emf.ecore.util.EcoreUtil; //導入依賴的package包/類
/**
* <!-- 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));
}
示例7: getProfile
import org.eclipse.emf.ecore.util.EcoreUtil; //導入依賴的package包/類
@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;
}
示例8: updatePart
import org.eclipse.emf.ecore.util.EcoreUtil; //導入依賴的package包/類
/**
* {@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("");
}
}
}
}
示例9: getProfile
import org.eclipse.emf.ecore.util.EcoreUtil; //導入依賴的package包/類
/**
* @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;
}
示例10: updatePart
import org.eclipse.emf.ecore.util.EcoreUtil; //導入依賴的package包/類
/**
* {@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());
}
}
示例11: getConnectedEdgesForEObjectSingleCase
import org.eclipse.emf.ecore.util.EcoreUtil; //導入依賴的package包/類
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);
}
}
示例12: setNode
import org.eclipse.emf.ecore.util.EcoreUtil; //導入依賴的package包/類
/**
* <!-- 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 ) );
}
示例13: analyzeResourceProblems
import org.eclipse.emf.ecore.util.EcoreUtil; //導入依賴的package包/類
/**
* 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;
}
}
示例14: setDevice
import org.eclipse.emf.ecore.util.EcoreUtil; //導入依賴的package包/類
/**
* <!-- 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 ) );
}
示例15: setOwningFSM
import org.eclipse.emf.ecore.util.EcoreUtil; //導入依賴的package包/類
/**
* <!-- 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));
}