Skip to content

Commit

Permalink
[528436] Increased robustness of query registry listener handling
Browse files Browse the repository at this point in the history
Change-Id: Ica658bb1d710e6ab928f95a4016390fefaba9c64
Signed-off-by: Zoltan Ujhelyi <[email protected]>
(cherry picked from commit 169e3e8)
  • Loading branch information
ujhelyiz committed Jan 27, 2018
1 parent c04ec07 commit 5130899
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,13 @@ public Set<IQuerySpecificationRegistryEntry> 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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class QueryRegistryTreeInput {
@Accessors(PUBLIC_GETTER)
IRegistryView view

@Accessors(PUBLIC_GETTER, PUBLIC_SETTER)
@Accessors(PUBLIC_GETTER)
IQuerySpecificationRegistryChangeListener listener

new(IQuerySpecificationRegistry registry) {
Expand All @@ -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) {
Expand Down

0 comments on commit 5130899

Please sign in to comment.