org.eclipse.emf.ecore.EcorePackage Java Examples

The following examples show how to use org.eclipse.emf.ecore.EcorePackage. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MetamodelTest.java    From xtext-core with Eclipse Public License 2.0 7 votes vote down vote up
@Test public void testDerivedModel() {
	EPackage pack = DatatypeRulesTestLanguagePackage.eINSTANCE;
	EClass model = (EClass) pack.getEClassifier("Model");
	assertNotNull(model);
	EStructuralFeature feature = model.getEStructuralFeature("id");
	assertNotNull(feature);
	assertEquals(EcorePackage.Literals.ESTRING, feature.getEType());
	feature = model.getEStructuralFeature("value");
	assertNotNull(feature);
	assertEquals(EcorePackage.Literals.EBIG_DECIMAL, feature.getEType());
	feature = model.getEStructuralFeature("vector");
	assertNotNull(feature);
	assertEquals(EcorePackage.Literals.ESTRING, feature.getEType());
	feature = model.getEStructuralFeature("dots");
	assertNotNull(feature);
	assertEquals(EcorePackage.Literals.ESTRING, feature.getEType());
}
 
Example #2
Source File: NoDocumentationInferenceXcoreEcoreBuilder.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void handleAnnotations(XModelElement xModelElement, EModelElement eModelElement) {
	super.handleAnnotations(xModelElement, eModelElement);

	// the following special handling only applies to EPackages
	if (!(eModelElement instanceof EPackage)) {
		return;
	}

	// obtain annotation that was created based on the automatic inference of copyright headers
	Optional<EAnnotation> inferredAnnotations = eModelElement.getEAnnotations().stream()
			.filter(a -> a.getSource().equals(GenModelPackage.eNS_URI))
			// find annotation that is added automatically by inferring copyright header
			.filter(a -> a.getDetails().containsKey("documentation") && a.getDetails().size() == 1)
			.findFirst();

	// delete @Ecore annotation as it is not present in an incremental build
	Optional<EAnnotation> ecoreAnnotation = eModelElement.getEAnnotations().stream()
			.filter(a -> a.getSource().equals(EcorePackage.eNS_URI))
			.findFirst();

	// removes annotation from container
	inferredAnnotations.ifPresent(a -> eModelElement.getEAnnotations().remove(a));
	ecoreAnnotation.ifPresent(a -> eModelElement.getEAnnotations().remove(a));
}
 
Example #3
Source File: LocalUniqueNameContext.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Iterable<IEObjectDescription> getExportedObjects(EClass type, QualifiedName name, boolean ignoreCase) {
	Preconditions.checkArgument(!ignoreCase);
	Object result = index.get(name.getFirstSegment());
	if (result == null) {
		return Collections.emptyList();
	}
	if (result instanceof IEObjectDescription) {
		if (EcoreUtil2.isAssignableFrom(type, ((IEObjectDescription) result).getEClass())) {
			return Collections.singletonList((IEObjectDescription)result);
		}
		return Collections.emptyList();
	}
	@SuppressWarnings("unchecked")
	List<IEObjectDescription> casted = (List<IEObjectDescription>) result;
	if (type == EcorePackage.Literals.EOBJECT) {
		return casted;
	}
	return FluentIterable.from(casted).filter(it -> EcoreUtil2.isAssignableFrom(type, it.getEClass()));
}
 
Example #4
Source File: ChannelPropertiesEditionComponent.java    From eip-designer with Apache License 2.0 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()) {
		ChannelPropertiesEditionPart basePart = (ChannelPropertiesEditionPart)editingPart;
		if (EipPackage.eINSTANCE.getChannel_ToEndpoint().equals(msg.getFeature()) && basePart != null && isAccessible(EipViewsRepository.Channel.Properties.toEndpoint))
			basePart.setToEndpoint((EObject)msg.getNewValue());
		if (EipPackage.eINSTANCE.getChannel_FromEndpoint().equals(msg.getFeature()) && basePart != null && isAccessible(EipViewsRepository.Channel.Properties.fromEndpoint))
			basePart.setFromEndpoint((EObject)msg.getNewValue());
		if (EipPackage.eINSTANCE.getChannel_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(EipViewsRepository.Channel.Properties.name)) {
			if (msg.getNewValue() != null) {
				basePart.setName(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				basePart.setName("");
			}
		}
		if (EipPackage.eINSTANCE.getChannel_Guaranteed().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(EipViewsRepository.Channel.Properties.guaranteed))
			basePart.setGuaranteed((Boolean)msg.getNewValue());
		
		
	}
}
 
