diff --git a/org.fortiss.tooling.ext.reuse/src/org/fortiss/tooling/ext/reuse/utils/.ratings b/org.fortiss.tooling.ext.reuse/src/org/fortiss/tooling/ext/reuse/utils/.ratings index 3c0000d221aafa218e8efc4dec537c880f3da9df..814ab789e2d9d8366405a2252956bf9cfd8e4805 100644 --- a/org.fortiss.tooling.ext.reuse/src/org/fortiss/tooling/ext/reuse/utils/.ratings +++ b/org.fortiss.tooling.ext.reuse/src/org/fortiss/tooling/ext/reuse/utils/.ratings @@ -1,2 +1,2 @@ -ReuseLibraryModelElementFactory.java b6109682e2b465c98d6ff4453f409ab9801e70fa YELLOW +ReuseLibraryModelElementFactory.java d72834d2f7d337dc4bf716f5cfd957c826083517 YELLOW ReuseLibraryUtils.java 623e28edc4ce7d5e7cb46d66ba5dcae6c86bb1bc YELLOW diff --git a/org.fortiss.tooling.ext.reuse/src/org/fortiss/tooling/ext/reuse/utils/ReuseLibraryModelElementFactory.java b/org.fortiss.tooling.ext.reuse/src/org/fortiss/tooling/ext/reuse/utils/ReuseLibraryModelElementFactory.java index b6109682e2b465c98d6ff4453f409ab9801e70fa..d72834d2f7d337dc4bf716f5cfd957c826083517 100644 --- a/org.fortiss.tooling.ext.reuse/src/org/fortiss/tooling/ext/reuse/utils/ReuseLibraryModelElementFactory.java +++ b/org.fortiss.tooling.ext.reuse/src/org/fortiss/tooling/ext/reuse/utils/ReuseLibraryModelElementFactory.java @@ -22,7 +22,10 @@ import static org.fortiss.tooling.ext.reuse.utils.ReuseLibraryUtils.getReuseElem import java.util.Date; import java.util.Random; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.ENamedElement; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EContentAdapter; import org.fortiss.tooling.ext.reuse.model.AF3ReuseFactory; import org.fortiss.tooling.ext.reuse.model.ReuseElementSpec; import org.fortiss.tooling.ext.reuse.model.ReuseLibrary; @@ -84,6 +87,24 @@ public class ReuseLibraryModelElementFactory { spec.setSourceLibUUID(sourceLibrary.getLibraryUUID()); spec.setSourceLibName(sourceLibrary.getName()); spec.setLastUpdate(now); + + // if the new reuse element is changed, the update date needs to be updated + element.eAdapters().add(new EContentAdapter() { + @Override + public void notifyChanged(Notification notification) { + // only update if the change was not already a previous date update + Object feature = notification.getFeature(); + if (feature instanceof ENamedElement) { + String featureName = ((ENamedElement) feature).getName(); + if (!featureName.equals("lastUpdate")) { + spec.setLastUpdate(new Date()); + } + } + + super.notifyChanged(notification); + } + }); + return spec; }