diff --git a/query/plugins/org.eclipse.viatra.query.runtime/src/org/eclipse/viatra/query/runtime/registry/view/AbstractRegistryView.java b/query/plugins/org.eclipse.viatra.query.runtime/src/org/eclipse/viatra/query/runtime/registry/view/AbstractRegistryView.java index f8121492f4..b5b011671c 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime/src/org/eclipse/viatra/query/runtime/registry/view/AbstractRegistryView.java +++ b/query/plugins/org.eclipse.viatra.query.runtime/src/org/eclipse/viatra/query/runtime/registry/view/AbstractRegistryView.java @@ -109,11 +109,13 @@ public Set getEntries(String fullyQualifiedNam @Override public void addViewListener(IQuerySpecificationRegistryChangeListener listener) { + checkArgument(listener != null, "Null listener not supported"); listeners.add(listener); } @Override public void removeViewListener(IQuerySpecificationRegistryChangeListener listener) { + checkArgument(listener != null, "Null listener not supported"); listeners.remove(listener); } diff --git a/query/plugins/org.eclipse.viatra.query.tooling.ui.browser/src/org/eclipse/viatra/query/tooling/ui/queryregistry/QueryRegistryTreeInput.xtend b/query/plugins/org.eclipse.viatra.query.tooling.ui.browser/src/org/eclipse/viatra/query/tooling/ui/queryregistry/QueryRegistryTreeInput.xtend index acd8acc09a..36768383c1 100644 --- a/query/plugins/org.eclipse.viatra.query.tooling.ui.browser/src/org/eclipse/viatra/query/tooling/ui/queryregistry/QueryRegistryTreeInput.xtend +++ b/query/plugins/org.eclipse.viatra.query.tooling.ui.browser/src/org/eclipse/viatra/query/tooling/ui/queryregistry/QueryRegistryTreeInput.xtend @@ -39,7 +39,7 @@ class QueryRegistryTreeInput { @Accessors(PUBLIC_GETTER) IRegistryView view - @Accessors(PUBLIC_GETTER, PUBLIC_SETTER) + @Accessors(PUBLIC_GETTER) IQuerySpecificationRegistryChangeListener listener new(IQuerySpecificationRegistry registry) { @@ -57,7 +57,16 @@ class QueryRegistryTreeInput { val entry = new QueryRegistryTreeEntry(treePackage.pckg, it) treePackage.pckg.entries.put(fullyQualifiedName, entry) ] - view.addViewListener(listener) + } + + def void setListener(IQuerySpecificationRegistryChangeListener listener) { + if (this.listener !== null) { + view.removeViewListener(this.listener) + } + this.listener = listener + if (listener !== null) { + view.addViewListener(listener) + } } def QueryRegistryTreeInputChange addEntryToInput(IQuerySpecificationRegistryEntry entry) {