@Override protected void lastListenerRemoved(){ if(this.currentSubscription != null){ this.currentSubscription.dispose(); this.currentSubscription = null; } } }
public void dispose() { this.delegate = null; for (Consumer<Integer> listener : todoCaretListeners) { Subscription s = todoCaretSubscriptions.remove(listener); if (s != null) { s.dispose(); } } for (Consumer<IRegion> listener : todoSelectionListeners) { Subscription s = todoSelectionSubscriptions.remove(listener); if (s != null) { s.dispose(); } } }
private void disposeListeners() { toDispose.forEach(s -> s.dispose()); toDispose.clear(); }
@Override public void changed(ObservableValue<? extends T> observable, T oldValue, T newValue) { if (this.currentSubscription != null) { this.currentSubscription.dispose(); } this.currentSubscription = scheduleExecution(delay, () -> { consumer.accept(newValue); this.currentSubscription = null; }); } };
public void setDelegate(EditingContext delegate) { this.delegate = delegate; // register early listeners if (this.delegate != null) { for (Consumer<Integer> listener : todoCaretListeners) { Subscription s = this.delegate.registerOnCaretOffsetChanged(listener); todoCaretSubscriptions.get(listener).setDelegate(()->s.dispose()); } for (Consumer<IRegion> listener : todoSelectionListeners) { Subscription s = this.delegate.registerOnSelectionChanged(listener); todoSelectionSubscriptions.get(listener).setDelegate(()->s.dispose()); } } }
void dispose() { if (this.fsSubscription != null) { this.fsSubscription.dispose(); if (this.children != null) { this.children.filtered(i -> i instanceof DirPathItemImpl) .forEach(i -> ((DirPathItemImpl) i).dispose()); } } } }
void dispose() { if (this.fsSubscription != null) { this.fsSubscription.dispose(); if (this.children != null) { this.children.filtered(i -> i instanceof DirPathItemImpl) .forEach(i -> ((DirPathItemImpl) i).dispose()); } } } }
/** * Show a temporary message if another temporary message is already showing * then the original one will be removed before * * @param temporaryMessage * the message to display * @param messageStyles * the message styles to apply * @return the subscription to remove the temporary message * @since 2.4.0 */ public Subscription showTemporaryMessage(String temporaryMessage, String... messageStyles) { if (this.currentTemporyMessage != null) { this.currentTemporyMessage.dispose(); } this.messageLabel.setText(temporaryMessage); this.messageLabel.getStyleClass().addAll(messageStyles); this.currentTemporyMessage = () -> { this.messageLabel.setText(this.message); this.messageLabel.getStyleClass().removeAll(messageStyles); this.currentTemporyMessage = null; }; return this.currentTemporyMessage; }
/** * Show a temporary message if another temporary message is already showing * then the original one will be removed before * * @param temporaryMessage * the message to display * @param messageStyles * the message styles to apply * @return the subscription to remove the temporary message * @since 2.4.0 */ public Subscription showTemporaryMessage(String temporaryMessage, String... messageStyles) { if (this.currentTemporyMessage != null) { this.currentTemporyMessage.dispose(); } TitleAreaDialogPane dialogPane = getDialogPane(); dialogPane.titleMessage.setText(temporaryMessage); dialogPane.titleMessage.getStyleClass().addAll(messageStyles); this.currentTemporyMessage = () -> { dialogPane.titleMessage.setText(titleProperty().get()); dialogPane.titleMessage.getStyleClass().removeAll(messageStyles); this.currentTemporyMessage = null; }; return this.currentTemporyMessage; }
Subscription s = subscriptions.remove(c.getElementRemoved()); if (s != null) s.dispose();