Example #5
Source File: EClassInfoTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testContainsCompatibleFeature_01() throws Exception {
	EcorePackage pack = EcorePackage.eINSTANCE;
	EClass eClass = pack.getEClass();
	EClassInfo objectUnderTest = new EClassifierInfo.EClassInfo(eClass, false, Collections.<String>emptySet(), null);
	assertEquals(true,objectUnderTest.containsCompatibleFeature("name", false, true, pack.getEString(), new StringBuilder()));
	assertEquals(false,objectUnderTest.containsCompatibleFeature("name", true, true, pack.getEString(), new StringBuilder()));
	assertEquals(false,objectUnderTest.containsCompatibleFeature("name", true, true, pack.getEAnnotation(), new StringBuilder()));
	assertEquals(false,objectUnderTest.containsCompatibleFeature("name", true, true, pack.getEShort(), new StringBuilder()));
	assertEquals(false,objectUnderTest.containsCompatibleFeature("names", false, true, pack.getEString(), new StringBuilder()));
	
	assertEquals(true,objectUnderTest.containsCompatibleFeature("eStructuralFeatures", true, true, pack.getEAttribute(), new StringBuilder()));
	assertEquals(true,objectUnderTest.containsCompatibleFeature("eStructuralFeatures", true, true, pack.getEReference(), new StringBuilder()));
	assertEquals(true,objectUnderTest.containsCompatibleFeature("eStructuralFeatures", true, true, pack.getEStructuralFeature(), new StringBuilder()));
	assertEquals(false,objectUnderTest.containsCompatibleFeature("eStructuralFeatures", false, true, pack.getEStructuralFeature(), new StringBuilder()));
	assertEquals(false,objectUnderTest.containsCompatibleFeature("eStructuralFeatures", true, true, pack.getEAnnotation(), new StringBuilder()));
}
 
