Commit 50ac6f44 authored by Müller, Marco's avatar Müller, Marco
Browse files

Adds a warning, when an ID could not be found

parent 56984f17
Loading
Loading
Loading
Loading
+6 −4
Changes for Core/core/src/main/java/org/codeling/lang/base/modeltrans/henshintgg/HenshinTGGTransformation.java: 6 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -231,7 +231,11 @@ public class HenshinTGGTransformation extends ModelTransformation {
							"The initial element {0} has {1} result elements. Will only add the first initial element. Translations should not create correspondence objects that have multiple sources or multiple targets.",
							initialObject, entry.getValue().size()), null);

				try {
					idRegistry.addTranslationModelElement(targetObject, initialObject);
				} catch (IllegalArgumentException e) {
					log.warning("Could not add an translation model element to the id registry.", e);
				}
			}
		}
	}
@@ -331,10 +335,8 @@ public class HenshinTGGTransformation extends ModelTransformation {
	/**
	 * Imports model roots into henshin TGG runtime.
	 *
	 * @param modelRoot
	 *            The model root elements
	 * @param henshinTggFileUri
	 *            The URI to the Henshin TGG transformation file.
	 * @param modelRoot         The model root elements
	 * @param henshinTggFileUri The URI to the Henshin TGG transformation file.
	 * @return An {@link ImportResult} containing the {@link TripleGraph}, a mapping
	 *         between Henshin Nodes and eobjects, and a reference to a
	 *         {@link TGGExecutor}.
+3 −1
Changes for Utilities/utils/src/main/java/org/codeling/utils/IDRegistry.java: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ public class IDRegistry {
	public HashMap<String, String[]> getRegistryEntries() {
		return id2paths;
	}

int i = 0;
	private void updateEntry(String id, String codePath, String implementationModelPath, String translationModelPath) {
		final String[] paths = id2paths.get(id);
		if (paths == null) {
@@ -77,6 +77,8 @@ public class IDRegistry {
	 */
	public void addTranslationModelElement(EObject translationModelElement, EObject implementationModelElement) {
		final String id = getIDFromImplementationModelElement(implementationModelElement);
		if(id==null) 
			throw new IllegalArgumentException("Could not find ID in registry for implementation model element "+implementationModelElement.toString());
		final String ilPath = getPath(translationModelElement);
		id2paths.get(id)[2] = ilPath;
	}