Skip to content
Snippets Groups Projects
Commit 19833d06 authored by Sebastian Bergemann's avatar Sebastian Bergemann
Browse files

Added date update with change notifier for all reuse elements


Issue-Ref: 4149
Issue-Url: af3#4149

Signed-off-by: default avatarSebastian Bergemann <bergemann@fortiss.org>
parent d6c5fa41
No related branches found
No related tags found
1 merge request!181Added correct hash creation in reuse (+ update detection)
ReuseLibraryModelElementFactory.java b6109682e2b465c98d6ff4453f409ab9801e70fa YELLOW
ReuseLibraryModelElementFactory.java d72834d2f7d337dc4bf716f5cfd957c826083517 YELLOW
ReuseLibraryUtils.java 623e28edc4ce7d5e7cb46d66ba5dcae6c86bb1bc YELLOW
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment