當前位置: 首頁>>代碼示例>>Java>>正文


Java EcoreFactory.eINSTANCE方法代碼示例

本文整理匯總了Java中org.eclipse.emf.ecore.EcoreFactory.eINSTANCE方法的典型用法代碼示例。如果您正苦於以下問題:Java EcoreFactory.eINSTANCE方法的具體用法?Java EcoreFactory.eINSTANCE怎麽用?Java EcoreFactory.eINSTANCE使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.emf.ecore.EcoreFactory的用法示例。


在下文中一共展示了EcoreFactory.eINSTANCE方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testAdapterIsCleared

import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
@Test public void testAdapterIsCleared() throws Exception {
	EcoreFactory factory = EcoreFactory.eINSTANCE;
	EClass eClass = factory.createEClass();
	Resource resource = new ResourceImpl();
	resource.getContents().add(eClass);
	CacheAdapter ca = new OnChangeEvictingCache().getOrCreate(resource);
	setValue(ca);
	EAttribute attribute = factory.createEAttribute();
	assertIsSet(ca);
	eClass.getEStructuralFeatures().add(attribute);
	assertIsNull(ca);
	setValue(ca);
	attribute.setName("Foo");
	assertIsNull(ca);
	setValue(ca);
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:17,代碼來源:OnChangeEvictingCacheAdapterTest.java

示例2: initialize

import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
@Before
public void initialize() {
  EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE;

  testClass = ecoreFactory.createEClass();

  testReference = ecoreFactory.createEReference();
  testReference.setEType(testClass);
  testReference.setContainment(true);
  testClass.getEStructuralFeatures().add(testReference);

  testReference2 = ecoreFactory.createEReference();
  testReference2.setEType(testClass);
  testReference2.setContainment(true);
  testClass.getEStructuralFeatures().add(testReference2);

  testPackage = ecoreFactory.createEPackage();
  testPackage.getEClassifiers().add(testClass);
  testPackage.setNsURI("http:///com.avaloq.tools.ddk.xtext.test");
  EPackage.Registry.INSTANCE.put(testPackage.getNsURI(), testPackage);
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:22,代碼來源:ShortFragmentProviderTest.java

示例3: init

import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
@Before
public void init() {
  EcoreFactory modelFactory = EcoreFactory.eINSTANCE;
  testModelPackage = modelFactory.createEPackage();
  testModelPackage.setName("TypeProviderTestEPackage");
  testModelPackage.setNsPrefix("typeprovidertestpackage");
  testModelPackage.setNsURI("http://testabstracttype");
  EFactory instanceFactory = testModelPackage.getEFactoryInstance();
  EClass clazz = createEClass("ExpressionContainer");
  expressionContainerReference = modelFactory.createEReference();
  clazz.getEStructuralFeatures().add(expressionContainerReference);
  expressionContainerReference.setName("expression");
  expressionContainerReference.setEType(typeModelPackage.getIExpression());
  expressionContainerReference.setContainment(true);
  expression1Container = instanceFactory.create(clazz);
  expression1Container.eSet(expressionContainerReference, expression1);
  expression2Container = instanceFactory.create(clazz);
  expression2Container.eSet(expressionContainerReference, expression2);
  expression3Container = instanceFactory.create(clazz);
  expression3Container.eSet(expressionContainerReference, expression3);
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:22,代碼來源:AbstractTypeProviderTest.java

示例4: setUp

import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
@Override
public void setUp() {
  super.setUp();
  final EcoreFactory factory = EcoreFactory.eINSTANCE;
  final EClass baseClass = factory.createEClass();
  baseClass.setName("Base");
  EList<EObject> _contents = this.primaryResource.getContents();
  _contents.add(baseClass);
  final EClass superClass = factory.createEClass();
  superClass.setName("SuperClass");
  EList<EObject> _contents_1 = this.referencedResource.getContents();
  _contents_1.add(superClass);
  EList<EClass> _eSuperTypes = baseClass.getESuperTypes();
  _eSuperTypes.add(superClass);
}
 
開發者ID:eclipse,項目名稱:xtext-extras,代碼行數:16,代碼來源:AbstractURIHandlerWithEcoreTest.java

示例5: testChangeable

import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
public void testChangeable(){
	EcorePackage pack = EcorePackage.eINSTANCE;
	EClass eClass = pack.getEClass();
	EClassInfo objectUnderTest = new EClassifierInfo.EClassInfo(eClass, false, Collections.<String>emptySet(), null);
	EcoreFactory fac = EcoreFactory.eINSTANCE;
	EReference reference = fac.createEReference();
	reference.setName("newReference");
	reference.setEType(eClass);
	reference.setChangeable(true);
	reference.setContainment(true);
	eClass.getEStructuralFeatures().add(reference);
	assertEquals(true,objectUnderTest.containsCompatibleFeature("newReference", false, true, eClass, new StringBuilder()));
	reference.setChangeable(false);
	assertEquals(false,objectUnderTest.containsCompatibleFeature("newReference", false, true, eClass, new StringBuilder()));
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:16,代碼來源:EClassInfoTest.java

示例6: getResource

import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
private Resource getResource(String resourceURI, String references) {
	XMIResourceImpl res = new XMIResourceImpl();
	res.setURI(URI.createURI(resourceURI));
	EcoreFactory f = EcoreFactory.eINSTANCE;
	EClass class1 = f.createEClass();
	res.getContents().add(class1);
	class1.setName("mytype");
	if (references!=null) {
		EClass referencedProxy = f.createEClass();
		String fragment = res.getURIFragment(class1);
		((InternalEObject)referencedProxy).eSetProxyURI(URI.createURI(references).appendFragment(fragment));
		class1.getESuperTypes().add(referencedProxy);
	}
	return res;
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:16,代碼來源:ResourceSetReferencingResourceSetTest.java

示例7: setUp

import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
	resource = new XMLResourceImpl();
	resource.setURI(URI.createURI("foo:/test"));
	nameProvider = new IQualifiedNameProvider.AbstractImpl() {
		@Override
		public QualifiedName getFullyQualifiedName(EObject obj) {
			if (obj instanceof ENamedElement)
				return QualifiedName.create(((ENamedElement) obj).getName());
			return null;
		}
	};
	strategy = new DefaultResourceDescriptionStrategy();
	strategy.setQualifiedNameProvider(nameProvider);
	description = new DefaultResourceDescription(resource, strategy);
	EcoreFactory f = EcoreFactory.eINSTANCE;
	pack = f.createEPackage();
	pack.setName("MyPackage");
	eClass = f.createEClass();
	eClass.setName("MyEClass");
	dtype = f.createEDataType();
	dtype.setName("MyDatatype");
	pack.getEClassifiers().add(eClass);
	pack.getEClassifiers().add(dtype);
	resource.getContents().add(pack);

}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:28,代碼來源:DefaultResourceDescriptionTest.java

示例8: createEClass

import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
private EClass createEClass(final String name, final EClass... superTypes) {
  EcoreFactory modelFactory = EcoreFactory.eINSTANCE;
  EClass clazz = modelFactory.createEClass();
  clazz.setName(name);
  for (EClass superType : superTypes) {
    clazz.getESuperTypes().add(superType);
  }
  testModelPackage.getEClassifiers().add(clazz);
  return clazz;
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:11,代碼來源:AbstractTypeProviderTest.java

示例9: main

import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
/**
 * 
 * 
 * @param args
 *            void
 */
public static void main(String[] args) {
    Model model = UMLFactory.eINSTANCE.createModel();
    model.setName("UML Model");
    org.eclipse.uml2.uml.Package pack = (org.eclipse.uml2.uml.Package) model.createNestedPackage("View");
    UseCase usecase = UMLHelper.createUseCase();
    usecase.setName("handle uc");
    pack.getPackagedElements().add(usecase);
    URI uri = URI.createURI("file://d://original.umx");
    EcoreFactory factory = EcoreFactory.eINSTANCE;
    EAttribute eAttribute = factory.createEAttribute();
    eAttribute.setName("UC_IC");
    eAttribute.setEType(EcorePackage.eINSTANCE.getEString());
    usecase.eClass().getEStructuralFeatures().add(eAttribute);
    // UMLPackage.eINSTANCE.getEClassifiers().add(eAttri);

    usecase.eSet(eAttribute, "333");

    Resource resource = new UMLResourceImpl(uri);
    resource.getContents().add(model);
    try {
        resource.save(null);
    } catch (IOException e) {
        e.printStackTrace();
    }

}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:33,代碼來源:UML2Refiner.java

示例10: EPackageImpl

import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
/**
 * <!-- begin-user-doc -->
 * Creates an instance.
 * <!-- end-user-doc -->
 * @generated NOT
 */
protected EPackageImpl()
{
  super();

  setEFactoryInstance(new EFactoryImpl());

  ecorePackage = EcorePackage.eINSTANCE;
  ecoreFactory = EcoreFactory.eINSTANCE;
}
 
開發者ID:LangleyStudios,項目名稱:eclipse-avro,代碼行數:16,代碼來源:EPackageImpl.java

示例11: Express2EMF

import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
public Express2EMF(File schemaFileName, String modelName, String nsUri) {
	schema = new SchemaLoader(schemaFileName.getAbsolutePath()).getSchema();
	eFactory = EcoreFactory.eINSTANCE;
	ePackage = EcorePackage.eINSTANCE;
	schemaPack = eFactory.createEPackage();
	try {
		new DerivedReader(schemaFileName, schema);
	} catch (FileNotFoundException e) {
		LOGGER.error("", e);
	}
	schemaPack.setName(modelName);
	schemaPack.setNsPrefix("iai");
	schemaPack.setNsURI(nsUri);

	createTristate();

	addClasses();
	addSupertypes();
	addSimpleTypes();
	addDerivedTypes();
	addEnumerations();
	addHackedTypes();
	addSelects();
	addAttributes();
	addInverses();
	EClass ifcBooleanClass = (EClass) schemaPack.getEClassifier("IfcBoolean");
	ifcBooleanClass.getESuperTypes().add((EClass) schemaPack.getEClassifier("IfcValue"));
	doRealDerivedAttributes();
	clean();
}
 
開發者ID:opensourceBIM,項目名稱:BIMserver,代碼行數:31,代碼來源:Express2EMF.java

示例12: addAnnotation

import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
protected void addAnnotation(EModelElement targetObject, String key, String value) {
	EAnnotation annotation = targetObject.getEAnnotation(ANNOTATION_SOURCE);
	if (annotation == null) {
		EcoreFactory factory = EcoreFactory.eINSTANCE;
		annotation = factory.createEAnnotation();
		annotation.setSource(ANNOTATION_SOURCE);
		targetObject.getEAnnotations().add(annotation);
	}
		
	annotation.getDetails().put(key, value);

}
 
開發者ID:markus1978,項目名稱:clickwatch,代碼行數:13,代碼來源:DefaultTargetObjectCreator.java

示例13: createEClass

import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
private EClass createEClass(ResultSet resultSet) throws SQLException {

		EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE;

		EPackage ePackage = ecoreFactory.createEPackage();
		ePackage.setName("PIPPO");
		ePackage.setNsPrefix("asup");
		ePackage.setNsURI("http://asup");

		EClass eClass = ecoreFactory.createEClass();
		eClass.setName(this.getClass().getSimpleName());
		eClass.getESuperTypes().add(QOperatingSystemOutputPackage.eINSTANCE.getObjectRow());

		ePackage.getEClassifiers().add(eClass);

		ResultSetMetaData resultSetMetaData = resultSet.getMetaData();

		for (int c = 1; c <= resultSetMetaData.getColumnCount(); c++) {

			String columnName = resultSetMetaData.getColumnName(c);
			int columnLength = resultSetMetaData.getPrecision(c);

			EAttribute eAttribute = ecoreFactory.createEAttribute();
			eAttribute.setName(columnName);
			eAttribute.setEType(EcorePackage.eINSTANCE.getEString());

			EAnnotation eAnnotation = ecoreFactory.createEAnnotation();
			eAnnotation.setSource(QIntegratedLanguageDataPackage.eNS_PREFIX);
			eAnnotation.getReferences().add(QIntegratedLanguageDataPackage.eINSTANCE.getCharacterDef());
			eAnnotation.getDetails().put("length", Integer.toString(columnLength));
			eAttribute.getEAnnotations().add(eAnnotation);

			eClass.getEStructuralFeatures().add(eAttribute);

		}

		return eClass;
	}
 
開發者ID:asupdev,項目名稱:asup,代碼行數:39,代碼來源:SQLStatementRunner.java

示例14: setUp

import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
	factory = EcoreFactory.eINSTANCE;
	nameResolver = SimpleAttributeResolver.newResolver(String.class, "name");
	superClassResolver = SimpleAttributeResolver.newResolver(EList.class, "eSuperTypes");
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:7,代碼來源:SimpleAttributeResolverTest.java

示例15: EcorePackageImpl

import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
/**
 * Creates an instance of the model <b>Package</b>, registered with
 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
 * package URI value.
 * <p>Note: the correct way to create the package is via the static
 * factory method {@link #init init()}, which also performs
 * initialization of the package, or returns the registered package,
 * if one already exists.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @see org.eclipse.emf.ecore.EPackage.Registry
 * @see org.eclipse.emf.ecore.EcorePackage#eNS_URI
 * @see #init()
 * @generated
 */
private EcorePackageImpl()
{
  super(eNS_URI, EcoreFactory.eINSTANCE);
}
 
開發者ID:LangleyStudios,項目名稱:eclipse-avro,代碼行數:20,代碼來源:EcorePackageImpl.java


注:本文中的org.eclipse.emf.ecore.EcoreFactory.eINSTANCE方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。