1 19 20 package org.netbeans.modules.apisupport.project; 21 22 import java.awt.Dialog ; 23 import junit.framework.Assert; 24 import org.openide.DialogDescriptor; 25 import org.openide.DialogDisplayer; 26 import org.openide.NotifyDescriptor; 27 28 32 public class DialogDisplayerImpl extends DialogDisplayer { 33 34 private static Object toReturn; 35 private NotifyDescriptor lastNotifyDescriptor; 36 private Dialog dialog; 37 38 public static void returnFromNotify(Object value) { 39 Object o = DialogDisplayer.getDefault(); 40 Assert.assertEquals("My class", DialogDisplayerImpl.class, o.getClass()); 41 42 Assert.assertNull("No previous value", toReturn); 43 toReturn = value; 44 } 45 46 public Object notify(NotifyDescriptor descriptor) { 47 lastNotifyDescriptor = descriptor; 48 Object r = toReturn; 49 toReturn = null; 50 51 Assert.assertNotNull("We are supposed to return a value", r); 52 return r; 53 } 54 55 public Dialog createDialog(DialogDescriptor descriptor) { 56 if (dialog == null) { 57 Assert.fail("Not implemented"); 58 } 59 return dialog; 60 } 61 62 public NotifyDescriptor getLastNotifyDescriptor() { 63 return lastNotifyDescriptor; 64 } 65 66 public void reset() { 67 this.lastNotifyDescriptor = null; 68 } 69 70 public void setDialog(Dialog dialog) { 71 this.dialog = dialog; 72 } 73 74 } 75 | Popular Tags |