@Override public void removePostSelectionListener(String partId, ISelectionListener listener) { Set<ISelectionListener> listeners = targetedPostSelectionListeners.get(partId); if (listeners != null) { listeners.remove(listener); if (listeners.isEmpty() && selectionService != null) { selectionService.removePostSelectionListener(partId, targetedPostListener); } } }
@Inject void setSelectionService(@Optional ESelectionService selectionService) { if (this.selectionService != null) { this.selectionService.removeSelectionListener(listener); for (String partId : targetedListeners.keySet()) { this.selectionService.removeSelectionListener(partId, targetedListener); } this.selectionService.removePostSelectionListener(postListener); for (String partId : targetedPostSelectionListeners.keySet()) { this.selectionService.removePostSelectionListener(partId, targetedPostListener); } } if (selectionService != null) { selectionService.addSelectionListener(listener); for (String partId : targetedListeners.keySet()) { selectionService.addSelectionListener(partId, targetedListener); } selectionService.addPostSelectionListener(postListener); for (String partId : targetedPostSelectionListeners.keySet()) { selectionService.addPostSelectionListener(partId, targetedPostListener); } this.selectionService = selectionService; } }