Example #6
Source File: DomPackageImpl.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
 *
 * <p>This method is used to initialize {@link DomPackage#eINSTANCE} when that field is accessed.
 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @see #eNS_URI
 * @see #createPackageContents()
 * @see #initializePackageContents()
 * @generated
 */
public static DomPackage init() {
	if (isInited) return (DomPackage)EPackage.Registry.INSTANCE.getEPackage(DomPackage.eNS_URI);

	// Obtain or create and register package
	Object registeredDomPackage = EPackage.Registry.INSTANCE.get(eNS_URI);
	DomPackageImpl theDomPackage = registeredDomPackage instanceof DomPackageImpl ? (DomPackageImpl)registeredDomPackage : new DomPackageImpl();

	isInited = true;

	// Initialize simple dependencies
	EcorePackage.eINSTANCE.eClass();

	// Create package meta-data objects
	theDomPackage.createPackageContents();

	// Initialize created meta-data
	theDomPackage.initializePackageContents();

	// Mark meta-data to indicate it can't be changed
	theDomPackage.freeze();

	// Update the registry and return the package
	EPackage.Registry.INSTANCE.put(DomPackage.eNS_URI, theDomPackage);
	return theDomPackage;
}
 
Example #7
Source File: EcoreResourceDescriptionManagerTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testPerformance() throws Exception {
		GenericResourceDescriptionManager manager = getEmfResourceDescriptionsManager();
		Collection<String> uris = ImmutableList.copyOf(EPackage.Registry.INSTANCE.keySet());
		for(String uri: uris) {
			EPackage pack = EPackage.Registry.INSTANCE.getEPackage(uri);
			IResourceDescription description = manager.getResourceDescription(pack.eResource());
			assertNotNull(description);
			for(int i = 0; i < 10; i++) {
				Iterator<EObject> iter = EcoreUtil.getAllProperContents(pack, true);
				while(iter.hasNext()) {
					EObject next = iter.next();
					if (next instanceof ENamedElement) {
						String name = ((ENamedElement) next).getName();
//						Iterable<IEObjectDescription> objects = 
						description.getExportedObjects(EcorePackage.Literals.EOBJECT, QualifiedName.create(name), false);
//						assertFalse(name + " - " + uri + " - " + next, Iterables.isEmpty(objects));
					}
				}
			}
		}
	}
 
Example #8
Source File: FilterPropertiesEditionComponent.java    From eip-designer with Apache License 2.0 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()) {
		FilterPropertiesEditionPart basePart = (FilterPropertiesEditionPart)editingPart;
		if (EipPackage.eINSTANCE.getEndpoint_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(EipViewsRepository.Filter.Properties.name)) {
			if (msg.getNewValue() != null) {
				basePart.setName(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				basePart.setName("");
			}
		}
		if (EipPackage.eINSTANCE.getEndpoint_ToChannels().equals(msg.getFeature())  && isAccessible(EipViewsRepository.Filter.Properties.toChannels))
			basePart.updateToChannels();
		if (EipPackage.eINSTANCE.getEndpoint_FromChannels().equals(msg.getFeature())  && isAccessible(EipViewsRepository.Filter.Properties.fromChannels))
			basePart.updateFromChannels();
		if (EipPackage.eINSTANCE.getFilter_Expression().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(EipViewsRepository.Filter.Properties.expression)) {
			if (msg.getNewValue() != null) {
				basePart.setExpression(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
			} else {
				basePart.setExpression("");
			}
		}
		
	}
}
 
Example #9
Source File: DeclarativeValidatorTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testWarningWithSource() {
	AbstractDeclarativeValidator test = new AbstractDeclarativeValidator() {
		@Check
		public void foo(Object x) {
			warning(
					"Error Message", 
					EcorePackage.eINSTANCE.getEAnnotation(), 
					EcorePackage.Literals.ENAMED_ELEMENT__NAME,
					ValidationMessageAcceptor.INSIGNIFICANT_INDEX);
		}
	};
	BasicDiagnostic chain = new BasicDiagnostic();
	test.validate(EcorePackage.eINSTANCE.getEClass(), chain, Collections.emptyMap());
	assertEquals(1, chain.getChildren().size());

	Diagnostic diag = chain.getChildren().get(0);
	assertEquals("Error Message", diag.getMessage());
	assertEquals(EcorePackage.eINSTANCE.getEAnnotation().toString(), diag.getSource());
	assertEquals(Diagnostic.WARNING, diag.getSeverity());
}
 
Example #10
Source File: Scaler.java    From BIMserver with GNU Affero General Public License v3.0 6 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
private void setDoubleAsStringValues(IdEObject idEObject) {
	for (EAttribute eAttribute : idEObject.eClass().getEAllAttributes()) {
		if (eAttribute.getEType() == EcorePackage.eINSTANCE.getEDouble()) {
			EStructuralFeature asStringFeature = idEObject.eClass().getEStructuralFeature(eAttribute.getName() + "AsString");
			if (asStringFeature != null) {
				if (eAttribute.isMany()) {
					List list = (List) idEObject.eGet(eAttribute);
					List listAsString = (List) idEObject.eGet(asStringFeature);
					for (int i = 0; i < list.size(); i++) {
						listAsString.set(i, "" + list.get(i));
					}
				} else {
					idEObject.eSet(asStringFeature, "" + idEObject.eGet(eAttribute));
				}
			}
		}
	}
}
 
Example #11
Source File: ResourceSetBasedResourceDescriptionsTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testDataBasedResourceSetBasedResourceDescriptions() throws Exception {
	ResourceDescriptionsData data = new ResourceDescriptionsData(new ArrayList<IResourceDescription>());
	ResourceDescriptionsData.ResourceSetAdapter.installResourceDescriptionsData(resourceSet, data);
	resDescs.setContext(resourceSet);
	
	Resource resource = createResource();
	QualifiedName name = QualifiedName.create("SomeName");
	createNamedElement(name, EcorePackage.Literals.ECLASS, resource);
	// still empty
	assertFalse(resDescs.getAllResourceDescriptions().iterator().hasNext());
	assertTrue(resDescs.isEmpty());
	assertFalse(resDescs.getExportedObjectsByType(EcorePackage.Literals.ECLASS).iterator().hasNext());
	assertFalse(resDescs.getExportedObjects(EcorePackage.Literals.ECLASS,name, false).iterator().hasNext());
	assertFalse(resDescs.getExportedObjects().iterator().hasNext());
	
	// add resource description to data
	IResourceDescription description = resourceDescriptionManager.getResourceDescription(resource);
	data.addDescription(description.getURI(), description);
	// now contained
	assertSame(description, resDescs.getAllResourceDescriptions().iterator().next());
	assertFalse(resDescs.isEmpty());
	assertTrue(resDescs.getExportedObjectsByType(EcorePackage.Literals.ECLASS).iterator().hasNext());
	assertTrue(resDescs.getExportedObjects(EcorePackage.Literals.ECLASS,name, false).iterator().hasNext());
	assertFalse(resDescs.getExportedObjects(EcorePackage.Literals.EATTRIBUTE,name, false).iterator().hasNext());
	assertTrue(resDescs.getExportedObjects().iterator().hasNext());
}
 
Example #12
Source File: XtextPackageImpl.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
 * 
 * <p>This method is used to initialize {@link XtextPackage#eINSTANCE} when that field is accessed.
 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @see #eNS_URI
 * @see #createPackageContents()
 * @see #initializePackageContents()
 * @generated
 */
public static XtextPackage init() {
	if (isInited) return (XtextPackage)EPackage.Registry.INSTANCE.getEPackage(XtextPackage.eNS_URI);

	// Obtain or create and register package
	XtextPackageImpl theXtextPackage = (XtextPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof XtextPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new XtextPackageImpl());

	isInited = true;

	// Initialize simple dependencies
	EcorePackage.eINSTANCE.eClass();

	// Create package meta-data objects
	theXtextPackage.createPackageContents();

	// Initialize created meta-data
	theXtextPackage.initializePackageContents();

	// Mark meta-data to indicate it can't be changed
	theXtextPackage.freeze();

 
	// Update the registry and return the package
	EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, theXtextPackage);
	return theXtextPackage;
}
 
Example #13
Source File: DeclarativeValidatorTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testErrorWithSource() {
	AbstractDeclarativeValidator test = new AbstractDeclarativeValidator() {
		@Check
		public void foo(Object x) {
			error(
					"Error Message", 
					EcorePackage.eINSTANCE.getEAnnotation(), 
					EcorePackage.Literals.ENAMED_ELEMENT__NAME,
					ValidationMessageAcceptor.INSIGNIFICANT_INDEX);
		}
	};
	BasicDiagnostic chain = new BasicDiagnostic();
	test.validate(EcorePackage.eINSTANCE.getEClass(), chain, Collections.emptyMap());
	assertEquals(1, chain.getChildren().size());

	Diagnostic diag = chain.getChildren().get(0);
	assertEquals("Error Message", diag.getMessage());
	assertEquals(EcorePackage.eINSTANCE.getEAnnotation().toString(), diag.getSource());
	assertEquals(Diagnostic.ERROR, diag.getSeverity());
}
 
Example #14
Source File: EpatchTestLanguagePackageImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
 *
 * <p>This method is used to initialize {@link EpatchTestLanguagePackage#eINSTANCE} when that field is accessed.
 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @see #eNS_URI
 * @see #createPackageContents()
 * @see #initializePackageContents()
 * @generated
 */
public static EpatchTestLanguagePackage init()
{
  if (isInited) return (EpatchTestLanguagePackage)EPackage.Registry.INSTANCE.getEPackage(EpatchTestLanguagePackage.eNS_URI);

  // Obtain or create and register package
  Object registeredEpatchTestLanguagePackage = EPackage.Registry.INSTANCE.get(eNS_URI);
  EpatchTestLanguagePackageImpl theEpatchTestLanguagePackage = registeredEpatchTestLanguagePackage instanceof EpatchTestLanguagePackageImpl ? (EpatchTestLanguagePackageImpl)registeredEpatchTestLanguagePackage : new EpatchTestLanguagePackageImpl();

  isInited = true;

  // Initialize simple dependencies
  EcorePackage.eINSTANCE.eClass();

  // Create package meta-data objects
  theEpatchTestLanguagePackage.createPackageContents();

  // Initialize created meta-data
  theEpatchTestLanguagePackage.initializePackageContents();

  // Mark meta-data to indicate it can't be changed
  theEpatchTestLanguagePackage.freeze();

  // Update the registry and return the package
  EPackage.Registry.INSTANCE.put(EpatchTestLanguagePackage.eNS_URI, theEpatchTestLanguagePackage);
  return theEpatchTestLanguagePackage;
}
 
Example #15
Source File: GlobalRegistries.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public static void initializeDefaults() {
	//EMF Standalone setup
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(EcorePackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);
}
 
Example #16
Source File: ExportScopeProvider.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create a scope containing the EClasses of an EPackage.
 * 
 * @param parent
 *          The parent scope
 * @param importedPackage
 *          The Import of the package
 * @return The scope
 */
private IScope createEClassScope(final IScope parent, final Import importedPackage) {
  final String prefix = importedPackage.getPackageName();
  final Iterable<EClass> classes = Iterables.filter(importedPackage.getPackage().getEClassifiers(), EClass.class);
  final Iterable<IEObjectDescription> elements = EObjectDescriptions.<EClass> all(classes, NameFunctions.pair(NameFunctions.fromFeature(EcorePackage.Literals.ENAMED_ELEMENT__NAME), new AbstractNameFunction() {

    public QualifiedName apply(final EObject from) {
      return QualifiedName.create(prefix, ((EClass) from).getName());
    }
  }));
  return new SimpleScope(parent, elements);
}
 
Example #17
Source File: KeywordsTestLanguagePackageImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
 *
 * <p>This method is used to initialize {@link KeywordsTestLanguagePackage#eINSTANCE} when that field is accessed.
 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @see #eNS_URI
 * @see #createPackageContents()
 * @see #initializePackageContents()
 * @generated
 */
public static KeywordsTestLanguagePackage init()
{
  if (isInited) return (KeywordsTestLanguagePackage)EPackage.Registry.INSTANCE.getEPackage(KeywordsTestLanguagePackage.eNS_URI);

  // Obtain or create and register package
  Object registeredKeywordsTestLanguagePackage = EPackage.Registry.INSTANCE.get(eNS_URI);
  KeywordsTestLanguagePackageImpl theKeywordsTestLanguagePackage = registeredKeywordsTestLanguagePackage instanceof KeywordsTestLanguagePackageImpl ? (KeywordsTestLanguagePackageImpl)registeredKeywordsTestLanguagePackage : new KeywordsTestLanguagePackageImpl();

  isInited = true;

  // Initialize simple dependencies
  EcorePackage.eINSTANCE.eClass();

  // Create package meta-data objects
  theKeywordsTestLanguagePackage.createPackageContents();

  // Initialize created meta-data
  theKeywordsTestLanguagePackage.initializePackageContents();

  // Mark meta-data to indicate it can't be changed
  theKeywordsTestLanguagePackage.freeze();

  // Update the registry and return the package
  EPackage.Registry.INSTANCE.put(KeywordsTestLanguagePackage.eNS_URI, theKeywordsTestLanguagePackage);
  return theKeywordsTestLanguagePackage;
}
 
Example #18
Source File: IgnoreCaseLinkingTestPackageImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
 *
 * <p>This method is used to initialize {@link IgnoreCaseLinkingTestPackage#eINSTANCE} when that field is accessed.
 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @see #eNS_URI
 * @see #createPackageContents()
 * @see #initializePackageContents()
 * @generated
 */
public static IgnoreCaseLinkingTestPackage init()
{
  if (isInited) return (IgnoreCaseLinkingTestPackage)EPackage.Registry.INSTANCE.getEPackage(IgnoreCaseLinkingTestPackage.eNS_URI);

  // Obtain or create and register package
  Object registeredIgnoreCaseLinkingTestPackage = EPackage.Registry.INSTANCE.get(eNS_URI);
  IgnoreCaseLinkingTestPackageImpl theIgnoreCaseLinkingTestPackage = registeredIgnoreCaseLinkingTestPackage instanceof IgnoreCaseLinkingTestPackageImpl ? (IgnoreCaseLinkingTestPackageImpl)registeredIgnoreCaseLinkingTestPackage : new IgnoreCaseLinkingTestPackageImpl();

  isInited = true;

  // Initialize simple dependencies
  EcorePackage.eINSTANCE.eClass();

  // Create package meta-data objects
  theIgnoreCaseLinkingTestPackage.createPackageContents();

  // Initialize created meta-data
  theIgnoreCaseLinkingTestPackage.initializePackageContents();

  // Mark meta-data to indicate it can't be changed
  theIgnoreCaseLinkingTestPackage.freeze();

  // Update the registry and return the package
  EPackage.Registry.INSTANCE.put(IgnoreCaseLinkingTestPackage.eNS_URI, theIgnoreCaseLinkingTestPackage);
  return theIgnoreCaseLinkingTestPackage;
}
 
Example #19
Source File: UnassignedRuleCallTestLanguagePackageImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
 *
 * <p>This method is used to initialize {@link UnassignedRuleCallTestLanguagePackage#eINSTANCE} when that field is accessed.
 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @see #eNS_URI
 * @see #createPackageContents()
 * @see #initializePackageContents()
 * @generated
 */
public static UnassignedRuleCallTestLanguagePackage init()
{
  if (isInited) return (UnassignedRuleCallTestLanguagePackage)EPackage.Registry.INSTANCE.getEPackage(UnassignedRuleCallTestLanguagePackage.eNS_URI);

  // Obtain or create and register package
  Object registeredUnassignedRuleCallTestLanguagePackage = EPackage.Registry.INSTANCE.get(eNS_URI);
  UnassignedRuleCallTestLanguagePackageImpl theUnassignedRuleCallTestLanguagePackage = registeredUnassignedRuleCallTestLanguagePackage instanceof UnassignedRuleCallTestLanguagePackageImpl ? (UnassignedRuleCallTestLanguagePackageImpl)registeredUnassignedRuleCallTestLanguagePackage : new UnassignedRuleCallTestLanguagePackageImpl();

  isInited = true;

  // Initialize simple dependencies
  EcorePackage.eINSTANCE.eClass();

  // Create package meta-data objects
  theUnassignedRuleCallTestLanguagePackage.createPackageContents();

  // Initialize created meta-data
  theUnassignedRuleCallTestLanguagePackage.initializePackageContents();

  // Mark meta-data to indicate it can't be changed
  theUnassignedRuleCallTestLanguagePackage.freeze();

  // Update the registry and return the package
  EPackage.Registry.INSTANCE.put(UnassignedRuleCallTestLanguagePackage.eNS_URI, theUnassignedRuleCallTestLanguagePackage);
  return theUnassignedRuleCallTestLanguagePackage;
}
 
Example #20
Source File: CsvSinkEditPart.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void handleNotificationEvent(Notification event) {
	if (event.getNotifier() == getModel()
			&& EcorePackage.eINSTANCE.getEModelElement_EAnnotations().equals(event.getFeature())) {
		handleMajorSemanticChange();
	} else {
		super.handleNotificationEvent(event);
	}
}
 
Example #21
Source File: QualifiedNamePackageImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
 *
 * <p>This method is used to initialize {@link QualifiedNamePackage#eINSTANCE} when that field is accessed.
 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @see #eNS_URI
 * @see #createPackageContents()
 * @see #initializePackageContents()
 * @generated
 */
public static QualifiedNamePackage init()
{
  if (isInited) return (QualifiedNamePackage)EPackage.Registry.INSTANCE.getEPackage(QualifiedNamePackage.eNS_URI);

  // Obtain or create and register package
  Object registeredQualifiedNamePackage = EPackage.Registry.INSTANCE.get(eNS_URI);
  QualifiedNamePackageImpl theQualifiedNamePackage = registeredQualifiedNamePackage instanceof QualifiedNamePackageImpl ? (QualifiedNamePackageImpl)registeredQualifiedNamePackage : new QualifiedNamePackageImpl();

  isInited = true;

  // Initialize simple dependencies
  EcorePackage.eINSTANCE.eClass();

  // Create package meta-data objects
  theQualifiedNamePackage.createPackageContents();

  // Initialize created meta-data
  theQualifiedNamePackage.initializePackageContents();

  // Mark meta-data to indicate it can't be changed
  theQualifiedNamePackage.freeze();

  // Update the registry and return the package
  EPackage.Registry.INSTANCE.put(QualifiedNamePackage.eNS_URI, theQualifiedNamePackage);
  return theQualifiedNamePackage;
}
 
Example #22
Source File: OtherTestPackageImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
 *
 * <p>This method is used to initialize {@link OtherTestPackage#eINSTANCE} when that field is accessed.
 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @see #eNS_URI
 * @see #createPackageContents()
 * @see #initializePackageContents()
 * @generated
 */
public static OtherTestPackage init()
{
  if (isInited) return (OtherTestPackage)EPackage.Registry.INSTANCE.getEPackage(OtherTestPackage.eNS_URI);

  // Obtain or create and register package
  Object registeredOtherTestPackage = EPackage.Registry.INSTANCE.get(eNS_URI);
  OtherTestPackageImpl theOtherTestPackage = registeredOtherTestPackage instanceof OtherTestPackageImpl ? (OtherTestPackageImpl)registeredOtherTestPackage : new OtherTestPackageImpl();

  isInited = true;

  // Initialize simple dependencies
  EcorePackage.eINSTANCE.eClass();

  // Obtain or create and register interdependencies
  Object registeredPackage = EPackage.Registry.INSTANCE.getEPackage(SimpleTestPackage.eNS_URI);
  SimpleTestPackageImpl theSimpleTestPackage = (SimpleTestPackageImpl)(registeredPackage instanceof SimpleTestPackageImpl ? registeredPackage : SimpleTestPackage.eINSTANCE);

  // Create package meta-data objects
  theOtherTestPackage.createPackageContents();
  theSimpleTestPackage.createPackageContents();

  // Initialize created meta-data
  theOtherTestPackage.initializePackageContents();
  theSimpleTestPackage.initializePackageContents();

  // Mark meta-data to indicate it can't be changed
  theOtherTestPackage.freeze();

  // Update the registry and return the package
  EPackage.Registry.INSTANCE.put(OtherTestPackage.eNS_URI, theOtherTestPackage);
  return theOtherTestPackage;
}
 
Example #23
Source File: EmfResourceRenameStrategy.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected EAttribute getNameAttribute(EObject targetElement) {
	if (targetElement instanceof ENamedElement) {
		return EcorePackage.Literals.ENAMED_ELEMENT__NAME;
	}
	return null;
}
 
Example #24
Source File: ToEcoreTrafoTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
private XtextResource getResource(String uri) {
	XtextResourceSet set = get(XtextResourceSet.class);
	URI nsURI = URI.createURI(EcorePackage.eNS_URI);
	URI platformURI = URI.createURI("platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore");
	set.getURIConverter().getURIMap().put(platformURI, nsURI);
	set.getURIResourceMap().put(platformURI, set.getResource(nsURI, true));
	set.setClasspathURIContext(getClass().getClassLoader());
	// if(AllTests.isPluginContext) {
	// set.setClasspathUriResolver(new BundleClasspathUriResolver());
	// set.setClasspathURIContext(Activator.getDefault());
	// }
	XtextResource r = (XtextResource) set.getResource(URI.createURI(uri), true);
	return r;
}
 
Example #25
Source File: ImportScopeTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testMultipleElementsByName_01() throws Exception {
	final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
	final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EATTRIBUTE, null);
	SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), true);
	ImportNormalizer n1 = new ImportNormalizer(QualifiedName.create("COM"), true, true);
	ImportNormalizer n2 = new ImportNormalizer(QualifiedName.create("DE"), true, true);
	TestableImportScope scope = new TestableImportScope(newArrayList(n1,n2), outer, new ScopeBasedSelectable(outer), EcorePackage.Literals.EOBJECT, true);
	
	assertNotNull(scope.getSingleElement(QualifiedName.create("Foo")));
	Iterable<IEObjectDescription> elements = scope.getLocalElementsByName(QualifiedName.create("Foo"));
	assertEquals(2,size(elements));
}
 
Example #26
Source File: ValidPackageImpl.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
 * 
 * <p>This method is used to initialize {@link ValidPackage#eINSTANCE} when that field is accessed.
 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @see #eNS_URI
 * @see #createPackageContents()
 * @see #initializePackageContents()
 * @generated
 */
public static ValidPackage init()
{
  if (isInited) return (ValidPackage)EPackage.Registry.INSTANCE.getEPackage(ValidPackage.eNS_URI);

  // Obtain or create and register package
  ValidPackageImpl theValidPackage = (ValidPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ValidPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ValidPackageImpl());

  isInited = true;

  // Initialize simple dependencies
  EcorePackage.eINSTANCE.eClass();

  // Create package meta-data objects
  theValidPackage.createPackageContents();

  // Initialize created meta-data
  theValidPackage.initializePackageContents();

  // Mark meta-data to indicate it can't be changed
  theValidPackage.freeze();


  // Update the registry and return the package
  EPackage.Registry.INSTANCE.put(ValidPackage.eNS_URI, theValidPackage);
  return theValidPackage;
}
 
Example #27
Source File: ImportScopeTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testGetAllLocalElements_01() throws Exception {
	final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
	final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EATTRIBUTE, null);
	SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), true);
	ImportNormalizer n1 = new ImportNormalizer(QualifiedName.create("COM"), true, true);
	ImportNormalizer n2 = new ImportNormalizer(QualifiedName.create("DE"), true, true);
	TestableImportScope scope = new TestableImportScope(newArrayList(n1,n2), outer, new ScopeBasedSelectable(outer), EcorePackage.Literals.EOBJECT, true);
	
	Iterable<IEObjectDescription> elements = scope.getAllLocalElements();
	assertEquals(2,size(elements));
}
 
Example #28
Source File: ImportScopeTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testGetAllWithDuplicates() throws Exception {
	final IEObjectDescription desc1 = EObjectDescription.create(QualifiedName.create("com","foo","bar"), EcorePackage.Literals.EANNOTATION);
	final IEObjectDescription desc2 = EObjectDescription.create(QualifiedName.create("com","foo","bar"), EcorePackage.Literals.EATTRIBUTE);
	SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), false);
	ImportNormalizer n1 = new ImportNormalizer(QualifiedName.create("com"), true, false);
	TestableImportScope scope = new TestableImportScope(newArrayList(n1), outer, new ScopeBasedSelectable(outer), EcorePackage.Literals.EOBJECT, false);
	assertEquals(4,size(scope.getAllElements()));
}
 
