本文整理汇总了Java中org.eclipse.emf.ecore.resource.Resource.Factory类的典型用法代码示例。如果您正苦于以下问题:Java Factory类的具体用法?Java Factory怎么用?Java Factory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Factory类属于org.eclipse.emf.ecore.resource.Resource包,在下文中一共展示了Factory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareResourceSetAsDoneByExtractor
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入依赖的package包/类
/**
* Configure the resource set in the same manner as the software model extractor.
*
* @param cacheFileDirs
* The cache directories.
* @param jarPaths
* The jar files to register.
* @return The prepared resource set.
*/
private ResourceSet prepareResourceSetAsDoneByExtractor(List<String> cacheFileDirs, List<String> jarPaths) {
ResourceSet rs = new SPLevoResourceSet();
Map<Object, Object> options = rs.getLoadOptions();
options.put(JavaClasspath.OPTION_USE_LOCAL_CLASSPATH, Boolean.TRUE);
options.put(JavaClasspath.OPTION_REGISTER_STD_LIB, Boolean.TRUE);
options.put(IJavaOptions.DISABLE_LAYOUT_INFORMATION_RECORDING, Boolean.TRUE);
options.put(IJavaOptions.DISABLE_LOCATION_MAP, Boolean.TRUE);
Factory originalFactory = new JavaSourceOrClassFileResourceFactoryImpl();
EPackage.Registry.INSTANCE.put("http://www.emftext.org/java", JavaPackage.eINSTANCE);
JavaClasspath javaClasspath = JavaClasspath.get(rs);
Map<String, Object> factoryMap = rs.getResourceFactoryRegistry().getExtensionToFactoryMap();
for (String jarPath : jarPaths) {
javaClasspath.registerClassifierJar(URI.createFileURI(jarPath));
}
factoryMap.put("java", new JavaSourceOrClassFileResourceCachingFactoryImpl(originalFactory, cacheFileDirs));
return rs;
}
示例2: initResourceSet
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入依赖的package包/类
private void initResourceSet(ResourceSet rs, List<String> sourceModelPaths, boolean loadLayoutInformation) {
final Boolean disableLayoutOption = loadLayoutInformation ? Boolean.FALSE : Boolean.TRUE;
final Map<Object, Object> options = rs.getLoadOptions();
options.put(JavaClasspath.OPTION_USE_LOCAL_CLASSPATH, Boolean.TRUE);
options.put(JavaClasspath.OPTION_REGISTER_STD_LIB, Boolean.TRUE);
options.put(IJavaOptions.DISABLE_EMF_VALIDATION, Boolean.TRUE);
options.put(IJavaOptions.DISABLE_LAYOUT_INFORMATION_RECORDING, disableLayoutOption);
options.put(IJavaOptions.DISABLE_LOCATION_MAP, disableLayoutOption);
options.put(ResourceHandlingOptions.USE_PLATFORM_RESOURCE,
ResourceHandlingOptions.USE_PLATFORM_RESOURCE.getDefault());
Factory originalFactory = new JavaSourceOrClassFileResourceFactoryImpl();
Factory cachedJaMoPPFactory = new JavaSourceOrClassFileResourceCachingFactoryImpl(originalFactory,
sourceModelPaths);
JavaClasspath.get(rs);
Map<String, Object> factoryMap = rs.getResourceFactoryRegistry().getExtensionToFactoryMap();
factoryMap.put("java", cachedJaMoPPFactory);
// DesignDecision No caching for byte code resources to improve performance
factoryMap.put("class", originalFactory);
}
示例3: initializeOCL
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入依赖的package包/类
/**
* Initializes OCL Pivot in case this is used by a metamodel.
*/
private static void initializeOCL() {
// Register Pivot globally (resourceSet == null).
org.eclipse.ocl.examples.pivot.OCL.initialize(null);
String oclDelegateURI = OCLDelegateDomain.OCL_DELEGATE_URI_PIVOT;
EOperation.Internal.InvocationDelegate.Factory.Registry.INSTANCE.put(oclDelegateURI,
new OCLInvocationDelegateFactory.Global());
EStructuralFeature.Internal.SettingDelegate.Factory.Registry.INSTANCE.put(oclDelegateURI,
new OCLSettingDelegateFactory.Global());
EValidator.ValidationDelegate.Registry.INSTANCE.put(oclDelegateURI,
new OCLValidationDelegateFactory.Global());
OCLinEcoreStandaloneSetup.doSetup();
org.eclipse.ocl.examples.pivot.model.OCLstdlib.install();
}
示例4: getResourceFactoryExtensions
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入依赖的package包/类
/**
* Adds all registered resource factory extensions to the given map. Such
* extensions can be used to register multiple resource factories for the same
* file extension.
*/
public void getResourceFactoryExtensions(Map<String, Factory> factories) {
if (Platform.isRunning()) {
IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
IConfigurationElement configurationElements[] = extensionRegistry.getConfigurationElementsFor(eu.hyvar.feature.expression.resource.hyexpression.mopp.HyexpressionPlugin.EP_ADDITIONAL_EXTENSION_PARSER_ID);
for (IConfigurationElement element : configurationElements) {
try {
String type = element.getAttribute("type");
Resource.Factory factory = (Resource.Factory) element.createExecutableExtension("class");
if (type == null) {
type = "";
}
Resource.Factory otherFactory = factories.get(type);
if (otherFactory != null) {
Class<?> superClass = factory.getClass().getSuperclass();
while(superClass != Object.class) {
if (superClass.equals(otherFactory.getClass())) {
factories.put(type, factory);
break;
}
superClass = superClass.getClass();
}
}
else {
factories.put(type, factory);
}
} catch (CoreException ce) {
new eu.hyvar.feature.expression.resource.hyexpression.util.HyexpressionRuntimeUtil().logError("Exception while getting default options.", ce);
}
}
}
}
示例5: init
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入依赖的package包/类
protected void init() {
if (factories == null) {
factories = new LinkedHashMap<String, Factory>();
}
if (new eu.hyvar.feature.expression.resource.hyexpression.util.HyexpressionRuntimeUtil().isEclipsePlatformAvailable()) {
new eu.hyvar.feature.expression.resource.hyexpression.util.HyexpressionEclipseProxy().getResourceFactoryExtensions(factories);
}
if (factories.get("") == null) {
factories.put("", new eu.hyvar.feature.expression.resource.hyexpression.mopp.HyexpressionResourceFactory());
}
}
示例6: getFactoryForURI
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入依赖的package包/类
public Factory getFactoryForURI(URI uri) {
URI trimmedURI = uri.trimFileExtension();
String secondaryFileExtension = trimmedURI.fileExtension();
Factory factory = factories.get(secondaryFileExtension);
if (factory == null) {
factory = factories.get("");
}
return factory;
}
示例7: getResourceFactoryExtensions
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入依赖的package包/类
/**
* Adds all registered resource factory extensions to the given map. Such
* extensions can be used to register multiple resource factories for the same
* file extension.
*/
public void getResourceFactoryExtensions(Map<String, Factory> factories) {
if (Platform.isRunning()) {
IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
IConfigurationElement configurationElements[] = extensionRegistry.getConfigurationElementsFor(eu.hyvar.mspl.manifest.resource.hymanifest.mopp.HymanifestPlugin.EP_ADDITIONAL_EXTENSION_PARSER_ID);
for (IConfigurationElement element : configurationElements) {
try {
String type = element.getAttribute("type");
Resource.Factory factory = (Resource.Factory) element.createExecutableExtension("class");
if (type == null) {
type = "";
}
Resource.Factory otherFactory = factories.get(type);
if (otherFactory != null) {
Class<?> superClass = factory.getClass().getSuperclass();
while(superClass != Object.class) {
if (superClass.equals(otherFactory.getClass())) {
factories.put(type, factory);
break;
}
superClass = superClass.getClass();
}
}
else {
factories.put(type, factory);
}
} catch (CoreException ce) {
new eu.hyvar.mspl.manifest.resource.hymanifest.util.HymanifestRuntimeUtil().logError("Exception while getting default options.", ce);
}
}
}
}
示例8: init
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入依赖的package包/类
protected void init() {
if (factories == null) {
factories = new LinkedHashMap<String, Factory>();
}
if (new eu.hyvar.mspl.manifest.resource.hymanifest.util.HymanifestRuntimeUtil().isEclipsePlatformAvailable()) {
new eu.hyvar.mspl.manifest.resource.hymanifest.util.HymanifestEclipseProxy().getResourceFactoryExtensions(factories);
}
if (factories.get("") == null) {
factories.put("", new eu.hyvar.mspl.manifest.resource.hymanifest.mopp.HymanifestResourceFactory());
}
}
示例9: getResourceFactoryExtensions
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入依赖的package包/类
/**
* Adds all registered resource factory extensions to the given map. Such
* extensions can be used to register multiple resource factories for the same
* file extension.
*/
public void getResourceFactoryExtensions(Map<String, Factory> factories) {
if (Platform.isRunning()) {
IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
IConfigurationElement configurationElements[] = extensionRegistry.getConfigurationElementsFor(eu.hyvar.feature.mapping.resource.hymapping.mopp.HymappingPlugin.EP_ADDITIONAL_EXTENSION_PARSER_ID);
for (IConfigurationElement element : configurationElements) {
try {
String type = element.getAttribute("type");
Resource.Factory factory = (Resource.Factory) element.createExecutableExtension("class");
if (type == null) {
type = "";
}
Resource.Factory otherFactory = factories.get(type);
if (otherFactory != null) {
Class<?> superClass = factory.getClass().getSuperclass();
while(superClass != Object.class) {
if (superClass.equals(otherFactory.getClass())) {
factories.put(type, factory);
break;
}
superClass = superClass.getClass();
}
}
else {
factories.put(type, factory);
}
} catch (CoreException ce) {
new eu.hyvar.feature.mapping.resource.hymapping.util.HymappingRuntimeUtil().logError("Exception while getting default options.", ce);
}
}
}
}
示例10: init
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入依赖的package包/类
protected void init() {
if (factories == null) {
factories = new LinkedHashMap<String, Factory>();
}
if (new eu.hyvar.feature.mapping.resource.hymapping.util.HymappingRuntimeUtil().isEclipsePlatformAvailable()) {
new eu.hyvar.feature.mapping.resource.hymapping.util.HymappingEclipseProxy().getResourceFactoryExtensions(factories);
}
if (factories.get("") == null) {
factories.put("", new eu.hyvar.feature.mapping.resource.hymapping.mopp.HymappingResourceFactory());
}
}
示例11: getResourceFactoryExtensions
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入依赖的package包/类
/**
* Adds all registered resource factory extensions to the given map. Such
* extensions can be used to register multiple resource factories for the same
* file extension.
*/
public void getResourceFactoryExtensions(Map<String, Factory> factories) {
if (Platform.isRunning()) {
IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
IConfigurationElement configurationElements[] = extensionRegistry.getConfigurationElementsFor(eu.hyvar.feature.constraint.resource.hyconstraints.mopp.HyconstraintsPlugin.EP_ADDITIONAL_EXTENSION_PARSER_ID);
for (IConfigurationElement element : configurationElements) {
try {
String type = element.getAttribute("type");
Resource.Factory factory = (Resource.Factory) element.createExecutableExtension("class");
if (type == null) {
type = "";
}
Resource.Factory otherFactory = factories.get(type);
if (otherFactory != null) {
Class<?> superClass = factory.getClass().getSuperclass();
while(superClass != Object.class) {
if (superClass.equals(otherFactory.getClass())) {
factories.put(type, factory);
break;
}
superClass = superClass.getClass();
}
}
else {
factories.put(type, factory);
}
} catch (CoreException ce) {
new eu.hyvar.feature.constraint.resource.hyconstraints.util.HyconstraintsRuntimeUtil().logError("Exception while getting default options.", ce);
}
}
}
}
示例12: init
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入依赖的package包/类
protected void init() {
if (factories == null) {
factories = new LinkedHashMap<String, Factory>();
}
if (new eu.hyvar.feature.constraint.resource.hyconstraints.util.HyconstraintsRuntimeUtil().isEclipsePlatformAvailable()) {
new eu.hyvar.feature.constraint.resource.hyconstraints.util.HyconstraintsEclipseProxy().getResourceFactoryExtensions(factories);
}
if (factories.get("") == null) {
factories.put("", new eu.hyvar.feature.constraint.resource.hyconstraints.mopp.HyconstraintsResourceFactory());
}
}
示例13: getResourceFactoryExtensions
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入依赖的package包/类
/**
* Adds all registered resource factory extensions to the given map. Such
* extensions can be used to register multiple resource factories for the same
* file extension.
*/
public void getResourceFactoryExtensions(Map<String, Factory> factories) {
if (Platform.isRunning()) {
IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
IConfigurationElement configurationElements[] = extensionRegistry.getConfigurationElementsFor(eu.hyvar.context.contextValidity.resource.hyvalidityformula.mopp.HyvalidityformulaPlugin.EP_ADDITIONAL_EXTENSION_PARSER_ID);
for (IConfigurationElement element : configurationElements) {
try {
String type = element.getAttribute("type");
Resource.Factory factory = (Resource.Factory) element.createExecutableExtension("class");
if (type == null) {
type = "";
}
Resource.Factory otherFactory = factories.get(type);
if (otherFactory != null) {
Class<?> superClass = factory.getClass().getSuperclass();
while(superClass != Object.class) {
if (superClass.equals(otherFactory.getClass())) {
factories.put(type, factory);
break;
}
superClass = superClass.getClass();
}
}
else {
factories.put(type, factory);
}
} catch (CoreException ce) {
new eu.hyvar.context.contextValidity.resource.hyvalidityformula.util.HyvalidityformulaRuntimeUtil().logError("Exception while getting default options.", ce);
}
}
}
}
示例14: init
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入依赖的package包/类
protected void init() {
if (factories == null) {
factories = new LinkedHashMap<String, Factory>();
}
if (new eu.hyvar.context.contextValidity.resource.hyvalidityformula.util.HyvalidityformulaRuntimeUtil().isEclipsePlatformAvailable()) {
new eu.hyvar.context.contextValidity.resource.hyvalidityformula.util.HyvalidityformulaEclipseProxy().getResourceFactoryExtensions(factories);
}
if (factories.get("") == null) {
factories.put("", new eu.hyvar.context.contextValidity.resource.hyvalidityformula.mopp.HyvalidityformulaResourceFactory());
}
}
示例15: getResourceFactoryExtensions
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入依赖的package包/类
/**
* Adds all registered resource factory extensions to the given map. Such
* extensions can be used to register multiple resource factories for the same
* file extension.
*/
public void getResourceFactoryExtensions(Map<String, Factory> factories) {
if (Platform.isRunning()) {
IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
IConfigurationElement configurationElements[] = extensionRegistry.getConfigurationElementsFor(eu.hyvar.dataValues.resource.hydatavalue.mopp.HydatavaluePlugin.EP_ADDITIONAL_EXTENSION_PARSER_ID);
for (IConfigurationElement element : configurationElements) {
try {
String type = element.getAttribute("type");
Resource.Factory factory = (Resource.Factory) element.createExecutableExtension("class");
if (type == null) {
type = "";
}
Resource.Factory otherFactory = factories.get(type);
if (otherFactory != null) {
Class<?> superClass = factory.getClass().getSuperclass();
while(superClass != Object.class) {
if (superClass.equals(otherFactory.getClass())) {
factories.put(type, factory);
break;
}
superClass = superClass.getClass();
}
}
else {
factories.put(type, factory);
}
} catch (CoreException ce) {
new eu.hyvar.dataValues.resource.hydatavalue.util.HydatavalueRuntimeUtil().logError("Exception while getting default options.", ce);
}
}
}
}