90 shutdown = true; 91 super.interrupt(); 92 } 93 94 public void run() { 95 while (true) { 96 try { 97 pumpEvents(new Conditional() { 98 public boolean evaluate() { 99 return true; 100 } 101 }); 102 } finally { 103 if(getEventQueue().detachDispatchThread(this, shutdown)) { 104 break; 105 } 106 } 107 } 108 } 109 110 // MacOSX change: 111 // This was added because this class (and java.awt.Conditional) are package private. 112 // There are certain instances where classes in other packages need to block the 113 // AWTEventQueue while still allowing it to process events. This uses reflection 114 // to call back into the caller in order to remove dependencies. 115 // 116 // NOTE: This uses reflection in its implementation, so it is not for performance critical code. 117 // 118 // cond is an instance of sun.lwawt.macosx.EventDispatchAccess 119 // 120 private Conditional _macosxGetConditional(final Object cond) { 121 try { 122 return new Conditional() { 123 final Method evaluateMethod = Class.forName("sun.lwawt.macosx.EventDispatchAccess").getMethod("evaluate", null); 124 public boolean evaluate() { 125 try { 126 return ((Boolean)evaluateMethod.invoke(cond, null)).booleanValue(); 127 } catch (Exception e) { 128 return false; 129 } 130 } 131 }; 132 } catch (Exception e) { 133 return new Conditional() { public boolean evaluate() { return false; } }; 134 } 135 } 136 137 138 void pumpEvents(Conditional cond) { 139 pumpEvents(ANY_EVENT, cond); 140 } 141 142 void pumpEventsForHierarchy(Conditional cond, Component modalComponent) { 143 pumpEventsForHierarchy(ANY_EVENT, cond, modalComponent); 144 } 145 146 void pumpEvents(int id, Conditional cond) { 147 pumpEventsForHierarchy(id, cond, null); 148 } 149 150 void pumpEventsForHierarchy(int id, Conditional cond, Component modalComponent) { 151 pumpEventsForFilter(id, cond, new HierarchyEventFilter(modalComponent)); 152 } 153 154 void pumpEventsForFilter(Conditional cond, EventFilter filter) { 155 pumpEventsForFilter(ANY_EVENT, cond, filter); 156 } 157 | 90 shutdown = true; 91 super.interrupt(); 92 } 93 94 public void run() { 95 while (true) { 96 try { 97 pumpEvents(new Conditional() { 98 public boolean evaluate() { 99 return true; 100 } 101 }); 102 } finally { 103 if(getEventQueue().detachDispatchThread(this, shutdown)) { 104 break; 105 } 106 } 107 } 108 } 109 110 void pumpEvents(Conditional cond) { 111 pumpEvents(ANY_EVENT, cond); 112 } 113 114 void pumpEventsForHierarchy(Conditional cond, Component modalComponent) { 115 pumpEventsForHierarchy(ANY_EVENT, cond, modalComponent); 116 } 117 118 void pumpEvents(int id, Conditional cond) { 119 pumpEventsForHierarchy(id, cond, null); 120 } 121 122 void pumpEventsForHierarchy(int id, Conditional cond, Component modalComponent) { 123 pumpEventsForFilter(id, cond, new HierarchyEventFilter(modalComponent)); 124 } 125 126 void pumpEventsForFilter(Conditional cond, EventFilter filter) { 127 pumpEventsForFilter(ANY_EVENT, cond, filter); 128 } 129 |