1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 23:25:26 +02:00

[236355] [api] Add an IRSEInteractionProvider#eventExec() method

This commit is contained in:
Martin Oberhuber 2008-06-10 09:34:15 +00:00
parent e990f7db75
commit 6723d9cba7
2 changed files with 25 additions and 2 deletions

View file

@ -8,6 +8,7 @@
* Contributors:
* Martin Oberhuber (Wind River) - [190231] initial API and implementation
* IBM Corporation - Javadoc for runInDefaultContext() method
* Martin Oberhuber (Wind River) - [236355] [api] Add an IRSEInteractionProvider#eventExec() method
*******************************************************************************/
package org.eclipse.rse.core;
@ -107,6 +108,19 @@ public interface IRSEInteractionProvider {
*/
public void asyncExec(Runnable runnable);
/**
* Run the given runnable with "event" semantics, that is: asynchronously
* run it through {@link #asyncExec(Runnable)} on the interaction provider's
* designated event thread, unless the call is already coming from that very
* thread.
*
* In that case, the Runnable is run immediately and synchronously.
*
* @param runnable the Runnable to run asynchronously with "event" semantics
* @see #asyncExec(Runnable)
*/
public void eventExec(Runnable runnable);
/**
* Flush the Queue of Runnables enqueued with {@link #asyncExec(Runnable)}.
*

View file

@ -8,6 +8,7 @@
* Contributors:
* Martin Oberhuber (Wind River) - [190231] initial API and implementation
* Martin Oberhuber (Wind River) - brought in methods from SubSystem (c) IBM
* Martin Oberhuber (Wind River) - [236355] [api] Add an IRSEInteractionProvider#eventExec() method
*******************************************************************************/
package org.eclipse.rse.internal.ui;
@ -38,7 +39,7 @@ import org.eclipse.ui.PlatformUI;
* with the <a href="http://www.eclipse.org/dsdp/tm/">Target Management</a>
* team.
* </p>
*
*
* @since org.eclipse.rse.ui 3.0
*/
public class DefaultUIInteractionProvider implements IRSEInteractionProvider {
@ -138,10 +139,18 @@ public class DefaultUIInteractionProvider implements IRSEInteractionProvider {
return d;
}
public void asyncExec(Runnable runnable) {
public void asyncExec(final Runnable runnable) {
getDefaultDisplay().asyncExec(runnable);
}
public void eventExec(final Runnable runnable) {
if (Display.getCurrent() != null) {
runnable.run();
} else {
asyncExec(runnable);
}
}
public void flushRunnableQueue() {
Display d = Display.getCurrent();
if (d == null) {