Skip to content

Commit

Permalink
democles does no longer observe all resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Arikae committed Jun 24, 2020
1 parent d93efab commit db79c53
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 123,8 @@ public class DemoclesGTEngine implements IContextPatternInterpreter, MatchEventL
*/
protected Optional<String> debugPath = Optional.empty();

protected ResourceSetImpl resourceSet;

/**
* Creates a new DemoclesGTEngine.
*/
Expand Down Expand Up @@ -258,7 260,7 @@ public void initialise(Registry registry, IMatchObserver matchObserver) {

@Override
public ResourceSet createAndPrepareResourceSet(final String workspacePath) {
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet = new ResourceSetImpl();
// In contrast to EMFDemoclesPatternMetamodelPlugin.createDefaultResourceSet, we
// do not delegate directly to the global registry!
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
Expand All @@ -275,8 277,8 @@ public ResourceSet createAndPrepareResourceSet(final String workspacePath) {

@SuppressWarnings("unchecked")
@Override
public void monitor(final ResourceSet resourceSet) {
for (Resource r : resourceSet.getResources()) {
public void monitor(final Collection<Resource> resources) {
for (Resource r : resources) {
if ("ecore".equals(r.getURI().fileExtension())) {
logger.warn("Are you sure your resourceSet should contain a resource for a metamodel?: " r.getURI());
logger.warn("You should probably initialise this metamodel and make sure your "
Expand Down Expand Up @@ -310,7 312,9 @@ public void monitor(final ResourceSet resourceSet) {
});
});

observer.install(resourceSet);
resources.forEach(r -> {
observer.install(r);
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 105,7 @@ private Optional<TGGConstraintComponentBuilder<VariableRuntime>> handleTGGAttrib
}

@Override
public void monitor(final ResourceSet resourceSet) {
public void monitor(final Collection<Resource> resources) {
if (options.debug.ibexDebug()) {
savePatterns(resourceSet, options.project.path() "/debug/democles-patterns.xmi", patterns.values()//
.stream()//
Expand All @@ -115,7 115,7 @@ public void monitor(final ResourceSet resourceSet) {
savePatterns(resourceSet, options.project.path() "/debug/ibex-patterns.xmi", Arrays.asList(ibexPatterns));
}

super.monitor(resourceSet);
super.monitor(resources);
}

/**
Expand Down

0 comments on commit db79c53

Please sign in to comment.