|
Lines 116-173
Link Here
|
| 116 |
* (non-Javadoc) Method declared on Thread. |
116 |
* (non-Javadoc) Method declared on Thread. |
| 117 |
*/ |
117 |
*/ |
| 118 |
public void run() { |
118 |
public void run() { |
| 119 |
try { |
119 |
// RAP [rh] supply a fake-context for the entire execution of runnable and exception handling |
| 120 |
if (runnable != null) { |
120 |
UICallBack.runNonUIThreadWithFakeContext(display, new Runnable() { |
| 121 |
runnable.run(progressMonitor); |
|
|
| 122 |
} |
| 123 |
} catch (InvocationTargetException e) { |
| 124 |
throwable = e; |
| 125 |
} catch (InterruptedException e) { |
| 126 |
throwable = e; |
| 127 |
} catch (RuntimeException e) { |
| 128 |
throwable = e; |
| 129 |
} catch (ThreadDeath e) { |
| 130 |
// Make sure to propagate ThreadDeath, or threads will never |
| 131 |
// fully terminate |
| 132 |
throw e; |
| 133 |
} catch (Error e) { |
| 134 |
throwable = e; |
| 135 |
} finally { |
| 136 |
// notify the operation of change of thread of control |
| 137 |
if (runnable instanceof IThreadListener) { |
| 138 |
Throwable exception = |
| 139 |
invokeThreadListener(((IThreadListener) runnable), callingThread); |
| 140 |
|
| 141 |
//Forward it if we don't already have one |
| 142 |
if(exception != null && throwable == null) |
| 143 |
throwable = exception; |
| 144 |
} |
| 145 |
|
121 |
|
| 146 |
// Make sure that all events in the asynchronous event queue |
122 |
public void run() { |
| 147 |
// are dispatched. |
123 |
try { |
| 148 |
display.syncExec(new Runnable() { |
124 |
if (runnable != null) { |
| 149 |
public void run() { |
125 |
runnable.run(progressMonitor); |
| 150 |
// do nothing |
126 |
} |
|
|
127 |
} catch (InvocationTargetException e) { |
| 128 |
throwable = e; |
| 129 |
} catch (InterruptedException e) { |
| 130 |
throwable = e; |
| 131 |
} catch (RuntimeException e) { |
| 132 |
throwable = e; |
| 133 |
} catch (ThreadDeath e) { |
| 134 |
// Make sure to propagate ThreadDeath, or threads will never |
| 135 |
// fully terminate |
| 136 |
throw e; |
| 137 |
} catch (Error e) { |
| 138 |
throwable = e; |
| 139 |
} finally { |
| 140 |
// notify the operation of change of thread of control |
| 141 |
if (runnable instanceof IThreadListener) { |
| 142 |
Throwable exception = |
| 143 |
invokeThreadListener(((IThreadListener) runnable), callingThread); |
| 144 |
|
| 145 |
//Forward it if we don't already have one |
| 146 |
if(exception != null && throwable == null) |
| 147 |
throwable = exception; |
| 148 |
} |
| 149 |
|
| 150 |
// Make sure that all events in the asynchronous event queue |
| 151 |
// are dispatched. |
| 152 |
display.syncExec(new Runnable() { |
| 153 |
public void run() { |
| 154 |
// do nothing |
| 155 |
} |
| 156 |
}); |
| 157 |
|
| 158 |
// Stop event dispatching |
| 159 |
continueEventDispatching = false; |
| 160 |
|
| 161 |
// Force the event loop to return from sleep () so that |
| 162 |
// it stops event dispatching. |
| 163 |
display.asyncExec(null); |
| 164 |
|
| 165 |
// RAP [fappel]: deactivate UI-Callback for this thread |
| 166 |
String key |
| 167 |
= String.valueOf( ModalContextThread.this.hashCode() ); |
| 168 |
UICallBack.deactivate( key ); |
| 169 |
|
| 151 |
} |
170 |
} |
| 152 |
}); |
171 |
} |
| 153 |
|
|
|
| 154 |
// Stop event dispatching |
| 155 |
continueEventDispatching = false; |
| 156 |
|
| 157 |
// Force the event loop to return from sleep () so that |
| 158 |
// it stops event dispatching. |
| 159 |
display.asyncExec(null); |
| 160 |
|
172 |
|
| 161 |
// RAP [fappel]: deactivate UI-Callback for this thread |
173 |
} ); // RAP [rh] end of fake-context runnable |
| 162 |
UICallBack.runNonUIThreadWithFakeContext( display, new Runnable() { |
|
|
| 163 |
public void run() { |
| 164 |
String key |
| 165 |
= String.valueOf( ModalContextThread.this.hashCode() ); |
| 166 |
UICallBack.deactivate( key ); |
| 167 |
} |
| 168 |
} ); |
| 169 |
|
| 170 |
} |
| 171 |
} |
174 |
} |
| 172 |
|
175 |
|
| 173 |
/** |
176 |
/** |