@Override public <T extends MApplicationElement> @NonNull T createModelElement(@NonNull Class<@NonNull T> clazz, @NonNull Supplier<@NonNull String> contributor, Function<@NonNull T, @NonNull T> processor) { T element = this.modelService.createModelElement(clazz); element.setContributorURI("platform:/plugin/" + contributor); //$NON-NLS-1$ element = processor.apply(element); return element; }
private Resource loadResource(URI uri) { Resource resource; try { resource = getResource(uri); } catch (Exception e) { // TODO We could use diagnostics for better analyzing the error logger.error(e, "Unable to load resource " + uri.toString()); //$NON-NLS-1$ return null; } // TODO once we switch from deltas, we only need this once on the default model? String contributorURI = URIHelper.EMFtoPlatform(uri); if (contributorURI != null) { TreeIterator<EObject> it = EcoreUtil.getAllContents(resource.getContents()); while (it.hasNext()) { EObject o = it.next(); if (o instanceof MApplicationElement) { ((MApplicationElement) o).setContributorURI(contributorURI); } } } return resource; }
el.setContributorURI(contributorURI); r = (E4XMIResource) eObj.eResource(); if (contributorURI != null && (eObj instanceof MApplicationElement)) ((MApplicationElement) eObj).setContributorURI(contributorURI); applicationResource.setID(eObj, r.getInternalId(eObj));