@Override public void dispose() { super.dispose(); if (!dynamicEnabled) { return; } Scale scale = getScale(); if (!scale.isDisposed()) { scale.removeSelectionListener(selectionListener); } }
public void testRenderRemoveSelectionListener() throws Exception { Scale scale = new Scale(shell, SWT.NONE); SelectionListener listener = new SelectionAdapter() {}; scale.addSelectionListener(listener); Fixture.markInitialized(display); Fixture.markInitialized(scale); Fixture.preserveWidgets(); scale.removeSelectionListener(listener); lca.renderChanges(scale); Message message = Fixture.getProtocolMessage(); assertEquals(Boolean.FALSE, message.findListenProperty(scale, "selection")); }