public void undo() { if (listener != null) combo.removeModifyListener(listener); wc.setAttribute(key, oldVal); if (combo != null && !combo.isDisposed()) combo.setText(oldVal); if (listener != null) combo.addModifyListener(listener); postOp(POST_UNDO); }
public IStatus redo() { if (listener != null) combo.removeModifyListener(listener); wc.setAttribute(key, newVal); if (combo != null && !combo.isDisposed()) combo.setText(newVal); if (listener != null) combo.addModifyListener(listener); postOp(POST_REDO); return Status.OK_STATUS; }
@Test public void testRenderRemoveModifyListener() throws Exception { ModifyListener listener = new ModifyListener() { public void modifyText(ModifyEvent event) {} }; combo.addModifyListener(listener); Fixture.markInitialized(display); Fixture.markInitialized(combo); Fixture.preserveWidgets(); combo.removeModifyListener(listener); lca.renderChanges(combo); Message message = Fixture.getProtocolMessage(); assertEquals(Boolean.FALSE, message.findListenProperty(combo, "Modify")); }