/** * {@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()) { FlowEventPropertiesEditionPart flowEventPart = (FlowEventPropertiesEditionPart) editingPart; if (EnvironmentPackage.eINSTANCE.getObeoDSMObject_Description().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && flowEventPart != null && isAccessible(FlowViewsRepository.FlowEvent.Properties.description)) { if (msg.getNewValue() != null) { flowEventPart.setDescription( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { flowEventPart.setDescription(""); } } if (CinematicPackage.eINSTANCE.getNamedElement_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && flowEventPart != null && isAccessible(FlowViewsRepository.FlowEvent.Properties.name)) { if (msg.getNewValue() != null) { flowEventPart.setName( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { flowEventPart.setName(""); } } if (FlowPackage.eINSTANCE.getFlowEvent_Binds().equals(msg.getFeature()) && isAccessible(FlowViewsRepository.FlowEvent.Properties.binds)) flowEventPart.updateBinds(); } }
/** * {@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()) { NamespacePropertiesEditionPart namespacePart = (NamespacePropertiesEditionPart) editingPart; if (EnvironmentPackage.eINSTANCE.getNamespace_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && namespacePart != null && isAccessible(EnvironmentViewsRepository.Namespace.Properties.name)) { if (msg.getNewValue() != null) { namespacePart.setName( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { namespacePart.setName(""); } } if (EnvironmentPackage.eINSTANCE.getObeoDSMObject_Description().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && namespacePart != null && isAccessible(EnvironmentViewsRepository.Namespace.Properties.description)) { if (msg.getNewValue() != null) { namespacePart.setDescription( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { namespacePart.setDescription(""); } } } }
protected void addConnectorImplementation( ConnectorImplementation impl, List<IResource> resourcesToExport, boolean includeSources) throws FileNotFoundException, CoreException { final IRepositoryStore store = getImplementationStore(); String fileName = NamingUtils.getEResourceFileName(impl, true); final EMFFileStore fileStore = (EMFFileStore) store.getChild(fileName); if (!fileStore.canBeShared()) { File f = new File(fileStore.getEMFResource().getURI().toFileString()); if (f.exists()) { IFile implFile = store.getResource().getFile(f.getName()); implFile.create(new FileInputStream(f), true, Repository.NULL_PROGRESS_MONITOR); resourcesToExport.add(implFile); cleanAfterExport.add(implFile); } } else { implBackup = EcoreUtil.copy(impl); String jarName = NamingUtils.toConnectorImplementationFilename( impl.getImplementationId(), impl.getImplementationVersion(), false) + ".jar"; if (!impl.getJarDependencies().getJarDependency().contains(jarName)) { impl.getJarDependencies().getJarDependency().add(jarName); } impl.setHasSources(includeSources); IRepositoryFileStore file = store.getChild(fileName); file.save(EcoreUtil.copy(impl)); resourcesToExport.add(file.getResource()); } }
public void testResourceAccessor() throws Exception { CDOSession session = openSession(); CDOTransaction transaction = session.openTransaction(); CDOResource resource = transaction.createResource(getResourcePath("/test1")); Supplier supplier = getModel1Factory().createSupplier(); supplier.setName("Stepper"); resource.getContents().add(supplier); URI supplierTempURI = EcoreUtil.getURI(supplier); // Retrieving supplier from URI before commit EObject supplier1 = transaction.getResourceSet().getEObject(supplierTempURI, true); assertEquals(supplier, CDOUtil.getEObject(supplier1)); transaction.commit(); URI supplierURI = EcoreUtil.getURI(supplier); // Retrieving supplier from URI after commit EObject supplierFromURI = transaction.getResourceSet().getEObject(supplierURI, true); assertEquals(supplier, CDOUtil.getEObject(supplierFromURI)); EObject supplierAfterCommit2 = transaction.getResourceSet().getEObject(supplierTempURI, true); if (session.getRepositoryInfo().getIDGenerationLocation() == IDGenerationLocation.STORE) { assertEquals(null, supplierAfterCommit2); } else { assertEquals(supplier, supplierAfterCommit2); } }
/** * {@inheritDoc} * * @see * org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification) */ public void updatePart(Notification msg) { if (editingPart.isVisible()) { RotateAnimationPropertiesEditionPart basePart = (RotateAnimationPropertiesEditionPart) editingPart; if (DroidPackage.eINSTANCE.getTerminalAnimationElements_FromAlpha().equals(msg.getFeature()) && basePart != null && isAccessible(DroidViewsRepository.RotateAnimation.Properties.fromAlpha)) { if (msg.getNewValue() != null) { basePart.setFromAlpha( EcoreUtil.convertToString( EcorePackage.eINSTANCE.getEFloatObject(), msg.getNewValue())); } else { basePart.setFromAlpha(""); } } if (DroidPackage.eINSTANCE.getTerminalAnimationElements_ToAlpha().equals(msg.getFeature()) && basePart != null && isAccessible(DroidViewsRepository.RotateAnimation.Properties.toAlpha)) { if (msg.getNewValue() != null) { basePart.setToAlpha( EcoreUtil.convertToString( EcorePackage.eINSTANCE.getEFloatObject(), msg.getNewValue())); } else { basePart.setToAlpha(""); } } } }
/** * {@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()) { CommandPropertiesEditionPart basePart = (CommandPropertiesEditionPart) editingPart; if (StatemachinePackage.eINSTANCE.getCommand_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(StatemachineViewsRepository.Command.Properties.name)) { if (msg.getNewValue() != null) { basePart.setName( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { basePart.setName(""); } } if (StatemachinePackage.eINSTANCE.getCommand_Code().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(StatemachineViewsRepository.Command.Properties.code)) { if (msg.getNewValue() != null) { basePart.setCode( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { basePart.setCode(""); } } } }
@SuppressWarnings("unchecked") protected void createEntryExitPoints(Diagram subdiagram) { TreeIterator<EObject> eAllContents = subdiagram.eAllContents(); List<Edge> entryPointsToCreate = new ArrayList<Edge>(); List<Edge> exitPointstoCreate = new ArrayList<Edge>(); while (eAllContents.hasNext()) { EObject next = eAllContents.next(); if (next instanceof View) { EList<Edge> targetEdges = ((View) next).getTargetEdges(); for (Edge edge : targetEdges) { if (!EcoreUtil.isAncestor(subdiagram, edge.getSource())) entryPointsToCreate.add(edge); } EList<Edge> sourceEdges = ((View) next).getSourceEdges(); for (Edge edge : sourceEdges) { if (!EcoreUtil.isAncestor(subdiagram, edge.getTarget())) exitPointstoCreate.add(edge); } } } for (Edge edge : entryPointsToCreate) { createEntryPoint(edge, subdiagram); } for (Edge edge : exitPointstoCreate) { createExitPoint(edge, subdiagram); } }
@Test public void getAddedAndRemoved() { final EObject obj00 = EcoreUtil.create(eClass0); final EObject obj1 = EcoreUtil.create(eClass1); final EObject obj01 = EcoreUtil.create(eClass0); final EObject obj02 = EcoreUtil.create(eClass0); final List<Notification> messages = new ArrayList<Notification>(); obj1.eAdapters() .add( new AdapterImpl() { @Override public void notifyChanged(Notification msg) { messages.add(msg); } }); // Add obj1.eSet(multiRef, Arrays.asList(new EObject[] {obj00, obj01})); EMFUtils.setOrAdd(obj1, multiRef, obj02); // Remove final List list = (List) obj1.eGet(multiRef); list.remove(obj00); list.removeAll(Arrays.asList(new EObject[] {obj01, obj02})); final List<EObject> addedObjects = new ArrayList<EObject>(); final List<EObject> removedObjects = new ArrayList<EObject>(); for (Notification msg : messages) { addedObjects.addAll(EMFUtils.getAddedObjects(msg, obj00.getClass())); removedObjects.addAll(EMFUtils.getRemovedObjects(msg, obj00.getClass())); } assertEquals(Arrays.asList(new EObject[] {obj00, obj01, obj02}), addedObjects); assertEquals(Arrays.asList(new EObject[] {obj00, obj01, obj02}), removedObjects); }
@Test public void set() { EObject obj0 = EcoreUtil.create(eClass0); EObject obj1 = EcoreUtil.create(eClass1); EMFUtils.setOrAdd(obj0, singleRef, obj1); assertEquals(obj1, obj0.eGet(singleRef)); }
@Override public Object visit( NegativeOperatorExpression negativeOperatorExpression, TypeResolutionContext context, EolVisitorController<TypeResolutionContext, Object> controller) { controller.visit(negativeOperatorExpression.getExpr(), context); Expression expression = negativeOperatorExpression.getExpr(); // get the expression Type exprType = expression.getResolvedType(); if (exprType instanceof BooleanType) { // if expression is of type boolean context.getLogBook().addError(expression, "Expression cannot be Boolean"); } if (exprType instanceof StringType) { // if expression is of type string // handle string context.getLogBook().addError(expression, "Expression cannot be String"); } if (exprType instanceof RealType) { // if expression is of type real negativeOperatorExpression.setResolvedType(EcoreUtil.copy(exprType)); } if (exprType instanceof IntegerType) { negativeOperatorExpression.setResolvedType(EcoreUtil.copy(exprType)); } return null; }
/** @generated */ public boolean equals(Object obj) { if (obj instanceof IAC.diagram.navigator.IACNavigatorItem) { return EcoreUtil.getURI(getView()) .equals(EcoreUtil.getURI(((IAC.diagram.navigator.IACNavigatorItem) obj).getView())); } return super.equals(obj); }
protected Object convertValue(EStructuralFeature feature, Object value) { String constantName = String.valueOf(value).toUpperCase(); Class<?> constants = SWT.class; String constantClass = EcoreUtil.getAnnotation(feature, SwtBuilder.getAnnotationUri(), "constantClass"); if (constantClass != null) { try { constants = context.convert(constantClass, Class.class); } catch (Exception e) { throw new IllegalArgumentException( "Conversion from " + value + " failed: " + e.getMessage(), e); } } if (feature.getEType() == EcorePackage.eINSTANCE.getEString()) { String type = EcoreUtil.getAnnotation(feature, SwtBuilder.getAnnotationUri(), "type"); if ("int".equals(type)) { value = SwtBuilder.getStaticField(constants, constantName, Integer.class, SWT.DEFAULT); } else if (type != null) { try { Class<?> typeClass = context.convert(type, Class.class); value = SwtBuilder.getStaticField(constants, constantName, typeClass, null); } catch (Exception e) { throw new IllegalArgumentException( "Conversion from " + value + " to " + type + " failed: " + e.getMessage(), e); } } } else if (feature.getEType() == org.eclipse.e4.tm.swt.styles.StylesPackage.eINSTANCE.getSwtConstant()) { value = SwtBuilder.getStaticField(constants, constantName, Integer.class, SWT.DEFAULT); } return value; }
/** * {@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()) { DomainClassPropertiesEditionPart domainClassPart = (DomainClassPropertiesEditionPart) editingPart; if (EnvironmentPackage.eINSTANCE.getType_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && domainClassPart != null && isAccessible(GraalViewsRepository.DomainClass.Properties.name)) { if (msg.getNewValue() != null) { domainClassPart.setName( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { domainClassPart.setName(""); } } if (EnvironmentPackage.eINSTANCE.getStructuredType_Supertype().equals(msg.getFeature()) && domainClassPart != null && isAccessible(GraalViewsRepository.DomainClass.Properties.superType)) domainClassPart.setSuperType((EObject) msg.getNewValue()); if (EnvironmentPackage.eINSTANCE.getObeoDSMObject_Description().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && domainClassPart != null && isAccessible(GraalViewsRepository.DomainClass.Properties.description)) { if (msg.getNewValue() != null) { domainClassPart.setDescription( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { domainClassPart.setDescription(""); } } } }
@Test public void testResolveElements() throws Exception { URI resourceURI = URI.createFileURI("testresource.refactoringtestlanguage"); String textualModel = "A { B { C { ref A.B } } ref B }"; XtextResource resource = getResource(textualModel, resourceURI.toString()); Element elementA = (Element) resource.getContents().get(0).eContents().get(0); Element elementB = elementA.getContained().get(0); Element elementC = elementB.getContained().get(0); URI uriB = EcoreUtil.getURI(elementB); URI uriC = EcoreUtil.getURI(elementC); String newName = "newB"; List<URI> renamedElementURIs = newArrayList(uriB, uriC); IRenameStrategy renameStrategy = getInjector().getInstance(IRenameStrategy.Provider.class).get(elementB, null); IRenamedElementTracker renamedElementTracker = new RenamedElementTracker(); Map<URI, URI> original2newElementURIs = renamedElementTracker.renameAndTrack( renamedElementURIs, newName, resource.getResourceSet(), renameStrategy, null); assertEquals("B", elementB.getName()); assertEquals(2, original2newElementURIs.size()); assertEquals(resourceURI.appendFragment(newName), original2newElementURIs.get(uriB)); assertEquals(uriC, original2newElementURIs.get(uriC)); }
/** * Gets the serializable string for design values. Design values include data set parameter * definitions and result set definitions. * * @param setDesign the data set desgin * @return the serializable string for design values */ private String serializeOdaValues(DataSetDesign setDesign) { DataSetParameters params = SchemaConversionUtil.convertToAdapterParameters(setDesign.getParameters()); ResultSets resultSets = setDesign.getResultSets(); DesignValues values = ModelFactory.eINSTANCE.createDesignValues(); values.setVersion(IConstants.DESINGER_VALUES_VERSION); boolean hasData = false; if (params != null) { values.setDataSetParameters((DataSetParameters) EcoreUtil.copy(params)); hasData = true; } if (resultSets != null) { values.setResultSets((ResultSets) EcoreUtil.copy(resultSets)); hasData = true; } if (!hasData) return IConstants.EMPTY_STRING; try { return SerializerImpl.instance().write(values); } catch (IOException e) { return null; } }
protected Map getOriginalToCopiesMap(final Resource source, final Resource target) { Map originalToCopied = new HashMap(); Map uriFragmentToObject = new HashMap(); for (final Iterator iter = source.getAllContents(); iter.hasNext(); ) { EObject originalObj = (EObject) iter.next(); String uri = EcoreUtil.getURI(originalObj).toString(); // get the uri fragment from the uri int beginIndex = uri.indexOf(DatatypeConstants.URI_REFERENCE_DELIMITER) + 1; String uriFragment = (beginIndex > 0 ? uri.substring(beginIndex) : uri); if (uriFragment != null) { uriFragmentToObject.put(uriFragment.toUpperCase(), originalObj); } } for (final Iterator iter = target.getAllContents(); iter.hasNext(); ) { EObject copiedObj = (EObject) iter.next(); String uri = EcoreUtil.getURI(copiedObj).toString(); // get the uri fragment from the uri int beginIndex = uri.indexOf(DatatypeConstants.URI_REFERENCE_DELIMITER) + 1; String uriFragment = (beginIndex > 0 ? uri.substring(beginIndex) : uri); if (uriFragment != null) { EObject originalObject = (EObject) uriFragmentToObject.get(uriFragment.toUpperCase()); if (originalObject != null) { originalToCopied.put(originalObject, copiedObj); } } } return originalToCopied; }
/** * {@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()) { ArtifactIdentifierPropertiesEditionPart basePart = (ArtifactIdentifierPropertiesEditionPart)editingPart; if (ScoPackage.eINSTANCE.getArtifactIdentifier_ResourceName().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(ScoViewsRepository.ArtifactIdentifier.Properties.resourceName)) { if (msg.getNewValue() != null) { basePart.setResourceName(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { basePart.setResourceName(""); } } if (ScoPackage.eINSTANCE.getArtifactIdentifier_BaselinedLineCount().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(ScoViewsRepository.ArtifactIdentifier.Properties.baselinedLineCount)) { if (msg.getNewValue() != null) { basePart.setBaselinedLineCount(EcoreUtil.convertToString(EcorePackage.Literals.EINT, msg.getNewValue())); } else { basePart.setBaselinedLineCount(""); } } if (ScoPackage.eINSTANCE.getArtifactIdentifier_CurrentLineCount().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(ScoViewsRepository.ArtifactIdentifier.Properties.currentLineCount)) { if (msg.getNewValue() != null) { basePart.setCurrentLineCount(EcoreUtil.convertToString(EcorePackage.Literals.EINT, msg.getNewValue())); } else { basePart.setCurrentLineCount(""); } } } }
/** * Loads a new instance of an aspect. This is required, because lower-level aspects that contain * dependencies will be modified, i.e., it's dependencies are woven into it. If this (lower-level) * aspect is loaded somewhere else, e.g., a GUI, the modifications are reflected there, which is * unwanted behavior. If the aspect were cloned, it would require the mappings of the * instantiation for this lower-level aspect to be updated to the new elements, which would be * more time-consuming to do. Therefore, to circumvent this, the aspect is saved in a temporary * file and loaded again using a separate resource set, which forces to load other aspects to be * loaded as new instances. Otherwise the existing resource set would get the resources for the * lower-level aspects from its cache. * * @param aspect the aspect to load a new instance for * @return a new instance of the given aspect */ public Aspect loadNewInstance(Aspect aspect) { // Given aspect has to be cloned. Otherwise, when adding the aspect to the new resource // it gets removed from its current resource. This will mean that the given aspect // is directly modified. Aspect result = EcoreUtil.copy(aspect); String pathName = TEMPORARY_ASPECT.getAbsolutePath(); // Use our own resource set for saving and loading to workaround the issue. ResourceSet resourceSet = new ResourceSetImpl(); // Create a resource to temporarily save the aspect. Resource resource = resourceSet.createResource(URI.createFileURI(pathName)); resource.getContents().add(result); try { resource.save(Collections.EMPTY_MAP); // Load the temporary aspect ... resource = resourceSet.getResource(URI.createFileURI(pathName), true); result = (Aspect) resource.getContents().get(0); // Copy the aspect to loose the reference to the temporary file... result = EcoreUtil.copy(result); } catch (IOException e) { e.printStackTrace(); } // Delete the temporary file ... TEMPORARY_ASPECT.delete(); return result; }
@Override public void setUp() throws Exception { super.setUp(); EcoreFactory factory = EcoreFactory.eINSTANCE; EPackage p = factory.createEPackage(); p.setName("TestPackage1"); EClass class0 = factory.createEClass(); class0.setName("Class0"); EClass class1 = factory.createEClass(); class1.setName("Class1"); EClass class2 = factory.createEClass(); class2.setName("Class2"); p.getEClassifiers().add(class0); p.getEClassifiers().add(class1); p.getEClassifiers().add(class2); leftModel = EcoreUtil.copy(p); URI leftURI = URI.createURI("leftmodel.ecore"); ModelUtils.attachResource(leftURI, leftModel); expectedModel = EcoreUtil.copy(leftModel); URI expectedURI = URI.createURI("expectedmodel.ecore"); ModelUtils.attachResource(expectedURI, expectedModel); p.getEClassifiers().remove(class1); rightModel = EcoreUtil.copy(p); URI rightURI = URI.createURI("rightmodel.ecore"); ModelUtils.attachResource(rightURI, rightModel); }
/** * {@inheritDoc} * * @see * org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification) */ public void updatePart(Notification msg) { if (editingPart.isVisible()) { PropertiesEditionElementPropertiesEditionPart basePart = (PropertiesEditionElementPropertiesEditionPart) editingPart; if (MappingPackage.eINSTANCE.getAbstractPropertyBinding_Name().equals(msg.getFeature()) && basePart != null && isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Properties.name)) { if (msg.getNewValue() != null) { basePart.setName( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { basePart.setName(""); } } if (MappingPackage.eINSTANCE.getAbstractPropertyBinding_Views().equals(msg.getFeature()) && isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Binding.views)) basePart.updateViews(); if (MappingPackage.eINSTANCE.getEMFPropertyBinding_Model().equals(msg.getFeature()) && basePart != null && isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Binding.model)) basePart.setModel((EObject) msg.getNewValue()); if (ComponentsPackage.eINSTANCE.getEEFElement_HelpID().equals(msg.getFeature()) && basePart != null && isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Properties.helpID)) { if (msg.getNewValue() != null) { basePart.setHelpID( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { basePart.setHelpID(""); } } } }
protected Item copyFromResource(Resource createResource, String newItemLabel) throws PersistenceException, BusinessException { if (newItemLabel != null) { Item newItem = (Item) EcoreUtil.getObjectByType( createResource.getContents(), PropertiesPackage.eINSTANCE.getItem()); Property property = newItem.getProperty(); property.setId(getNextId()); property.setAuthor(getRepositoryContext().getUser()); property.setLabel(newItemLabel); property.setDisplayName(newItemLabel); // BUG TDI-25050:If here throw exception,it will block the copy action // if (!isNameAvailable(getRepositoryContext().getProject(), property.getItem(), null)) { // throw new // BusinessException(Messages.getString("AbstractEMFRepositoryFactory.cannotGenerateItem")); // //$NON-NLS-1$ // } EcoreUtil.resolveAll(createResource); return newItem; } else { boolean changeLabelWithCopyPrefix = true; return copyFromResource(createResource, changeLabelWithCopyPrefix); } }
/** * {@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()) { ReferencePropertiesEditionPart referencePart = (ReferencePropertiesEditionPart) editingPart; if (EnvironmentPackage.eINSTANCE.getProperty_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && referencePart != null && isAccessible(EnvironmentViewsRepository.Reference.Properties.name)) { if (msg.getNewValue() != null) { referencePart.setName( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { referencePart.setName(""); } } if (EnvironmentPackage.eINSTANCE.getReference_ReferencedType().equals(msg.getFeature()) && referencePart != null && isAccessible(EnvironmentViewsRepository.Reference.Properties.referencedType)) referencePart.setReferencedType((EObject) msg.getNewValue()); if (EnvironmentPackage.eINSTANCE.getProperty_Multiplicity().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && isAccessible(EnvironmentViewsRepository.Reference.Properties.multiplicity)) referencePart.setMultiplicity((MultiplicityKind) msg.getNewValue()); if (EnvironmentPackage.eINSTANCE.getReference_IsComposite().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && referencePart != null && isAccessible(EnvironmentViewsRepository.Reference.Properties.isComposite)) referencePart.setIsComposite((Boolean) msg.getNewValue()); if (EnvironmentPackage.eINSTANCE.getReference_Navigable().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && referencePart != null && isAccessible(EnvironmentViewsRepository.Reference.Properties.navigable)) referencePart.setNavigable((Boolean) msg.getNewValue()); if (EnvironmentPackage.eINSTANCE.getReference_OppositeOf().equals(msg.getFeature()) && referencePart != null && isAccessible(EnvironmentViewsRepository.Reference.Properties.oppositeOf)) referencePart.setOppositeOf((EObject) msg.getNewValue()); if (EnvironmentPackage.eINSTANCE.getProperty_IsIdentifier().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && referencePart != null && isAccessible(EnvironmentViewsRepository.Reference.Properties.identifier)) referencePart.setIdentifier((Boolean) msg.getNewValue()); if (EnvironmentPackage.eINSTANCE.getObeoDSMObject_Description().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && referencePart != null && isAccessible(EnvironmentViewsRepository.Reference.Properties.description)) { if (msg.getNewValue() != null) { referencePart.setDescription( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { referencePart.setDescription(""); } } } }
/** @generated */ public boolean equals(Object obj) { if (obj instanceof hub.top.editor.ptnetLoLA.diagram.navigator.PtnetLoLANavigatorItem) { return EcoreUtil.getURI(getView()) .equals( EcoreUtil.getURI( ((hub.top.editor.ptnetLoLA.diagram.navigator.PtnetLoLANavigatorItem) obj) .getView())); } return super.equals(obj); }
/** @generated */ public boolean equals(Object obj) { if (obj instanceof org.eclipse.papyrus.uml.diagram.clazz.navigator.UMLDomainNavigatorItem) { return EcoreUtil.getURI(getEObject()) .equals( EcoreUtil.getURI( ((org.eclipse.papyrus.uml.diagram.clazz.navigator.UMLDomainNavigatorItem) obj) .getEObject())); } return super.equals(obj); }
@Lock(LockType.WRITE) private EObject getEObjectByID(String type, String id) { TreeIterator<EObject> eAllContents = resourceLoader.getResource().getAllContents(); while (eAllContents.hasNext()) { EObject next = eAllContents.next(); if (next.eClass().getInstanceTypeName().equals(type) && EcoreUtil.getID(next) != null && EcoreUtil.getID(next).equals(id)) return next; } throw new WebApplicationException(Response.Status.NOT_FOUND); }
private void assertOutputObject(ModelExtent outModel) { EPackage result = (EPackage) EcoreUtil.getObjectByType(outModel.getContents(), EcorePackage.eINSTANCE.getEPackage()); EPackage input = (EPackage) EcoreUtil.getObjectByType(fInput.getContents(), EcorePackage.eINSTANCE.getEPackage()); assertEquals(input.getName() + "_Ecore2Ecore", result.getName()); assertUnchangedInput(); }
private void copyContent(Scenario source, Scenario target) { target.setContent(EcoreUtil.copy(source.getContent())); target.setTeslaContent(EcoreUtil.copy(source.getTeslaContent())); target.getAttachments().clear(); target.getAttachments().addAll(EcoreUtil.copyAll(source.getAttachments())); target.getContexts().clear(); target.getContexts().addAll(source.getContexts()); target.getVerifications().clear(); target.getVerifications().addAll(source.getVerifications()); target.setDescription(source.getDescription()); }
/** @generated */ @Override public boolean equals(Object obj) { if (obj instanceof org.eclipse.papyrus.uml.diagram.profile.navigator.UMLNavigatorItem) { return EcoreUtil.getURI(getView()) .equals( EcoreUtil.getURI( ((org.eclipse.papyrus.uml.diagram.profile.navigator.UMLNavigatorItem) obj) .getView())); } return super.equals(obj); }
@Test public void containingListAndIndex() { EObject obj0 = EcoreUtil.create(eClass0); assertNull(EMFUtils.getContainingList(obj0)); assertEquals(-1, EMFUtils.getIndexWithinParent(obj0)); EObject obj1 = EcoreUtil.create(eClass1); assertNull(EMFUtils.getContainingList(obj1)); assertEquals(-1, EMFUtils.getIndexWithinParent(obj1)); EMFUtils.setOrAdd(obj1, multiRef, obj0); assertTrue(obj1.eGet(multiRef) == EMFUtils.getContainingList(obj0)); assertEquals(0, EMFUtils.getIndexWithinParent(obj0)); }
/** @generated */ public boolean equals(Object obj) { if (obj instanceof org.spbu.pldoctoolkit.graph.diagram.fproduct.navigator.DrlModelNavigatorItem) { return EcoreUtil.getURI(getView()) .equals( EcoreUtil.getURI( ((org.spbu.pldoctoolkit.graph.diagram.fproduct.navigator.DrlModelNavigatorItem) obj) .getView())); } return super.equals(obj); }