/**
* Laods the package and any sub-packages from their serialized form.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void loadPackage() {
if (isLoaded)
return;
isLoaded = true;
URL url = getClass().getResource(packageFilename);
if (url == null) {
throw new RuntimeException("Missing serialized package: " + packageFilename);
}
URI uri = URI.createURI(url.toString());
Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
try {
resource.load(null);
} catch (IOException exception) {
throw new WrappedException(exception);
}
initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
createResource(eNS_URI);
}
java类org.eclipse.emf.ecore.resource.Resource的实例源码
Task1PackageImpl.java 文件源码
项目:rgse.ttc17.emoflon.tgg
阅读 20
收藏 0
点赞 0
评论 0
N4MFStandaloneSetupGenerated.java 文件源码
项目:n4js
阅读 15
收藏 0
点赞 0
评论 0
public void register(Injector injector) {
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("n4mf", resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("n4mf", serviceProvider);
}
StandaloneSetup.java 文件源码
项目:gemoc-studio
阅读 12
收藏 0
点赞 0
评论 0
public void doEMFRegistration() {
EPackage.Registry.INSTANCE.put(
org.eclipse.gemoc.sample.legacyfsm.fsm.FsmPackage.eNS_URI,
org.eclipse.gemoc.sample.legacyfsm.fsm.FsmPackage.eINSTANCE
);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
"*",
new XMIResourceFactoryImpl()
);
Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().put(
"melange",
new MelangeResourceFactoryImpl()
);
}
GlueModelCreator.java 文件源码
项目:ttc2017smartGrids
阅读 19
收藏 0
点赞 0
评论 0
private static HashSet<MMXU> getAllMMXU(Resource resource) {
HashSet<MMXU> mmxus = new HashSet<MMXU>();
TreeIterator<EObject> iterator = resource.getAllContents();
while (iterator.hasNext()) {
EObject eOb = iterator.next();
if (eOb instanceof MMXU) {
MMXU asset = (MMXU) eOb;
mmxus.add(asset);
}
}
return mmxus;
}
ModelIO.java 文件源码
项目:Tarski
阅读 14
收藏 0
点赞 0
评论 0
public void write(final URI uri, final T obj) {
final Resource resource = this.getResourceSet().createResource(uri);
resource.getContents().add(obj);
final HashMap<Object, Object> options = new HashMap<>();
try {
resource.save(options);
} catch (final IOException e) {
e.printStackTrace();
}
}
WorldResourceFactoryImpl.java 文件源码
项目:neoscada
阅读 19
收藏 0
点赞 0
评论 0
/**
* Creates an instance of the resource.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public Resource createResource ( final URI uri )
{
final XMIResource result = new WorldResourceImpl ( uri );
result.getDefaultSaveOptions ().put ( XMLResource.OPTION_URI_HANDLER, new URIHandlerImpl.PlatformSchemeAware () );
return result;
}
EagerResourceSetBasedResourceDescriptions.java 文件源码
项目:n4js
阅读 20
收藏 0
点赞 0
评论 0
private Map<URI, IResourceDescription> getDescriptionsMap() {
Descriptions descriptions = getDescriptions(getResourceSet());
if (descriptions == null) {
descriptions = new Descriptions();
getResourceSet().eAdapters().add(descriptions);
List<Resource> list = new ArrayList<>(getResourceSet().getResources());
for (Resource resource : list) {
IResourceDescription description = computeResourceDescription(resource.getURI());
if (description != null) {
descriptions.map.put(resource.getURI(), description);
}
}
}
return descriptions.map;
}
RamlTckTest.java 文件源码
项目:rest-modeling-framework
阅读 13
收藏 0
点赞 0
评论 0
@Test
@UseDataProvider("allTckRamlFiles")
public void tckFilesParse(final File f) throws IOException, TckParseException {
final Resource resource;
final URI fileURI = URI.createURI(f.toURI().toString());
try {
resource = fromUri(fileURI);
} catch (Exception e) {
throw new TckParseException(fileURI.toString(), e);
}
assertThat(resource).isInstanceOf(Resource.class)
.overridingErrorMessage("Failed to parse: " + f.toString());
}
GrmEditor.java 文件源码
项目:time4sys
阅读 23
收藏 0
点赞 0
评论 0
@Override
public void notifyChanged(Notification notification) {
if (notification.getNotifier() instanceof Resource) {
switch (notification.getFeatureID(Resource.class)) {
case Resource.RESOURCE__IS_LOADED:
case Resource.RESOURCE__ERRORS:
case Resource.RESOURCE__WARNINGS: {
Resource resource = (Resource)notification.getNotifier();
Diagnostic diagnostic = analyzeResourceProblems(resource, null);
if (diagnostic.getSeverity() != Diagnostic.OK) {
resourceToDiagnosticMap.put(resource, diagnostic);
}
else {
resourceToDiagnosticMap.remove(resource);
}
if (updateProblemIndication) {
getSite().getShell().getDisplay().asyncExec
(new Runnable() {
public void run() {
updateProblemIndication();
}
});
}
break;
}
}
}
else {
super.notifyChanged(notification);
}
}
ComponentEditor.java 文件源码
项目:neoscada
阅读 34
收藏 0
点赞 0
评论 0
@Override
protected void unsetTarget ( Resource target )
{
basicUnsetTarget ( target );
resourceToDiagnosticMap.remove ( target );
if ( updateProblemIndication )
{
getSite ().getShell ().getDisplay ().asyncExec ( new Runnable () {
public void run ()
{
updateProblemIndication ();
}
} );
}
}