public synchronized void removeFlavorListener(FlavorListener listener) { if (listener == null) { return; } AppContext appContext = AppContext.getAppContext(); EventListenerAggregate contextFlavorListeners = (EventListenerAggregate) appContext.get(CLIPBOARD_FLAVOR_LISTENER_KEY); if (contextFlavorListeners == null){ //else we throw NullPointerException, but it is forbidden return; } if (contextFlavorListeners.remove(listener) && --numberOfFlavorListeners == 0) { unregisterClipboardViewerChecked(); currentDataFlavors = null; } }
public synchronized void removeFlavorListener(FlavorListener listener) { if (listener == null) { return; } AppContext appContext = AppContext.getAppContext(); EventListenerAggregate contextFlavorListeners = (EventListenerAggregate) appContext.get(CLIPBOARD_FLAVOR_LISTENER_KEY); if (contextFlavorListeners == null){ //else we throw NullPointerException, but it is forbidden return; } if (contextFlavorListeners.remove(listener) && --numberOfFlavorListeners == 0) { unregisterClipboardViewerChecked(); currentFormats = null; } }
public synchronized FlavorListener[] getFlavorListeners() { EventListenerAggregate contextFlavorListeners = (EventListenerAggregate) AppContext.getAppContext().get(CLIPBOARD_FLAVOR_LISTENER_KEY); return contextFlavorListeners == null ? new FlavorListener[0] : (FlavorListener[])contextFlavorListeners.getListenersCopy(); }