本文整理匯總了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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()));
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}
}
示例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;
}
示例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();
}
示例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);
}
示例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;
}
示例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");
}
示例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);
}