Skip to content

Commit

Permalink
Fixed #508 Can't open ReqIf models wiht the genconf wizard.
Browse files Browse the repository at this point in the history
  • Loading branch information
ylussaud committed Oct 27, 2023
1 parent 5c5d2d6 commit 5ff45d5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.impl.EStringToStringMapEntryImpl;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.URIConverter;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
Expand Down Expand Up @@ -537,6 +538,9 @@ private TemplateCustomProperties validatePage(final Generation gen, URI template
final ResourceSetImpl defaultResourceSet = new ResourceSetImpl();
defaultResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*",
new XMIResourceFactoryImpl());
defaultResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
.putAll(Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap());

final ResourceSet resourceSetForModel = M2DocUtils.createResourceSetForModels(
new ArrayList<Exception>(), queryEnvironment, defaultResourceSet, GenconfUtils.getOptions(gen));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/*******************************************************************************
* Copyright (c) 2018, 2023 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Obeo - initial API and implementation
*
*******************************************************************************/
package org.obeonetwork.m2doc.genconf.editor.wizard;

import java.io.IOException;
Expand Down Expand Up @@ -216,6 +227,9 @@ private void initializeVariableDefinition(Generation gen) {
final ResourceSetImpl defaultResourceSet = new ResourceSetImpl();
defaultResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*",
new XMIResourceFactoryImpl());
defaultResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
.putAll(Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap());

final ResourceSet resourceSetForModel = M2DocUtils.createResourceSetForModels(new ArrayList<Exception>(),
queryEnvironment, defaultResourceSet, GenconfUtils.getOptions(gen));
final List<Definition> newDefinitions = GenconfUtils.getNewDefinitions(gen, properties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.impl.EStringToStringMapEntryImpl;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
Expand Down Expand Up @@ -655,6 +656,8 @@ private void updateEditingDomain(Generation gen) {
final ResourceSetImpl defaultResourceSet = new ResourceSetImpl();
defaultResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*",
new XMIResourceFactoryImpl());
defaultResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
.putAll(Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap());

if (editingDomain != null) {
M2DocUtils.cleanResourceSetForModels(queryEnvironment, editingDomain.getResourceSet());
Expand Down

0 comments on commit 5ff45d5

Please sign in to comment.