Skip to content

Commit 844fcf6

Browse files
authored
Merge pull request #2361 from ControlSystemStudio/patches
#2360 Add a helper method to clean up existing selections
2 parents d903958 + 9e79f23 commit 844fcf6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

core/framework/src/main/java/org/phoebus/framework/selection/SelectionService.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,16 @@ public void setSelection(Object source, Selection selection) {
8585
for (SelectionChangeListener listener : listeners)
8686
listener.selectionChanged(source, oldValue, newValue);
8787
}
88+
89+
/**
90+
* Clear the selection
91+
*
92+
* @param source the source of the new selection
93+
*/
94+
public void clearSelection(Object source) {
95+
final Selection newValue = SelectionUtil.emptySelection();
96+
final Selection oldValue = SelectionService.selection.getAndSet(newValue);
97+
for (SelectionChangeListener listener : listeners)
98+
listener.selectionChanged(source, oldValue, newValue);
99+
}
88100
}

0 commit comments

Comments
 (0)