Example #29
Source File: Bug296889TestPackageImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
 *
 * <p>This method is used to initialize {@link Bug296889TestPackage#eINSTANCE} when that field is accessed.
 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @see #eNS_URI
 * @see #createPackageContents()
 * @see #initializePackageContents()
 * @generated
 */
public static Bug296889TestPackage init()
{
  if (isInited) return (Bug296889TestPackage)EPackage.Registry.INSTANCE.getEPackage(Bug296889TestPackage.eNS_URI);

  // Obtain or create and register package
  Object registeredBug296889TestPackage = EPackage.Registry.INSTANCE.get(eNS_URI);
  Bug296889TestPackageImpl theBug296889TestPackage = registeredBug296889TestPackage instanceof Bug296889TestPackageImpl ? (Bug296889TestPackageImpl)registeredBug296889TestPackage : new Bug296889TestPackageImpl();

  isInited = true;

  // Initialize simple dependencies
  EcorePackage.eINSTANCE.eClass();

  // Create package meta-data objects
  theBug296889TestPackage.createPackageContents();

  // Initialize created meta-data
  theBug296889TestPackage.initializePackageContents();

  // Mark meta-data to indicate it can't be changed
  theBug296889TestPackage.freeze();

  // Update the registry and return the package
  EPackage.Registry.INSTANCE.put(Bug296889TestPackage.eNS_URI, theBug296889TestPackage);
  return theBug296889TestPackage;
}
 
Example #30
Source File: EnumAndReferenceTestLanguagePackageImpl.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
 *
 * <p>This method is used to initialize {@link EnumAndReferenceTestLanguagePackage#eINSTANCE} when that field is accessed.
 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @see #eNS_URI
 * @see #createPackageContents()
 * @see #initializePackageContents()
 * @generated
 */
public static EnumAndReferenceTestLanguagePackage init()
{
  if (isInited) return (EnumAndReferenceTestLanguagePackage)EPackage.Registry.INSTANCE.getEPackage(EnumAndReferenceTestLanguagePackage.eNS_URI);

  // Obtain or create and register package
  Object registeredEnumAndReferenceTestLanguagePackage = EPackage.Registry.INSTANCE.get(eNS_URI);
  EnumAndReferenceTestLanguagePackageImpl theEnumAndReferenceTestLanguagePackage = registeredEnumAndReferenceTestLanguagePackage instanceof EnumAndReferenceTestLanguagePackageImpl ? (EnumAndReferenceTestLanguagePackageImpl)registeredEnumAndReferenceTestLanguagePackage : new EnumAndReferenceTestLanguagePackageImpl();

  isInited = true;

  // Initialize simple dependencies
  EcorePackage.eINSTANCE.eClass();

  // Create package meta-data objects
  theEnumAndReferenceTestLanguagePackage.createPackageContents();

  // Initialize created meta-data
  theEnumAndReferenceTestLanguagePackage.initializePackageContents();

  // Mark meta-data to indicate it can't be changed
  theEnumAndReferenceTestLanguagePackage.freeze();

  // Update the registry and return the package
  EPackage.Registry.INSTANCE.put(EnumAndReferenceTestLanguagePackage.eNS_URI, theEnumAndReferenceTestLanguagePackage);
  return theEnumAndReferenceTestLanguagePackage;
}