本文整理汇总了Java中org.eclipse.uml2.uml.resources.util.UMLResourcesUtil类的典型用法代码示例。如果您正苦于以下问题:Java UMLResourcesUtil类的具体用法?Java UMLResourcesUtil怎么用?Java UMLResourcesUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UMLResourcesUtil类属于org.eclipse.uml2.uml.resources.util包,在下文中一共展示了UMLResourcesUtil类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createAndInitResourceSet
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
/**
* Creates and initializes a resource set.
*
* @return The created and initialized resource set.
*/
public ResourceSet createAndInitResourceSet() {
ResourceSet resourceSet = new ResourceSetImpl();
URI uml2ResourcesPluginURI = URI.createURI(ExporterConfiguration.UML2_RESOURCES_PLUGIN_PATH);
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION,
UMLResource.Factory.INSTANCE);
Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
uml2ResourcesPluginURI.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
uml2ResourcesPluginURI.appendSegment("metamodels").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
uml2ResourcesPluginURI.appendSegment("profiles").appendSegment(""));
uriMap.put(URI.createURI("pathmap://TXTUML_STDLIB/"),
URI.createURI("platform:/plugin/hu.elte.txtuml.stdlib/src/hu/elte/txtuml/stdlib/"));
UMLResourcesUtil.init(resourceSet);
return resourceSet;
}
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:31,代码来源:ResourceSetFactory.java
示例2: serializeInstance
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void serializeInstance(String fileName, Map<String, Boolean> options) {
ResourceSet rscSet = new ResourceSetImpl();
UMLResourcesUtil.init(rscSet);
fileName+=".uml";
Resource resource = rscSet.createResource(URI.createURI(fileName).appendFileExtension(UMLResource.FILE_EXTENSION));
Iterator<EObject> objIt = objList.iterator();
EObject model = UMLFactory.eINSTANCE.createModel();
resource.getContents().add(model);
while (objIt.hasNext()) {
EObject obj = objIt.next();
if (isRoot(obj))
resource.getContents().add(obj);
((List<EObject>) model.eGet(UMLPackage.eINSTANCE.getPackage_PackagedElement())).add(obj);
}
try{
resource.save(options);
}catch (IOException e) {
e.printStackTrace();
}
}
开发者ID:SOM-Research,项目名称:EMFtoCSP,代码行数:23,代码来源:UmlModelBuilder.java
示例3: saveModel
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
private void saveModel(List<Package> pkgs) throws IOException {
// Create a resource-set to contain the resource(s) that we are saving
ResourceSet resourceSet = new ResourceSetImpl();
// Initialize registrations of resource factories, library models,
// profiles, Ecore metadata, and other dependencies required for
// serializing and working with UML resources. This is only necessary in
// applications that are not hosted in the Eclipse platform run-time, in
// which case these registrations are discovered automatically from
// Eclipse extension points.
UMLResourcesUtil.init(resourceSet);
// Create the output resource and add our model package to it.
// Resource resource = resourceSet.createResource(uri);
Resource resource = new XMIResourceImpl();
for (Package pkg : pkgs) {
resource.getContents().add(pkg);
}
// And save.
Map<?, ?> options = null; // No save options needed.
resource.save(outputStream, options);
outputStream.close();
}
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:26,代码来源:FHIMExporter.java
示例4: createControl
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
@Override
public void createControl(final Composite parent) {
resourceSet = UMLResourcesUtil.init(new ResourceSetImpl());
initializeDialogUnits(parent);
readCriteria();
final Composite pageContainer = new Composite(parent, SWT.NONE);
style(pageContainer, createSearchTermContainer(pageContainer), createMatchContainer(pageContainer));
if (!history.isEmpty()) {
updateControls(history.get(0));
}
setControl(pageContainer);
PlatformUI.getWorkbench().getHelpSystem()
.setHelp(pageContainer, NiemUmlHelpContextIds.REFERENCE_LIBRARY_SEARCH_PAGE);
}
开发者ID:GRA-UML,项目名称:tool,代码行数:21,代码来源:ReferenceLibrarySearchPage.java
示例5: createEmfModelByURI
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
protected EmfModel createEmfModelByURI(String name, String model, String metamodel,
boolean readOnLoad,
boolean storeOnDisposal) throws EolModelLoadingException {
// @Correctness this assumes the metamodels are in the EPackage.Registry.
// This does not hold for using Ecore files directly, unless we load them into
// the registry first.
// See if we can tell Epsilon to fallback on the Ecore file.
// @Correctness this condition seems fishy
if (metamodel.contains("UML")) {
UMLResourcesUtil.init(null);
}
EmfModel emfModel = new EmfModel();
StringProperties properties = new StringProperties();
properties.put(Model.PROPERTY_NAME, name);
properties.put(EmfModel.PROPERTY_METAMODEL_URI, metamodel);
properties.put(EmfModel.PROPERTY_MODEL_URI, model);
properties.put(EmfModel.PROPERTY_IS_METAMODEL_FILE_BASED, "false");
properties.put(Model.PROPERTY_READONLOAD, readOnLoad + "");
properties.put(Model.PROPERTY_STOREONDISPOSAL, storeOnDisposal + "");
emfModel.load(properties);
return emfModel;
}
开发者ID:atlanmod,项目名称:emfviews,代码行数:25,代码来源:EclDelegate.java
示例6: copyResource
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
protected void copyResource(final URI destURI, final File oldFile) throws IOException {
//! Have to replace this with re-saving the resource to the other location:
// simply copying breaks the path-based URL to the metamodel file
ResourceSetImpl rs = new ResourceSetImpl();
UMLResourcesUtil.init(rs);
final Resource oldResource = rs.createResource(URI.createFileURI(oldFile.toString()));
oldResource.load(null);
oldResource.setURI(destURI);
oldResource.save(null);
oldResource.unload();
}
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:12,代码来源:UMLIndexingTest.java
示例7: ModelMapProvider
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
/**
* @param directory
* Directory of the saved mapping.
* @param filename
* File name of the saved mapping (without extension).
* @throws ModelMapException
* @throws FileNotFoundException
* @throws IOException
* @throws ClassNotFoundException
*/
public ModelMapProvider(URI directory, String filename) throws ModelMapException {
uriFragmentMapper = new URIFragmentMapper(directory, filename);
ResourceSet resourceSet = new ResourceSetImpl();
UMLResourcesUtil.init(resourceSet);
URI modelURI = URI.createURI(uriFragmentMapper.getModelPath());
if (modelURI == null) {
throw new ModelMapException(CANNOT_LOAD_MODEL);
}
resource = resourceSet.getResource(modelURI, true);
if (resource == null) {
throw new ModelMapException(CANNOT_LOAD_MODEL);
}
}
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:25,代码来源:ModelMapProvider.java
示例8: loadUmlResource
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
private Resource loadUmlResource(URI modelUri) {
ResourceSet rSet = new ResourceSetImpl();
UMLResourcesUtil.init(rSet);
rSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
rSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
.put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
UMLResource r = (UMLResource) rSet.getResource(modelUri, true);
EcoreUtil.resolveAll(r);
UMLResourcesUtil.init(rSet);
return new EResourceUMLAdapter(r);
}
开发者ID:SOM-Research,项目名称:EMFtoCSP,代码行数:12,代码来源:TestNonRegression.java
示例9: loadUmlResource
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private Resource loadUmlResource (URI modelUri) {
ResourceSet rSet = new ResourceSetImpl();
UMLResourcesUtil.init(rSet);
rSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
rSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
UMLResource r = (UMLResource)rSet.getResource(modelUri, true);
EcoreUtil.resolveAll(r);
UMLResourcesUtil.init(rSet);
return new EResourceUMLAdapter(r);
}
开发者ID:SOM-Research,项目名称:EMFtoCSP,代码行数:12,代码来源:WizardHandler.java
示例10: loadModel
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
/**
* Load model.
*
* @param in the in
* @param fileURI the file uri
* @param packageName the package name
* @return the package
* @throws IOException Signals that an I/O exception has occurred.
*/
private Package loadModel(InputStream in, URI fileURI, String packageName)
throws IOException {
// Create a resource-set to contain the resource(s) that we are saving
ResourceSet resourceSet = new ResourceSetImpl();
// Initialize registrations of resource factories, library models,
// profiles, Ecore metadata, and other dependencies required for
// serializing and working with UML resources. This is only necessary in
// applications that are not hosted in the Eclipse platform run-time, in
// which case these registrations are discovered automatically from
// Eclipse extension points.
UMLResourcesUtil.init(resourceSet);
Resource resource = resourceSet.createResource(fileURI);
// And load.
Map<?, ?> options = null; // No load options needed.
resource.load(options);
// Look for Package with specified name.
EList<EObject> contents = resource.getContents();
for (EObject content : contents) {
if (content instanceof Package) {
Package model = (Package) content;
if (model.getName().equals(packageName)) {
LOG.info("Loaded '" + model.getQualifiedName() + "' from '" + fileURI
+ "'.");
return model;
}
}
}
return null;
}
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:45,代码来源:FHIMImporter.java
示例11: createRepository
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
@Override
public IRepository createRepository(URI baseURI, boolean includeBase, Properties creationSettings) throws CoreException {
return new Repository(baseURI, includeBase, creationSettings) {
@Override
protected ResourceSet newResourceSet() {
ResourceSet rs = super.newResourceSet();
Map<URI, URI> uriMap = rs.getURIConverter().getURIMap();
String[][] mappings = new String[][] {
{ "pathmap://MDD_LIBRARIES/", "models/libraries/", "base.uml" },
{ "pathmap://MDD_PROFILES/", "models/profiles/", "mdd_extensions.uml" },
{ "pathmap://UML_LIBRARIES/", "libraries/", "UMLPrimitiveTypes.library.uml" },
{ "pathmap://UML_METAMODELS/", "metamodels/", "UML.metamodel.uml" },
{ "pathmap://UML_PROFILES/", "profiles/", "StandardL2.profile.uml" }, };
for (String[] mapping : mappings) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
String url = cl.getResource(mapping[1] + mapping[2]).toString();
String toUri = url.substring(0, url.length() - mapping[2].length());
uriMap.put(URI.createURI(mapping[0]), URI.createURI(toUri));
}
UMLResourcesUtil.init(rs);
return rs;
}
};
}
开发者ID:abstratt,项目名称:textuml,代码行数:28,代码来源:StandaloneUtil.java
示例12: registerResourceFactories
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
/**
* This can be used to update the resource set's resource factory registry with all needed factories.
*
* @param resourceSet
* The resource set which registry has to be updated.
*/
@Override
public void registerResourceFactories(ResourceSet resourceSet) {
UMLResourcesUtil.init(resourceSet);
super.registerResourceFactories(resourceSet);
// TODO If you need additional resource factories registrations, do them here. The following line is an example for UML.
// resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
//resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("mpdcat", new gov.niem.reference.niem.resource.mpd.catalog._1.mpdcat.util.mpdcatResourceFactoryImpl());
// resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("emtl", new org.eclipse.acceleo.model.mtl.resource.EMtlBinaryResourceFactoryImpl());
// resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("mtl", new EMtlResourceFactoryImpl());
// resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("emtl", new EMtlResourceFactoryImpl());
//resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", UMLResource.Factory.INSTANCE);
}
开发者ID:GRA-UML,项目名称:tool,代码行数:20,代码来源:CommonGenerator.java
示例13: doExecute
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
@Override
protected void doExecute() {
final ResourceSet resourceSet = UMLResourcesUtil.init(new ResourceSetImpl());
final Resource templateUmlResource = resourceSet.getResource(UML_TEMPLATE, true);
final Resource templateDiResource = resourceSet.getResource(DI_TEMPLATE, true);
final Resource templateNotationResource = resourceSet.getResource(NOTATION_TEMPLATE, true);
List<EObject> toCopy = new ArrayList<EObject>();
toCopy = templateUmlResource.getContents();
EcoreUtil.resolveAll(resourceSet);
toCopy.addAll(templateNotationResource.getContents());
toCopy.addAll(templateDiResource.getContents());
final List<EObject> copies = new ArrayList<EObject>(EcoreUtil.copyAll(toCopy));
replaceVariables(copies, uml.getURI().trimFileExtension().lastSegment());
final Collection<Diagram> diagrams = EcoreUtil.<Diagram> getObjectsByType(copies, NotationPackage.Literals.DIAGRAM);
final Collection<SashWindowsMngr> sashWindowsMngrs = EcoreUtil.<SashWindowsMngr> getObjectsByType(copies,
DiPackage.Literals.SASH_WINDOWS_MNGR);
copies.removeAll(diagrams);
copies.removeAll(sashWindowsMngrs);
uml.getContents().clear();
diagram.getContents().clear();
notation.getContents().clear();
uml.getContents().addAll(copies);
diagram.getContents().addAll(sashWindowsMngrs);
notation.getContents().addAll(diagrams);
}
开发者ID:info-sharing-environment,项目名称:NIEM-Modeling-Tool,代码行数:33,代码来源:InitFromTemplateCommand.java
示例14: setup
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
@Override
public void setup() throws Throwable {
UMLResourcesUtil.initGlobalRegistries();
super.setup();
addUMLComponents();
}
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:7,代码来源:UMLIndexingTest.java
示例15: createResourceSet
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
protected ResourceSet createResourceSet() {
return UMLResourcesUtil.init(new ResourceSetImpl());
}
开发者ID:GRA-UML,项目名称:tool,代码行数:4,代码来源:TransformDelegate.java
示例16: registerPackages
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
/**
* This can be used to update the resource set's package registry with all needed EPackages.
*
* @param resourceSet
* The resource set which registry has to be updated.
*/
@Override
public void registerPackages(ResourceSet resourceSet) {
// org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor x;
UMLResourcesUtil.init(resourceSet);
super.registerPackages(resourceSet);
//resourceSet.getPackageRegistry().put(org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNsURI(), org.eclipse.uml2.uml.UMLPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(org.eclipse.ocl.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.ocl.ecore.EcorePackage.eINSTANCE);
// TODO If you need additional package registrations, do them here. The following line is an example for UML.
// resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
// get catalog metamodel
/*
resourceSet.getPackageRegistry().put("http://reference.niem.gov/niem/resource/mpd/catalog/1.0/",
gov.niem.reference.niem.resource.mpd.catalog._1.mpdcat.mpdcatPackage.eINSTANCE);
*/
// we need to get profile definitions
// resourceSet.getPackageRegistry().put("http://www.eclipse.org/uml2/2.1.0/UML", org.eclipse.uml2.uml.UMLPackage.eINSTANCE);
// these do not help the applied stereotype problem
//resourceSet.getPackageRegistry().put("http://www.omg.org/spec/UML/20110701", org.eclipse.uml2.uml.UMLPackage.eINSTANCE);
//resourceSet.getPackageRegistry().put("http://www.eclipse.org/uml2/4.0.0/UML", org.eclipse.uml2.uml.UMLPackage.eINSTANCE);
//UMLUtil.init(resourceSet);
/*
platform:/plugin/plugin-name_1.2.3/...
A folder to folder mapping, i.e., where both source and target end in /, will remap entire subtrees, not just instances that match exactly.
URI mappings can also be defined from the source code with the org.eclipse.emf.ecore.resource.URIConverter.URI_MAP as follows:
*/
/*
URIConverter.URI_MAP.put(URI.createURI("pathmap://NIEM_PROFILES/"), URI.createURI("platform:/plugin/gov.niem.uml.resources/profiles/"));
URIConverter.URI_MAP.put(URI.createURI("pathmap://NIEM_LIBRARIES/"), URI.createURI("platform:/plugin/gov.niem.uml.resources/libraries/"));
URIConverter.URI_MAP.put(URI.createURI("pathmap://UML_LIBRARIES/"), URI.createURI("platform:/plugin/org.eclipse.uml2.uml.resources/libraries/"));
URIConverter.URI_MAP.put(URI.createURI("pathmap://NIEM_PSM_PROFILES/"), URI.createURI("platform:/plugin/gov.niem.uml.psm.resources/profiles/"));
*/
// URIConverter.URI_MAP.put(URI.createURI("pathmap://MAGICDRAW/"), URI.createURI("platform:/plugin/gov.niem.uml.psm.resources/magicdraw/"));
// URIConverter.URI_MAP.put(URI.createURI("pathmap://MAGICDRAW/UML.ecore"), URI.createURI("http://www.nomagic.com/magicdraw/UML/2.4.1"));
// resourceSet.getPackageRegistry().put("http://www.nomagic.com/magicdraw/UML/2.4.1", UMLPackage.eINSTANCE);
// resourceSet.getPackageRegistry().put("pathmap://MAGICDRAW/UML.ecore", UMLPackage.eINSTANCE);
ResourceSet myResourceSet=new ResourceSetImpl();
// myResourceSet.getPackageRegistry().put(org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNsURI(), org.eclipse.uml2.uml.UMLPackage.eINSTANCE);
// myResourceSet.getPackageRegistry().put("http://www.eclipse.org/uml2/2.1.0/UML", org.eclipse.uml2.uml.UMLPackage.eINSTANCE);
myResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
// myResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("uml",UMLResource.Factory.INSTANCE);
}
开发者ID:GRA-UML,项目名称:tool,代码行数:57,代码来源:CommonGenerator.java
示例17: createServiceInstance
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
@Override
public Object createServiceInstance() {
final ResourceSet resourceSet = UMLResourcesUtil.init((ResourceSet) super.createServiceInstance());
resourceSet.getResource(URI.createURI("http://www.omg.org/spec/NIEM-UML/20120501/XmlPrimitiveTypes"), true);
return resourceSet;
}
开发者ID:info-sharing-environment,项目名称:NIEM-Modeling-Tool,代码行数:7,代码来源:NiemModelSetServiceFactory.java
示例18: get_the_root_model
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil; //导入依赖的package包/类
public static Model get_the_root_model(final IFile aUmlFile) {
return (Model) UMLResourcesUtil.init(new ResourceSetImpl())
.getResource(URI.createPlatformResourceURI(aUmlFile.getFullPath().toString(), true), true).getContents()
.get(0);
}
开发者ID:info-sharing-environment,项目名称:NIEM-Modeling-Tool,代码行数:6,代码来源:UMLUtils.java
注:本文中的org.eclipse.uml2.uml.resources.util.UMLResourcesUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论